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 msf_c = 159.15 HzGain 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.