Deep sleep during specific times

You can’t be checking the time while the device is asleep, so you would have to wake it up every 60 seconds to do what you propose. However, there’s no need to do that. Just check the time at some interval while the device is awake, and when it’s 3 PM tell the system to go to sleep until 9 the next morning. Look at mdma’s last post in this [thread][1] to see how to do that. Or, you could simply pass the number of seconds between 3 PM and the following 9 AM, which is 64,800.

if (Time.hour() == 15 && Time.minute() == 0) {
    Sytem.sleep(SLEEP_MODE_DEEP, 64800);
}

Be sure to set your time zone (in setup), with Time.zone().
[1]: Have System.sleep SLEEP_MODE_DEEP wakeup at the same time everday

3 Likes