Why your ESP32 keeps randomly resetting (and how to fix it)
If your ESP32 reboots at random — often the moment WiFi transmits — the cause is almost always power, not your code. WiFi TX pulls short current spikes that sag the 3V3 rail below the brownout threshold, and the chip resets to protect itself.
Here is the order we check it on every board.
1. Decoupling at the power pins
Put a 0.1µF (100nF) capacitor right at each power pin, with the shortest possible trace to ground. This is the single most common first-board miss. The cap supplies the fast current the chip needs before the regulator can react.
2. Bulk capacitance for WiFi spikes
The 100nF caps handle high-frequency noise but not the larger, slower current draw of a WiFi transmit burst. Add bulk capacitance near the module:
- 10–22µF close to the module, plus
- a 470µF (or larger) bulk cap on the 3V3 rail.
If reboots only happen during WiFi activity, this is usually the fix.
3. Don’t power 3V3 from the USB-serial chip
A lot of cheap boards take 3V3 from the little regulator built into the USB-to-serial chip. That regulator cannot supply WiFi current peaks. Use a proper 3V3 regulator rated for the peak current (500mA+ headroom is comfortable).
4. Check the brownout detector
The firmware brownout detector fires when the rail dips. People often disable it to “fix” the resets — that hides the symptom and can corrupt flash writes. Fix the power instead. If you must adjust it, do it knowing the rail is marginal.
5. Star-ground the RF section
A noisy ground under the antenna section couples into everything. Keep the RF ground clean and stitched.
Short version: 100nF at every power pin, bulk cap for WiFi, a real 3V3 regulator (not the USB-serial one), and a clean ground. That clears the vast majority of “random” ESP32 resets.
Stuck on a board that still misbehaves? Tell us what it’s doing — power debugging is most of what we do.