I am building a golf cart and want to install a raspberry PI as dashboard computer for it. For this purpose I am using a Raspberry Pi 4 model B and I have a RPi UPSPack V3 for a ups. I have it wired up so that when I power on the golf cart the UPS gets power and when I turn off the golf cart the power to the UPS gets cut. I would like to set it up now so that the raspberry boots when the UPS gets power and shuts down when the power is disconnected from the UPS (just like a dashboard computer in a car). I'm kind of new to the subjects of UPS so any suggestions would be great.
1 Answer
Have a look at the github repository you posted. At the end it starts talking about connecting the raspberry pi with the UPS via serial. My Chinese are not up to speed unfortunately :) If you open up the 2 .py files in the UPSPACK_V3/UPS_GUI_py/ you can get an idea on how to use their library and how to tell if the power is connected to the UPS.
Line 14
version,vin,batcap,vout = test.decode_uart()
You are interested in the vin variable. If you know that then you can tell the raspberry when to power off...