Raspberry Pi 5 UPS-DFRobot

Raspberry Pi 5 UPS


This is an uninterruptible power supply (UPS) expansion board specifically designed for Raspberry Pi 5. It can be used as a mobile power supply, providing a stable 5V output with a maximum of 5A. Its enhanced power management system can intelligently monitor the power status of Raspberry Pi 5 and automatically cut off power when Raspberry Pi 5 shuts down, thereby increasing usage time and battery lifespan. It supports power outage and power adapter failure detection, and can automatically switch to UPS power supply in the event of a power outage or adapter failure. It can power on automatically when power is restored and can be completely shut down through software and I2C battery level detection. The automatic shutdown voltage can be set. Additionally, it supports fast charging with a maximum charging voltage of 3A, enabling quick charging. It is suitable for mobile power supply for Raspberry Pi 5 in various applications such as smart cars, outdoor equipment setups, and detection scenarios.

safety Instructions & warnings




Hardware description

Raspberry Pi GPIO used

PIN GPIO Functions
3 GPIO2 I2C-SDA,battery fuel-gauge systems-reading battery voltage and percentage
5 GPIO3 I2C-SCL,battery fule-gauge systems-reading battery voltage and percentage
31 GPIO6 AC power loss & power adapter failture detection,Low-power supply failed,High-power supply OK
36 GPIO16 Control battery charging,High-charging disabled,Low-charging enabled

Battery voltage level indicators

Battery voltage range(V) D1 D2 D3 D4 Remark
3.87-4.2 ON ON ON ON discharging levels of 100%
3.7-3.87 ON ON ON OFF discharging levels of 75%
3.55-3.7 ON ON OFF OFF discharging levels of 50%
3.4-3.55 ON OFF OFF OFF discharging levels of 25%
Below 3.4 OFF OFF OFF OFF low battery

Hardware installation

Software Tutorials

Editing the EEPROM configuration

1.From the command line or Terminal window start by running the following command:

sudo rpi-eeprom-config -e

Change the setting of POWER_OFF_ON_HALT from 0 to 1 ,Add PSU_MAX_CURRENT=5000 at the end of the file that reads like this:

2.Reboot your Raspberry Pi 5 to make the change take effect.

sudo reboot

Configuring the Raspberry Pi for I2C

1.Open I2C through graphical interface or command line

2.Update your Pi and Install the required dependencies

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python3-pip

3.Download the required scripts

git clone https://github.com/suptronics/x120x.git

4.Reboot the Raspberry Pi

sudo reboot

The Raspberry Pi will reboot and the interface will be enabled.

5.Once you have logged into your Raspberry Pi from the command line, run the command to see all the connected devices

sudo i2cdetect -y 1

the address of the battery fuel gauging chip

Reading battery voltage & percentage

1.Run the command to read battery voltage and percentage

sudo python3 bat.py

2.Change the battery low voltage to implement safe shutdown. default is less than 3.20Vdc.

 sudo vi bat.py

Note: the voltage range must be 3.00~4.10vdc.

AC Power loss or power adapter failure detection (PLD)

Execute the command to initiate power loss detection (PLD)

sudo python3 pld.py

Disconnect the power adapter and observe the detection of the power loss.

More Documents