A rail your whole circuit can forget about
Everything you have built so far — the amplifiers, the filters, the oscillators — quietly assumed one thing was already true: that a clean, steady voltage was waiting at the supply pins, never sagging, never buzzing, always exactly the number on the schematic. That calm rail is not free. The wall gives you wild high-voltage AC; a coin cell gives you a number that slowly fades; a solar panel gives you whatever the sun feels like. The power supply is the chain of stages that takes raw, messy energy and turns it into the boring, dependable rail every other circuit takes for granted.
Think of it as a small water-treatment plant for electricity. Each stage hands a slightly tamer version of the power to the next, and only the last stage is clean enough to drink. End to end, the classic mains supply runs like this: step the voltage down, force it one way, store it in a reservoir to fill the gaps, then actively hold it steady — and finally park a little tank right next to each thirsty chip. This guide walks the whole chain once, top to bottom, so the four deep-dive guides that follow have a map to hang on.
stage: mains AC transformer rectifier reservoir cap regulator load
(bridge) (smoothing) (lin/switch) + decoupling
~~~~ --> )||( --> >|< >|< --> === --> [ REG ] --> === [ IC ]
)||( >|< >|< C1 C2
what: step down one-way only fill the hold steady local tank
& isolate (folds the AC) valleys at fixed Vout at the pin
level: high lower pulsating ripply DC, flat, fixed steady
wobbly AC wobbly AC DC humps unregulated regulated DC at loadStage one: the unregulated front end
The first three stages should feel familiar from the diodes rung, so we will move fast. A transformer trades the wall's tall, dangerous AC for a shorter, safer AC at the turns ratio you choose — and just as importantly, it isolates your circuit from the live mains. A bridge rectifier then folds that AC so it only ever flows one way, giving lumpy, throbbing DC. Finally a reservoir capacitor — our rechargeable bucket — charges to near the peak and feeds the load through the gaps, filling the valleys into something close to flat DC.
What comes out is an unregulated supply: roughly the right voltage, but not a number you can trust. It droops as you draw more current, it drifts up and down with the mains, and a residual sawtooth — the ripple the bucket could not flatten — rides on top forever. For a motor or a heater that is fine. For a microcontroller or a precise analog stage it is not nearly good enough. Something has to actively clean it up.
It is worth seeing the front end for what it really is: just 'get some raw DC from somewhere.' It does not have to be a transformer and a rectifier — a battery, a USB port, a solar panel, or a wall-wart already gives you raw DC. Whatever the source, it shares the same flaw: the voltage is only approximate, and it moves. So the interesting, universal part of the chain is everything after the raw DC — the regulation. That is where the next four guides live.
Stage two: regulation, the thermostat the front end lacks
Regulation is the act of actively holding the output at a chosen value no matter what the input or the load does. A regulated supply behaves like a thermostat for voltage: it constantly measures its own output, compares it against a fixed target, and nudges itself back whenever it drifts. Swing the input around, yank the load current up and down — the regulated output barely twitches. That is the whole difference from the unregulated rail, which simply passes its wobble straight through.
Every regulator, of any kind, is built from two ideas you already know. First it needs a voltage reference: a stable internal yardstick that says 'this is what 1.2 volts really is,' immune to temperature and supply changes — usually a bandgap reference (or, more crudely, a Zener). Second it needs negative feedback: the same thermostat loop from the op-amp rung, forever comparing a scaled copy of the output against that reference and driving the error toward zero. A reference sets the target; feedback hits it.
Two roads to a regulated rail: linear vs switching
The first road is the linear regulator. Picture a series-pass transistor sitting in the line like an automatically adjusted tap: the feedback loop opens or closes it just enough to drop whatever extra voltage is needed, so the output lands exactly on target. It is simple, quiet, and cheap. But that tap dissipates the surplus as heat — it burns (Vin − Vout) times the load current, every second, as warmth.
Put numbers on it. Feed a 5 V regulator from a 12 V rail at 0.5 A. The load receives 5 times 0.5 = 2.5 W; the regulator throws away (12 − 5) times 0.5 = 3.5 W as heat — more than it delivers. Its efficiency is only Vout/Vin ≈ 5/12 ≈ 42 percent, and that 3.5 W has to go somewhere. The bigger the gap from input to output, the worse it gets; this is the honest, unavoidable price of the linear approach.
The second road is the switching regulator, or SMPS. Instead of bleeding off the surplus, it chops the input into fast on/off pulses with PWM, pours those pulses into an inductor — a flywheel for current that smooths the chopping back into steady DC — and adjusts the pulse width to hold the output on target. Because the switch is either fully on (no voltage across it) or fully off (no current through it), it wastes very little, so a buck (step-down), boost (step-up), or buck-boost can hit 85 to 95 percent efficiency. The catch is noise: all that fast switching sprays ripple and EMI a linear regulator never makes.
- Small voltage drop and you need it quiet — an audio or sensor rail? Reach for a linear regulator or LDO; the heat is small and the noise is lowest.
- Big input-to-output gap, high current, or running from a battery you want to last? Use a switcher; the efficiency saves both heat and runtime.
- Need to step UP, or up-and-down as a battery sags? Only a switcher (boost or buck-boost) can do that — a linear can never raise the voltage.
- Want the best of both? Common practice is a switcher to get close, followed by a small low-noise linear/LDO to scrub the last of the ripple.
The worries that bite you in the real world
A supply that works in theory still has a handful of practical ways to misbehave, and each gets its own treatment later in this rung. Ripple is the leftover wobble; dropout is the minimum headroom a regulator needs between input and output — fall below it and it stops regulating, which is exactly why the low-dropout regulator (LDO) exists, trading a tiny drop for tighter rails. Remember to size the reservoir cap so that even at the bottom of the ripple sag, the input still stays one dropout above the output.
Three more habits keep a supply alive. Decoupling capacitors are little local tanks beside each chip, so a sudden gulp of current is supplied next door instead of sagging down the long pipe from the regulator. Inrush current is the violent first gulp at power-on, when empty caps look like a short — tame it with a fuse, surge-rated parts, or a soft-start. And good regulators protect themselves with current limit and thermal shutdown, quietly folding back or switching off before they cook.
When a linear regulator must burn watts, that heat has to escape, so a heat sink bolts on to give it more surface to shed warmth into the air — guide 5 shows how to size one honestly. And the source itself may be a battery, whose voltage starts high, sags under load, and fades as it empties, which is often the very reason to reach for a boost or buck-boost. From here the rung zooms in: guides 2 and 3 dissect the linear regulator and the reference, guide 4 the switching converter, and guide 5 the heat, ripple, and protection that keep it all from going up in smoke.