Guide · Power · DIY
How to power your ESP32 — from the wall to lithium
An ESP32 is happy on anything from a USB port to a solar panel — but the source shapes the whole project: portable or plugged in, days or years, indoors or off-grid. Here are the four that cover almost every build, and how to pick.
Li-Po / Li-Ion (18650) — the portable standard
A single lithium cell (a flat Li-Po or an 18650) is the default for anything battery-powered: 3.7 V nominal, high capacity, and easy USB charging with a TP4056 module. The one thing to remember: 3.7–4.2 V is above the ESP’s 3.3 V, so you need an LDO regulator in between (most dev boards have one). Great for handhelds, trackers and anything that recharges. To make a cell last, the trick isn’t a bigger battery — it’s deep sleep.
LiFePO4 — the sleep-forever chemistry
LiFePO4 is the quiet hero for low-power projects. At 3.2 V nominal it sits right in the ESP’s range, so you can often run the chip directly, with no LDO — and an LDO’s quiescent current is exactly what drains a sleeping node. Add tiny self-discharge and real cold tolerance, and it’s ideal for battery sensors that mostly sleep for months. Slightly lower energy density than Li-Po, and it wants a LiFePO4-specific charger.
Switching PSU — plugged-in and stable
For anything that stays in one place, a switching power supply (5 V or 12 V) off mains is the simplest answer: steady voltage, plenty of current, and short-circuit protection. Use it for LED strips, relays, motors — loads a battery can’t sustain. Two cautions: give it headroom for inrush current (a relay coil or a motor spikes hard), and a brown-out on a weak supply is a top cause of random reboots — see the brownout guide.
Solar + supercapacitor — off-grid, forever
For an outdoor node with no mains and no one to swap batteries, a small solar panel feeding a supercapacitor (or a LiFePO4 cell) is a near-endless supply. The panel tops up by day, the cap carries the node through the night, and a deep-sleep duty cycle keeps the budget tiny. It’s the classic setup for a remote weather station. The design work is in sizing the panel and cap to your sleep current and worst-case sunless days.
The 30-second decision
| Source | Voltage | Best for | LDO needed? |
|---|---|---|---|
| Li-Po / 18650 | 3.7 V | portable, rechargeable | yes |
| LiFePO4 | 3.2 V | long-sleep sensors | often no |
| Switching PSU | 5 / 12 V | stationary, high current | on-board reg |
| Solar + supercap | panel + cap | outdoor, no swaps | depends |
Rule of thumb: rechargeable and portable → Li-Po/18650; a sensor that sleeps for months → LiFePO4 (skip the LDO); a fixed install with hungry loads → a switching PSU; outdoors with nobody to service it → solar + supercap. Whatever the source, a solid 3.3 V rail and a decoupling cap are what keep it from rebooting under load.
On a battery? Deep sleep is what turns days of runtime into a year.