You have finished your ESP32 project.
The firmware works.
The sensors are reading correctly.
The device runs perfectly when connected to USB power.
Then you switch to a battery.
Suddenly, everything changes:
The ESP32 randomly restarts
- WiFi connections drop unexpectedly
- Sensors stop responding
- The serial monitor shows brownout warnings
- The device works for a few minutes and then fails
The first reaction from many developers is:
"There must be something wrong with my code."
Sometimes that is true.
But in many battery-powered embedded projects, the real problem is not software.
It is the power system.
An ESP32-based device is only as reliable as the power source supporting it. A battery that looks good on paper may still fail when the device demands short bursts of current.
Understanding why this happens requires looking beyond battery capacity and understanding how batteries behave under real operating conditions.
1. ESP32 Does Not Consume Power in a Constant Pattern
One of the biggest mistakes in battery-powered design is assuming that the device consumes a fixed amount of current.
For example:
"My ESP32 uses around 20mA, so a 2000mAh battery should last about 100 hours."
This calculation may look reasonable, but real devices rarely operate this way.
An ESP32 has different power states:
- Deep sleep
- Idle
- CPU processing
- Sensor operation
- WiFi communication
- Bluetooth transmission
Each state requires a different amount of current.
During deep sleep, an ESP32-based device may consume only microamps.
During normal operation, the current may increase significantly.
During WiFi transmission, the device can require short but intense current bursts.
For example:
The important point is:
The battery must handle the peak current, not only the average current.
2. The Real Cause of Many ESP32 Resets: Voltage Drop Under Load
A common misconception is:
"My battery is 3.7V, and my ESP32 needs 3.3V, so everything should work."
But battery voltage is not a fixed number.
A lithium battery has a voltage curve that changes depending on:
- Charge level
- Temperature
- Current demand
- Internal resistance
When the ESP32 suddenly activates WiFi, the current demand increases quickly.
At that moment, the battery voltage can temporarily drop.
This is called voltage sag.
The relationship can be simplified as:
Voltage Drop = Current × Internal Resistance
or:
Vdrop = I × R
Where:
I = current spike
R = battery internal resistance
For example:
A battery with higher internal resistance will experience a larger voltage drop when the ESP32 demands more current.
The result:
Battery voltage falls below the minimum operating voltage of the system.
The ESP32 detects unstable power and resets.
3. Battery Capacity Is Not the Only Specification That Matters
When selecting a battery, many developers focus on one number:
mAh
Capacity is important, but it does not tell the whole story.
Two batteries can have the same capacity but completely different performance.
Example:
Battery A:
2000mAh capacity
Low internal resistance
Battery B:
3000mAh capacity
Higher internal resistance
For a low-power sensor, Battery B may provide longer runtime.
But for an ESP32 device with frequent WiFi transmission, Battery A may actually perform better because it can deliver current more effectively.
Important battery specifications for embedded projects include:
Capacity
How much energy the battery can store.
Internal resistance
How much voltage loss occurs during current demand.
Discharge capability
How much current the battery can safely provide.
Operating temperature range
How performance changes in different environments.
For IoT devices, choosing the battery only by capacity is often a mistake.
4. Why Small Batteries Often Fail in IoT Devices
Modern IoT products are becoming smaller.
Developers want:
- Smaller enclosures
- Lighter designs
- Longer battery life
This often leads to choosing the smallest possible battery.
However, smaller does not always mean better.
A small battery may have enough capacity for the expected runtime but still fail during peak current events.
Consider a WiFi sensor:
Most of the time:
Device sleeps
Current consumption is very low
Occasionally:
- WiFi turns on
- Data is transmitted
- Current suddenly increases
The average power consumption may look excellent.
But the battery must still support those short high-current events.
This is especially important for applications such as:
- WiFi cameras
- GPS trackers
- Robotics projects
- Wireless sensors
A battery should be selected based on the complete operating profile, not just average consumption.
5. The Battery Is Only One Part of the Power System
Although the battery is often the first suspect, it is not always the problem.
The complete power path usually looks like this:
Battery
|
Protection Circuit
|
Voltage Regulator
|
ESP32
|
Sensors / Communication Modules
Every component in this chain can affect system stability.
5.1 Voltage Regulator Problems
A common design mistake is selecting a regulator without considering real operating conditions.
For example:
A LiPo battery provides:
Around 4.2V when fully charged
Around 3.7V nominal voltage
Lower voltage as it discharges
The regulator must maintain a stable output throughout this range.
Problems can occur when:
The regulator cannot provide enough current
The dropout voltage is too high
Efficiency is poor
Thermal limits are exceeded
A regulator that works during testing may fail when WiFi creates a current spike.
5.2 The Role of Capacitors
Many ESP32 development boards include capacitors near the power input for a reason.
Capacitors can help provide short bursts of current when the system suddenly demands more power.
For example:
- ESP32 starts WiFi transmission
- Current demand increases rapidly
- Capacitor temporarily supports the power requirement
- Voltage remains more stable
However, capacitors are not a replacement for a properly selected battery.
If the battery has insufficient discharge capability, adding larger capacitors only hides the problem temporarily.
6. A Practical Debugging Checklist for ESP32 Battery Resets
When an ESP32 device keeps restarting, follow a systematic troubleshooting process.
Step 1: Check the Serial Monitor
Look for messages such as:
Brownout detector was triggered
A brownout usually means the supply voltage dropped below a safe level.
This is a strong indication of a power issue.
Step 2: Measure Voltage During Peak Activity
Do not only measure the battery voltage when the device is idle.
The important moment is when the device is under maximum load.
Test during:
- WiFi transmission
- Bluetooth activity
- Motor startup
- Sensor activation
An oscilloscope is ideal because voltage drops can happen very quickly.
A normal multimeter may not capture short voltage dips.
Step 3: Check Battery Specifications
Review:
- Battery capacity
- Maximum discharge current
- Internal resistance
- Temperature rating
A battery designed for low-power electronics may not be suitable for high-current applications.
Step 4: Test With Another Power Source
A useful debugging method:
Replace the battery temporarily with:
- A laboratory power supply
- A larger battery
- A different battery chemistry
If the problem disappears, the battery or power design is likely the cause.
7. Choosing the Right Battery for ESP32 Projects
There is no single battery that works best for every ESP32 application.
The correct choice depends on the device requirements.
Low-Power Sensor Nodes
Examples:
- Temperature sensors
- Environmental monitoring devices
- BLE beacons
Important factors:
- Long standby time
- Small size
- Low self-discharge
Possible choices:
- LiPo
- Li-ion
- WiFi Devices and High-Current Applications
Examples:
- ESP32 cameras
- Wireless gateways
- Robotics projects
Important factors:
- High peak current capability
- Low internal resistance
- Stable voltage output
Battery selection should prioritize performance under load.
Long-Life Outdoor IoT Devices
Examples:
Remote monitoring systems
Industrial sensors
Important factors:
Long cycle life
Temperature stability
Reliability
Possible considerations:
Larger battery capacity
LiFePO4 solutions
Energy harvesting systems
8. Design Tips to Prevent Battery-Related ESP32 Resets
The best solution is preventing the problem during the design stage.
1. Measure Real Power Consumption
Do not rely only on theoretical calculations.
Measure:
Sleep current
Active current
Wireless transmission current
Real measurements are always more valuable than assumptions.
2. Design Around Peak Current
Average current determines runtime.
Peak current determines stability.
Both matter.
3. Select the Battery Early
Do not wait until the PCB and enclosure are finished.
Battery selection affects:
- Device size
- Charging circuit
- Thermal design
- Mechanical structure 4. Optimize Firmware
Power optimization is not only hardware-related.
Firmware can significantly improve battery life by reducing:
- Unnecessary wake-ups
- Long communication periods
- Excessive processing time
A well-designed power system combines:
- Efficient firmware
- Proper electronics
- Correct battery selection
- Conclusion: Your ESP32 Reset Problem May Not Be a Software Bug
When an ESP32 device works perfectly on USB power but fails on battery, the problem is often related to power delivery.
The battery may have enough capacity but still fail because of:
- High internal resistance
- Insufficient discharge capability
- Voltage sag
- Poor thermal performance
A reliable battery-powered IoT device requires coordination between:
- Firmware design
- Power management
- PCB layout
- Voltage regulation
- Battery selection
The battery is not just an energy storage component.
It is part of the entire system architecture.
So the next time your ESP32 randomly resets, do not only debug your code.
Check the power first. Your battery might be the real problem.



Top comments (0)