The ESP32 reset itself because its supply voltage dipped below the safe level for a moment. The chip is working as designed. Wi-Fi start-up and motors both draw sudden current, and a weak supply sags under it. Fix the power, not the code.
What the message means
The ESP32 has a brownout detector that resets the chip when the supply falls too low. The message “Brownout detector was triggered” followed by a reboot usually appears when Wi-Fi turns on or a motor starts.
Fix it in this order
- Change the USB cable first. Thin or long cables drop voltage under load.
- Use a different USB port or a powered hub. Some front-panel ports give very little current.
- Never run motors or servos from the ESP32 board’s 5 V or 3.3 V pin. Give them their own supply and join the grounds.
- Add a bulk capacitor, roughly 100 to 470 uF, across the board’s supply close to the module.
- If you run from a battery, check the voltage under load, not at rest. A tired cell sags.
- Only as a last resort, disable the detector in code. That hides the symptom and leaves the weak supply in place.
The last-resort code line
This turns the detector off. It does not make the supply stronger, and the board can then misbehave or corrupt writes instead of resetting.
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
void setup() {
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
}Why it happens
The ESP32 has a brown-out detector that resets the chip when its supply voltage drops too low. The usual cause is a weak supply: a USB port or cable that cannot deliver the current, or a battery that sags when the Wi-Fi radio transmits or a motor starts.
Use a good short USB cable and a port or charger that can supply enough current, add a 100 µF to 470 µF capacitor close to the board supply, and power motors from a separate supply with a common ground. Disabling the detector hides the symptom and is not a fix.
If you see this, do this
| You see | Do this |
|---|---|
| It resets right as Wi-Fi connects | Supply cannot cover the radio burst. Cable, port or capacitor. |
| It resets when a motor starts | Motor current is sagging the shared rail. Split the supplies. |
| It only happens on battery | Cell is weak or the regulator cannot supply the peak. |
Related
ESP32 pinout for robotics, robot battery guide, ESP32 failed to connect.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.