DSPRelated.com

Low-Pass Filter

Category: Filters | Also known as: LPF, Low pass, lowpass

A low-pass filter (LPF) is a filter that passes signal components below a defined cutoff frequency while attenuating components above it. It is one of the fundamental building blocks in signal processing, used in both analog hardware and digital firmware to remove high-frequency noise, anti-alias a signal before sampling, or smooth a measurement.

In practice

In embedded systems, LPFs appear in two main forms: analog (RC networks, active op-amp stages) and digital (FIR or IIR algorithms running on the MCU). A first-order analog RC filter with cutoff fc = 1/(2*pi*R*C) is often placed directly on an ADC input to suppress noise and prevent aliasing. For a 10 kHz cutoff with a 10 kOhm resistor, that gives C = 1.6 nF.

On the digital side, a first-order IIR (exponential moving average) is extremely common on resource-constrained MCUs because it requires only one multiply and one add per sample. The update equation y[n] = alpha*x[n] + (1-alpha)*y[n-1] can even be reformulated with a power-of-two coefficient so the multiply reduces to a bit shift -- a useful trick on 8-bit and 16-bit parts with no hardware multiplier, though some such parts do have multiply instructions, and constraining alpha to a power of two is an approximation. The post "An Efficient Lowpass Filter in Octave" explores efficient implementations along these lines.

FIR low-pass filters offer linear phase response and unconditional stability, but their computational cost scales with the number of taps (filter order). A 64-tap FIR running at 48 kHz sample rate requires on the order of 64 multiply-accumulate operations per sample in a straightforward implementation -- feasible on a Cortex-M4 with its DSP instructions and single-cycle MAC, but potentially prohibitive on a small 8-bit MCU. (Optimized implementations exploiting filter symmetry or polyphase structures can reduce this count.) IIR designs (Butterworth, Chebyshev, Biquad) achieve steeper roll-off with far fewer coefficients. The post "Reducing IIR Filter Computational Workload" covers techniques to lower IIR execution cost further.

A frequent pitfall is confusing the filter cutoff frequency with the sampling rate. When a digital filter is specified in normalized frequency, the same coefficient set produces different Hz cutoffs at different sample rates -- though the exact relationship depends on the design method and how the filter is parameterized. Another common mistake is placing the analog anti-aliasing LPF after the ADC rather than before it -- by then, aliased components are already folded into the baseband and cannot be removed.

Discussed on DSPRelated

Frequently asked

What is the difference between a first-order IIR low-pass filter and an FIR low-pass filter?
A first-order IIR LPF (exponential moving average) uses feedback: the output depends on both the current input and the previous output. It is computationally cheap but exhibits a non-linear phase response (frequency-dependent group delay), which can be a concern when waveform shape must be preserved. Its frequency response rolls off at only -20 dB/decade. An FIR LPF uses a weighted sum of past input samples only -- no feedback. FIR filters can be designed for perfectly linear phase (constant group delay across the passband), which matters when waveform shape must be preserved, but they require many more coefficients to achieve a sharp transition band.
How do I choose the cutoff frequency for an ADC input anti-aliasing filter?
The anti-aliasing LPF must attenuate signal energy above half the ADC sample rate (the Nyquist frequency) sufficiently to meet the system's aliasing error budget before sampling occurs. The required attenuation depends on the acceptable aliasing level for the application and does not always need to reach the ADC noise floor. In practice, designers often set the analog filter cutoff at one-fifth to one-half of the sample rate and accept that a digital LPF will do additional filtering afterward. The exact choice depends on how much attenuation the analog filter provides at Nyquist and how steeply the signal spectrum falls off above the desired passband.
Can a low-pass filter be implemented without floating-point arithmetic?
Yes. The exponential moving average can be reformulated using fixed-point arithmetic. A common technique on MCUs without an FPU is to choose alpha as a power of two (e.g., 1/8, 1/16), replacing the multiply with a right bit shift. For example: y = y + ((x - y) >> 4). This works well on 8-bit PICs, AVRs, and MSP430s. More precise fixed-point IIR implementations use Q-format arithmetic with 16- or 32-bit accumulators to avoid overflow and coefficient quantization error.
What causes a low-pass filter to ring, and when does it matter?
Ringing (oscillatory overshoot after a step input) occurs in filters with a resonant pole -- typically higher-order IIR designs such as Chebyshev Type I or elliptic filters optimized for steep roll-off. Butterworth filters are maximally flat in the passband and ring less; Bessel filters are optimized for flat group delay and ring the least. Ringing matters in control loops (it can cause instability), in pulse-shape measurements (it distorts edge timing), and in audio (audible artifacts). For sensor smoothing where only DC or slow drift is of interest, ringing is rarely a concern.
What is a biquad low-pass filter and why is it used?
A biquad is a second-order IIR section (two poles, two zeros) described by five coefficients. Higher-order IIR LPFs are typically implemented as a cascade of biquad sections rather than as a single high-order filter, because each biquad is independently stable and coefficient quantization errors are more manageable. ARM CMSIS-DSP provides optimized biquad routines (arm_biquad_cascade_df2T_f32, and fixed-point variants) that exploit the Cortex-M4/M7 DSP instruction set. Cascading biquads is the standard approach on Cortex-M-based MCUs when sharper LPF roll-off is needed.

Differentiators vs similar concepts

A low-pass filter is often contrasted with a high-pass filter (passes frequencies above the cutoff, attenuates below), a band-pass filter (passes a range of frequencies between two cutoffs), and a band-stop or notch filter (attenuates a specific frequency range). An LPF and a high-pass filter with the same cutoff are complements: their frequency responses sum to unity (for a first-order IIR pair, this is exact). The term "smoothing filter" is sometimes used informally for a low-pass filter applied to time-domain data, but smoothing can also refer to non-linear operations (median filter, Savitzky-Golay) that are not strictly LPFs.