Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
The UPS HAT (E) is an uninterruptible power supply (UPS) expansion board specially designed for the Raspberry Pi series. Onboard battery meter chip, fast-charging chip, and high-power buck chip which can provide high-power input and output as well as monitor the operating state of the module via the I2C interface.
The USB Type C interface is the bidirectional recharging interface and supports recharging and output with a maximum power of 40W. USB Type A interface is the 5V output interface, the LED is the fast-recharging indicator and turns on when it is in the fast recharging state. 0FF/ON is the power switch silkscreen.
Note 1: Do not charge when the battery is connected reversely. Reversing the battery connection may damage the battery protection chip.
Note 2: When assembling the battery, please follow the V1-V2-V3-V4 order to install. Otherwise, the reverse connection may turn on the warning indicator. The disassembled battery needs to be connected to the charger to charge in order to activate the output.
Note 3: After replacing the battery, it needs to complete several full charge/discharge cycles, so that the chip automatically calculates the battery parameters, and the capacitance is more accurate.
Note 4: The actual output current of the module can be up to 10A, due to heat dissipation reasons, it is recommended that the use of no more than 6A, and the use of larger currents should be added to the active cooling.
Note 5: Due to the battery type and temperature effects, the battery capacity may be inaccurate, to determine whether the voltage is charged or not should be based on voltage values.
sudo raspi-config Select Interfacing Options -> I2C -> yes to enable i2C kernel driver
And then reboot the Raspberry Pi:
sudo reboot
To demonstrate this demo on the Raspberry Pi, you only need to insert the module into the Raspberry Pi headers or connect it to the I2C interface of the Raspberry Pi via a cable with VCC connected to 3.3V.
Enter the following command to run the demo:
sudo apt-get install p7zip wget https://files.waveshare.com/wiki/UPS-HAT-(E)/UPS_HAT_E.7z 7zr x UPS_HAT_E.7z -r -o./ cd UPS_HAT_E python3 ups.py
The demo will output values such as battery voltage, current, power and the remaining battery capacity percentage after it runs.
The negative VBUS current value indicates type-c output current and the positive one indicates input current. If the battery current is negative, it indicates the battery output current (which can be the Raspberry Pi load current), and if the battery current is positive, it indicates the battery charging current.
When the system load is high and the battery voltage is low, it is undesirable to see that the battery current may be insufficient, leading to continuous system restarts. In practical applications, you can prevent this by shutting down the system automatically when the battery voltage is too low.
In the example demo, battery voltage checking has been added. If the battery voltage is too low and there is no external charging power, the demo will shut down the system within 60 seconds.
The demo will display the following statement to indicate that the battery voltage is too low, and it is necessary to charge it promptly, otherwise, the demo will shut down automatically:
Voltage Low, please charge in time, otherwise, it will shut down in 58 s
Open the terminal and execute:
cd ~/UPS_HAT_E DISPLAY=':0.0' python3 batteryTray.py
Run the demo to display the upper right corner of the battery logo. If it does not display and the demo does not report errors, you should check the I2C interface and the installation of libraries.
After reboot the battery logo appears in the upper right corner indicating that the setup is successful, mouse over the battery icon position will show the battery level, voltage and charge.
When the battery level drops below 5%, a low battery warning will appear. After 60 seconds, it will power off automatically.
If it has no effects, you can test as below:
cd ~/UPS_HAT_E ./main.sh #Do not add "sudo" sudo reboot
The Raspberry Pi 5 will detect the PD protocol at Type-C interface, and it will limit the current to 3A if the protocol is not detected and display the following prompts:
Run the following commands to open "eeprom" to edit:
sudo rpi-eeprom-config --edit
Add the following settings to remove the 3A current limit, and provide 5A current.
PSU_MAX_CURRENT=5000
When a low voltage is detected, you can use a demo to control the Raspberry Pi to save data before shutting down, thereby avoiding data loss due to sudden power loss.
However, after the Raspberry Pi shuts down while still powered, it will not automatically restart when power is applied again. But you can enable this function through I2C setting.
To detect I2C addresses, open the terminal and execute the following command.
i2cdetect -y 1
0x2D is the I2C address of IMU chip. Run the following commands, you can check the register values, and the corresponding values of registers with the addresses 0x00, 0x01 respectively are 0x0a and 0x0b.
After changing the value of the 0x01 register to 0x55, the MCU will disconnect the Raspberry Pi power supply after 30s, and detect the charging port after 60s. If it is charged, it will automatically reboot the Raspberry Pi.
Run the following commands to set the 0x01 register as 0x55.
i2cset -y 1 0x2d 0x01 0x55
Note 1: The Raspberry Pi needs to be turned off immediately after setting 0x01 to 0x55, otherwise, the data may get lost after it powers off in 30s.
Note 2: The start when power applied function has been added to the sample demo.
21700 Lithium batteries with an outline diameter of 21mm and a height of 70.0mm. The standard voltage is 3.7V and the voltage is 4.2V after fully charged.
Negative indicates output current and positive is input current. Positive battery current indicates charging and negative battery current indicates discharging.
Install i2c-tools. To check the I2C address easily, you can input the following commands in the console:
sudo apt-get install i2c-tools
After installation, you can check the I2C address with the following commands:
sudo i2cdetect -y 1
If it is not recognized:
It is recommended to lock the screws and solder the pin headers for better contact.
The Pi 5 will detect the power of the USB power supply. If the USB power supply is not applicable, the current would be limited. You can add the following command to the /boot/firmware/config.txt file to solve:
usb_max_current_enable=1