Power and the 3V3 rail
Forty milliamps per pin, a few hundred through the regulator, and a Wi-Fi transmit burst that takes a quarter of an amp on its own. Add them up before wiring, not after the board starts rebooting.
Budget the peak, not the average
The averages are comfortable and the peaks are not. An ESP32 idles at about 45 mA and transmits at around 240, in bursts of a couple of hundred milliseconds. A regulator that supplies the average happily will sag on the burst, the brown-out detector fires at 2.43 V, and the board resets — reliably, at the exact moment the radio comes up, which is why it reads as a Wi-Fi bug.
Three limits, not one
Per pin: 40 mA absolute maximum, and comfortable well below that. One LED at 10 mA is fine, a relay coil is not, a motor is absurd.
Per rail: whatever the regulator on your board can do, thermally, which is usually a few hundred milliamps rather than the amp printed on the part. The 3V3 pin on a dev board is a convenience for sensors, not a power supply for actuators.
Per supply: whatever is upstream. USB gives you 500 mA and a stiff rail. A CR2032 gives you about 3 mA before its voltage collapses, which is why a coin cell cannot run Wi-Fi at all without a large capacitor beside it.
The two cheap fixes
A 100 µF electrolytic across 3V3 and GND, close to the board, supplies the transmit burst locally so the regulator does not have to. A small ceramic alongside it handles the fast edges. This is the fix that turns a board that resets every few minutes into one that does not.
Turning the transmit power down. The default is around 19.5 dBm and 11 dBm is plenty for a house. It roughly halves the burst current and costs range you were not using.
Anything with a motor gets its own supply
Servos, pumps, steppers, solenoids and long LED strips all draw currents that have no business anywhere near a microcontroller's regulator. Separate supply, grounds tied together, and a transistor or driver between the pin and the load. That is not caution — it is the arrangement that works.
The code
The chip records why it reset. If it says brown-out, the problem is the supply and no amount of debugging the sketch will help.
#include <esp_system.h>
#include <WiFi.h>
void setup() {
Serial.begin(115200);
delay(200);
if (esp_reset_reason() == ESP_RST_BROWNOUT)
Serial.println("BROWN-OUT: the 3V3 rail sagged. This is a supply fault.");
// Cutting transmit power is the cheapest fix for a marginal supply.
WiFi.mode(WIFI_STA);
WiFi.setTxPower(WIFI_POWER_11dBm); // default is 19.5 dBm
WiFi.begin("your-ssid", "your-password");
}
void loop() {}Disabling the brown-out detector makes the symptom go away and the cause worse — the chip carries on running at a voltage where flash writes corrupt. Fix the rail instead.
Same two moves: find out whether the last reset was a brown-out, and turn the radio down if it was.
import machine, network
if machine.reset_cause() == machine.WDT_RESET:
print("watchdog — a software fault")
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.config(txpower=11) # dBm; default is around 19.5
wlan.connect("your-ssid", "your-password")A brown-out that only happens on battery and never on USB is the classic shape. USB supplies far more current than a small cell can, and hides the problem right up until deployment.
When it does not work
A transmit burst is around 240 mA on top of everything else, for a fraction of a second. A supply that copes with idle current will not necessarily cope with that. Add a 100 µF capacitor near the board and turn the transmit power down.
USB supplies half an amp with a stiff rail and a battery through a small regulator does not. Test on the supply the project will actually ship with, and do it before designing anything else around the current.
A stalling servo draws close to an amp. It should never be on the board's 3V3 or 5V pin. Give it its own supply and connect the grounds together — this is the single most common power mistake in hobby projects.
A pin is a signal, not a supply. Past about 20 mA it is out of comfortable range and 40 mA is the absolute maximum. A relay coil needs a transistor and a flyback diode between it and the pin.
The same arithmetic over a longer period. How much a cell holds, what the duty cycle spends, and what number to design to.
Battery and power budget →Edit this page — content/esp32/power-and-the-3v3-rail.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.