Most electronics needs a steady voltage: 5 V for an Arduino Uno, 3.3 V for a Pico or ESP32, sometimes both. Batteries and plug-in adapters rarely supply exactly that, and a battery's voltage falls as it runs down. A voltage regulator takes whatever comes in and delivers a fixed, steady output. There are two families, and picking the wrong one is a common reason projects run hot or flatten batteries.
Linear regulators
A linear regulator works like an automatically adjusted resistor in series with the load. It drops the extra voltage across itself and turns it into heat. Classic examples are the 7805 (5 V out), the AMS1117-3.3 fitted to many 3.3 V boards, and the adjustable LM317.
Because the same current flows in and out, the power wasted is simply:
P = (Vin − Vout) × I
Example: 9 V in, 5 V out, 300 mA load. The regulator dissipates (9 − 5) × 0.3 = 1.2 W, and the efficiency is only 5 ÷ 9 = 56%. 1.2 W will make a TO-220 regulator too hot to touch without a heatsink. Our heatsink calculator works out how hot it will get.
Good points: simple, cheap, a very clean low-noise output, and only a couple of capacitors needed. Bad points: wasteful when the input is much higher than the output.
Dropout voltage and LDOs
A linear regulator needs its input to be a little higher than its output, called the dropout voltage. Below that, it stops regulating and the output sags. The classic 7805 needs roughly 2 V of headroom (its datasheet tests it with 10 V in), so it can't make a clean 5 V from a 5 V USB supply or a 6 V battery that's running down. The AMS1117 drops out at about 1.1 V at 800 mA.
A low-dropout regulator (LDO) works with much less headroom, often a few hundred millivolts or less at light loads. That's why 3.3 V LDOs are popular for running a 3.3 V board from a single lithium cell, which sits between about 3.0 and 4.2 V. Near the bottom of that range, though, even an LDO will drop out.
Switching regulators: buck and boost
A switching regulator turns a transistor fully on and off very fast, tens of kilohertz to a few megahertz, and smooths the result with an inductor and capacitors. Because the switch is never half-on, very little power is lost, and efficiencies of 85 to 95% are normal.
- Buck converters step the voltage down, such as 12 V to 5 V.
- Boost converters step it up, such as a single 1.2 V cell up to 5 V.
- Buck-boost converters do either, which suits a lithium cell (3.0 to 4.2 V) making 3.3 V.
The same example with a 90% efficient buck converter: the load takes 5 × 0.3 = 1.5 W, so the input is 1.5 ÷ 0.9 = 1.67 W and only 0.17 W is lost as heat, against 1.2 W for the linear regulator. A buck also draws less current from the input than the load takes, which a linear regulator never can.
The catch: switching regulators produce electrical noise (ripple) at the switching frequency, need more parts and careful layout, and can interfere with radios and sensitive analogue measurements. Ready-made modules solve most of the layout problems. Size the parts with our buck converter calculator or try the buck converter lab.
Which should you use?
| Situation | Best choice |
|---|---|
| Small drop and low current (5 V to 3.3 V at 100 mA) | Linear or LDO: only 0.17 W lost |
| Big drop or high current (12 V to 5 V at 1 A) | Buck converter |
| Battery voltage below the output you need | Boost, or buck-boost if the battery spans the output |
| Sensitive audio, precision ADC or radio | LDO, or a switcher followed by an LDO to clean up the ripple |
| Battery-powered, long life | Switching regulator with low quiescent current, or an LDO with very low quiescent current if the drop is small |
Don't forget the capacitors
Every regulator datasheet specifies input and output capacitors, and some LDOs are only stable with a particular type and range of capacitance on the output. Use the values and types the datasheet gives, placed close to the pins. Missing capacitors are a common cause of a regulator oscillating or a board resetting at random. More on general power sense in how to power your projects safely.
Going deeper
Quiescent current
Every regulator uses a little current to run itself, even with no load: its quiescent or ground current. The classic 7805 uses several milliamps, which alone would flatten a 2,000 mAh battery in a few weeks. Low-power LDOs designed for battery use take a few microamps. When a project spends most of its life asleep, quiescent current often matters more than efficiency at full load. Put it into our battery life calculator as part of the sleep current.
Thermal limits in numbers
Junction temperature = ambient + P × θJA, where θJA is the junction-to-ambient thermal resistance in the datasheet. For a TO-220 with no heatsink, θJA is typically around 50 to 65 °C/W, so the 1.2 W in the example above raises the junction about 60 to 80 °C above ambient. That's uncomfortably close to the usual 125 °C limit on a warm day, and most regulators then shut down or fold back their output. SOT-223 parts like the AMS1117 depend heavily on the copper area on the PCB.
Power supply rejection
PSRR is how well a regulator stops input ripple reaching the output. Linear regulators are good at low frequencies but their rejection falls off at high frequencies, so an LDO after a 1 MHz buck converter removes less of the switching ripple than you might hope. A small LC filter between the two helps.
Buck converter duty cycle
An ideal buck converter in continuous conduction has an output of Vin × D, where D is the duty cycle. Real converters need a slightly higher D to cover switch and diode losses. TI's application note SLVA477 sets out the full inductor and capacitor calculations that our calculator uses.
Sources
The main references behind this guide. Numbers we worked out ourselves, such as the code outputs, come from running the code.