PWM → Voltage (RC DAC)

Average voltage, ripple and effective resolution of a PWM filtered by an RC low-pass.

Average voltage and ripple

Turning PWM into a voltage

An RC low-pass averages the PWM: the DC output is simply the duty cycle times the high level,

but the cap never fully settles, so a triangle-ish ripple rides on top. Charging for and discharging for with gives the exact peak-to-peak:

For a well-filtered output () this simplifies to , worst at 50% duty. Ripple sets the effective resolution: bits. Push the PWM frequency up or up to cut ripple — at the cost of slower settling ().

Frequently asked questions

How do you convert PWM to an analog voltage?

Pass the PWM signal through an RC low-pass filter. The capacitor averages the switching waveform, giving a DC output equal to duty cycle × logic-high voltage (Vavg = D × VH).

How do I calculate the ripple of a PWM DAC?

Peak-to-peak ripple ≈ VH × D × (1−D) ÷ (f × R × C) for a well-filtered output, worst at 50% duty. The exact value is VH × (1−a)(1−b) ÷ (1−ab) with a = e^(−ton/RC) and b = e^(−toff/RC).

What R and C should I use for a PWM DAC?

Choose RC so the cutoff frequency 1/(2πRC) is well below the PWM frequency — more filtering means less ripple but slower settling (about 5×RC). A common starting point is a few kΩ with 100 nF at a 10–50 kHz PWM.

How many bits of resolution can a PWM DAC achieve?

The effective resolution is limited by ripple: roughly log2(VH ÷ Vpp) bits. Lowering the ripple — by raising the PWM frequency or the RC time constant — gives more usable bits.