Picture a small robot. It has a two-cell LiPo battery, two drive motors, a couple of servos for an arm, a strip of LEDs and a microcontroller running the show.
Every one of those parts wants a different voltage. The motors run straight from the battery, somewhere between 6 and 8.4 V. The servos want 5 or 6 V. The LED strip wants 5 V. The microcontroller wants a steady 3.3 V, and it can be damaged by anything much higher.
One battery, four voltages. This article is about how you get from the voltage you have to the voltages you need, and about the two circuits that do almost all of that work: the LDO and the buck converter. It builds on Electricity, explained with water and Staying inside the limits.
Why so many voltages?
Chips run at the voltage their silicon is built for. The smaller a chip's transistors, the thinner their insulating layers, and the lower the voltage they can take. Older chips ran at 5 V. Most modern microcontrollers, including the ESP32-S3 on the Vector S3, run at 3.3 V, and many sensors run at 3.3 V or 1.8 V. Inside, the processor core often runs lower still, from its own built-in regulator.
Power-hungry parts like higher voltages. Power is voltage times current, so for the same power a higher voltage needs less current, which means thinner wires and less heat in them. That's why motors, LED strips and anything power-hungry often run at 5, 12 or 24 V.
Batteries don't hold still. A single LiPo cell reads 4.2 V when full and about 3.0 V when empty. Whatever powers your microcontroller has to give it 3.3 V throughout, from a full battery to a nearly flat one.
| Part | Typical voltage |
|---|---|
| Modern microcontroller | 3.3 V |
| Many sensors | 3.3 V or 1.8 V |
| Older boards and logic | 5 V |
| Hobby servos | 5 to 6 V |
| LED strips | 5 V or 12 V |
| DC motors | 3 to 24 V, depending on the motor |
| USB | 5 V |
| One LiPo cell | 3.0 to 4.2 V |
Why not just use a resistor?
The river picture from Electricity, explained with water suggests an obvious idea. If you have 5 V and want 3.3 V, put a resistor in front of your circuit and let it drop the extra 1.7 V.
The problem is in V = I × R. The drop across a resistor depends on the current through it, and your circuit's current doesn't stay put. A microcontroller might draw 20 mA while idle and 300 mA the moment its Wi-Fi transmits. Choose the resistor for 20 mA, and at 300 mA it drops fifteen times as much voltage. The microcontroller browns out just when it needs power most.
What you need is something that watches the output and adjusts itself to hold it steady, however much current the circuit draws and however much the input wanders. That's a voltage regulator. There are two main kinds.
Linear regulators and LDOs
Think of the float valve inside a toilet cistern. A float sits on the water. As the level rises, the float lifts and closes the valve; as the level drops, the float falls and opens it. Whatever happens, the level ends up in the same place.
A linear regulator is that float valve, made from electronics. At its heart is a transistor working as a variable valve, partly open, exactly like the amplifier mode in the transistor section of Electricity, explained with water. A small circuit constantly compares the output voltage against a precise reference, and opens or closes the valve to hold the output steady. If the load draws more current, it opens further. If the input rises, it closes a little.
It works beautifully, but it has one unavoidable cost. A partly open valve is a narrow pipe, and a narrow pipe with current through it turns power into heat. Everything above the output voltage is burned off:
heat = (V_in − V_out) × I
efficiency = V_out ÷ V_inFrom 5 V down to 3.3 V at 200 mA, that's 1.7 × 0.2 = 0.34 W of heat and 66% efficiency. Fine. From 12 V down to 3.3 V at the same current, it's 1.74 W and 27% efficiency. Nearly three-quarters of the power goes into heating the regulator. The heat calculator in Staying inside the limits shows what that does to its temperature.
What "LDO" means
A linear regulator needs a little extra voltage at its input to work: the dropout voltage. Older designs needed about 2 V of headroom, so to get a steady 3.3 V you had to supply at least 5.3 V.
An LDO, a low-dropout regulator, needs far less: often 0.1 to 0.5 V. That matters most with batteries. An LDO can make 3.3 V from a single LiPo cell until the battery drops to about 3.4 or 3.5 V. Below that, it can't regulate any more, and its output simply follows the battery down.
When an LDO is the right choice
- Small voltage differences, modest currents. 5 V to 3.3 V for a microcontroller is the classic case.
- When you need a quiet supply. An LDO's output is very clean, which matters for sensors, audio and radio circuits.
- When simplicity matters. An LDO is one small chip and two capacitors, costs very little and is hard to get wrong.
Watch the quiescent current, the current the regulator draws just to run itself. Some LDOs draw milliamps, which quietly flattens a battery. Battery projects need one rated in microamps.
Buck converters: switching instead of burning
The linear regulator wastes power because its valve sits partly open. But remember the transistor section of Electricity, explained with water: a valve that's either fully open or fully shut wastes almost nothing. When it's fully open, nothing's in the way. When it's fully shut, nothing flows.
A buck converter uses that trick. Instead of partly opening a valve, it slams a switch fully on and fully off, hundreds of thousands of times a second. If the switch is on for a quarter of the time, the average voltage coming out is a quarter of the input.
Raw chopped-up voltage is useless to a microcontroller, though. It needs to be smoothed, and the two parts from Electricity, explained with water do exactly that:
- The inductor is the heavy water wheel. While the switch is on, it gathers speed slowly, so the current rises gradually instead of jumping. When the switch turns off, it refuses to stop, and keeps pushing current to the output.
- The capacitor is the stretchy membrane, or a small tank at the output. It soaks up the extra when the inductor pushes a little more than your circuit takes, and tops up the output when it pushes a little less.
When the switch turns off, the inductor's current needs somewhere to come from, exactly like the water hammer problem. So a buck converter has a second path from ground: in simpler designs a diode, and in most modern ones a second switch that turns on whenever the first turns off.
Switch 1 flicks on and off hundreds of thousands of times a second. Here it's slowed right down. Watch which way the current goes in each half of the cycle, and how the inductor keeps it flowing even while switch 1 is off.
Circuit
Switch 1 on, for 27% of each cycle
The input pushes current through the inductor to the output. The inductor resists the change, so the current climbs gradually, and the inductor stores energy as it does.
Two cycles, repeating
The dashed line is the average inductor current, which is exactly what your circuit draws. The output wobbles by only 5.44 mV, zoomed in here so you can see it.
Input voltage
Controller
Duty cycle, set by the controller
27% = 3.3 V ÷ 12 V
What your circuit draws from the output
Speed
- Output
- 3.30 V
- duty × input
- Input current
- 306 mA
- vs 1 A out
- Buck heat
- 367 mW
- about 90% efficient
- LDO heat
- 8.7 W
- same job, 27% efficient
The ratio of on-time to the whole cycle is the duty cycle, D, and for a buck converter:
V_out = D × V_inTo make 3.3 V from 12 V, the switch is on 27.5% of the time. The controller inside the converter measures the output continuously and adjusts the duty cycle, the same way the LDO adjusts its valve. Change the input voltage in the widget and watch the duty cycle follow.
Less current in than out
Because a buck converter barely wastes anything, power in is almost equal to power out. So when it steps the voltage down, it can draw less current from its input than it delivers.
Take 12 V to 3.3 V at 1 A. Your circuit uses 3.3 W. At 90% efficiency the converter draws about 3.7 W, which from 12 V is only 0.31 A. An LDO doing the same job would draw the full 1 A from 12 V. That's 12 W taken from the supply, 8.7 W of it turned into heat.
The costs
A buck converter isn't free:
- Ripple and noise. Switching makes the output wobble slightly and throws off electrical noise that can disturb radios, audio and sensitive sensors.
- More parts, and layout matters. The fast-switching current loop has to be kept small on the circuit board, or it radiates noise and misbehaves.
- Lower efficiency at very light loads. Many converters have a power-saving mode to help, at the cost of more ripple.
A common pattern gets the best of both. A buck converter does the big step down efficiently, to maybe 3.6 or 5 V, then an LDO takes it the last small step to a clean 3.3 V.
Cheap buck modules are everywhere, and their headline current ratings are often optimistic. Check the actual converter chip's datasheet, stay well inside its ratings, and expect it to get warm at high currents. Everything in Staying inside the limits applies.
Going up: boost and buck-boost
Sometimes the voltage you need is higher than the one you have: 5 V for an LED strip from a single 3.7 V LiPo cell, for example.
A boost converter does this with the same parts in a different arrangement. It uses the switch to spin up the inductor, then lets the inductor's refusal to stop push current out on top of the input voltage, like the water hammer from Electricity, explained with water, put to work. This time the trade runs the other way: to deliver 5 V at 1 A from 3.7 V, it draws around 1.5 A from the battery.
A buck-boost converter can do both. It's the right tool when a battery's range straddles the voltage you need, like a LiPo cell running from 4.2 V down to 3.0 V while you want a steady 3.3 V throughout.
Choosing
| Situation | Good choice |
|---|---|
| Small drop, modest current (5 V to 3.3 V, a few hundred mA) | LDO |
| Big drop or high current (12 V to 5 V at 2 A) | Buck converter |
| Noise-sensitive circuit (sensors, audio, radio) | LDO, or a buck followed by an LDO |
| Need more than you have (3.7 V battery to 5 V) | Boost converter |
| Battery range straddles the output | Buck-boost, or an LDO that accepts dropping out near empty |
Back to the robot. The motors run from the battery through a motor driver. The servos get their own buck converter with plenty of current to spare, because servos draw a lot when they start moving or strain against a load. The microcontroller gets 3.3 V from a small buck converter, or from an LDO fed by the 5 V rail.
What it shouldn't have is an LDO straight from the battery to 3.3 V. From a full 8.4 V at 250 mA, that's (8.4 − 3.3) × 0.25 ≈ 1.3 W of heat, enough to cook a small regulator.
For each regulator in a design, check:
- Input range: will the input always be inside the regulator's rating, from full battery to flat, including spikes when it's plugged in?
- Headroom: at the lowest input, is there still enough above the output for the dropout?
- Current: can it supply the peak current, including start-up and Wi-Fi bursts, with margin?
- Heat: for an LDO, what does
(V_in − V_out) × Ido to its temperature? - Noise and standby: is the output clean enough for what it feeds, and is the quiescent current low enough for a battery?
Get these right and a single battery can safely power everything on the board. For how to size the supply itself, see Powering your project.
