From Waveshare Wiki
Jump to: navigation, search

UPS HAT (B)for Raspberry Pi.





UPS HAT (B) For Raspberry Pi, 5V Uninterruptible Power Supply, Multi Battery Protection Circuits.


  • Designed for Raspberry Pi series, compatible with Raspberry Pi 3 / 3B+ / 4B, etc.
  • I2C bus communication, monitoring the batteries voltage, current, power, and remaining capacity in real-time.
  • Multi battery protection circuits: overcharge/discharge protection, over current protection, short circuit protection, and reverse protection, along with the equalizing charge feature, more safe and stable.
  • Onboard 5V regulator, up to 5A continuous output current, more sufficient power source for Raspberry Pi.
  • 5V USB output, convenient for powering other boards.
  • Batteries warning indicators, easy to check if the battery is connected correctly.


  • Output voltage:5V
  • Charger:8.4V 2A
  • Control bus:I2C
  • Battery supported:2 x 18650 Li batteries (NOT included)
  • Dimensions:56 × 85mm
  • Mounting hole:3.0mm


UPS-HAT-B-details-3.jpg UPS-HAT-B-details-7.jpg
The 8.4V interface is the charging interface, which uses an 8.4V 2A power supply for charging. 5V OUT is a USB male port that can output 5V power. The 0FF/ON silkscreen is the power switch silkscreen.
Note 1: Please turn the power switch to OFF before you connect the battery, or the board may be damaged because of shorting. After installing, make sure that the Pogo pins are completely aligned with the pin header before turning on the power. If the Pogo pins are not conducting, you can press the pin to loosen it or use a knife to scratch off the oxide layer of the pin header.
Note 2: The board may not work when you mount the batteries for the first time, you need to press the Boot button to activate the circuit.
Note 3: When connecting the battery for the first time, you need to pay attention to whether the WARNING LED is on. If the LED is on, it means that the corresponding battery is connected reversely. Prohibit charging when the battery is connected reversely
Note 4: It is recommended not to exceed 4A when working for a long time and working with a high current. It will heat up when working at 5A for a long time. Pay attention to heat dissipation..
Note 5: To use the power supply configured with the product to charge, using other power sources may cause the product to be damaged due to too large and unstable output power ripple.


  • Li-ion and Li-po batteries are quite unstable. They may cause fire, personal injury, or property damage, if they're not properly recharged or used.
  • Do not reversely connect the polarities when recharging or discharging the battery. Do not use inferior charger/charging panel to recharge the battery.
  • Do not mix use old batteries with new ones, avoid using batteries of different brands.
  • When buying Lithium battery, should always make sure the battery specification is compatible with the expansion board. Choose batteries from formal manufacturer, and ensure the batteries will work stably and safely by aging test.
  • Lithium batteries have limited cycle life, they will also deteriorate as time goes by. Should be replaced with new ones when the batteries reaching their max cycle life, or working over two years, whichever comes first.
  • Should be placed carefully and properly, keep it away from inflammables and explosives articles, away from children, avoid any safety accident caused by careless storage.

How to use

Enable I2C interface

Open the terminal:

sudo raspi-config 
Choose Interfacing Options -> I2C ->yes 

RPI open i2c.png
Then reboot the Pi:

sudo reboot

Run the example

Fix the UPS HAT (B) with Raspberry Pi.
Open a terminal and run the following commands:

sudo apt-get install p7zip
7zr x UPS_HAT_B.7z -r -o./

The terminal will print the IP address, battery voltage, current, and the percentage of battery quantity, as well as the CPU, GPU and memory information after starting the server.
UPS HAT 1.png
Note: if the current value is negative, it means that the batteries are feeding the Raspberry Pi. If the current value is positive, it means that the batteries are charging.


Demo codes



Red light for charging, green light for full, may flash when almost full. The indicator light is off may be a short circuit.


As long as the load is connected will always be red or flashing, and will not turn green, because the charger is always in the state of power supply, there is constant current output.


  • You need to connect and press the boot button to activate the protective circuit.

  • Without other devices and in standby mode, the battery can feed the Pi for about 3 hours after fully charging.

  • The capacity is measured by the battery voltage, it is higher than the actual value if you connect the power adapter for charging.
  • The expected voltage when fully charging is 4.2V, however, the actual voltage will be smaller than it.

  • Negative value means that the battery is discharging and powering the Pi.

  • It is recommended to be fully charged before use; when the battery is full, the indicator on the charger from red to green, and run the program can see the power close to 100%.
  • The pogo pin contact is not good, please reassemble the UPS.



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)