Batteries and Power Supplies
Cell chemistries, battery life, linear and switching regulators, bench supplies and current limiting.
Cells and chemistries
A cell is one electrochemical unit; a battery is one or more cells together. The chemistry sets the voltage, whether it can be recharged, and how it must be treated. The curve shows how the voltage of each type changes as it empties.
| Chemistry | Nominal voltage | Full / empty | Rechargeable | Notes |
|---|---|---|---|---|
| Alkaline (AA, AAA, 9 V) | 1.5 V | 1.6 / 0.9 V | No | Cheap, long shelf life, high internal resistance; may leak when empty |
| NiMH (AA, AAA) | 1.2 V | 1.4 / 1.0 V | Yes | Safe and easy; self-discharges (low-self-discharge types hold charge for months) |
| Lithium primary (CR2032, AA lithium) | 3.0 V / 1.5 V | 3.0 / 2.0 V | No | Coin cells deliver only a few mA; AA lithium suits cold and long life |
| Li-ion / LiPo (18650, pouch) | 3.6–3.7 V | 4.2 / 3.0 V | Yes | Highest energy density; needs a protected circuit and proper charging |
| LiFePO4 | 3.2 V | 3.65 / 2.5 V | Yes | Safer and long-lived; flatter curve; lower energy density |
| Lead-acid (sealed) | 2.0 V (12 V as 6 cells) | 2.15 / 1.75 V per cell | Yes | Heavy and cheap; good for large standby and starter use |
Capacity, runtime and C-rate
Capacity is the charge a cell can deliver, in mAh or Ah. Energy is capacity times voltage, in Wh. The quoted capacity is for a particular discharge rate, so a heavy load delivers less, and cold weather reduces it.
runtime (h) ≈ capacity (mAh) × 0.8 ÷ load current (mA) energy (Wh) = capacity (Ah) × voltage (V) 1C = capacity in amps
Worked example: a sensor node on a 2 000 mAh Li-ion cell
| Load (at 3.3 V) | Current |
|---|---|
| Microcontroller (active) | 80 mA |
| Sensor board | 10 mA |
| Small display | 20 mA |
| Status LED (with resistor) | 10 mA |
| Total | 120 mA |
- Output power: 3.3 V × 120 mA = 0.40 W.
- With a buck converter at 90 % efficiency, input power is 0.44 W, which at a 3.7 V cell is 119 mA from the battery (less than the load current because the converter steps the voltage down).
- Runtime ≈ 2 000 × 0.8 ÷ 119 = 13.5 hours. The 0.8 allows for usable capacity, cell aging and cold.
- Using a linear regulator instead would draw the full 120 mA from the cell, giving 13.3 hours: the cost of the wasted voltage drop.
- Reducing the average current is the biggest lever: sleeping the microcontroller most of the time (see Embedded Systems) can extend this from hours to months.
- C-rate expresses the load or charge current as a multiple of capacity: for a 2 000 mAh cell, 1C = 2 A and 0.5C = 1 A. Cells have maximum charge and discharge C-rates.
- Internal resistance makes the voltage sag under load and warms the cell. Alkaline and coin cells have high internal resistance; use a capacitor across the supply for pulsed loads such as radios.
Series and parallel packs
- Series (positive of one to the negative of the next) adds voltage: capacity stays the same. Three Li-ion cells in series (3S) give 3 × 3.6 = 10.8 V nominal and 12.6 V full.
- Parallel adds capacity and current capability: the voltage stays the same. Two 2 500 mAh cells in parallel (2P) give 5 000 mAh.
- 3S2P of 2.5 Ah, 3.6 V cells = 10.8 V, 5.0 Ah, 54 Wh.
- Never mix cells of different chemistry, capacity, age or charge in one pack, and connect parallel cells only when their voltages are within about 0.1 V (the current surge can be large).
- A multi-cell lithium pack needs a battery management system (BMS) that balances the cells and cuts off overcharge, over-discharge and over-current.
Charging and battery safety
- Li-ion and LiPo charge at a constant current (usually 0.5C to 1C) until the cell reaches 4.20 V (±1 %), then at a constant 4.2 V until the current falls to about C/10. Use a charger IC made for the chemistry (TP4056 for single cells, a BMS for packs).
- LiFePO4 terminates at 3.6–3.65 V per cell: a Li-ion charger will overcharge it.
- NiMH uses a charger that detects the end of charge (−ΔV or temperature). Trickle-charging in an unsuitable charger damages cells.
- Never charge alkaline or primary lithium cells. They can vent or burst.
- Lithium cells can catch fire if shorted, punctured, overcharged, over-discharged, overheated or charged below 0 °C. Use protected cells, fuse the battery lead, and never charge unattended or on a flammable surface. A damaged or swollen cell should be taken out of service and disposed of at a recycling point.
- Storage. Store lithium cells at about 40–60 % charge (around 3.8 V per cell) in a cool place. Do not leave them fully charged or fully empty for months.
- Disposal. Take all cells to a battery recycling point; do not put them in the bin.
- Soldering to cells. Heat can damage lithium cells. Use cells with solder tabs or a holder (see Soldering).
Voltage regulators
Batteries and adapters rarely give the exact voltage a circuit needs, and the voltage changes as a battery discharges. A regulator holds the output at a fixed voltage. There are two kinds: linear (simple, wasteful) and switching (efficient, noisier).
Linear regulators and dropout
A linear regulator (7805, AMS1117, LM1117) acts like a variable resistor that drops the extra voltage as heat. It is simple, needs only two capacitors, and makes no switching noise. Its flaw is that all of the input current passes through to the output, so the heat is (Vin − Vout) × I.
Pheat = (Vin − Vout) × Iload efficiency = Vout ÷ Vin
- Dropout voltage is the minimum difference between input and output for regulation to hold. A standard 7805 needs about 2 V (so 7 V in for 5 V out); a low-dropout (LDO) part needs only 0.1–0.5 V (AP2112, MCP1700, LD1117).
- Example 1: 12 V to 5 V at 0.5 A: P = 7 × 0.5 = 3.5 W. A TO-220 regulator in free air has a junction-to-ambient thermal resistance of about 50 °C/W, so it would rise 175 °C: far too hot without a heat sink. A rise of 40 °C needs a total of 11.4 °C/W or less. Use a switching regulator.
- Example 2: 5 V to 3.3 V at 0.5 A with an AMS1117 in a SOT-223 package: P = 1.7 × 0.5 = 0.85 W. At about 90 °C/W (with a copper pad), the temperature rise is 77 °C: warm but acceptable.
- Capacitors. Follow the datasheet: usually 10 µF on the input and output (some older parts need a particular ESR). The wrong output capacitor can make an LDO oscillate.
- Noise. Linear regulators give a clean output, which suits analog and radio circuits, often used after a switching regulator.
Switching regulators
A switching (switch-mode) regulator turns a transistor on and off hundreds of thousands of times a second and uses an inductor and capacitor to smooth the output. Because the switch is either fully on or fully off, little power is lost: typical efficiency is 85–95 %.
| Topology | Output vs input | Duty cycle | Example |
|---|---|---|---|
| Buck | Lower | D = Vout ÷ Vin | 12 V to 5 V: D = 0.42 (42 %) |
| Boost | Higher | D = 1 − Vin ÷ Vout | 3.7 V to 5 V: D = 0.26 (26 %) |
| Buck-boost | Higher or lower | depends | A Li-ion cell (3.0–4.2 V) to a steady 3.3 V |
| Flyback / isolated | Any, isolated | transformer | Wall adapters, mains supplies |
- Inductor ripple. The inductor current ripple in a buck is ΔI = (Vin − Vout) × D ÷ (L × f). For 12 V to 5 V with a 10 µH inductor at 500 kHz, ΔI = 7 × 0.42 ÷ (10 × 10−6 × 500 000) = 0.58 A peak-to-peak. Choose an inductor whose saturation current exceeds the load plus half the ripple.
- Ready-made modules (LM2596, MP1584, XL4015 boards) are cheap and convenient. Check the real ratings; some boards claim more current than they deliver without a heat sink.
- Noise. Switching regulators put ripple and spikes on the output and radio-frequency noise on the input. Fix with low-ESR output capacitors, a short layout, a ferrite bead, and a linear regulator after the converter for sensitive analog circuits.
- Efficiency varies with load. It is lower at very light load, which matters for battery devices that sleep; check for a low-quiescent-current type.
Sizing a supply
- Add up the worst-case current of every load, including start-up peaks (motors, LEDs at full white, radios that transmit).
- Allow 20–30 % headroom. A supply run at its limit gets hot and wears out sooner.
- Check the voltage under load, not just open-circuit: a cheap unregulated adapter marked 9 V may read 12 V with no load.
- Check the ripple and noise if the load is analog or radio.
- Voltage drop in wires matters on long runs; see System Integration.
- Brown-outs. If a microcontroller resets when a motor or radio starts, the supply is sagging; add bulk capacitance (see Capacitors), a thicker supply wire, or a separate supply for the motor.
Wall adapters, USB and bench supplies
| Source | Voltage | Typical current | Notes |
|---|---|---|---|
| USB 2.0 port | 5 V | 500 mA | Max current for a device until it negotiates; many ports supply more |
| USB 3.x port | 5 V | 900 mA | Higher with charging-port signaling |
| USB charger | 5 V | 1–3 A | Needs the correct resistors on the data lines or CC pins to deliver more |
| USB-C / USB PD | 5, 9, 12, 15, 20 V (and up to 48 V) | up to 5 A (100 W; 240 W extended) | Negotiated by a PD trigger chip; the cable must be rated for 5 A |
| Regulated wall adapter | fixed | 0.5–5 A | Stable output; check the barrel size and polarity |
| Unregulated adapter | rises with light load | rated at full load | Cheap; the no-load voltage can be 30 % high |
- Bench supply. A bench supply gives an adjustable voltage and an adjustable current limit. In constant-voltage mode it holds the set voltage; if the load tries to draw more than the limit, it switches to constant-current mode and the voltage falls. Set the current limit low first, so a wiring mistake cannot destroy parts.
- Power a new board safely: set the voltage, set a current limit a little above the expected current, connect, and watch the display. A reading that hits the limit at once means a short.
- Mains adapters must be certified (UL, CE, UKCA). Do not buy or build uncertified mains supplies for products or unattended use.
Related
- Power and Motor Electronics: the overview of this guide.
- Switches, Connectors and Protection: fuses, reverse-polarity protection and connectors for power.
- Capacitors: decoupling and smoothing.
- Diodes and LEDs: rectifiers and Zener regulators.
- Workshop Safety: batteries, fire and electrical safety.
FAQ
Should I use a linear or switching regulator?
Use a linear (LDO) regulator when the input is close to the output, the current is small, or noise matters. Use a switching regulator when the voltage drop is large or the current is high, since the linear part would waste the difference as heat. You can also use both, with a switcher first and a linear regulator after it for a clean analog supply.
Why does my regulator get so hot?
Heat is (Vin − Vout) × I. Dropping 12 V to 5 V at 0.5 A wastes 3.5 W, more than a bare regulator can lose. Reduce the input voltage, use a heat sink, or switch to a buck converter.
How long will my battery last?
Divide the capacity in mAh by the average current in mA, then multiply by about 0.8 for usable capacity. Measure the real average current with a meter in series (see Test Tools and Fault Finding); a microcontroller that sleeps most of the time can last a thousand times longer than one that does not.
Can I power a 5 V board from a 3.7 V lithium cell?
Not directly. The cell voltage falls from 4.2 V to 3.0 V, below 5 V, so use a boost converter (or a boost power-bank module) to get a steady 5 V, or run the board at 3.3 V from an LDO.
Is it safe to leave a lithium cell charging overnight?
Only with a protected cell and a proper charger, on a non-flammable surface, and ideally with someone nearby. A damaged cell, a wrong charger or a faulty protection circuit can start a fire.
References
- Cell and battery datasheets (for example Energizer E91, Panasonic NCR18650B, Samsung 25R, A123/Battle Born LiFePO4).
- IEC 62133, Safety requirements for portable sealed secondary cells and batteries.
- USB Implementers Forum, USB Power Delivery and USB Battery Charging specifications.
- Regulator datasheets: 78xx (onsemi/TI), AMS1117, LM2596, MCP1700 (Microchip); Horowitz and Hill, The Art of Electronics, chapter 9.
Last reviewed: October 2026. Values are typical: check the datasheets of the parts you use. Do not work on live mains equipment unless you are qualified.
