ESP32 Deep-Sleep Wake-on-Touch

ESP32 sleeps at ~10 µA, wakes when you touch a wire, blinks an LED, sleeps again. Battery lasts months.

Difficulty: Breadboard. Estimated build time: about 30 minutes. Estimated parts cost: about US$9.50. 4-line bill of materials. Compare supplier offers when available. A coin-cell-friendly proximity touch sensor.

Wire the touch electrode and LED

Plug an ESP32 DevKit V1 into the breadboard, straddling the centre channel so all pins are reachable. Connect a 22 AWG solid-core jumper to GPIO 4 (also labelled T0 on the silkscreen) — leave the other end free or terminate it on a square copper pad on perfboard. That free wire is your touch electrode. Connect a 470 Ω resistor between GPIO 2 and the anode of an LED; LED cathode to GND. This is your wake-up indicator.

Calibrate the touch threshold

Flash a quick calibration sketch that prints touchRead(T0) every 100 ms. With your finger off the wire you should see a steady value in the range 50–80 (depends on wire length and ambient humidity). With your finger on the wire the value drops to 10–20. Pick a threshold halfway between — typically 35–40. The values are unitless; the touch peripheral counts oscillator cycles per fixed sample window and a finger detunes the oscillator downward.

Configure deep-sleep wake-on-touch

In setup(), call touchAttachInterrupt(T0, callback, threshold) where threshold is your calibrated value. Then enable touchpad as a wake source with esp_sleep_enable_touchpad_wakeup() and call esp_deep_sleep_start(). On wake, control returns to the top of setup() — there is no loop() execution between sleeps, the chip is truly off.

Verify the power numbers

Hook a USB power meter between your laptop and the DevKit. With the chip asleep, the meter should read 10–20 mA on a stock DevKit — the USB-UART chip and the 3.3 V LDO are the dominant draws, not the ESP32 itself. On a bare ESP32 module fed from a clean 3.3 V supply this drops to ~10 µA. Either way, you have proven the ESP32 wakes reliably on touch and returns to sleep within 200 ms. On a CR2032 coin cell, that’s 12+ months of standby.