RisalDash RisalDash

Guide · Power · Batteries

Which battery for your ESP32 project?

The moment a project leaves the USB cable, you need a battery — and the type decides its size, runtime, safety and price. Five rechargeable chemistries cover almost everything a maker builds: Li-Ion (18650), Li-Po, NiMH, LiFePO4 and lead-acid. Here's what each is good at, how to charge it, and which one fits your build.

PowerBatteriesLi-IonLiFePO4NiMHESP32
Five battery types for ESP32 and Arduino: Li-Ion 18650, Li-Po, NiMH, LiFePO4 and lead-acid
Five chemistries, five jobs — pick by voltage, capacity, cycle life and how it charges.

This is the battery half of powering a board. For the wider picture — a wall PSU, solar + supercap, LDO vs buck and the dreaded brownout — see how to power an ESP32 and fixing brownout resets.

TypeVoltageCapacityCyclesChargingBest for
Li-Ion 186503.7 V2–3.5 Ah300–500TP4056 (CC/CV) + BMSrobots, portable, IoT
Li-Po3.7 V0.15–10 Ah300–500CC/CV + BMSdrones, wearables, RC
NiMH AA/AAA1.2 V0.6–2.7 Ah500–1000simple NiMH chargerlearning, sensors, remotes
LiFePO43.2 V1.5–100 Ah2000–7000LiFePO4 CC/CV + balance24/7, solar, off-grid
Lead-acid12 V1.3–100 Ah200–500float 13.8–14.4 VUPS, solar, big robots

1. Li-Ion 18650 — the default choice

The 18650 cell is the workhorse: 3.7 V nominal (4.2 V full), 2000–3500 mAh, cheap and available everywhere, in a rugged metal can. It's the best all-round balance of capacity, size and price for robots, portable gadgets and IoT nodes. Charge it with a dedicated CC/CV module like the TP4056, and use a protection board (BMS) to guard against over-discharge and shorts.

2. Li-Po — thin, light, high-current

Same 3.7 V lithium chemistry in a soft pouch: very thin and light, in sizes from 150 mAh to 10 Ah, and able to deliver high current without sagging (20C and up). That makes it the pick for drones and quadcopters, wearables, RC models and slim enclosures. The trade-off is fragility — a pouch can puncture or swell — so it also needs a BMS and correct CC/CV charging, and a little mechanical care.

3. NiMH (AA / AAA) — simple and safe

1.2 V per cell, AA around 2000–2700 mAh, AAA 600–1200 mAh, 500–1000 cycles. The appeal is simplicity: no protection circuit, no special charger drama, and far more tolerant of abuse than lithium — ideal for beginners, classroom kits, sensors, remotes and toys. The catch is voltage: to feed a 5 V board use 4×AA (4.8 V) + a boost converter; for a 3.3 V rail, use a buck converter.

4. LiFePO4 — the sleep-for-years chemistry

Lithium iron phosphate runs at 3.2 V (charge to 3.6 V, discharge to 2.5 V) and is the safest lithium chemistry — thermally stable, very hard to ignite — with an enormous 2000–7000+ cycle life and a wide −20…+60 °C range. It's the choice for anything that must run 24/7 and for years: solar stations, off-grid sensors, UPS backups, remote trackers. Charge only with a LiFePO4-aware CC/CV charger with balancing, and never above 3.65 V per cell. Bonus: 3.2 V sits close to the ESP's 3.3 V rail, so a single cell + a low-dropout regulator is a tidy supply.

5. Lead-acid (SLA, 12 V) — cheap, heavy, proven

The old classic: 12 V, 1.3–100 Ah, dirt cheap and extremely rugged, but heavy and limited to 200–500 cycles. It earns its place where weight doesn't matter and capacity does — solar storage, UPS/backup, big robots and machines, mobile power stations. Charge at a float of 13.8–14.4 V and avoid deep discharge (below ~10.5 V) to keep its lifespan. Step 12 V down to 5 V/3.3 V with a buck converter.

The one rule that saves your board

A lithium cell is 3.7–4.2 V; an ESP32 pin is 3.3 V. Never wire a lithium battery straight to the 3.3 V or 5 V pin. Charge through a TP4056 (or a BMS module), then feed the board through a regulator or converter — a buck/LDO down to 3.3 V, or a boost up from NiMH. Get this wrong and you cook the board; get it right and even a coin-cell project runs clean.

Monitor it from the dashboard

Reading the cell voltage is one ADC pin and a resistor divider — then show it as a gauge or a live web dashboard:

// Read a Li-Ion cell through a 2:1 divider (two equal resistors) on an ADC pin
const int   BAT_PIN = 34;            // ADC1 — keeps working with Wi-Fi on
const float DIVIDER = 2.0;           // 100k / 100k halves the cell voltage

float readBattery() {
  int raw = analogRead(BAT_PIN);              // 0..4095
  return (raw / 4095.0) * 3.3 * DIVIDER;      // pin volts -> cell volts (~4.2 full, ~3.3 empty)
}

int percent(float v) {               // rough Li-Ion curve
  int p = (v - 3.3) / (4.2 - 3.3) * 100;
  return p < 0 ? 0 : (p > 100 ? 100 : p);
}

Feed readBattery() and percent() into a widget and you get the “Battery: 87% · 3.74 V” readout every portable build wants. (On the ESP32, prefer an ADC1 pin like GPIO32–39 — ADC2 is unavailable while Wi-Fi is on.)

The 30-second pick

ESP32, mobile or IoT → Li-Ion 18650 or Li-Po. Arduino Nano/Uno, stationary or learning → 4×AA NiMH (+ boost) or an 18650 + boost. Robots and anything moving → Li-Po, for its light weight and high current. Outdoor, solar or must-run-for-years → LiFePO4. Big, cheap, weight-doesn't-matter → lead-acid. Match capacity, current and conditions to the job — the right cell is what makes a build reliable.

Show battery %, voltage and every sensor on a live screen the ESP serves itself.