• 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

Deep Sleep 24hr wakes up premature

Q&A Forum › Category: ESP32 › Deep Sleep 24hr wakes up premature
0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI asked 4 years ago

Hi Rui & Sara,
I am trying to use the deep sleep function, to put the esp32 to sleep for at least 24hr.  unfortunately, when I set the unit to 24hr sleep time, it will wake up at random time between 5min to 10min later.  however, if i set the sleep time to 5, 15, 30, 60 min explicitly, the unit will wake up exactly on time as programmed. this only happens when set to 24hr. any idea to fix this or possibly board problem?
//declare constants

#define SAMPLING_LIMIT 100 // default no of sample data per second
#define CI_CUT_OFF 43200 // current interruptor gross time submission deadline
#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 86400 // Time ESP32 will go to sleep (in seconds); default = 1 day */
#define WDT_TIMEOUT 120 // seconds WDT */
#define UTC_TO_KL 28800 // 8-hours, set to local time

//set external RTC interrupt
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36,0); //1 = High, 0 = Low
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);

Question Tags: Deep sleep
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
 
I searched for a while and found some suggestions.
Here’s something easy to experiment:

  • https://www.esp32.com/viewtopic.php?t=17607

Here’s another suggestion (not so easy):

  • https://forum.arduino.cc/t/esp32-deep-sleep-is-24h-sleep-effectively-possible/677173

 
I hope this helps.
Regards,
Sara

0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI answered 4 years ago

Hi Sara,
Thanks for your search. I am testing something like below now. so far, it has been few hours and no false wake up yet.  I set it to wake up at 11pm tonite. we’ll see how it goes.
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36,0); //1 = High, 0 = Low
uint64_t TIME_TO_SLEEP = 18000;
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);

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

Ok.
Then, let me know the results.
Regards,
Sara

0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI answered 4 years ago

Hi Sara,
tested the esp32 internal timer for 29700 sec @ 8hours 15min..deep sleep at 23:15h, woke up at 07:25, 5mins drift
I’ll use DS3231 RTC for long sleep n wake then.

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

Hi.
Yes, for better results, many people recommend using an external RTC instead.
Regards,
Sara

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.