Design an RC low-pass filter for a target cutoff, predict its gain and phase, and simulate its step response.
Why it matters
Filters are everywhere in electrical engineering: anti-aliasing filters before ADCs, EMI filters on power supplies, tone controls, sensor smoothing, and the LC filters that clean up an inverter's output before it reaches the grid. The single-pole RC low-pass is the simplest and the one you will design most often, and it teaches the language (cutoff, decibels, roll-off, phase) used for every other filter.
The RC low-pass
A resistor R in series with the signal, then a capacitor C to ground; the output is taken across the capacitor. At low frequencies the capacitor's impedance 1 / (j omega C) is huge, so the output follows the input. At high frequencies the capacitor acts like a short, so the output falls.
H(f) = 1 / (1 + j f / fc)
fc = 1 / (2 pi R C) (cutoff, or -3 dB, frequency)
|H| = 1 / sqrt(1 + (f / fc)^2)
phase = -atan(f / fc)
- At
f = fc:|H| = 0.707(-3.01 dB) and the phase is -45°. - Well above
fc: the gain falls by 20 dB per decade (a factor of 10 per factor of 10 in frequency). At10 fcit is about -20 dB, so a tenth of the amplitude. - Decibels for voltage gain:
dB = 20 log10(|H|).
The time constant tau = R C describes the time response: after a step input the output reaches 63.2% of the final value at t = tau, and about 99% after 5 tau.
Worked example: designing for 1 kHz
You want to remove noise above roughly 1 kHz from a sensor signal, and the source can drive about 1.6 kΩ.
C = 1 / (2 pi R fc) = 1 / (2 pi * 1,600 * 1,000) = 99.5 nF -> use 100 nF
fc (actual) = 1 / (2 pi * 1,600 * 100e-9) = 995 Hz
tau = 1,600 * 100e-9 = 160 µs
At 10 kHz the gain is about -20 dB; at 100 Hz it is -0.04 dB, essentially untouched. Remember the source and load impedances add to the network: a load resistance comparable to R lowers the gain and shifts fc, so buffer with an op-amp follower if needed.
Higher-order and other filters
- High-pass: swap
RandC(output acrossR) to block DC and low frequencies,fcunchanged. - Steeper roll-off: cascade stages or use active designs. A second-order filter falls at 40 dB per decade. Sallen-Key and multiple-feedback op-amp circuits implement Butterworth (flattest passband), Bessel (best step response) and Chebyshev (sharpest cutoff, with ripple) responses.
- Design tools: in real work you would use
scipy.signal.butterandscipy.signal.freqsto compute responses, or a vendor filter wizard, then check in LTspice.
Digital version
A discrete-time first-order low-pass (an exponential moving average) is the same idea in firmware:
alpha = dt / (R C + dt)
y[k] = y[k-1] + alpha * (x[k] - y[k-1])
With a small time step dt, this closely matches the analog RC. It is how many microcontrollers smooth sensor readings.
Simulate it
In Falstad or LTspice, build 1.6 kΩ and 100 nF, drive with a sine and sweep the frequency (LTspice .ac dec 100 10 100k gives a Bode plot). Then drive it with a square wave and watch the edges round off with the RC time constant.
Common mistakes
- Using
1 / (R C)as the cutoff in hertz. That is the angular frequency in rad/s; divide by2 pi. - Mixing up power and voltage decibels (
10 log10vs20 log10). - Ignoring source and load impedance when the filter connects to real circuits.
- Expecting a sharp cutoff from one RC stage: at
2 fcthe signal is still 45% of its amplitude. - Choosing tiny capacitors (a few pF) where stray capacitance dominates.
Recap
fc = 1 / (2 pi R C); atfc, gain is -3 dB and phase -45°.- One pole rolls off at 20 dB per decade; the step response reaches 63.2% at
tau = R C. y += alpha (x - y)withalpha = dt / (RC + dt)is the digital equivalent.
Try it
Open the Do tab to code RC filter design functions and simulate a step response.