4
\$\begingroup\$

I would like to use this schematic:

enter image description here

to create a square-wave generator but I would like to modify it by getting an output that runs from 0 to +5V, as well as changing the signal so that I can change the duty cycle of the pulse(PWM).

Should I replace the resistor R2 with a variable resistor so that I can get the PWM signal? If not, what would be the correct approach?

\$\endgroup\$
1
\$\begingroup\$

One way to vary the duty cycle would be to remove R1 and connect a potentiometer track between V- and V+ with the wiper connected to R2/non-inverting input of the comparator. With the pot at mid position you will get 50% duty cycle but this will only be very roughly linear for small changes in position of the pot. Also, the frequency will reduce as you move the pot either side of mid-position.

Note that if you want single supply (5V) operation with the original circuit as shown, R1 would have to be returned to 2.5V rather than 0V.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

I'm pretty sure that the only way to get PWM from this circuit is to have different charging and discharging rates for the capacitor C. You can change the operating frequency by R2 as you described, but you don't get duty cycle control.

Usually, you need two elements to make PWM - one to control the overall period, the other to control the on-time and off-time. You get this sort of configuration easily if you opt for a 555 timer-based PWM, which internally is two comparators with a latch and some other glue. You can get good duty cycle control with this approach, 555s are common, and the parts count is reasonable.

| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ The same basic circuit given in the link should work without the 555, using just an opamp. Just make the trigger and threshold inputs the opamp negative input, and take the output to the R1 / diode configuration from the op amp output. The 555 has the advantage that it doesn't need a bipolar power supply because it has two comparators. \$\endgroup\$ – Bitrex Nov 1 '11 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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