[](Product Link)

Introduction

DFRobot Raspberry Pi UPS HAT is an uninterruptable power supply shield for Raspberry Pi, compatible with Pi 2/3/A+/ZERO/ZERO W(not support Raspberry Pi 3B+) . It can provide steady power source to Raspberry Pi for an extended period of time when the system is powered-off, by which to avoid system damage and assure safe shut down. In addition, the product could be used to supply stable power for some applications requiring mobility such as, Raspberry Pi camera, tablet PC and field data collection system.

A MAX17043 fuel gauge is adopted in this product for accurate power detection. Besides, we also employed an on-board microcontroller (MCU) for data processing. In this way, Raspberry Pi board is able to directly get information of power capacity and battery voltage via I2C communication. 5 on-board LEDs on the shield could show the status of the battery power visually without programming.

We adopted an excellent power management solution in this Raspberry Pi UPS HAT. Over 90% power conversion efficiency and non-dioded design make the shield able to keep low heating temperature even under continuous high load operation of Raspberry Pi.

warning_yellow.pngNotes:

  1. 3.7V Lithium Battery is not included in the package due to transportation constraints.
  2. Please use 3.7V Lithium Battery that meets standard specification.
  3. Please note that there would be a certain degree of heating in the power source area of the product during operation, you can never be too careful in use.
  4. Not support Raspberry Pi 3B+.

Specification

Dimension

Pinout

IMG2: Raspberry Pi UPS HAT Bottom View

IMG3: Raspberry Pi UPS HAT Top View

Serial Number Function Description Status Description
1 USB charge interface Charge by 5V DC
2 Charging Indicator ON: in charging Blinking: battery is not detected OFF: uncharged
3 Function Keys Query Electric Quantity
4 Electric Quantity Indication Indicating Present Power Status
5 Li-ion Battery Solder Point Solder Li-on Battery
6 Raspberry Pi 40Pin Socket Connect Raspberry Pi
7 Button When in uncharged state, press the button once, and the indicator will show the current battery power for 10 seconds.

LEDs vs Electric Quantity

Electric Quantity(EQ) LEDs Status(uncharged) LEDs Status(in charging)
EQ<10% The first LED flashes slowly(about at a frequency of 3Hz) The first LED flashes quickly(about at a frequency of 6Hz)
10%≤EQ<20% The first LED is on The first LED flashes quickly(about at a frequancy of 6Hz)
20%≤EQ<40% The first two LEDs are on The first LED is on, and the second LED flashes quickly (about at a frequency of 6Hz)
40%≤EQ<60% The first three LEDs are on The first two LEDs is on, and the third LED flashes quickly(about at a frequency of 6Hz)
60%≤EQ<80% The first four LEDs are on The first three LEDs is on, and the fourth LED flashes quickly(about at a frequency of 6Hz)
EQ≥80% 5 LEDs are on The first four LEDs is on, and the fifth LED flashes quickly(about at a frequency of 6Hz)

Note: in order to protect the lithium battery from over discharge when there is no enough power from USB, we set that when the battery power is lower than 10%, the power supply from UPS to Raspberry Pi will be cut down whether it is in charging or not. The power supply will not be resumed unless the battery power is back up to above 10%.

Register Description

Register Name R/W Data Range Default Value Description
0×00 Device address R/W 1-127 0×10 I2C Slave address. The default address is 0×10. If the address is changed, the new address will be valid after repowering the module
0×01 PID R 0×DF Product ID
0×02 VERSION R 0×10 Hardware Version
0×03 Voltage Value Register high-order bits R 0×00 LSB is 1.25mV, and combine with voltage value register high-order bits into a 12 bits voltage value. VCELL_H=0×0A, VCELL_L=0×50, VCELL=0×0A50*1.25=3300mV
0×04 Voltage Value Register low-order bits R 0×00 LSB is 1.25mV, and combine with voltage value register high-order bits into a 12 bits voltage value. VCELL_H=0×0A, VCELL_L=0×50, VCELL=0×0A50*1.25=3300mV
0×05 Electric Quantity High-order bits register R 0×00 LSB is 0.003906% of Electric Quantity. For example: SOC_H=0×3C, SOC_L=0×FF, SOC=0×3CFF*0.003906≈60.99%
0×06 Electric Quantity low-order bits register R 0×00 LSB is 0.003906% of Electric Quantity. For example: SOC_H=0×3C, SOC_L=0×FF, SOC=0×3CFF*0.003906≈60.99%

Tutorial

How To Enable Raspberry Pi I2c Interface?

Normally, Raspberry Pi’s I2C interface is default to be disabled. Set it to enable manually so as to access the related data of DFRobot Raspberry Pi UPS HAT(such as battery capacity and set turn-on time) via I2C bus.

Enable I2C Interface

Input command to the terminal: sudo raspi-config, select [Interfacing Options](or[Advanced Options])->[I2C]->[Yes]->[OK]

Step 1

Step 2

Step 3

Step 4

Reboot Raspberry Pi after finishing configuration(command: reboot)

Check if I2C interface configuration is ok.

Check if I2C interface configuration is ok by Ismod, seen as below.

Step 5

Install tool to test I2C device

Command:

sudo apt-get install i2c-tools

Test if the installation is ok:

sudo i2cdetect -y l

Step 7: detected I2C device on the bus

If a problem like this appeared:

No devices are connected

Then change raspi-blacklist.conf configuration, raspi-blacklist.conf is under /etc/modprobe.d/  directory, input command:

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Add “#” to i2c device driver, such as:#blacklist i2c-bcm2835. Now I2C interface is enabled.

Check UPS Electric Quantity

Create ups.py file, and input the following the content:

import smbus
addr=0x10 #ups i2c address
bus=smbus.SMBus(1) #i2c-1
vcellH=bus.read_byte_data(addr,0x03)
vcellL=bus.read_byte_data(addr,0x04)
socH=bus.read_byte_data(addr,0x05)
socL=bus.read_byte_data(addr,0x06)

capacity=(((vcellH&0x0F)<<8)+vcellL)*1.25 #capacity
electricity=((socH<<8)+socL)*0.003906 #current electric quantity percentage

print("capacity=%dmV"%capacity)
print("electricity percentage=%.2f"%electricity)

Input python3 ups.py to the terminal to check the electric quantity information.

FAQ

Q&A Some general Arduino Problems/FAQ/Tips
A Please click the topic link on DFRobot Forum.
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Raspberry Pi UPS HAT from DFRobot Store or DFRobot Distributor.

Turn to the Top