So the new Pi has a built in RTC and for $5 I can attach a rechargeable battery that lets the RTC tick on even when the power is cut. This is great because I want to emulate the wake up behavior of an additional device like the often out of stock PiJuice (but at a fraction of the cost).
I learned how to set wakeup alarms with code like this:
$ sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"
$ sudo sh -c "echo `date '+%s' -d '+ 3 minutes'` > /sys/class/rtc/rtc0/wakealarm"
which will set an alarm to turn the pi back on. But I can't find many more details about using this wake alarm
Questions:
If the /rtc0/wakealarm is set to a time in the past, what is the
behavior? Does it ignore it? Does it re-start immediately?Can one set multiple wakealarms at the same time? ie. wake up at 4:20am and 5:45am and 6:30am
Is there an easy way to schedule wakeups in a format similar to cron where I give the wakealarm a format like 0 0 * * 1-5 to tell it to only wake up on weekdays?
linux has a command called rtcwake which seems more featured, but when I tried using examples i found around the internet on a pi, i get errors. Can a pi use rtcwake?
dtoverlay
documentation?. There are some RTC options available there that may interest you. I've not yet tried the Pi5's inbuilt RTC, so I can't comment on that, but I assume it's treated like most of the other RTCs supported in the device tree.