C428 of 30
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

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 fs−fmax, 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?

Name it

The steps

  1. Attenuation needed: aliases should sit below the converter's resolution, A=6.02N+1.76 dB for N bits.
  2. Where: the first frequency to fold into the signal band 0..fmax is fs−fmax.
  3. Order: with the Butterworth corner at fmax (3 dB down there), n≥log10⁡(10A/10−1)2log10⁡fs−fmaxfmax (lesson 8).
  4. Stages: each pole pair becomes an equal-resistor unity-gain Sallen-Key stage with C1=2QωcR and C2=12QωcR (lesson 26); an odd order adds an RC section with C=1ωcR.
  5. Check: compute the response from the component values, 1s2R2C1C2+2sRC2+1 per Sallen-Key stage and 11+sRC per RC stage, and confirm the attenuation at fs−fmax.

Trade-offs

Putting the corner at fmax 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 f0.

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
  1. Attenuation needed. A=74dB at 9 kHz
  2. Order. n≥3.88 so fourth order.
  3. Stage Qs. Its pole pairs have Q = 0.541 and 1.307.
  4. Capacitors. That gives stages of 17.2 nF with 14.7 nF, and 41.6 nF with 6.09 nF.
  5. 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
  1. First alias. It's now at 19 kHz.
  2. Order. n≥7.402log10⁡19=2.89 so third order.
  3. Stages. That's one Sallen-Key stage (Q = 1) plus an RC section.
  4. 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), C1 = 22 nF and C2 = 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?

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.