UPS HAT turning off after 30 seconds to 2.5 minutes

The UPS HAT is turning off after 30 seconds to 2.5 minutes for no apparent reason. It initially did not do this and had ran for over a week initially but early last week we finally received the 18650’s and installed one, the UPS Hat would just turn itself off as described above.

I have been fighting with it this one ever since (we have 6 UPS HATs, 3 have not been tested yet, 2 seem to be working fine but no software or battery has been installed out of fear the same thing will happen). Initially we did not have any of the software configured as the behaviour without the software was fine for our use case (and because we were using just Debian Buster it didn’t want to install anyway).

In troubleshooting this, I have switched to the official full Raspbian release, installed the software as outlined in the Getting Started guide. To accomplish some of this, I ended up powering the Pi directly so that it could run long enough to actually install software.

Later I found the manual firmware upgrade instructions because the pi would not stay running long enough for the remote management to allow a firmware upgrade. I have updated the firmware to the latest available v0.3.22, I am not 100% convinced that the firmware update has been fully applied as the everything powered off during please wait part of the firmware upgrade (see below).

pi@raspberrypi:~ $ python3 update_firmware.py 
1%
2%
3%
4%
5%
6%
[snip]
97%
98%
99%
100%
Firmware packages are being writen to flash...
Please wait until the application starts!
. . . . . . . . . . . . . . . packet_write_wait: Connection to 192.168.20.114 port 22: Broken pipe

I left it for 2 minutes and it did not come back up so I pressed the S1 button to turn it on. It ran long enough to do the following (unfortunately I didn’t time it, but I doubt it was more than 2.5 minutes):
$ ssh pi@192.168.20.114
pi@192.168.20.114’s password:
Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Apr 19 09:07:00 2021
pi@raspberrypi:~ $ python3 read_sensors.py 
************* Input Sensors **************
Traceback (most recent call last):
  File "read_sensors.py", line 7, in <module>
    print("Input Temp: " + str(api.get_input_temp()))
  File "/home/pi/.local/lib/python3.7/site-packages/power_api/power_api.py", line 102, in get_input_temp
    raw[PROTOCOL_HEADER_SIZE : COMMAND_SIZE_FOR_INT32 - 2], "big"
TypeError: 'NoneType' object is not subscriptable
pi@raspberrypi:~ $ python3 read_sensors.py 
************* Input Sensors **************
error in 0
Traceback (most recent call last):
  File "read_sensors.py", line 7, in <module>
    print("Input Temp: " + str(api.get_input_temp()))
  File "/home/pi/.local/lib/python3.7/site-packages/power_api/power_api.py", line 102, in get_input_temp
    raw[PROTOCOL_HEADER_SIZE : COMMAND_SIZE_FOR_INT32 - 2], "big"
TypeError: 'int' object is not subscriptable
pi@raspberrypi:~ $ python3 read_sensors.py 
************* Input Sensors **************
Traceback (most recent call last):
  File "read_sensors.py", line 7, in <module>
    print("Input Temp: " + str(api.get_input_temp()))
  File "/home/pi/.local/lib/python3.7/site-packages/power_api/power_api.py", line 102, in get_input_temp
    raw[PROTOCOL_HEADER_SIZE : COMMAND_SIZE_FOR_INT32 - 2], "big"
TypeError: 'NoneType' object is not subscriptable
pi@raspberrypi:~ $ python3 read_sensors.py 
************* Input Sensors **************
Input Temp: 28.62
Input Voltage: 5.184
Input Current: 0.65
Input Power: 3.369
************* System Sensors **************
System Temp: 38.4
System Voltage: 5.164
System Current: 0.598
System Power: 3.092
************* Battery **************
Battery Temp: 28.0
Battery Voltage: 4.203
Battery Current: 0.0
Battery Power: 0.0
Battery Level: 4
Battery Health: 92
************* Fan **************
Fan Health: 1
Fan Speed: 7545
pi@raspberrypi:~ $ python3 test.py 
LPM: 2
WDT Status: 2
WDT Interval: 4
Fan Mode: 1
Battery Separation: 2
RGB Anim: bytearray(b'\x01\x01\x03')
POWER OUT. STAT: 2
POWER OUT. PARAMS: (25, 5)
Alive Threshold: 250
EDM: 2
LPM: 2
WDT INTERVAL: 4
Power Outage Status: 2
SE ID's: bytearray(b'')
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from power_api import SixfabPower
>>> 
>>> api = SixfabPower()
>>> 
>>> print( "firmware: " + str(api.get_firmware_ver()))
firmware: v0.3.22
>>> print( "clearprogram: " + str(api.clear_program_storage()))
error in 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/power_api/power_api.py", line 1638, in clear_program_storage
    result = raw[PROTOCOL_HEADER_SIZE]
TypeError: 'int' object is not subscriptable
>>> print( "reset_mcu: " str(api.reset_mcu()))
KeyboardInterrupt
>>> print( "clearprogram: " + str(api.clear_program_storage()))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/power_api/power_api.py", line 1638, in clear_program_storage
    result = raw[PROTOCOL_HEADER_SIZE]
TypeError: 'NoneType' object is not subscriptable
>>> print( "clearprogram: " + str(api.clear_program_storage()))
clearprogram: 1
>>> print( "clearprogram: " + str(api.restore_factory_defaults())
... )
clearprogram: None
>>> packet_write_wait: Connection to 192.168.20.114 port 22: Broken pipe

If I boot into firmware update mode (purple L1) the UPS HAT stayed on for over an hour before I tried to flash the firmware.

At this point, I am not sure if I am missing something or it has gone bad somehow.

Thanks,

I just realized I did not say how this was being powered. I have been using two different Canakit USB-C power supply that comes with the Canakit RPi4 (5.1V @ 3.5A). The behaviour is the same.

I just tried a multiport power supply (Kopplen). When using USB-C (which can power my laptop using USB-PD) it behaves the same as with the Canakit power supply. When plugged using the micro b port on the HAT to the QuickCharge 3.0 port (5V 3A) on the Kopplen the Hat runs for much longer, 20-30 minutes (though it has also only ran for 30 seconds twice).

Also Dug my bench power supply and tried power it via J4 @ 14V and it seems to be behaving the same way as when on USB-C (J3).