Raspberry Pi 5 RTC Battery

Raspberry Pi 5 RTC Battery

Raspberry Pi 5 Installation RTC Battery 


 RTC Battery Explanation :

  • This rechargeable lithium battery is designed to be used with Raspberry Pi 5 to power the onboard real-time clock (RTC) whenever mains power is disconnected. It comes with a compatible connector for the dedicated backup battery header on the Raspberry Pi 5 board (labelled 'BAT', next to the USB-C connector).
  • The power-management IC used on Raspberry Pi 5 integrates a real-time clock and charging circuitry for these button cells, which can power the clock while mains power is disconnected, and will also recharge the battery when power is connected.
  • RTC module includes a crystal oscillator that generates a stable clock signal (32 kHz). This signal is divided to provide accurate seconds, minutes, hours, days, months, and years. When the Raspberry Pi 5 boots up, it reads the time and date information from the RTC module.
  • The RTC continues to keep track of time, ensuring that the system always has an accurate reference, even if there are power interruptions or reboots. And this works even if it’s not hooked up to the internet or a Network Time Protocol Server.
  • In the absence of an external power source, the estimated battery operating life is six months.


Applications of RTC :

  • Memory Backup, RTC backup including :
  • Drive recorders, PCs, Communication/radio, Medical equipments, FA equipments and others.
  • RTC can often be programmed to generate alarms or wake-up signals at specific times.
  • It helps to ensure the operating system runs properly, even when your Pi is offline
  • It can guarantee timestamps, log files, and scheduled tasks


Example applications :

  1. Cat/dog recognition camera for a pet door. A pet door that uses a camera to recognize the animal before opening door.
  2. Security cameras or animal cams. When it senses movement, it can wake up, snap a photo, and then go back to sleep.




The 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. See photo below.



1. Insert the jst connector of RTC battery to the J5 connector as shown above.

2. Power up the Raspberry Pi 5.

3, Open terminal and type :


sudo nano /boot/firmware/config.txt



4. In the config.txt directory. Go to the bottom of the text file. Under [all] . Insert the command :


5. Press CTRL + X to exit and save the changes.


Wake Alarm


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.




You can test the functionality with:

echo +600 | sudo tee /sys/class/rtc/rtc0/wakealarm

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)



The RTC is still usable even when there is no backup battery attached to the J5 connector.


Enabling battery charging


The RTC is equipped with a constant-current (3mA) constant-voltage charger.


Charging of the battery is disabled by default. There are sysfs files that show the charging voltage setpoint and limits:






If you add rtc_bbat_vchg to /boot/firmware/config.txt:



…​and reboot, you’ll see:






The battery will be charged at the set voltage. Remove the dtparam line from config.txt to stop charging.


Hardware Components