Learn & build · Electronics · Chapter 10

Power supplies

Chips want a steady, exact voltage: 3.3 V, 5 V, 1.8 V. Batteries sag as they empty (chapter 5) and wall adapters ripple (chapter 4). A regulator turns whatever comes in into exactly what's needed. There are two ways, and the difference between them decides whether your battery lasts a day or a week: burn off the extra (linear), or chop and smooth (switching).

In plain words: a linear regulator is a tap that a robot keeps adjusting so the output stays at 5 V; the extra pressure is wasted as heat. A switching regulator is a tap flicked fully on and off thousands of times a second, with a coil and a capacitor smoothing the flicks into a steady flow; almost nothing is wasted.

1. A linear regulator: chapter 7 in a chip

Inside a 7805 or an LDO: a precise reference voltage, an op-amp, and a transistor between input and output, run half on (chapter 4, section 5). The op-amp compares (a divided-down copy of) the output with the reference and drives the transistor until they match: negative feedback holding the output still. The transistor drops whatever voltage is left over, and that drop times the current is heat.

🎯 Challenge: run 1 A at 5 V from 12 V and keep the chip under 125 °C.

The math, step by step

The same current flows in and out (plus a few mA for the chip itself), so

\[ P_{heat} = (V_{in} - V_{out})\, I, \qquad \eta = \frac{P_{out}}{P_{in}} = \frac{V_{out}}{V_{in}}, \qquad T_{chip} = T_{room} + P_{heat}\,(\theta_{JC} + \theta_{sink}) \]

12 V to 5 V at 1 A: 7 W of heat, 42% efficient. A TO-220 package alone (about 50 °C/W to the air) would try to reach 25 + 350 °C; it shuts down at about 150 °C first. Every linear regulator also has a dropout: the least \(V_{in} - V_{out}\) it needs to keep regulating, about 2 V for a 7805 and 0.1–0.3 V for an LDO ("low dropout").

An LDO makes 3.3 V from a 4.8 V supply at 1 A. How much heat?

\((4.8 - 3.3) \times 1 = 1.5\) W, and an efficiency of 3.3/4.8 = 69%.

2. A buck converter: chop and smooth

Now a switch (a MOSFET, chapter 4) connects the input to a coil for a fraction \(D\) of each cycle, then a diode lets the coil keep pushing current while the switch is off. The coil's current can't jump (chapter 3), so it ramps up and down in a small triangle around the load current, and the capacitor smooths what's left. The output is the average of the chopped input.

🎯 Challenge: make 3.3 V from 12 V (within 0.05 V).

The math, step by step

In steady state the coil's current ends each cycle where it started, so the volt-seconds across it balance: \((V_{in} - V_{out})\, D\,T = V_{out}\,(1 - D)\,T\). Solve:

\[ V_{out} = D\, V_{in}, \qquad \Delta I_L = \frac{(V_{in} - V_{out})\, D}{L\, f_{sw}} \]

An ideal buck wastes nothing: the switch is either fully on (no voltage across it) or fully off (no current through it). Real ones lose a little in the switch's resistance, the diode's drop and the coil's wire, and land at 85–95%. A bigger coil means a smaller ripple triangle; if the load current falls below half the ripple, the current hits zero each cycle ("discontinuous mode") and the simple formula stops holding.

What duty cycle makes 3.3 V from 12 V in an ideal buck?

\(D = 3.3/12 = 0.275\). The chip's own feedback loop sets it, and keeps adjusting as the input and load change.

A linear regulator burns the extra voltage as heat, so its efficiency is \(V_{out}/V_{in}\); a switching regulator chops and smooths, and passes nearly all the power through.

3. A boost converter: more volts out than in

Rearrange the same parts: the switch now shorts the coil to ground, storing energy; when it lets go, the coil's current has to keep flowing and forces itself through the diode into the output at a higher voltage, chapter 3's flyback spike, harnessed. That's how one AA cell runs a 5 V USB gadget, and how LED drivers make 30 V.

\[ V_{out} = \frac{V_{in}}{1 - D} \qquad (\text{ideal}) \]

A boost makes 5 V from a 1.5 V cell. What duty cycle (ideal)?

\(1 - D = 1.5/5 = 0.3\), so \(D = 0.7\). The input current is higher than the output current by the same ratio: 100 mA out at 5 V needs about 333 mA from the cell, plus losses.

4. The battery budget

A project on a single lithium-ion cell (4.2 V full, 3.0 V empty) needs 3.3 V at 100 mA. Linear or buck? The cell's energy is fixed; what matters is how much of it reaches the circuit.

A 9 V battery powers a 3.3 V microcontroller through a linear regulator. Where does most of the battery's energy go?

(9 − 3.3)/9 = 63% is burned as heat. A buck would deliver about 90%: the same battery lasts about 2.4 times longer.

Chips like the AMS1117 (an LDO), the MP1584 (a buck) and the MT3608 (a boost) on tiny modules cost under a dollar; now you know what's inside each and when to reach for which. Try the 5 V regulated supply template in the circuit lab: watch the raw DC ripple while the 7805's output stays flat, until you load it too hard. Next: light and sensors.

Previous: Oscillators and timers · All chapters: Learn & build.

Last updated