While you are learning and prototyping, your ESP32 is usually powered through the USB cable connected to your computer. But for real projects — a weather station on your balcony, a sensor in your garden, a battery-powered remote control — you need to understand the different ways to power your board and how to choose the right one.
🔗How the ESP32 DevKit Power System Works
The ESP32 chip itself runs at 3.3V. But your DevKit board is designed to accept a range of input voltages and regulate them down to the 3.3V the chip needs. Most ESP32-WROOM-32 DevKit boards have three ways to receive power:
| Power Input | Voltage | How It Gets to 3.3V | Use Case |
|---|---|---|---|
| USB connector | 5V | Through the onboard 3.3V regulator (often an AMS1117-3.3) | Development, always-plugged-in projects |
| VIN pin | 5--12V (varies by board) | Through the onboard 3.3V regulator | External power supplies, car adapters |
| 3.3V pin | 3.3V exactly | Bypasses the regulator entirely | Direct from a 3.3V regulator you provide |
Warning: The 3.3V pin connects directly to the ESP32 chip with no protection. If you feed more than 3.6V into this pin, you risk permanently damaging the chip. Only use this pin if you have a well-regulated 3.3V source.
🔗Option 1: USB Power
The simplest option. Plug in a USB cable from any 5V source — your computer, a phone charger, or a USB power bank.
Pros:
- No wiring needed
- Widely available power sources
- Also gives you serial communication for debugging
Cons:
- Tethered to a cable
- Some cheap chargers provide noisy power that can cause instability
For a desk project or something near a wall outlet, a basic 5V / 1A USB phone charger is more than sufficient. The ESP32 does not need much current (more on that below), so even a 500mA USB 2.0 port will work for most applications.
Tip: USB-C is becoming standard on newer boards. Make sure you have the right cable for your board's connector — micro-USB and USB-C are the most common.
🔗Option 2: VIN Pin
The VIN (Voltage In) pin feeds power through the board's onboard voltage regulator. This is useful when you have an external power supply that is not USB.
The acceptable voltage range depends on the regulator on your specific board. The common AMS1117-3.3 regulator needs at least around 4.7V input to reliably output 3.3V, and can handle up to about 12V. However, the regulator converts excess voltage to heat:
$$P_{heat} = (V_{in} - 3.3\,\text{V}) \times I_{load}$$
At 12V input drawing 200mA, the regulator dissipates $(12 - 3.3) \times 0.2 = 1.74\,\text{W}$, which is a lot for a tiny chip. At 5V input with the same current, it is only $(5 - 3.3) \times 0.2 = 0.34\,\text{W}$, which is fine.
Warning: Feeding 12V through VIN while using WiFi (high current draw) can overheat the regulator. Stick to 5--7V on the VIN pin for reliable operation.
Typical sources for VIN:
- 5V wall adapter with bare wires
- 4x AA batteries (~6V)
- 9V battery (works but drains fast and wastes power as heat)
🔗Option 3: The 3.3V Pin (Direct Power)
You can bypass the onboard regulator entirely by feeding a regulated 3.3V directly into the 3.3V pin. This is the most efficient option because no power is wasted in the regulator.
This approach makes sense when:
- You are building a custom PCB with your own 3.3V regulator
- You are powering the ESP32 from another board's 3.3V output
- You need maximum efficiency for battery life
Warning: This path has no overvoltage protection. You must be confident your supply is stable, clean, and between 3.0V and 3.6V. A brief spike above 3.6V can destroy the ESP32.
🔗Option 4: Battery Power
Battery power makes your projects truly portable. Here are the most common options:
🔗LiPo / Li-Ion Batteries (3.7V nominal)
Lithium batteries are the most popular choice for portable ESP32 projects. A single cell provides 3.0--4.2V, which is close to the 3.3V the ESP32 needs.
The 18650 cell is particularly popular — it is inexpensive, widely available, and a single cell at ~3000mAh can power an ESP32 for days in a deep-sleep application.
A common setup uses a TP4056 module for charging and a voltage regulator:
USB Charger → TP4056 → 18650 Cell → 3.3V Regulator → ESP32 (3.3V pin)Some ESP32 development boards (like the TTGO T-Display or certain FireBeetle boards) have a JST battery connector and built-in charging circuitry, making LiPo power plug-and-play.
Tip: Never connect a LiPo battery directly to the VIN pin without checking whether your board has an onboard LiPo charging circuit. If it does not, you need an external TP4056 or similar module to handle charging safely.
🔗AA/AAA Batteries
Alkaline batteries are readily available and safe to handle:
- 2x AA (3.0V) -- can power the 3.3V pin directly, but voltage sags under load and drops below 3.0V as batteries deplete. Marginal.
- 3x AA (4.5V) -- works well through the VIN pin / onboard regulator.
- 4x AA (6.0V) -- reliable through VIN.
🔗CR123A or 2x AA Lithium
Lithium primary (non-rechargeable) cells like Energizer Lithium AA hold voltage more steadily than alkaline and work better in cold temperatures. Two lithium AAs provide ~3.0--3.4V, which is viable for the 3.3V pin.
🔗ESP32 Power Consumption
Understanding how much power the ESP32 actually uses helps you choose the right supply and estimate battery life.
| Mode | Typical Current | Description |
|---|---|---|
| Active (WiFi TX) | ~160--240mA | Transmitting data over WiFi |
| Active (WiFi RX) | ~95--100mA | Receiving data over WiFi |
| Active (no radio) | ~30--50mA | CPU running, WiFi/BT off |
| Modem sleep | ~20--30mA | CPU on, WiFi off between intervals |
| Light sleep | ~0.8mA | CPU paused, wakes quickly |
| Deep sleep | ~10uA | Almost everything off, RTC memory retained |
The difference between active WiFi and deep sleep is enormous — a factor of roughly 20,000. This is why deep sleep is essential for battery-powered projects.
🔗Estimating Battery Life
A rough estimate for battery life:
$$t_{hours} = \frac{C_{battery}}{I_{average}}$$
where $C_{battery}$ is the battery capacity in mAh and $I_{average}$ is the average current draw in mA.
Example: You have a sensor that wakes up every 5 minutes, takes a reading, sends it over WiFi (takes 3 seconds at 200mA), then goes back to deep sleep (10uA). The average current is approximately:
$$I_{avg} = \frac{3\,\text{s} \times 200\,\text{mA} + 297\,\text{s} \times 0.01\,\text{mA}}{300\,\text{s}} = \frac{600 + 2.97}{300} \approx 2\,\text{mA}$$
With a 3000mAh 18650 cell:
$$t = \frac{3000\,\text{mAh}}{2\,\text{mA}} = 1500\,\text{hours} \approx 62\,\text{days}$$
In practice, real-world battery life will be somewhat lower due to self-discharge, voltage regulator quiescent current, and other factors — but the order of magnitude is correct.
🔗Power Budgeting for Projects
When planning a project, list everything that draws power:
| Component | Typical Current |
|---|---|
| ESP32 (WiFi active) | ~200mA |
| Small OLED display (SSD1306) | ~20mA |
| DHT22 sensor | ~1.5mA |
| Relay module | ~70mA per relay |
| LED (single, with resistor) | ~5--20mA |
| Servo motor | ~100--500mA (varies with load) |
| NeoPixel LED (full white) | ~60mA per LED |
Add up the worst-case currents for everything that could be on simultaneously. This is your peak draw. Your power supply must handle the peak, and your average draw determines battery life.
Tip: If your project uses a servo, motor, or multiple NeoPixels, a 5V / 500mA USB port may not be enough. Use a dedicated 5V / 2A supply, and power hungry peripherals separately from the ESP32 when possible.
🔗GPIO Voltage Limits
One more critical safety note: the ESP32's GPIO pins operate at 3.3V logic. This means:
- Digital HIGH output is 3.3V
- Maximum safe input voltage on any GPIO is 3.6V
- Feeding 5V into a GPIO pin can damage the chip
If you need to interface with 5V devices, use a logic level shifter or a simple voltage divider. We cover this in more detail in the electronics basics article.
Warning: Never connect a 5V signal directly to an ESP32 GPIO pin. This is one of the most common mistakes beginners make, and it can silently damage your board.
🔗Quick Reference: Which Power Method to Use
| Scenario | Recommended Power Method |
|---|---|
| Learning and prototyping | USB from computer |
| Desk project near an outlet | USB wall charger (5V/1A) |
| Portable / battery-powered | 18650 + TP4056 + 3.3V regulator |
| Powered by existing 5V supply | VIN pin |
| On a custom PCB | 3.3V pin with your own regulator |
| Solar-powered outdoor project | Solar panel + charge controller + LiPo + 3.3V regulator |
🔗What's Next?
Now that you know how to keep your ESP32 powered, it is time to learn how it communicates with sensors and other devices. In the next article, we will explore the communication protocols -- I2C, SPI, UART, and OneWire -- that let your ESP32 talk to the outside world.