Electronics From Zero Search/

Explainer · Intermediate · about 30 minutes

Power supplies

Every circuit needs a steady voltage, but what you have is a battery that runs down, a plug-in adapter, or a USB port. Regulators, rectifiers and smoothing capacitors turn that into clean power. See where the wasted energy goes, how much ripple is left, and how long a battery will last.

The idea

A microcontroller wants exactly 5 V or 3.3 V. A fresh 9 V battery gives 9.6 V and a tired one 7 V; a 12 V adapter may give 13 V with no load. A voltage regulator takes a higher, wobbly voltage and gives a fixed one.

  • Linear regulators (such as the 7805) burn off the extra voltage as heat. They are simple, cheap and quiet.
  • Switching regulators (buck converters) switch on and off very fast and smooth the result with an inductor and capacitor, wasting much less energy.

For a linear regulator the current in equals the current out, so the heat is easy to work out:

heat (W) = (Vin − Vout) × I

Each regulator also needs its input to be a little above its output: the dropout voltage. Below that it cannot regulate, and the output sags.

Linear regulator: where the energy goes

Regulator circuit
Output—
Heat in the regulator—
Efficiency—
Chip temperature—

Model: the figures are typical datasheet values, rounded (dropout at full current, the chip’s own current, and the thermal resistance from chip to air for each mounting), with the room at 25 °C. Real parts and boards vary a lot, so check your part’s datasheet. The buck comparison assumes 85% efficiency; good modules reach 90% or more, and they are less efficient at very light loads.

From AC to smooth DC

A transformer (inside a plug-in AC adapter) gives a low AC voltage. A rectifier made of diodes lets current through in one direction only, giving bumps. A big smoothing capacitor fills the gaps between the bumps: it charges at each peak and supplies the load in between.

The capacitor sags a little between peaks. That dip is the ripple:

ripple ≈ I ÷ (f × C)

Here f is the number of bumps per second: twice the mains frequency for a full-wave bridge rectifier, once for a single-diode half-wave rectifier.

Safety

Never build anything that connects to mains electricity. The transformer and everything before it must be a sealed, approved adapter that already gives a low voltage. The circuits on this site start at its low-voltage output.

Big electrolytic capacitors must go the right way round and be rated above the peak voltage; reversed or overvolted, they can burst.

after the rectifier across the capacitor 7 V (what a 7805 needs)

Peak—
Ripple (simulated)—
Ripple (formula)—
Lowest voltage—

Model: an ideal transformer, diodes that each drop 0.7 V, a capacitor that charges instantly at each peak, and a load that draws a constant current. The formula assumes the capacitor supplies the load for the whole gap between peaks, so it slightly overestimates the ripple: the safe side for choosing a capacitor. A real adapter’s voltage also drops under load.

Batteries: how long will it last?

A battery’s capacity is given in milliamp-hours (mAh): 2000 mAh can supply 20 mA for about 100 hours, or 200 mA for about 10. Count on only part of it: capacity falls at high currents and in the cold, and a circuit stops working before the battery is completely flat.

hours ≈ capacity (mAh) × 0.8 ÷ current (mA)

  • In series (+ to −), cells add their voltages; the capacity stays the same.
  • In parallel, the capacity adds; the voltage stays the same. Only parallel identical cells at the same charge.
Pack voltage—
Capacity—
Stored energy—
Running time—

Model: nominal voltages and typical capacities at a small current, with 80% of the capacity counted as usable. Brands and real conditions vary: treat the running time as an estimate.

Choosing a supply

Comparing ways to power a project
SituationGood choiceWhy
Arduino on the benchUSB (5 V)Already regulated and current-limited by the computer; fine for an LED or two and small sensors.
A small drop at low current (9 V to 5 V at 50 mA)Linear regulatorOnly 0.2 W of heat; simple and electrically quiet.
A big drop or a big current (12 V to 5 V at 1 A)Buck converterA linear regulator would waste 7 W and need a large heatsink.
Battery-powered for monthsLow-quiescent LDO or none at allThe regulator’s own current matters: 5 mA would flatten a coin cell in under two days.
Motors, servos or many LEDsA separate supply for themTheir current surges make the voltage dip and can reset a microcontroller. Connect the grounds together.

Check your understanding