Table of Contents

Here’s how you can wake up the ESP32 from deep sleep using Touchpad T3:

ESP32 Deep Sleep Wake-Up via Touchpad T3

#include <esp_sleep.h>
#include <driver/touch_pad.h>

#define TOUCHPAD_PIN T3  // Touchpad 3 (GPIO15)
#define TOUCH_THRESHOLD 40  // Adjust this value based on sensitivity needs

void callback() {
    Serial.println("Touched! Waking up...");
}

void setup() {
    Serial.begin(115200);
    delay(1000);

    // Initialize touch sensor
    touchAttachInterrupt(TOUCHPAD_PIN, callback, TOUCH_THRESHOLD);

    Serial.println("ESP32 entering deep sleep...");

    // Enable touchpad wake-up
    esp_sleep_enable_touchpad_wakeup();

    // Enter deep sleep mode
    esp_deep_sleep_start();
}

void loop() {
    // This will not execute after wake-up because the ESP32 restarts
}

**How It Works

  1. touchAttachInterrupt()
  • Sets up Touchpad T3 (GPIO15) as an interrupt-based wake-up source.
  • Uses a custom threshold (TOUCH_THRESHOLD) to determine when a touch event occurs.
  • Calls the callback() function when the touchpad is triggered.
  1. Sensitivity Adjustment
  • Lower values = More sensitive (detects lighter touches).
  • Higher values = Less sensitive (requires firmer touches).
  • You may need to experiment with the threshold based on your environment.

Since the TouchPad is used, the ESP32 will enter Deep Sleep Mode, consuming around ~10-150µA.

Categorized in:

Deep Sleep,

Tagged in: