I am using the ArduinoLowPower library to put the MKR board into sleep and just recognized, that millis() does not count while in sleep. What other options do I have except an external RTC attachment (suggested in stackoverflow forum)?
The LowPower docs on deep sleep actually say, that the RTC clock is still running while in sleep (here) but I couldn't find a way to access it.
I was also thinking of IDLE mode, but since I am running on Battery, I would like to save as much energy as possible. Could anybody tell me the power differences, no info found.
The above works well. But I recognized that the millis() function is not continuing to count during sleep. But now I am using the RTC clock which works well.
My datasheet from a SAMD21 has table 16-4 (Sleep Mode Overview) in section 16.6.2.8 Sleep Mode Controller. That table lists which clocks are running in the various sleep modes.
Thats going to be specific to the particular Arduino, what it uses for a regulator, USB interface other bits and bobs etc. Unfortunatly all to often board manufacturers seem to keep quite about thier board deep sleep currents.
The SAMD21 itself is capable of very low power RTC deep sleep. Oqn the XIAO, if you remove the green power LED, the deep sleep current is around 5uA.
And if the
LowPower.deepSleep(milliseconds);
Is not quite your thing, you can use the RTC to set the time, then set an alarm to wake it up at some time in future. Deep sleep current is the same as the deepSleep() command.