PWM from an op-amp

lion-mclionheadlion mclionhead wrote 03/25/2018 at 08:56 • 1 min read • Like

Worthless in any practical sense, but nifty & maybe useful if you have absolutely no microcontroller in lieu of a bag of LM324's.  1 op amp generates a triangle wave.  The other op amp is a comparator that chops the triangle wave into PWM.  R1 & C1 change the frequency.  The R4 & R5 ratio changes the duty cycle.

 Simulating it in LTSpice required a dual power supply, though a real circuit probably works on a single supply.  The simulator probably needs A starting on a power rail.  

The LM324 is actually fast enough to hit 1khz, so it can drive LED lighting or a servo.  Higher speeds require a higher slew rate op-amp.  A microcontroller uses far less components & is a lot easier to tune.