3.1 ESP32 Deep Sleep

less than 1 minute read

ESP32 Deep Sleep


Tutorials_Site

Power Mode

  1. Active mode
  2. Modem Sleep mode
  3. Light Sleep mode
  4. Deep Sleep mode
  5. Hibernation mode

Wake Up Sources

  1. Timer
  2. Touch pins
  3. ULP co-processor
  4. external wake up

Timer Wake Up

esp_sleep_enable_timer_wakeup(time_in_us)


time_in_us <- microSeconds
5㎲ * 1,000,000 = 5 s

RTC memory

RTC_DATA_ATTR int bootCount = 0;


Deep Sleep start

esp_deep_sleep_start()



Touch Wake UP

Sensitivity

#define Threshold 40


Get touchPin status

touchPin = esp_sleep_get_touchpad_wakeup_status();


T0 ~ T9

Setup touch interrupt

touchAttachInterrupt(T3, callback, Threshold); 


T3 -> GPIO15
callback function

  1. asleep -> not working
  2. awake -> hold the touchPin -> working

Confirm touch

esp_sleep_enable_touchpad_wakeup();


External Wake Up

BitMask

#define BUTTON_PIN_BITMASK 0x200000000


bitmask -> Pin binary registry -> hex

ext0

esp_sleep_enable_ext0_wakeup(GPIO_NUM_X, level);


onePin and (HIGH or LOW)

ext1

esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK,ESP_EXT1_WAKEUP_ANY_HIGH);


BITMASK -> Serveral Pins
ESP_EXT1_WAKEUP_ANY_HIGH -> Press any button to High


Go to top

Leave a comment