That’s covered in the esp32 datasheet
But, here’s some stuff to note:
- The ESP32 Thing Plus uses the ESP32 WROOM module, which has RTC GPIOs that can be used for ext1 wake-up.
- For ext1 wake-up, you can use multiple RTC GPIOs. On the ESP32, the following pins can be used as RTC GPIOs: 0, 2, 4, 12-15, 25-27, 32-39.
- To use ext1 wake-up, you need to:
- Configure the desired RTC GPIOs
- Enable ext1 as a wake-up source
- Set the wake-up mode (ALL_LOW or ANY_HIGH)
- Put the ESP32 into deep sleep
- Here’s a basic code example for using ext1 wake-up:
#include <esp_sleep.h>
void setup() {
Serial.begin(115200);
// Configure RTC GPIO (e.g., GPIO39 and GPIO36) as wake-up sources
esp_sleep_enable_ext1_wakeup(((uint64_t)1 << 39) | ((uint64_t)1 << 36), ESP_EXT1_WAKEUP_ANY_HIGH);
Serial.println("Going to sleep now");
esp_deep_sleep_start();
}
void loop() {
// This will never be reached
}
This example uses GPIO 36 and 39 as wake-up pins.
-
The SparkFun ESP32 Thing Plus board may not explicitly label which pins are RTC GPIOs, but you can refer to the ESP32 datasheet or pinout diagrams to identify them.
-
When using ext1 wake-up, remember that only RTC peripherals are powered during deep sleep, so you may need to reinitialize other peripherals after waking up