I'm using AD9833 to generate sine, triangle and square wave. Square from IC has 0,65V amptlitude and 50% duty cycle. I would like in simple way change duty cycle this square signal from 0-100%. Using potentiometer or uC. I have only one ideas, generate PWM from uC, but AD9833 is easier to control frequency.

edit I designed this layout I want use 3 potentiometer to set duty cycle, ampltiude, and signal offset. You can check the correctness? In spice everything is okay. V1 and V3 is AD9833 output

enter image description here

  • \$\begingroup\$ Welcome to EE.SE. Please note that this is not a free design service so you should show what you understand about your problem and where you are stuck. You are also missing specifications from your question: what is the voltage level?; what is the logic family, if relevant?; what is the min and max duty cycle required. If English is not your first language then add this to your user profile so we can make allowances. \$\endgroup\$
    – Transistor
    Commented Jun 30, 2018 at 16:57
  • 1
    \$\begingroup\$ The AD9833 has a triangle-wave output. By feeding this into one input of a comparator and adjusting the voltage on the other input using one of your potentiometers you can adjust the duty cycle on the comparator output. Add a schematic of an attempted solution into your question (there's a built-in CircuitLab button on the editor toolbar) and we'll get the question re-opened and help you out. Notice how much your question changed when you added the details? \$\endgroup\$
    – Transistor
    Commented Jun 30, 2018 at 17:23
  • \$\begingroup\$ The square wave input needs a precise stable input and Vref to Pot with same accuracy from -Vp to +Vp to get 0 to 100% but this must be outside the loop to remain accurate. This is THE broad Answer to a broad question , put on hold from narrow view. \$\endgroup\$ Commented Jun 30, 2018 at 17:27
  • 1
    \$\begingroup\$ If you say that, then you have not fully described your project. Please update your post with more information. \$\endgroup\$
    – jsotola
    Commented Jun 30, 2018 at 18:23
  • 1
    \$\begingroup\$ AD9833 datasheet page 16 Vout Pin can indeed be configured to provide a triangle output. See Table 15, set OPBITEN=0 and Mode=1 to get triangle output from AD9833 VOUT (this is the essentially DDS phase accumulator). Feed that into the comparator, and the output from the comparator will be a square wave with duty cycle determined by the comparator threshold. Given VOUT is in the range 0.038V to 0.65V (page 3), then adjust the comparator threshold centered around 0.344V (50% duty cycle). \$\endgroup\$
    – MarkU
    Commented Jun 30, 2018 at 21:03

1 Answer 1


Is impossible to use triangular with comparator, because IC has one output for square and triangular. [From question comments.]


simulate this circuit – Schematic created using CircuitLab

Figure 1. A comparator will convert a triangle wave to a square wave while allowing pulse width modulation.

By adjusting R1 the switching threshold varies and this will adjust the pulse width.

enter image description here

Figure 2. Input and output when varying R1 from V3 to V2.

There may be some trouble at either end of the pot if the triangle peaks or troughs have any variation in amplitude. This would manifest itself at the low-end as a variation from low pulse-width to continuous 0 V and at the high end from high pulse-width to continuous 5 V.

  • \$\begingroup\$ AD9834 is pretty much the same chip but it has adjustable amplitude that is extremely easy to control using AD5620 (I've done it before with great results). Do you think it might be more precise to change the amplitude with fixed comparator threshold than change threshold with fixed amplitude? \$\endgroup\$
    – Maple
    Commented Jul 1, 2018 at 17:18
  • 1
    \$\begingroup\$ I have no idea. I never heard of either chip before this question. Post your idea as an answer but maybe wait to see if the OP responds to comments before spending any time on this. \$\endgroup\$
    – Transistor
    Commented Jul 1, 2018 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.