I tried to simulate the following PWM generator: enter image description here

The output at the PWM node records a constant voltage, not a PWM signal. So I simulated the sawtooth generator separately

enter image description here

And the output of this generator too isn't what it is supposed to be:

enter image description here

So what might be the problem with this sawtooth generator?

  • \$\begingroup\$ Why didn't you copy the original design? \$\endgroup\$
    – user16324
    Commented Feb 3, 2020 at 16:53
  • \$\begingroup\$ @BrianDrummond My bad, I uploaded the wrong diagram, I just edited the post with the correct one. (by the way, the previous one, i.e. the one I just removed, didn't work either.) \$\endgroup\$
    – Hilbert
    Commented Feb 3, 2020 at 16:58
  • 3
    \$\begingroup\$ Mainly, the LM358 is not a very good opamp (and the 741 will barely work at all off 5V). Opamps of that era don't work too well near their supply rails , so 10V gives more headroom. (The originally posted cct had 10V (+/-5), but then biased the input to 2.5V not 0V). Now look for a newer "rail to rail" opamp and it should be fine at 5V. \$\endgroup\$
    – user16324
    Commented Feb 3, 2020 at 17:21
  • 1
    \$\begingroup\$ Also this is a triangle generator not a sawtooth, but both work for PWM. It is a Schmitt Inverter Astable Oscillator that can be done with a logic inverter for the easiest method. Then the Pot has equal resistors on either side to go from 1/3 to 2/3Vcc using the inverter input triangle. \$\endgroup\$ Commented Feb 3, 2020 at 17:37
  • 1
    \$\begingroup\$ Here's a variation of your design using the 1st comparator (preferably a high speed one), tinyurl.com/s5bssse as a PFM instead of PWM , which are often used in Boost converters. You choose a constant Pulse width, which changes with Pot bias voltage beween the rails of the analog output of asymmetric triangle to get an asymmetric PWM that changes like a VCO, except it is a constant pulse width PWM that changes duty cycle of the smallest pulse to be constant and then rapidly changes frequency due to the larger pulse width at extreme <10% or > 90% range. @Andyaka might like this version. \$\endgroup\$ Commented Feb 3, 2020 at 18:18

1 Answer 1


Try increasing the supply voltage to maybe 10 volts. – Andy aka

@Andyaka It worked! I really can't see why it had to do with supply voltage, would you mind giving a glimpse of the reason we had to increase it? – Hilbert

I believe that the reason it worked at 10 volts is because the hysteresis levels around U1a coupled with the inability of the opamp to drive close to the limited positive rail were just fighting against running at 5 volts. It might work at 6 volts of course but, a rail to rail output opamp would be better.


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.