geeekpi / upsplus

UPS Plus is a new generation of UPS power management module. It is an improved version of the original UPS prototype. It has been fixed the bug that UPS could not charge and automatically power off during work time. It can not only perform good battery power management, but also provide stable voltage output and RTC functions. At the same time,it support for FCP, AFC, SFCP fast charge protocol, support BC1.2 charging protocol, support battery terminal current/voltage monitoring and support two-way monitoring of charge and discharge. It can provide programmable PVD function. Power Voltage Detector (PVD) can be used to detect if batteries voltage is below or above configured voltage. Once this function has been enabled, it will monitoring your batteries voltage, and you can control whether or not shut down Raspberry Pi via simple bash script or python script. This function will protect your batteries from damage caused by excessive discharge. It can provide Adjustable data sampling Rate. This function allows you to adjust the data sampling rate so that you can get more detailed battery information and also it will consume some power. The data sampling information can communicate with the upper computer device through the I2C protocol. UPS Plus supports the OTA firmware upgrade function. Once there is a new firmware update, it is very convenient for you to upgrade firmware for UPS Plus. The firmware upgrade can be completed only by connecting to the Internet,and execute a python script. Support battery temperature monitoring and power-down memory function. UPS Plus can be set to automatically start the Raspberry Pi after the external power comes on. The programmable shutdown and forced restart function will provide you with a remote power-off restart management method. That means you don’t need to go Unplug the power cable or press the power button to cut off the power again. You can set the program to disconnect the power supply after a few seconds after the Raspberry Pi is shut down properly. And you can also reconnect the power supply after a forced power failure to achieve a remote power-off and restart operation. Once it was setting up, you don't need to press power button to boot up your device which is very suitable for smart home application scenarios.
https://wiki.52pi.com/index.php?title=UPS_Plus_SKU:_EP-0136
MIT License
73 stars 25 forks source link

[Firmware v.9] Protection Voltage Reset (and other parameters) #60

Closed ClaxiVa closed 7 months ago

ClaxiVa commented 3 years ago

So basically for some reason the Protection voltage just resets itslef to the default 3700mV once in a minute, exactly at 01 second of every minute.

Also what's the point in setting Protection voltage same as Empty voltage?

And while in case with Protection voltage I'm able to rewrite it for at least a minute, I can do nothing with Empty voltage, it accepts arguments through i2c but the result is the same – 3700mV for Empty voltage. That's why my RasPi4 turns off when I have 2 LEDs saying my UPS is only half-way empty, lol

And the same goes to the Sampling period btw – unable to change it.

https://user-images.githubusercontent.com/59376597/127082337-b516546d-4cc8-4886-9ecf-fc9690272e5a.mp4

ClaxiVa commented 3 years ago

I tried to roll back to v7 and it still behaves strangely (once in couple of minutes it rewrites Protection voltage to 3700 but then rewrites it back to the value I typed in by itself), but at least Protections voltage seems fine. Yet Empty voltage still stays at 3700 and it pisses me off: judging by LEDs the UPS knows the batteries are only half-way empty, but anyways the system turns off at 3700mV

nickfox-taterli commented 3 years ago

There may be default scripts in the crontab that are modifying this parameter.

ClaxiVa commented 3 years ago

I've checked that, there were some from /bin directory (upsPlus and upsPlus_iot), but even after removing those from crontab and rebooting the system Protection voltage rolls back to 3700 every minute

UPD. By the way I've noticed that Back-to-AC function is also set back to "on" by itself

bchwtz commented 3 years ago

I had the same issue due to the cronjobs being called both from user piand root. Disabling (just commenting them out) resolved this problem. Here is what my crontab looks like now.

pi@raspberrypi:~ $ crontab -l
#* * * * * /usr/bin/python3 /home/pi/bin/upsPlus.py > /tmp/upsPlus.log
#* * * * * /usr/bin/python3 /home/pi/bin/upsPlus_iot.py > /tmp/upsPlus_iot.log
pi@raspberrypi:~ $ sudo crontab -l
# ROOT Crontab
#* * * * * /usr/bin/python3 /root/bin/upsPlus.py > /tmp/upsPlus.log
#* * * * * /usr/bin/python3 /root/bin/upsPlus_iot.py > /tmp/upsPlus_iot.log
ClaxiVa commented 3 years ago

I had the same issue due to the cronjobs being called both from user piand root. Disabling (just commenting them out) resolved this problem. Here is what my crontab looks like now.

pi@raspberrypi:~ $ crontab -l
#* * * * * /usr/bin/python3 /home/pi/bin/upsPlus.py > /tmp/upsPlus.log
#* * * * * /usr/bin/python3 /home/pi/bin/upsPlus_iot.py > /tmp/upsPlus_iot.log
pi@raspberrypi:~ $ sudo crontab -l
# ROOT Crontab
#* * * * * /usr/bin/python3 /root/bin/upsPlus.py > /tmp/upsPlus.log
#* * * * * /usr/bin/python3 /root/bin/upsPlus_iot.py > /tmp/upsPlus_iot.log

Thank you, I didn't know crontab had two "instances". I'll see later if it works for me or not