I would like to put a ESP32 in deep sleep and Wake up it both by timer or by gpio (ext0 mode)
Then I “merged” the “Learn ESP32 with Arduino IDE” module 3 unit2 and unit4 sketches.
Easy to do, the sketch compiles and uploads well, but the ESP32 reboots at wake up : when I use a gpio pin to awake it, the timer counter content is reset and I desynchronize my timer wake up.
Any ideas to fix the problem ?
Have a good day
You can use an external RTC module to keep track of time. Like this one, for example: https://makeradvisor.com/tools/real-time-clock-module-ds1307/
If your ESP connects to WiFi after deep sleep, you can get the current NTP time and compare it with the last NTP time to put the ESP in deep sleep for the remaining time. https://randomnerdtutorials.com/esp32-ntp-client-date-time-arduino-ide/
There is a library to keep track of time during deep sleep, but it is for ESP IDF: https://github.com/espressif/esp-idf/tree/master/examples/protocols/sntp/
How are you keeping track of time in your project?