What are Digital Filters? (Moving Average, Butterworth, Kalman)
Digital filters are algorithms that suppress unwanted components (noise, interference, vibration) in a signal after it has been digitized by an ADC. Every filter trades noise reduction against response speed; the right one depends on the character of the signal and of the noise.
Common filter types
| Filter | Formula / principle | Strength | Weakness |
|---|---|---|---|
| Moving average (MA) | Mean of the last N samples | Simple, reduces random noise | Delay grows with N |
| Exponential (EMA) | y[n] = α·x[n] + (1−α)·y[n−1] | Little memory, one parameter | Step response settles slowly |
| Median | Middle value of the last N samples | Rejects isolated spikes | Higher computational cost |
| Butterworth (IIR) | Maximally flat passband | Clearly defined cutoff | Phase delay varies with frequency |
| Kalman | Weighted blend of model prediction and measurement | Effective for dynamic systems | Needs a model and noise parameters |
A Butterworth filter is -3 dB at its cutoff frequency (fc), and above fc attenuation increases by 20 dB/decade per order. A 2nd-order filter therefore attenuates a component at 10 × fc by about 40 dB (a factor of 100); saying it "cuts off" everything above fc is not accurate. Extensions of the Kalman filter for non-linear systems are covered in Advanced Filtering.
Worked example: moving average
A moving average with N = 20 samples at a 1 kHz sampling rate:
- Window length:
20 × 1 ms = 20 ms. That is exactly one period of 50 Hz, so the filter has zero gain at 50 Hz and its multiples and strongly rejects mains interference. - Noise reduction: uncorrelated random noise falls by about
√N = √20 ≈ 4.5times. - Delay: group delay is
(N − 1) / 2 = 9.5 samples ≈ 9.5 ms.
With N = 200, noise falls about 14 times but delay rises to roughly 100 ms; in filling control that delay can cause overshoot.
Common mistakes
- Using a digital filter in place of the anti-aliasing filter that belongs before sampling. A digital filter cannot separate a component that has already folded through aliasing.
- Heavy filtering in tests where the peak value matters; the filter under-reads the peak.
- Raising the filter setting without fixing the source of noise (wiring, grounding) (see Noise).
- Ignoring filter delay inside a control loop.
Where are they used in industry?
Stable readings on weighing indicators, weighbridges on vibrating ground, dosing control and cleaning up force curves on test machines are typical uses of digital filters. The Amazeng GDT Digital Transmitter includes an adaptive digital filter that can be adjusted manually or automatically to suppress interference and noise. For AI-based approaches, see Smart Transmitters: AI Noise Filtering.
Related Terms
- What is Signal Noise and How to Prevent It?What signal noise is: EMI sources, SNR and noise-free resolution maths, shielding and differential inputs, filtering and common wiring mistakes.
- Advanced Filtering: Unscented Kalman vs Standard KalmanKalman, Extended Kalman (EKF) and Unscented Kalman (UKF) compared: how they work, a worked gain calculation, sigma points and how to choose between them.
- What is Aliasing?What aliasing is: the Nyquist rule, the alias frequency formula with worked numbers, why an anti-aliasing filter is needed and common sampling mistakes.
- What is ADC (Analog-to-Digital Converter)?What an ADC is and how it works: LSB and SNR formulas, 12-bit vs 24-bit compared, a worked load cell example and the most common mistakes.