Why does ESP32 not wake up from deep sleep?
When deep sleep wake fails, it's usually not “mystery firmware.” It's almost always one of these: wrong pin, wrong wake mode, floating input, or power dropping out.
1) You picked a pin that can't wake from deep sleep
GPIO wake from deep sleep requires RTC-capable pins. Not every GPIO works. If you picked a random pin because it was “free,” that's the first thing to fix.
2) The wake pin is floating
If your wake source is a button or sensor output, don't leave it floating. Use pullups/pulldowns so the pin sits at a known level while sleeping.
- Button to GND: INPUT_PULLUP + wake on LOW
- Button to 3.3V: pulldown + wake on HIGH
3) EXT0 vs EXT1 mismatch
- EXT0 is one pin, one level (HIGH or LOW).
- EXT1 is a set of pins and an ANY/ALL rule.
If you coded EXT1 but wired like EXT0 (or vice versa), it'll never behave the way you expect.
4) It “wakes,” but you think it didn't
Remember: deep sleep wake is a reboot. If your code immediately goes back to sleep, it can look like it never woke. Print wake cause right at boot.
#include <esp_sleep.h>
void setup() {
Serial.begin(115200);
delay(200);
Serial.print("Wake cause: ");
Serial.println((int)esp_sleep_get_wakeup_cause());
// keep it awake for a moment so you can see output
delay(1500);
}
void loop() {}5) Power is dropping out (brownout or battery sag)
If the ESP32 is browning out, it can reset in weird ways that look like “wake failure.” Make sure the supply is stable and add bulk capacitance near the board.
When wake doesn't work: verify the wake pin is RTC-capable, add pullups/pulldowns, confirm EXT0 vs EXT1 logic, and print the wake reason on boot. If it's flaky during WiFi or load changes, fix power next.
Related: Wake sources (timer/touch/GPIO) · Deep sleep basics · Brownout detector reset