Pulse Width Modulation (PWM) is useful for lamp dimming, motor control, or other applications where an efficient way to vary current or voltage is desired.
Here is a simple circuit to generate the PWM modulated signal that is an improvement over most 555 based PWM circuits, and uses a comparable number of parts.
The duty-cycle is controlled by a voltage (external or from a pot), and the duty-cycle can go from 0% (full-off) to 100% (full-on).
Most 555 circuits are capable of neither.
It also has a larger operating voltage range of 2V to 36V.
This circuit requires only two comparators, as in one LM393 package or one-half of a LM339 package, both common and inexpensive, along with seven passive components (besides the three in the optional pot control circuit).
It generates a PWM signal with a duty-cycle that can be varied continuously from 0% (full off) to 100% (full on) by either by an external control voltage (Mod_In) or the optional pot control circuit.
The LTspice simulation of the circuit is shown below.
U1 is configured as a relaxation oscillation with the frequency determined by the value of R1 and C1.
R3, R4, and R5 generate symmetrical plus and minus switching points (hysteresis) for the oscillator.
U1's output is a square-wave which charges and discharges C1 through R1, generating an exponential shaped sawtooth voltage on the capacitor going between about 1/4 and 3/4 of the supply voltage.
This gives an oscillation frequency of approximately 1/(2.2*R1C1).
This frequency varies very little with change in supply voltage, and does not vary with the PWM duty-cycle.
Since the circuit uses only high speed comparators it can operate at much higher frequencies than most op amp based PWM circuits.
Operation at frequencies upwards of 100kHz should be readily achievable, if needed.
This sawtooth at C1 is connected to one input of comparator U2.
The other comparator input is fed the modulation (Mod_In) voltage with range between 1/4V+ to 3/4V+ which gives a PWM range of 0% to 100%.
Thus the output can be adjusted from fully off to fully on.
This is greater than most 555 type PWM circuits, which cannot be voltage controlled, and are generally limited in their duty-cycle range to to within a few percent of 0% and 100%.
The Mod-In duty-cycle voltage can be generated externally or by the optional pot.
The simulation is shown with a Mod_In voltage (V_Mod) going from 1/4V+ to 3/4 V+.
The PWM duty-cycle for this Mod_In range goes from 0% (full off) to 100% (full on) as shown in the bottom plot.
(The 1/4V+ offset can be readily generated if needed, by a differential op amp circuit, example below & here).
It you need an inverted output signal with respect to the control voltage, just interchange the input connections on U2.
U2's output can be fed to a MOSFET or whatever else you want controlled by the PWM signal.
A simple and inexpensive MOSFET push-pull gate driver for voltages up to 15V can be made using a CD4050 chip and tieing all 6 buffers inputs and outputs in parallel as shown here:
Connected to U2's output, this will drive considerably more MOSFET gate capacitance than U2's output can drive by itself, for higher PWM frequencies.
Since the waveform generated by U1 is not a true triangle-wave, the circuit's change of duty-cycle with control voltage is not quite linear as it would be with a precise triangle-wave as generated by a square-wave into a true integrator, but the deviation from linear is small and should be adequate for lamp dimming, dc motor speed control, and other applications where high linearity between the control signal and the PWM duty-cycle is not required.
The circuit will operate over the LM339/393's voltage range of 2v to 36V.
Simple PWM Circuit For Lamp Dimming, etc., Improves On 555 PWM Circuits
PWM circuit has voltage control of 0% to 100% duty-cycle