Electronics / Theory / Power supplies
Theory 07

Power supplies Every circuit assumes a stable rail, and a surprising share of "faulty project" problems are really the supply sagging, spiking or running out. Getting this right removes a whole category of bugs before they happen.

needs Capacitorssystems view
Tier 0 · Groundregulation

Turning some voltage into the voltage you want

Module 0.1

Linear vs switching

Two philosophies, and where the heat goes
Linear (7805, AMS1117)Switching (buck / boost)
MethodBurns the excess voltage as heatChops at high frequency, stores energy in an inductor
EfficiencyVout/Vin — poor with a large drop80–95% regardless of drop
NoiseVery cleanSwitching ripple at tens of kHz
Can step up?No, only downYes (boost), and invert
Cost / complexityOne part, two capacitorsA module, or a more careful layout
Use forSmall clean loads, analogue, referencesAnything drawing real current
// why a 7805 from 12V at 500mA gets hot
P_wasted = (12 − 5) × 0.5 = 3.5 watts in a small package
// a buck converter doing the same job wastes about 0.3W

Dropout voltage is the linear regulator's other constraint: it needs the input to stay some margin above the output — often 1.5–2V for older parts, a few hundred millivolts for a low-dropout (LDO) type. Trying to get 5V out of a fading battery pack at 5.4V will fail on an ordinary 7805 and work on an LDO.

Practical choice for hobby work: a small adjustable buck module costs a couple of pounds and handles most jobs efficiently. Keep a linear LDO for analogue sections where switching ripple would matter — sensors, audio, references. Using both, with the linear fed from the switcher, is a standard and entirely reasonable pattern.
Module 0.2

Batteries

Voltage curves, capacity and the safety rules
TypeNominalNotes
Alkaline AA1.5VSags steadily as it discharges; four gives ~6V fresh, ~4V tired
NiMH AA1.2VFlatter curve, rechargeable; four gives ~4.8V
Li-ion / LiPo3.7V4.2V full to 3.0V empty. Needs protection and a proper charger
9V PP39VConvenient, low capacity, poor value — fine for a blinking LED, not a motor
USB power bank5VExcellent for projects; may switch off below a minimum draw

Capacity is quoted in mAh: 2000mAh nominally supplies 200mA for ten hours. Treat it as optimistic — high currents reduce effective capacity, and a regulator's own consumption counts too.

Lithium safety, not optional. Never short, puncture, over-discharge or charge a lithium cell unattended. Use cells with protection circuitry and a charger designed for the chemistry. A LiPo failure is a fire, not a puff of smoke — this is the one place in hobby electronics where an ordinary mistake has serious consequences.
Tier 3 · Builda solid rail

Designing the power path

Module 3.1

The standard arrangement

Five things, in order from the input
1Protection — a series Schottky or a P-channel MOSFET against reversed polarity, and a fuse if the source can deliver real current.
2Bulk capacitance at the input, typically 100–470µF electrolytic, rated well above the input voltage.
3Regulation to the rail your logic needs, sized for peak rather than average current.
4Output capacitance as the regulator's datasheet specifies — this is not optional, some regulators oscillate without it.
5Decoupling — 100nF ceramic at every chip's power pins, physically close.

Sizing for peaks, not averages

A microcontroller idling at 20mA that transmits over Wi-Fi in 300mA bursts needs a supply and capacitance that can cover the burst. An ESP32 browning out during transmission is one of the most common beginner problems, and it looks exactly like a firmware crash. The fix is a supply with headroom plus a few hundred µF nearby.

Star grounding, informally: run high-current returns (motors, LED strips) back to the supply separately from the microcontroller's ground rather than daisy-chaining through it. Shared ground wire has resistance, so a motor's return current shifts the ground the microcontroller measures against — producing false readings and resets that no amount of code will fix.
Drill 1

Your board runs fine on USB but resets whenever a servo moves, even though the 5V supply is rated for 2A. What is the most likely cause?

Transient dip, not average capacity. A 2A rating says nothing about behaviour over milliseconds: a servo's stall and start-up current spikes far above its running current, and the wiring's resistance turns that spike into a voltage dip at the board. Fixes, in order: a few hundred µF close to the servo, thicker or shorter power wiring, separate ground returns to the supply, and if it persists, a separate supply for the motor with grounds tied at one point.
Referencesearchable

Glossary