Debugging ESP32 Brownout Resets: Power Supply Ripple, Capacitor Placement, and Brownout Detector Tuning
The symptom is almost always the same: an ESP32 project runs fine on a USB cable plugged into a computer, then reboots randomly — or reboots reliably every time it tries to do something specific, like turn on WiFi, key a relay, or drive a servo — the moment it's deployed on battery or a wall adapter out in the shop. The serial monitor, if you catch it in time, prints something like Brownout detector was triggered just before the reset. This is one of the most common "my code works but my project doesn't" failures in ESP32 projects, and it's almost never actually a firmware bug. It's a power delivery problem that the chip is specifically designed to detect and protect itself from, and understanding why it triggers makes it straightforward to fix.
What the Brownout Detector Actually Does
The ESP32 has a built-in analog brownout detector (BOD) that watches the chip's core supply voltage and forces an immediate reset if it drops below a threshold (around 2.43V by default, configurable in a narrow range via efuse/firmware settings). This exists because running digital logic below its minimum operating voltage doesn't fail gracefully — it produces corrupted register states, garbage memory reads, and unpredictable execution, which is a much worse outcome than a clean reset. The brownout detector trades an unpredictable crash for a predictable, logged reboot. Seeing the brownout message is good news in one specific sense: the chip is telling you exactly what happened instead of silently corrupting data or hanging in a way that's much harder to diagnose.
Why the Voltage Actually Dips
The ESP32's WiFi and Bluetooth radios draw current in sharp, brief spikes rather than a smooth continuous load. During a transmit burst — connecting to an access point, sending a packet, or even just periodic beacon/probe traffic — the radio can pull 300–500mA for a few hundred microseconds to a few milliseconds, on top of whatever the rest of the board is drawing. A supply that measures a rock-solid 3.3V or 5V on a multimeter (which averages over time and can't see fast transients) can still sag well below the brownout threshold during one of these spikes, because the multimeter is reporting an average while the brownout detector is watching an instant.
Three things typically combine to turn a normal radio current spike into an actual brownout:
- Insufficient bulk capacitance near the chip to supply the spike locally while the regulator catches up.
- A regulator or USB power source that can't source the peak current fast enough — many small AMS1117-style linear regulators on cheap dev boards, and many phone chargers / USB hubs with aggressive current limiting, fall into this category.
- Voltage drop across long or thin supply wiring between the source and the board, which adds resistance that turns a current spike into a voltage dip right at the chip, even if the source itself is fine.
Fixing It: Capacitor Placement
The fastest, cheapest fix for most brownout issues is better local bulk capacitance, placed as close to the ESP32 module's 3.3V and GND pins as physically possible — not just somewhere on the board, and not just at the regulator output.
| Capacitor | Role | Placement Notes |
|---|---|---|
| 100–470µF electrolytic or tantalum | Bulk storage to ride through radio current spikes | Across 3.3V/GND directly at the module pins, not just at the regulator |
| 10µF ceramic | Mid-frequency decoupling, faster response than bulk electrolytic | Within a centimeter of the module's power pins |
| 0.1µF ceramic | High-frequency noise suppression | As close to the pin as the PCB layout allows |
Many bare ESP32 modules and minimal breakout boards skip some or all of this on the assumption that the carrier board or power supply handles it — which is a reasonable assumption when powered from a well-designed USB port on a computer, and a bad one on a thin dupont-wire breadboard connection to a wall adapter. Adding a 470µF electrolytic directly across the 3.3V rail right at the ESP32 is the single highest-value change for a board that resets specifically when WiFi activity starts.
Fixing It: The Power Source Itself
If local capacitance doesn't fully resolve it, look upstream:
- Linear regulators on many dev boards (the ubiquitous AMS1117 being the classic example) have a transient response that's not great for sharp current spikes; a regulator with better load transient specs, or simply a higher-current-rated one with more thermal and current margin, helps.
- USB power sources vary enormously in how they handle a sudden current demand. A phone charger optimized for slow-ramping charging current can respond poorly to a sharp ESP32 radio spike compared to a purpose-built 5V/2A+ supply. If you're powering from USB, try a different, higher-rated supply as a diagnostic step before redesigning anything.
- Wire gauge and length matter more than people expect at these current levels — thin jumper wires or a long run from a bench supply to a breadboard can add enough resistance that a 300mA spike produces a meaningful voltage drop by the time it reaches the chip. Shorten the run or step up to heavier gauge wire for the power connection specifically.
- Battery-powered projects add internal battery resistance to the equation; a cell or pack with a high internal resistance (common in small, cheap, or aging LiPo cells) will sag more under the same current spike than a pack with low internal resistance, even at the same nominal voltage and capacity.
Firmware-Side Levers
A few software changes reduce how hard the radio hits the supply, which can help as a secondary mitigation even after the hardware is improved:
- WiFi transmit power can be reduced with
esp_wifi_set_max_tx_power()(Arduino core exposes this viaWiFi.setTxPower()). Lower transmit power draws less peak current at the cost of range — often an acceptable trade for a sensor a few feet from its access point. - Modem sleep / power-save modes change the radio's duty cycle and can shift when and how often spikes occur, though they can also introduce latency that matters for some applications.
- Staggering startup of other current-hungry peripherals (servos, relays, displays with backlight inrush) away from the moment WiFi connects avoids stacking two spikes on top of each other, which is a common cause of a brownout that only happens on cold boot and not afterward.
It's worth being honest about firmware fixes, though: they manage the symptom by asking the radio to draw less current, rather than fixing the underlying supply weakness. A project that needs full transmit power for range will eventually need the hardware fix regardless.
Tuning or Disabling the Brownout Detector (Use Caution)
It's possible to lower the brownout threshold or disable the detector entirely in firmware (via efuse settings or, on the Arduino/ESP-IDF toolchains, a menuconfig option). Resist the temptation to do this as a first response to a brownout message. The detector is reporting a real voltage problem; disabling it doesn't fix the underlying power delivery issue, it just removes the safety net and lets the chip run in a state that's prone to silent corruption and much stranger, harder-to-diagnose failures — a corrupted WiFi stack, garbage sensor readings, or a hang that looks nothing like a power problem. Treat a disabled or lowered brownout detector as a last-resort diagnostic tool to confirm the theory, not a permanent fix, and re-enable it once the real supply issue is addressed.
A Practical Checklist
- Confirm the reset is actually a brownout by watching serial output at full baud rate through the exact moment of failure — don't assume, since other faults (watchdog timeouts, stack overflows) can also cause unexpected resets.
- Add a 470µF+ bulk capacitor directly at the module's 3.3V/GND pins as the first fix to try.
- Swap the power source (different USB supply, shorter/heavier wiring, or a better regulator) as the next step if the capacitor alone doesn't resolve it.
- Reduce WiFi transmit power temporarily as a diagnostic to confirm the radio is the trigger, then decide whether to keep it reduced or fix the supply properly.
- Only after confirming a real, understood hardware fix should you consider the project power-stable; a board that "seems fine now" after removing the brownout detector almost always has a worse failure waiting in the field.
Brownout resets are one of the few ESP32 failure modes where the chip is actively trying to help by failing loudly and predictably instead of corrupting silently. Reading that message as useful diagnostic information, rather than an annoyance to suppress, is the difference between a project that's genuinely power-stable and one that merely stops telling you about a problem it still has.