JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Active Filters, Regulators & a Real Power Supply

You have spent six rungs collecting parts — diodes, transistors, op-amps, feedback. Now you build something whole. We assemble an op-amp **active filter** to sculpt a signal's spectrum, a **Class-AB** stage to drive a real load, and a **linear regulator** that holds a rock-steady voltage. Then we close the loop opened on rung 2 and trace power all the way from the wall socket to a clean 5 V rail.

From a passive RC to an active filter

Back on rung 3 you met the humble RC filter: one resistor, one capacitor, and a cutoff where the signal starts to fade. It works — but it has two stubborn flaws. The capacitor must do its job while the *next* stage tugs on the output (loading), and a passive filter can only ever throw signal away, never restore it. The cure is to wrap an op-amp around the RC. The op-amp's near-infinite input impedance means it barely touches the filter, and its near-zero output impedance means it can shove that filtered signal into whatever comes next without flinching. That is the whole idea of an active filter.

The most famous building block is the Sallen–Key topology. Two resistors and two capacitors set the corner; the op-amp, wired with negative feedback as a unity-gain buffer, isolates the filter and lets you cascade stages without each one dragging the last down. Swap the positions of the R's and C's and a low-pass becomes a high-pass — same skeleton, mirror-image behaviour.

Sallen-Key 2nd-order LOW-PASS (unity-gain)

  Vin --[ R1 ]--+--[ R2 ]--+----------(+)\
               |          |            |  >--+--- Vout
             [ C1 ]     [ C2 ]   +---(-)/    |
               |          |      |           |
              (to Vout)  GND     +-----------+   (buffer: Vout fed back to -)

  fc = 1 / (2*pi*sqrt(R1*R2*C1*C2))

  Example: R1=R2=16 kOhm, C1=C2=1 nF
    fc = 1 / (2*pi * 16e3 * 1e-9) = 9.95 kHz  ~ 10 kHz audio corner

  Roll-off above fc: -40 dB/decade (2nd order = twice as steep as one RC)
A second-order low-pass: two RC sections, one op-amp, a 40 dB/decade skirt.

Low-pass, high-pass, band-pass — and what fc really means

Think of a filter as a doorman for frequencies. A low-pass waves through the slow, lazy signals and turns away the fast ones — it is what smooths a PWM output into a clean DC voltage, or kills the hiss above a voice band. A high-pass does the opposite, blocking DC and rumble while letting the quick wiggles through — that is how an audio input strips off a stray DC offset. Chain a high-pass and a low-pass together and you get a band-pass: a window that admits only a chosen slice of the spectrum, the heart of every radio tuner and every graphic-equaliser slider.

The cutoff frequency fc is not a wall — it is the point where the output power has dropped to half, the −3 dB point, where amplitude is 0.707 of the passband. Below fc a low-pass passes almost everything; an octave above, it has already cut the amplitude in half (for a single pole). The intuition that makes this stick: at fc the capacitor's reactance exactly equals the resistance, so the RC pair splits the signal evenly. The capacitor decides the corner; the op-amp decides the gain and keeps the corner from sagging under load.

MAGNITUDE RESPONSE (single-pole, log-log sketch)

 |H| dB
  0 ---------*********.            <- passband (flat, 0 dB)
             :        \.
 -3 ---------:---------o  <- fc: half power, 0.707 amplitude
             :          \.
-20 ---------:------------\.       <- 20 dB/decade slope (1 pole)
             :              \.
             fc            10*fc   freq (log)

  Low-pass : flat below fc, falls above
  High-pass: mirror image — falls below fc, flat above
  Band-pass: high-pass corner then low-pass corner = a hump
fc is the −3 dB knee, not a brick wall. Slope steepens 20 dB/decade per pole.

The Class-AB stage: driving a real load without melting

A filter that can only whisper into a high-impedance meter is academic. The moment you ask it to drive an 8 Ω loudspeaker, a motor, or a long cable, you need current — amps, not microamps. A bare op-amp output tops out around 20–40 mA; a speaker at a few watts wants ten times that. The answer is an output stage built from a complementary pair of transistors, and the workhorse design is the Class-AB amplifier.

Picture two transistors stacked between the supply rails — an NPN on top to *source* current and push the output high, a PNP below to *sink* current and pull it low. Each handles one half of the waveform, like two rowers each pulling on one side of the boat. That is Class-B, and it is efficient because each transistor rests while the other works. But there is a notorious flaw: near the zero-crossing, neither transistor is turned on (a BJT needs about 0.6 V to conduct), so the output flat-lines for a fraction of a volt. This is crossover distortion, and on a sine wave it sounds like grit.

Class-AB fixes it with a trick of breathtaking simplicity: bias the two transistors so a *trickle* of current flows through both even at idle. Now there is no dead zone — as one transistor hands off to the other, they overlap smoothly. You pay a little idle power for it, but the distortion vanishes. The bias is usually set by a string of two diodes (or a 'VBE multiplier') between the bases, generating exactly the ~1.2 V needed to keep both junctions on the edge of conduction.

CLASS-AB OUTPUT STAGE (push-pull)

          +Vcc
           |
          [ Q1 ]  NPN  (sources current, pushes HIGH)
  drive --+--|>|--+----+---- Vout --> LOAD (8 ohm speaker)
  (op-amp)  |     |
           VBE bias (~1.2 V, two diodes)
           |     |
  drive --+--|<|--+
          [ Q2 ]  PNP  (sinks current, pulls LOW)
           |
          -Vee

   Class-B : Iidle = 0   -> dead zone -> CROSSOVER DISTORTION
   Class-AB: Iidle ~ few mA -> overlap -> clean handoff

   Trick: enclose this stage INSIDE the op-amp's feedback loop
          -> the loop drives whatever is needed to crush residual distortion
Push-pull pair; a small idle bias erases the crossover notch. Feedback hides the rest.

The linear regulator: feedback that holds a voltage still

Your chips want 3.3 V or 5.0 V that does not flinch when the load surges or the input sags. A raw rectified-and-smoothed supply gives you a lumpy 9-ish volts with ripple riding on top — useless for a microcontroller's ADC. The device that tames it is the voltage regulator. The simplest is a Zener shunt: a Zener diode clamps at a fixed reverse voltage, and a series resistor dumps the excess. It works for milliamps but wastes power and droops under load.

The professional answer is a series-pass regulator built from three pieces you already know: a stable reference, an error amplifier (an op-amp), and a pass transistor. The op-amp compares a fraction of the output to the reference and drives the pass transistor's gate so that the output is forced to obey. If the load tugs the output down by a millivolt, the error amplifier sees the discrepancy and opens the pass transistor a hair wider to push it back up — thousands of times a second. It is negative feedback doing for voltage exactly what your car's cruise control does for speed.

SERIES LINEAR REGULATOR (the LDO idea)

  Vin(unreg, ripply) --[ PASS TRANSISTOR ]----+---- Vout (clean) --> load
                              ^                |
                              |             [ R1 ]
                       error amp drive         |
                              |                +---- Vfb
                         (op-amp)              |
                          /  \              [ R2 ]
                  Vref --(+)  (-)-- Vfb        |
                          \  /               GND
                       BANDGAP REFERENCE (1.205 V, T-stable)

  Loop forces Vfb = Vref, so:
     Vout = Vref * (1 + R1/R2)

  Example: Vref = 1.205 V, R1 = 3.15 R2  ->  Vout = 1.205 * 4.15 = 5.00 V

  Dropout: Vin must exceed Vout by the pass device's headroom
           (an LDO does this in ~0.1-0.3 V; a classic 7805 needs ~2 V)
Reference + error amp + pass device. The same feedback skeleton as the Class-AB amp.

Closing the loop: a complete power supply, wall to rail

On rung 2 we left a promise dangling: how does the 230 V (or 120 V) sine wave at the wall become the steady 5 V that feeds your logic? Now you own every piece of the answer. Let's walk the signal from the socket to the chip, watching the waveform get tamer at each stage.

  1. Transformer — steps the mains down to a safe amplitude (say 230 V → 9 V AC) and, crucially, isolates you from the lethal line. You still have a sine wave, just a small one.
  2. Rectifier — a bridge rectifier of four diodes flips the negative half-cycles upward, turning AC into a bumpy, all-positive pulsing DC. The output now never goes negative, but it slams to zero 100 (or 120) times a second.
  3. Smoothing capacitor — a big reservoir cap charges on each peak and discharges into the load between peaks, filling the valleys. What was pulsing DC becomes a roughly steady voltage with a small sawtooth ripple riding on top.
  4. Regulator — the series-pass regulator from the last section swallows the remaining ripple and the input variation, locking the output to exactly 5.00 V regardless of load or how much the cap droops between peaks.
  5. Decoupling — a small ceramic cap right at each chip's pins supplies the fast current spikes the regulator's feedback loop is too slow to chase, keeping the rail clean at megahertz.
FULL LINEAR SUPPLY — waveform tamed at every stage

  WALL        TRANSFORMER     RECTIFIER      + CAP          + REGULATOR
  ~230Vac  -> ~9Vac        -> bumpy DC    -> ripply DC    -> flat 5.00V

   /\  /\       /\  /\         /\/\/\/\        ~~~~~~~~        ___________
  /  \/  \     /  \/  \       //\//\//\/      (small saw-    (DC, regulated)
 -+--------   -+--------    --++--++--++--     tooth ripple)

  [~]---|XFMR|---[ BRIDGE ]---+---[ REG ]---+--- +5V
                  4 diodes  [Cin]         [Cout]    |
                              |             |     [0.1uF]  <- decoupling
                             GND           GND       |
                                                     GND

  Ripple before reg:  Vrip ~ I_load / (f * Cin)
    e.g. 200 mA, f=100 Hz, Cin=2200 uF -> Vrip ~ 0.9 V  (reg removes it)
Transformer → rectifier → smoothing cap → regulator → decoupling. Each stage flattens the curve.

You've arrived — and where the road forks next

Step back and look at what just happened. The active filter, the Class-AB amplifier, and the linear regulator are not three unrelated circuits — they are the *same idea* wearing three costumes. Each takes a high-gain op-amp, wraps it in negative feedback, and lets the loop force reality to match a desired target: a shaped spectrum, a faithful louder copy, a fixed voltage. Once you see feedback as the master pattern, every analog system becomes legible.

From here the road forks two ways. Down the power-electronics path you trade the heat of linear regulation for the efficiency of switching: buck and boost converters, PWM control, gate drivers, and the wide-bandgap SiC and GaN devices reshaping modern power. Down the op-amp / analog-design path you go deeper into the amplifier itself: instrumentation amps for tiny sensor signals, comparators for decisions, and the references and noise floors that set the limits of precision.