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);
Hi.
I searched for a while and found some suggestions.
Here’s something easy to experiment:
Here’s another suggestion (not so easy):
I hope this helps.
Regards,
Sara
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);
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.