Raspberry Pi 5 18650 Battery UPS HAT (5.1V 5A) (FIT0992)

This is a placeholder topic for “Raspberry Pi 5 18650 Battery UPS HAT (5.1V 5A)” comments.

The 5.1V 5A Raspberry Pi 5 power supply UPS HAT features a 4-cell 18650 battery holder for extended operation. Offers seamless power switching, automatic…

Read more

Going through the process of getting this to work on a Pi 5 and the pro’s & con’s.
The DFRobot Wiki and Tutorial are excellent. As with all DFRobot products it is well made and does what it is supposed to do without any fuss or detailed need to set it up.

The Pi has an AI board and a Camera. The plan is to place it on top of a Robot Cart to move it around as it processes images. Hence the battery pack to keep it running. The Pi will be remotely accessed via WiFi and a VNC link to display image processing.
The Pi consumes about 0.5A idle and probably more when the AI is running and remotely accessed. I estimate maybe 2 to 3 hours of usage before a recharge. Hopefully more.

In initial testing to see how the UPS works and how best to use it I came up against the almost charged condition of a Lithium battery, the trickle charge state. Where the charging chip will continually try to reach 100% when it really does not need to. My phone can be set to charge to 80% then stop or charge to 100%. My understanding of Lithium battery charging is that to continually trickle charge will eventually reduce the life of the battery.

In the case of this battery pack, if it has external power all the time and the Pi is powered on and off the trickle charge does NOT occur. But if external power is lost and the Pi is powered off, ie no drain on the UPS it will still fall into the trickle charge state on power up. Checking the power with the Pi shows it does not need to be in this state.
If it is used purely as an UPS to keep power to the Pi when external power fails, it will work well but takes longer charging if the Pi is on.

I think the best way to handle this situation is for the Pi to monitor the charging and disable it when the capacity is high enough, just like my phone does. This seems the best way to use it in my opinion.

DFRobot have provided a number of Python scripts to check the battery state. I intend to modify these to check for battery state and enable or disable charging as necessary. Running it as a CRON job or something.

Will post results of that when I have it working.

Cheers
Jim

PS I hope this may be of use to someone.

6 Likes

Well first post is a wall of text, not ideal.
After playing with this board, I am impressed.
It is well made and works nicely, UPS switching is seamless as it should be, the status is easily accessible and works out of the box no setup.

Highly recommend using the Pi to control the charging. The board on its own will continually try to trickle charge the batteries.
Below is the program I run from /etc/rc.local each time the Pi boots up.
It disables charging if over 90%. Unable to get it to reliably start charging at 30% and continue up to 90%. Will manually control charging for now.

Very good board so far.

Cheers
Jim

import struct
import smbus2
from gpiozero import InputDevice, Button

CHG_ONOFF_PIN = 16                                 # GPIO 16 High - disable charge, Low - enable charge
PLD_BUTTON = Button(6)                             # down = fail, up = pass

bus = smbus2.SMBus(1)
address = 0x36                                     # i2c address of status register

capacity_read = bus.read_word_data(address, 4)     # word 4 = capacity
capacity_swapped = struct.unpack("<H", struct.pack(">H", capacity_read))[0] # big endian to little endian
capacity = (int(capacity_swapped/26.2))/10         # convert to 1-100% scale, 1 decimal point
print('Battery Capacity % = ',capacity)

if PLD_BUTTON.is_pressed:
    InputDevice(CHG_ONOFF_PIN,pull_up=True)
    print('No AC power')
    print('Disable Charging')
else:
    print('AC power OK')
    if capacity >= 90:                                 # up / high = disabled
        InputDevice(CHG_ONOFF_PIN,pull_up=True)
        print('Disable Charging')
4 Likes

Cheers for the research Jim (and posting it).

Been looking at this exact board to make a Pi 5 Cyberdeck for a while, might be borrowing some of that code!

2 Likes

That’s correct, but it’s probably not what’s happening.

If the charger cutoff voltage is 4.2V and the battery is at 4.2V then no charging is taking place. But if there is some measured trickle charge current it’s because there is a load on the battery, even if it’s only the load that of the voltage monitoring plus the small internal leakage. That will cause the voltage to drop, the charger will cut in and top it back to 100%, and the cycle repeats. So what is often seen as a trickle charge is really just the charger topping up the battery to keep it at full charge. The ‘rule’ about not trickle charging is more about safety: not leaving a LiOn battery on a charger any longer than is actually required, or whilst unattended.

Whether ‘full charge’ should be 100% of the battery capacity or some lower figure is a different question. For a battery that undergoes significant charge/discharge cycles it probably doesn’t matter - it’s not going to be at 100% for any appreciable time. For a battery that mostly sits at the fully charged state then there is some advantage to setting that state to less than 100% of battery capacity.

3 Likes

Never been a fan of Pogo Pins and this came to bite me with this board.
Thought I had broken the I2C interface as it was not showing up.
(changed boards, 2GB is not enough for AI, 8GB works fine)

Turned out one of the I2C pogo pins was not making contact, although it had been ok on the first board. Checking the pin it seem duller than the others, cleaned it up and now works ok.

Along with this be careful when connecting the Pi 5 to the battery board, tighten all 4 connectors in sequence to ensure all pogo pin connect correctly, that may have been the problem anyway.

Cheers
Jim

1 Like