PWM to Analog DAC RC Low-Pass Filter Calculator (Cutoff & Settling)

Smooth a 20 kHz–62.5 kHz microcontroller PWM signal into a quiet analog voltage with an RC low-pass filter, balancing ripple attenuation against 5τ settling time.

Jump to results

Inputs

Filter topology & components
Frequency evaluation

Results

Estimates
−3 dB Cutoff frequency (fc)159.15 Hz
Time constant (τ)
1 ms
Gain at f_test
-45.86 dB (0.5%)
Phase shift at f_test
-89.7°
Settling time (3τ / 5τ)
3 ms / 5 ms
Reactance at f_test
50.93 Ω
Total impedance |Z|
10 kΩ
Bode magnitude plot (0.01·fc to 100·fc)
0 dB -20 dB -40 dB0.01×0.1×fc10×100×fc = 159.15 Hz (−3 dB) · Amber dot: f_test
Frequency response sweep
Frequencyf / fcMagnitude |H|Gain (dB)Phase (°)
1.59 Hz0.01×1-4.34e-4 dB-0.6°
15.92 Hz0.1×0.995-0.04 dB-5.7°
79.58 Hz0.5×0.8944-0.97 dB-26.6°
159.15 Hz1×0.7071-3.01 dB-45°
318.31 Hz2×0.4472-6.99 dB-63.4°
1.59 kHz10×0.0995-20.04 dB-84.3°
15.92 kHz100×0.01-40 dB-89.4°

First-order passive filters roll off at −20 dB/decade (−6 dB/octave). Buffer the output if downstream load impedance is less than 10× R.

Trade off PWM ripple suppression against analog step settling time

Microcontrollers without an internal DAC frequently synthesize analog control voltages (0–3.3 V or 0–10 V) by filtering a high-frequency hardware PWM timer. Setting the RC cutoff two decades below the PWM carrier (e.g., 159 Hz for a 31.25 kHz PWM) crushes carrier ripple by over −45 dB.

Remember the fundamental trade-off: lowering f_c cuts ripple proportionally, but lengthens 5τ step settling time proportionally (5 ms at τ = 1 ms).

Formulas

  • τ = 10 kΩ × 100 nF = 1.00 ms; 5τ settling (99.3%) = 5.00 ms
  • f_c = 159.15 Hz
  • Gain at 31.25 kHz PWM = −45.86 dB (0.51% ripple)

Worked example

A 10 kΩ + 100 nF filter achieves −45.86 dB attenuation on a 31.25 kHz PWM fundamental (under ~17 mV p-p on a 3.3 V rail) while settling to 99.3% in 5.0 ms.

Frequently asked questions

How can I reduce PWM ripple without making settling time 10× slower?

Increase the MCU PWM frequency (using a 16-bit timer at 8-bit or 10-bit resolution) or cascade two identical RC stages (2nd-order −40 dB/decade) buffered by an op-amp.

Do I need an op-amp buffer after a 10 kΩ PWM RC filter?

Yes if the downstream load draws more than a few microamps—otherwise the load resistance forms a voltage divider with the 10 kΩ series resistor and drops full-scale voltage.

Why does worst-case PWM ripple occur at 50% duty cycle?

A 50% square wave maximizes fundamental harmonic amplitude (`4/π × V_pp / 2`), whereas ripple drops toward zero near 0% and 100% duty cycle.