Getting Started · 7 min read

How to Power an ESP32 Project: USB, Battery, or Breadboard Rails

The ESP32 is forgiving about code and picky about power. Feed it wrong and you get random reboots, brownouts the moment Wi-Fi connects, or a dead board. Feed it right and it runs for months on a battery.

In short

On the bench: power over USB, done. Deployed: an 18650 shield or a regulated 3.3V supply on the 3V3 pin. The rules that keep boards alive: 5V goes only to VIN/5V or USB, GPIOs are 3.3V logic and never accept 5V, and Wi-Fi bursts need ~350mA of headroom your supply must actually deliver.

Your four real options

Source Where it connects Use it when Watch out for
USB cable USB port Bench development, flashing, serial monitoring Charge-only cables carry power but no data — the classic “port not found”
5V pin (VIN) 5V / VIN pin Clean regulated 5V from a wall adapter or bench PSU Unregulated wall warts can sag when Wi-Fi spikes
18650 shield USB port or 5V pin Portable and deployed projects; built-in charging Insert the cell with correct polarity — shields have no mercy circuit
Regulated 3.3V 3V3 pin Custom regulators, battery boards without their own LDO This bypasses the onboard regulator — 3.6V+ here kills the chip

The voltage rules that keep boards alive

Pin Voltage Current budget Rule
VIN / 5V 5V in ≥500mA supply Feeds the onboard 3.3V regulator
3V3 3.3V out ~500mA shared Powers your sensors; not a charger input
Any GPIO 3.3V logic 12mA source, 40mA absolute max Never apply 5V to a GPIO — not “briefly”, not through a big resistor

The reboot-when-Wi-Fi-starts symptom is almost always current, not voltage: the chip idles near 40mA but spikes past 350mA during radio bursts. A skinny USB cable or a tired regulator dips, the brownout detector fires, and the board resets. Shorter cable, better supply, problem gone.

Battery projects: sleep is the feature

An always-on ESP32 drains a 3000mAh 18650 in about three days. The same board waking once a minute to read a sensor and deep-sleeping in between runs for months — deep sleep draws around 10µA on the chip itself (a bit more on full dev boards with power LEDs and USB chips).

#include <esp_sleep.h>

void setup() {
  readSensorAndPublish();        // do the useful work first
  esp_sleep_enable_timer_wakeup(60ULL * 1000000ULL); // 60 s
  esp_deep_sleep_start();        // wake = full reboot into setup()
}
void loop() {} // never reached

Notice the pattern: deep sleep means your program lives entirely inside setup(). Wake, work, sleep, repeat.

Measure, don’t guess

Before deploying anything battery-powered, log what it actually draws across a full wake cycle — boot spike, Wi-Fi connect, sensor read, sleep floor. Guessing wrong by 3× is normal; measuring takes ten minutes. Our Breadboard Power Studio exists exactly for this: four isolated, current-logged rails so you see the consumption curve on screen instead of in a forum post mortem. And if you want to validate firmware behavior before it ever touches a battery, the free simulator runs the real binary in your browser.

More in the Knowledge Base: Your First ESP32 Project · GPIO Pinout: Safe Pins · All guides →