Lab 4.4 — Active Low-Pass Filter

Course 2 syllabus · Module 4 · Prev: « Lab 4.3 · Next: Lab 5.1 »

Goal

Build an active low-pass filter around the MCP6002, sweep it with DAC-generated sine tones, and measure its magnitude response point-by-point to construct a Bode plot by hand. You’ll set a cutoff frequency with an RC, watch the roll-off match −20 dB/decade (first-order) or −40 dB/decade (Sallen–Key second-order), and — crucially — build the exact circuit that will serve as the anti-alias filter in front of the STM32 ADC in Module 5. Every sampled-data system needs a low-pass filter before the sampler to keep out-of-band energy from folding into the signal; this lab is where you build, characterize, and trust that filter. Reconciling a measured Bode plot against \(H(j\omega)\) is the core skill of analog-front-end design.

Equipment & parts

  • WANPTEK supply at 5.0 V, current-limited.
  • MCP6002 dual op-amp with 0.1 µF decoupling; 100 kΩ/100 kΩ mid-rail divider (bias for single supply).
  • Siglent SDS1104X-E scope + two 10× probes.
  • Signal source: the MCP4725 DAC (Lab 3.3), programmed to output a mid-rail sine you can step across frequency. (The fixed ~1 kHz probe-comp square wave is not a sweep source and is not a sine — unsuitable here.)
  • Resistors and capacitors for a chosen cutoff (worked below for \(f_c \approx 1.6\) kHz): e.g. R = 10 kΩ, C = 10 nF; for the Sallen–Key add a matched second R/C and gain-set resistors.
  • Breadboard + jumpers.

Safety & don’t-break-it

  • ESD handling of the bare DIP (body only, insert with power off, decouple first) — same discipline as Labs 4.1–4.3.
  • Keep signals linear and inside the rails. Use a small mid-rail-centered input so the op-amp never clips (Lab 4.3) — a clipped input invalidates a magnitude measurement. Keep the DAC output within 0–5 V.
  • Discharge and observe polarity on any electrolytic used for coupling; prefer small ceramic/film caps for the filter’s frequency-setting C (lower tolerance drift and no polarity issue).
  • Common grounds for DAC, scope, op-amp, supply.

Background

First-order active LPF. The simplest realization buffers an RC low-pass with the op-amp (unity-gain, so the RC isn’t loaded), or places R and C in the feedback of an inverting stage. Either way the transfer function is single-pole:

\[ H(j\omega) = \frac{H_0}{1 + j\omega/\omega_c}, \qquad \omega_c = \frac{1}{RC}, \qquad f_c = \frac{1}{2\pi RC}. \]

The magnitude is \(|H| = H_0/\sqrt{1+(\omega/\omega_c)^2}\): flat (\(H_0\)) in the passband, −3 dB at \(f_c\), then falling at −20 dB/decade (one pole). For \(R = 10\text{ kΩ}, C = 10\text{ nF}\):

\[ f_c = \frac{1}{2\pi (10^4)(10^{-8})} = \frac{1}{2\pi \times 10^{-4}} \approx 1.59\text{ kHz}. \]

Second-order Sallen–Key LPF (steeper, better anti-alias). Two RC sections around one op-amp give a two-pole response:

\[ H(j\omega) = \frac{H_0\,\omega_0^2}{\omega_0^2 - \omega^2 + j\,\omega\omega_0/Q}, \qquad \omega_0 = \frac{1}{\sqrt{R_1 R_2 C_1 C_2}}, \qquad f_0 = \frac{\omega_0}{2\pi}. \]

For the equal-component version (\(R_1=R_2=R\), \(C_1=C_2=C\)) with a unity-gain buffer, \(f_0 = 1/(2\pi RC)\) and the quality factor \(Q\) is set by the stage gain \(K = 1+R_f/R_g\) via \(Q = 1/(3-K)\). Choosing \(K = 1.586\) gives \(Q = 0.707\) — the Butterworth (maximally flat) response. Above \(f_0\) the magnitude falls at −40 dB/decade — twice as steep as first-order, which is why a second-order anti-alias filter buys you a much cleaner cutoff for the same corner frequency.

Reading the Bode plot. Magnitude in dB is \(20\log_{10}|H|\); frequency on a log axis. The passband is a flat line at \(20\log_{10}H_0\); the roll-off is a straight line of slope −20 (1st-order) or −40 (2nd-order) dB/dec; they intersect at the corner \(f_c\). You’ll build this plot from measured tone-by-tone gains.

Procedure

Part A — Build the first-order filter.

  1. Bring up the MCP6002 (VDD=8, VSS=4, decoupled), mid-rail bias VB ≈ 2.5 V.
  2. Build a unity-gain first-order LPF: AC-couple the DAC sine onto R = 10 kΩ in series into IN A+ (pin 3), C = 10 nF from pin 3 to the AC ground (VB / the bypassed mid-rail node), and wire A as a follower (OUTA→IN A−). This buffers the RC so downstream loads don’t shift \(f_c\).
  3. Power on. Verify DC: OUTA sits at ≈ 2.5 V.

Part B — Sweep and measure the magnitude response.

  1. DAC → mid-rail sine, small amplitude, starting at 100 Hz. Scope CH1 = filter input (after the coupling cap, at R’s source), CH2 = OUTA. Use auto-measure Vpp on both.
  2. Step the frequency across at least a decade below to a decade above \(f_c\): e.g. 100 Hz, 300 Hz, 1 kHz, 1.59 kHz, 3 kHz, 10 kHz, 30 kHz (extend as the DAC’s clean-sine limit allows). At each point record \(|H| = V_\text{pp,out}/V_\text{pp,in}\) and \(20\log_{10}|H|\) dB.
  3. Locate the −3 dB frequency (where gain = 0.707× passband) and compare to the predicted \(f_c \approx 1.59\) kHz. Verify the high-frequency slope is ≈ −20 dB/dec (gain drops ~20 dB from \(f_c\) to \(10 f_c\)).

Part C — Second-order Sallen–Key (optional, recommended for the anti-alias role).

  1. Rebuild as an equal-component Sallen–Key with \(R = 10\text{ kΩ}, C = 10\text{ nF}\) (same \(f_0 \approx 1.59\) kHz) and gain \(K = 1.586\) (e.g. \(R_g = 10\text{ kΩ}, R_f = 5.86\text{ kΩ} \approx 5.9\text{ kΩ}\)) for a Butterworth \(Q = 0.707\).
  2. Repeat the sweep. Confirm the roll-off is now ≈ −40 dB/dec and the passband is maximally flat (no peaking).

Part D — Plot by hand.

  1. On semi-log paper (or plot in Python), draw the Bode magnitude: measured points, the flat passband asymptote, and the roll-off asymptote; mark \(f_c\) at their intersection.

Deliverable & expected results

A bench note (docs/lab-4-4.md) with the swept magnitude table and a hand-drawn/plotted Bode magnitude curve for the first-order (and, if built, the Sallen–Key) filter, annotated with \(f_c\) and the roll-off slope.

Frequency Predicted \(\lvert H\rvert\) (1st-order) Predicted dB Measured dB
100 Hz 0.998 −0.02 dB
1.0 kHz 0.847 −1.44 dB
1.59 kHz (\(f_c\)) 0.707 −3.0 dB
3.0 kHz 0.469 −6.6 dB
10 kHz 0.157 −16.1 dB
30 kHz 0.053 −25.5 dB

Predicted from \(|H| = 1/\sqrt{1+(f/1.59\text{k})^2}\). Cutoff \(f_c = 1/(2\pi RC) \approx 1.59\) kHz; Sallen–Key \(Q = 0.707\) (Butterworth).

Analysis & reconciliation

Confirm the measured −3 dB corner matches \(1/(2\pi RC)\) within component tolerance — note ceramic caps can be ±10–20%, so measure the actual C on the LC1020E (Lab 0.3) and recompute \(f_c\); that usually explains most of the corner error. Check the high-frequency asymptote slope by fitting the dB-vs-log-f points: it should be −20 (or −40) dB/dec, and any shortfall at very high frequency is the MCP6002’s own GBW rolloff (Lab 4.2) adding to the filter’s — a real effect worth naming. For the Sallen–Key, watch for passband peaking: if \(Q\) came out above 0.707 (gain \(K\) too high), you’ll see a bump before the corner; trim \(R_f\) down to flatten it. Finally, connect to sampling: state the ADC sample rate \(f_s\) you plan for Module 5 and confirm this filter attenuates energy at and above \(f_s/2\) enough to keep aliased content below your ADC’s noise floor — that is the whole reason this filter exists.

Going further

  • This is your anti-alias filter. Carry this exact circuit forward to Lab 5.4 — Aliasing: sample a tone above Nyquist with and without the filter in place and watch the alias appear/disappear.
  • Measure and plot the phase response too; a first-order LPF passes through −45° at \(f_c\) and approaches −90°, a second-order Butterworth through −90° at \(f_0\) toward −180°.
  • Design the filter for a specific \(f_s\): pick \(f_c\) roughly \(f_s/2.5\) and compute R, C; predict the attenuation at \(f_s/2\) for first- vs. second-order and decide which order your Module 5 chain needs.
  • Cascade the first-order and Sallen–Key sections (both MCP6002 halves) for a third-order filter and confirm −60 dB/dec.