Raspberry Pi 5 includes an RTC module. This can be battery powered via the J5 (BAT) connector on the board located to the right of the USB-C power connector.
You can set a wake alarm which will switch the board to a very low-power state (approximately 3mA). When the alarm time is reached, the board will power back on. This can be useful for periodic jobs like time-lapse imagery.
To support the low-power mode for wake alarms you should edit the bootloader config:
$ sudo -E rpi-eeprom-config --edit
… adding the following two lines.
Reboot Raspberry Pi so the updated EEPROM takes effect:
$ sudo reboot
You can test the functionality with:
$ echo +600 | sudo tee /sys/class/rtc/rtc0/
$ sudo halt
That will halt the board into a very low-power state, then wake and restart after 10 minutes.
The RTC also provides the time on boot e.g. in dmesg:
[ 1.295799] rpi-rtc soc:rpi_rtc: setting
system clock to 2023-08-16T15:58:50 UTC (1692201530)
…which may be useful if you don’t have an internet connection for getting time through NTP.
Adding a backup battery
The official battery part is a rechargeable lithium manganese coin cell, with a pre-fitted two-pin JST plug and an adhesive mounting pad. This is suitable for powering the Raspberry Pi 5 RTC when the main power supply for the board is disconnected, with a power-off current draw measuring in single-digit µA, giving a retention time that can be measured in months.
Enabling trickle charging
Trickle charging of the battery is disabled by default. There are sysfs files that show the current trickle charging voltage and limits:
You can check these values with
cat, for example:
…returns: “0”, the current charging value. If you add
rtc_bbat_vchg to /boot/firmware/config.txt using:
sudo nano /boot/firmware/config.txt
… and add:
…and reboot. Use
cat to investigate the values and you’ll see:
The battery will be trickle charging. Remove the dtparam line from config.txt to stop the trickle charging.