I would like to retain variables and resume where I left off upon awakening, and it looks like Light Sleep mode is good for that. But there is little out there explaining the details of how to implement it. If you know where to find the details, please post a link here.
Hi Steve.
I haven’t experimented with light sleep on ESP32.
I’m not sure if it is implemented on Arduino IDE. There are solutions for light-sleep on ESP-IDF.
Take a look at the following resources that might help:
- https://github.com/espressif/arduino-esp32/issues/475
- https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/sleep_modes.html#entering-light-sleep
Regards,
Sara
Yes, I got light sleep to work in Arduino IDE with:
esp_light_sleep_start();
and in Setup I allowed wakeup by time and button press:
esp_sleep_enable_timer_wakeup(SleepSecs * uS_TO_S_FACTOR);
esp_sleep_enable_ext0_wakeup(WAKEPIN,0); //1 = Low to High, 0 = High to Low. Pin pulled HIGH
Hi.
That’s great that you got it working.
And thank you for sharing your solution! It may be helpful for others!
Regards,
Sara
I ran into a problem with LightSleep with only a timer wakeup event.
esp_sleep_enable_timer_wakeup(SleepSecs * uS_TO_S_FACTOR);
esp_light_sleep_start();
returned immediately; However this worked as expected:
esp_sleep_enable_timer_wakeup(SleepSecs * uS_TO_S_FACTOR);
delay(100);
esp_light_sleep_start();
Regards
Hi everyone,
This discussion inspired me last week, and I have delved a little deeper into the subject to shed some additional light. I’ve written a fairly comprehensive tutorial that should give you a better understanding of how things work:
Experimenting with ESP32 sleep modes
Hopefully you’ll find it useful,
Regards,
Steph