Designs frequently require the conversion of a microprocessor’s pulse width modulation (PWM) signal into an analog voltage. Often a passive single-pole RC filter will satisfy design requirements, but this approach typically suffers from several drawbacks including slow response time, noisy results, and having an unbuffered output.
The circuit described here uses the ubiquitous LM431 shunt regulator to implement a second-order Sallen-Key low pass filter together with a level shifter (see the figure). Compared to the traditional approach, it provides a far sharper roll-off along with a low-impedance output, bipolar output. It will produce a –2.5- to +2.5-V output with a 0- to 5-V PWM signal input. The value of VOut is equal to (5 V × dc) – 2.5 V, where dc is the PWM duty from 0.0 to 1.0 (0% to 100%).
The component values depicted provide a flat response with a cutoff frequency around 2300 Hz, a –12-dB/octave roll-off, and drive capability of about 3 mA. You can easily change the cutoff frequency by adjusting R1 and R2 or C1 and C2, although it is important to keep R1 equal to R2 and C2 at about half the value of C1.
Doubling the resistor or capacitor values will cut the frequency in half. Halving either set of values will double the cutoff frequency. You can adjust R3 to provide more output current or to reduce power consumption. The 5-V rails depicted do not have to be precise and can be a higher voltage. Only the PWM input signal needs to be precisely 5 V.
Because it uses only six components, this circuit can be very cost effective. The LM431 can be purchased for as low as 10 cents in single-unit quantities, well below that of any op amp.
Editor’s Note: See Texas Instruments Application Report SLOA024B, “Analysis of the Sallen-Key Architecture,” for additional information on Sallen-Key filters.