Sub topic 5
Why a Project Needs Regulated Voltage
This chapter assumes you know Ohm's law and power (P = V × I). It also assumes you have met the three battery chemistries from the earlier chapters (alkaline, NiMH, lithium-ion) and their per-cell voltages. You do not need to know how regulators work internally yet. Linear and switching regulators get their own chapters. Here you will learn why a regulator is needed at all and what "dropout" means.
A battery is not a fixed voltage source
The number printed on a battery is its nominal voltage, a label for the typical value. A real cell moves through a range as it discharges, and that range is wider than most beginners expect.
| Chemistry | Fresh or full (per cell) | Nominal | Considered empty |
|---|---|---|---|
| Alkaline | about 1.6 V | 1.5 V | about 0.9 V |
| NiMH | about 1.4 V | 1.2 V | about 1.0 V |
| Lithium-ion / LiPo | 4.2 V | 3.7 V | about 3.0 V |
A pack of four AA alkaline cells in series therefore starts near 6.4 V and ends near 3.6 V. That is a swing of almost 3 V, and your project sees all of it. On top of that, the voltage sags whenever the load draws current, because of internal resistance. A radio transmit burst or a motor start can pull the terminal voltage down for a moment, even on a healthy battery.
What the load needs
Most parts on your board expect a narrow, stable supply.
- The microcontroller. An ATmega328P has a supported voltage range that depends on clock speed. At 16 MHz it expects roughly 4.5 V to 5.5 V. Below that, it may execute instructions incorrectly instead of stopping cleanly.
- The ADC. With the default analog reference,
analogReadmeasures against the supply voltage. If the supply moves, the same sensor voltage gives a different reading. - 3.3 V parts. Many sensors, SD cards, and radio modules are rated for about 3.6 V at most. Feeding them a fresh 6.4 V pack can destroy them.
- Timing and noise. Radios and precision analog circuits are sensitive to supply ripple and dips.
A regulator sits between the battery and the load. It takes a varying input and produces a fixed output, as long as the input stays inside the range the regulator can handle.
Four ways unregulated power fails
Brownouts and erratic behavior
When the supply falls below what the chip needs, you get resets, frozen sketches, or corrupted writes to EEPROM and SD cards. Boards with a brown-out detector reset cleanly at a set threshold. A board that sits near that threshold may reset repeatedly each time a load switches on.
Over-voltage damage
This is the opposite failure. A fresh pack, a charger left connected, or a 9 V battery can exceed a part's absolute maximum rating. Damage can be immediate or can shorten the part's life.
Drifting measurements
Suppose a sensor outputs 1.0 V and the ADC reference is the supply. At a 5.0 V supply you read about 205 counts. At 4.0 V you read about 256 counts, so the reading rises with no change in the real quantity. Your data appears to trend as the battery drains.
Noise and transients
Motors, relays, and radio bursts cause fast dips and spikes on the supply. A regulator, together with capacitors (covered in a later chapter), isolates the sensitive parts from this.
What a regulator promises, and the condition attached
A regulator holds its output steady only while the input is high enough. For a linear regulator, the input must exceed the output by a minimum margin called the dropout voltage. A classic 7805 needs about 2 V of headroom, so a 5 V output needs at least 7 V in. A low-dropout (LDO) regulator may need only 0.2 to 0.5 V of headroom.
When the input falls below output plus dropout, the regulator stops regulating. The output then follows the input downward, minus the dropout. The load receives a falling voltage again, which is the problem you were trying to remove. In practice, the regulator only helps when the battery's usable range stays above its dropout limit.
A worked check with real numbers
The script below tests several battery and regulator pairs at the full and empty ends of the discharge range. The values come from the table above and from typical datasheet figures.
PACKS = {
"4x AA alkaline": (4 * 1.6, 4 * 0.9),
"4x AA NiMH": (4 * 1.4, 4 * 1.0),
"1S Li-ion": (4.2, 3.0),
}
REGULATORS = {
"7805, 5 V, 2.0 V dropout": (5.0, 2.0),
"5 V LDO, 0.3 V dropout": (5.0, 0.3),
"3.3 V LDO, 0.2 V dropout": (3.3, 0.2),
}
def regulates(v_batt, v_out, dropout):
"""True if the input leaves enough headroom for regulation."""
return v_batt >= v_out + dropout
for pack, (v_full, v_empty) in PACKS.items():
for reg, (v_out, dropout) in REGULATORS.items():
full_ok = "ok" if regulates(v_full, v_out, dropout) else "DROPS OUT"
empty_ok = "ok" if regulates(v_empty, v_out, dropout) else "DROPS OUT"
print(f"{pack:15} {reg:26} full {v_full:.1f} V: {full_ok:9} "
f"empty {v_empty:.1f} V: {empty_ok}")Reading the results:
- The 7805 never regulates from any of these packs, because even a fresh four-cell alkaline pack at 6.4 V is below the 7.0 V it needs.
- The 5 V LDO regulates from both four-cell packs at the start. It stops when they are drained, so the useful part of the battery is wasted.
- The 3.3 V LDO holds across the whole range of both four-cell packs, but not from a single Li-ion cell at its 3.0 V cutoff.
- A single Li-ion cell cannot make 5 V with any linear regulator, since its maximum is 4.2 V. Making 5 V from it requires a converter that can raise voltage.
The last two points are the reason switching regulators exist, and the chapter after next covers them.
Common errors
- Using nominal voltage for the design. A 3-cell alkaline pack is not "4.5 V." It runs from about 4.8 V down to about 2.7 V. Design against both ends.
- Powering a 5 V board from 3 AA cells and assuming it is fine. The pack is at or below 4.5 V for most of its life, so the board is outside its supported range at 16 MHz.
- Skipping regulation because "it worked on the bench." A fresh battery at room temperature with a light load is the best case. Cold, aged, or loaded batteries behave differently.
- Regulating but ignoring dropout. A regulator that works at the start of the battery's life and fails at 60% charge is a common cause of "it stops after a few hours" reports.
- Putting 5 V logic on 3.3 V parts. Regulating the supply to 3.3 V does not help if the board's I/O pins still drive 5 V into a 3.3 V sensor. Supply voltage and logic level are separate issues, and a later chapter covers logic levels.
When you can skip a regulator
Regulation is not always needed. A few cases where a direct connection is reasonable:
- The load accepts the battery's whole range. Examples are some LED circuits and simple motors, where speed or brightness is allowed to change.
- A board already includes a regulator on its battery input, so you supply a voltage inside that input's rated range. The board-power chapter covers this in detail.
- A lithium-ion cell powers a part rated for 3.0 to 4.2 V, with protection against over-discharge in place.
Even then, check the lowest and highest voltages, not just the typical one. If you cannot name both numbers, you have not finished the design.
Exercise
You plan to power an Arduino-compatible 5 V board at 16 MHz from three AA alkaline cells in series through a 5 V LDO with 0.3 V dropout. Using 1.6 V per fresh cell and 0.9 V per empty cell, what is the battery's voltage range, and can this design provide a steady 5 V at any point in the battery's life?
Show answer
Three cells give 4.8 V fresh and 2.7 V empty. A 5 V output with 0.3 V dropout needs at least 5.3 V in. Even the fresh pack at 4.8 V is below that, so the LDO is always in dropout and never holds 5 V. The board would see about 4.5 V at best, falling as the cells drain. A boost or buck-boost converter, or more cells in series, is needed.
Exercise
A project reads a sensor with analogRead using the default reference, powered directly from a battery that falls from 5.0 V to 4.0 V over its life. The sensor's real output stays at 1.0 V. Roughly what raw readings do you get at the start and the end, and why does this matter?
Show answer
At 5.0 V the reading is about 1.0 / 5.0 × 1023, or roughly 205. At 4.0 V it is about 1.0 / 4.0 × 1023, or roughly 256. The reading rises about 25% with no change in the real quantity, because the ADC reference is the falling supply. A regulated supply, or a fixed internal reference, removes this error.