Electrical – PWM generator with adjustable duty cycle

pwm

I'm designing a pwm generator comparing a saw-tooth signal with a DC signal. The saw tooth is applied on the non inverting input of the U3A, and it is compared with the DC signal that comes from the voltage divider. The problem is that I can't find a formula that relates the square wave that I'm getting at output, the saw tooth signal and the DC signal. Can someone help me figure out a formula so I can size the voltage divider?
enter image description here

Best Answer

The range of voltages that are capable of being produced by R13 is largely what the signal amplitude range of the sawtooth should be. This gives you 0% to 100% PWM at the output of your comparator. I can't think of a way to express this more succintly by using a formula.

Choose R8, R13 and R7 to produce a range that equals the sawtooth peak and trough voltages - it's as simple as that. Or you can even exceed those voltages if you want to a guaranteed 0% and 100%. If you want to go from 1% to 99% choose those resistor values to produce a range just inside the limits of the sawtooth amplitude.

You can even use circuitry that peak detects the sawtooth limits and use these to set the end-point voltages on the potentiometer R13. Then, if your sawtooth grows a little, your PWM duty cycle remains constant.

Not really suited for a formulaic answer. However, a picture never hurts: -

enter image description here