• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

How to use ESP32 Light Sleep?

Q&A Forum › Category: ESP32 › How to use ESP32 Light Sleep?
0 Vote Up Vote Down
Steve asked 6 years ago

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.

Question Tags: Deep sleep, ESP32, light sleep
6 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

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

0 Vote Up Vote Down
Steve answered 6 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi.
That’s great that you got it working.
And thank you for sharing your solution! It may be helpful for others!
Regards,
Sara

1 Vote Up Vote Down
ROSW answered 5 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Thanks for sharing that! 🙂

0 Vote Up Vote Down
Steph answered 5 years ago

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

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.