A low pass filter is an electronic circuit that allows low-frequency signals and DC to pass through while attenuating high-frequency signals. Whether you are smoothing a microcontroller's PWM output into a steady analog voltage or killing high-frequency EMI noise on a 12V DC power rail, the underlying physics relies on frequency-dependent impedance. In this guide, we will break down the exact math, build a real-world PWM smoothing circuit, and cover the edge cases that ruin otherwise solid designs.
The Core Mechanism: Reactance and the Voltage Divider
The most common low pass topology is the passive RC (Resistor-Capacitor) filter. It works by exploiting a fundamental property of capacitors: their opposition to alternating current (reactance) changes depending on the frequency of the signal.
The formula for capacitive reactance ($X_c$) is:
$X_c = \frac{1}{2 \pi f C}$
Notice that frequency ($f$) is in the denominator. As frequency goes up, reactance goes down. In an RC low pass filter, the resistor is placed in series with the signal path, and the capacitor is placed in parallel to ground. This creates a frequency-dependent voltage divider. At DC (0 Hz), the capacitor's reactance is infinite, acting like an open circuit, so 100% of the DC voltage passes to the output. At very high frequencies, the capacitor's reactance approaches zero, acting like a short circuit to ground, effectively killing the signal.
The critical threshold of this circuit is the cutoff frequency ($f_c$). This is not where the signal stops entirely, but rather the -3 dB point where the output power drops by half, and the output voltage drops to exactly 70.7% ($1/\sqrt{2}$) of the input voltage.
Worked Example: Designing a 1.5 kHz PWM Smoothing Filter
Let’s design a filter to smooth a 5 kHz PWM signal from an ESP32 (3.3V logic) into a pseudo-analog DC voltage. We want to heavily attenuate the 5 kHz switching ripple while preserving the ability to change the DC voltage level reasonably fast.
1. Choose the Components:
Let’s select a 1 kΩ resistor and a 100 nF (0.1 µF) ceramic capacitor.
2. Calculate the Cutoff Frequency:
$f_c = \frac{1}{2 \pi R C}$
$f_c = \frac{1}{2 \times 3.14159 \times 1000 \times 0.0000001}$
$f_c \approx 1591.5 \text{ Hz}$
3. Calculate the Attenuation at the PWM Frequency (5 kHz):
The attenuation factor ($A$) at any frequency $f$ is:
$A = \frac{1}{\sqrt{1 + (f / f_c)^2}}$
$A = \frac{1}{\sqrt{1 + (5000 / 1591.5)^2}} = \frac{1}{\sqrt{1 + 9.87}} = \frac{1}{\sqrt{10.87}} \approx 0.30$
This means the 3.3V peak-to-peak PWM ripple is reduced to roughly 1V peak-to-peak at the output. While better than raw PWM, a 1V ripple might still cause jitter if you are driving a sensitive analog sensor or audio amplifier. To fix this, you would either lower the cutoff frequency (e.g., using a 10 kΩ resistor) or cascade a second RC stage to create a 2nd-order filter.
4. Calculate the Time Constant and Settling Time:
When you change the PWM duty cycle, the output voltage doesn't jump instantly; it ramps. The time constant ($\tau$) is $R \times C$.
$\tau = 1000 \times 0.0000001 = 100 \text{ µs}$.
It takes roughly $5\tau$ (500 µs) for the output to settle within 99% of its final DC value. This is a crucial trade-off: a lower cutoff frequency yields smoother DC but a slower response time to duty cycle changes.
Where You Meet Low Pass Filters in Practice
Low pass filters are everywhere in electrical and electronic systems. Here is where you will actively design or troubleshoot them:
- PWM to DAC Conversion: As demonstrated above, microcontrollers without true Digital-to-Analog Converters (DACs) use low pass filters to average out PWM pulses into variable DC voltages for motor control or LED dimming.
- Power Supply Decoupling and EMI: Switching DC-DC buck converters generate massive high-frequency noise (often 500 kHz to 2 MHz). Engineers place ferrite beads in series with the power rail. A ferrite bead acts as a lossy, frequency-dependent inductor, forming an LC low pass filter with the downstream decoupling capacitors to block switching noise from reaching sensitive RF or audio stages.
- Anti-Aliasing in ADCs: Before an analog signal enters an Analog-to-Digital Converter, it must pass through a low pass filter to block frequencies above the Nyquist limit (half the sampling rate). Without this, high-frequency noise folds back into the digital domain as phantom low-frequency signals, a phenomenon thoroughly documented in ADC anti-aliasing design guides.
- Audio Crossovers: In multi-speaker setups, subwoofers use high-current, low-pass inductor coils to block mid and high frequencies, ensuring only deep bass reaches the driver.
Common Confusions: Cutoff Is Not a Brick Wall
The most frequent mistake hobbyists make is assuming the cutoff frequency acts like a brick wall—completely passing everything below $f_c$ and completely blocking everything above it. In reality, a passive RC filter has a gentle roll-off slope.
A first-order RC filter attenuates signals at a rate of -20 dB per decade (or -6 dB per octave). This means if your cutoff is 1 kHz, a 10 kHz signal won't be eliminated; it will only be reduced by 20 dB (to 10% of its original voltage). If you need a steeper "brick wall" response, you must use an active filter topology or cascade multiple passive stages.
| Filter Order | Components (Typical) | Roll-Off (dB/Decade) | Roll-Off (dB/Octave) |
|---|---|---|---|
| 1st Order | 1 R, 1 C | -20 dB | -6 dB |
| 2nd Order | 2 R, 2 C (or Active Op-Amp) | -40 dB | -12 dB |
| 3rd Order | 3 R, 3 C (Active) | -60 dB | -18 dB |
| 4th Order | Cascaded 2nd-Order Active | -80 dB | -24 dB |
Another common confusion involves capacitor selection in audio low pass filters. Hobbyists often grab cheap Y5V or X7R ceramic capacitors. These Class 2 dielectrics exhibit severe microphonic effects and voltage coefficient drift, introducing distortion. For high-fidelity audio low pass filters, always specify C0G/NP0 ceramic capacitors or film capacitors, as detailed in advanced filter design tutorials.
Frequently Asked Questions
How does a low pass filter work with PWM signals?
When a PWM signal enters an RC low pass filter, the capacitor charges during the HIGH pulse and discharges through the resistor during the LOW pulse. If the RC time constant ($\tau = R \times C$) is significantly longer than the PWM period, the capacitor cannot fully charge or discharge within a single cycle. Instead, it settles at an average voltage proportional to the duty cycle. A 50% duty cycle on a 5V PWM pin will yield a steady 2.5V DC output, minus a small peak-to-peak ripple dictated by the cutoff frequency.
How does an active low pass filter work compared to a passive one?
A passive filter uses only resistors, capacitors, and inductors, which means it always introduces some signal loss (insertion loss) and its cutoff frequency shifts if you connect a low-impedance load to the output. An active low pass filter incorporates an operational amplifier (like the TL072 or MCP6001). The op-amp provides a high-impedance buffer so the load doesn't affect the filter math, allows for signal gain (amplifying the output), and enables the creation of sharp, higher-order roll-off slopes without using bulky inductors.
Why does my low pass filter output drop in voltage at the cutoff frequency?
By mathematical definition, the cutoff frequency ($f_c$) of a filter is the -3 dB point. At this exact frequency, the fixed resistance of the resistor and the frequency-dependent reactance of the capacitor are equal in magnitude ($R = X_c$). Because they form a voltage divider with equal impedance values, the output voltage mathematically resolves to $1/\sqrt{2}$, or exactly 70.7% of the input voltage. It is not a flaw in your components; it is the fundamental boundary condition of the filter's transfer function.






