C4 · Lesson 28 · Project
Turn a converter's resolution into a filter, then build it from real parts
A data logger samples a vibration sensor 10,000 times a second with a 12-bit converter, and the vibrations of interest are below 1 kHz. Anything above 5 kHz would alias into the measurements and be impossible to remove afterward, so an analog filter must cut it first, far enough that aliases sit below the converter's own resolution. In this project you'll go from those three numbers to a filter order, to stage capacitors for a Sallen-Key cascade, and finally check the finished design's response from its component values, the way you'd verify a schematic before building it.
- A Butterworth anti-aliasing filter's response (dB, log frequency) with its corner at the top of the signal band. The dashed line is the attenuation the converter needs; the marker is , the first frequency that folds into the band.
- Raise the order until the curve passes below the line at the marker.
- Then try sampling faster: the gap widens, and a lower order does.
Predict
The logger samples at 10 kHz with a 12-bit converter, and the signals go up to 1 kHz. What Butterworth order does the filter need, with its corner at 1 kHz?
- The first frequency that aliases into 0 to 1 kHz is 9 kHz, which must be 74 dB down (). A third-order filter gives 57 dB there, a fourth-order one 76 dB.
Name it
The steps
- Attenuation needed: aliases should sit below the converter's resolution, dB for bits.
- Where: the first frequency to fold into the signal band is .
- Order: with the Butterworth corner at (3 dB down there), (lesson 8).
- Stages: each pole pair becomes an equal-resistor unity-gain Sallen-Key stage with and (lesson 26); an odd order adds an RC section with .
- Check: compute the response from the component values, per Sallen-Key stage and per RC stage, and confirm the attenuation at .
Trade-offs
Putting the corner at loses 3 dB at the top of the band; moving it up a little preserves the band but needs a higher order. Sampling faster widens the gap: with oversampling and a digital filter afterward, the analog filter can be a simple second- or third-order one. Real designs also check the op amps' bandwidth and the capacitors' tolerance, since 5% capacitors shift each stage's Q and .
Worked example
Design the filter for 1 kHz signals sampled at 10 kHz by a 12-bit converter, with R = 10 kΩ.
Show the solution
- Attenuation needed.
- Order. so fourth order.
- Stage Qs. Its pole pairs have Q = 0.541 and 1.307.
- Capacitors. That gives stages of 17.2 nF with 14.7 nF, and 41.6 nF with 6.09 nF.
- Check. Checked from those values, it's 76.3 dB down at 9 kHz.
Answer a fourth-order filter: 17.2 nF with 14.7 nF (Q = 0.541) and 41.6 nF with 6.09 nF (Q = 1.307), 76.3 dB down at 9 kHz.
Worked example
The same signals sampled at 20 kHz: what does the filter need now?
Show the solution
- First alias. It's now at 19 kHz.
- Order. so third order.
- Stages. That's one Sallen-Key stage (Q = 1) plus an RC section.
- Check. Checked, it's 76.7 dB down at 19 kHz.
Answer a third-order filter, one Sallen-Key stage (Q = 1) plus an RC section, 76.7 dB down at 19 kHz.
Check
How far down must aliases be for a 12-bit converter?
Check
Signals up to 1 kHz are sampled at 20 kHz. Where is the first frequency that aliases into the signal band?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
Signals up to 1 kHz, sampled at 10 kHz by a 16-bit converter. What Butterworth order, cornered at 1 kHz, does the filter need?
Check
An odd-order design needs an RC section cornered at 1 kHz with R = 4.7 kΩ. What capacitor?
Write units the way you normally would: 1.5 nF, 1500 pF and 0.0015 µF are the same answer.
Check
A Sallen-Key stage has R = 10 kΩ (both), = 22 nF and = 10 nF. What is its gain at 5 kHz?
Check
An order-4 Butterworth filter is checked at 4 times its corner. How far down is it?
Check
Write required_order(fmax, fs, bits) (the Butterworth order, cornered at fmax, that puts the first alias below an ideal bits-bit converter's resolution) and design(fmax, fs, bits, R): return a list of stages, each ('SK', C1, C2) in order of increasing Q, then ('RC', C, None) if the order is odd.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write gain_db(stages, R, f): the filter's gain in dB at the frequencies f (an array), computed from the stage values that design returns.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does sampling faster make the anti-aliasing filter easier to build?
The filter has to pass the signal band unchanged while cutting everything that would fold back into it, and the first such frequency is the sampling rate minus the top of the signal band. Sampling faster pushes that frequency up, so the filter has a wider transition band in which to fall from passing everything to blocking almost everything. Each order of filter adds a fixed amount of attenuation per decade, so a wider gap on the log scale means fewer orders are needed to reach the same attenuation, and fewer stages, parts and op amps.
Practice
Keep practicing
9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.