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

Problem Using UPS Board w/RPi 3B #102

Open dfcolornet opened 2 years ago

dfcolornet commented 2 years ago

I am having troubles with one of the RPi UPS boards. I have NOT yet tried to do a firmware update, for fear of possible making it worse (since I know that doing a flash-n-crash can ruin a board). I am posting here because I cannot find a support e-mail, and am not sure if the problem is hardware or software, or if the former, how to reset the board using software.

I have one RPi UPS board that is working exactly as expected. The second one is exhibiting the following problems:

  1. Unlike the first, if I shut down the second RPi (sudo shutdown now), and press button on the UPS board, it does NOT remove power from the RPi (the red LEDs remain on both the UPS board & RPi).

  2. Unlike the first, whereby I can press the button on the UPS board to boot the RPi, on the second one I have to remove the power and both batteries, then re-insert the batteries, and then RPi boots automatically. However, the blue LEDs on the UPS do not light until I plug the power back in, even if the batteries have a change, put after plugging the power back in then 3 blue LEDs will light solid and one will blink. The button on the UPS board appears not to do anything.

  3. The Python script always throws a Remote I/O error (the first board will on occasion return an error, but seems to only do that when the UPS is reading the batteries, as noted by the blue LEDs on the UPS turning off and then back on); see error message below.

  4. If I insert uncharged batteries (18650s) in with the power plugged in, the batteries never charge, but the RPi will attempt to boot immediately with only one blinking blue light on the UPS, then fail (presumable because not enough power), and then turn off (no red power or green disk LED on the RPi), then a few second later it will try to boot again, fail again, and then turn off, and it will repeat this continuously every few seconds (I left it overnight, and when I removed the batteries and checked them externally, both were dead at less than 25%).

I was looking on your Wiki for a 'reset' to restore the UPS board settings, but could not find anything. I have never tried to update the firmware, and wanted to check with you first before attempting that (and I have no idea whether or not that might be successful).

Please advise. Additional details, including my config.txt, below.

Thanks in advance for any guidance you can provide. As I said, I bought another identical UPS board, which is functioning as expected. I thought that this one was originally working, but now seems to be completely non-functional. I thought it was working about a month ago, but not today.

Regards,

David E. Filip dfilip@colornet.com +1-212-338-0535

======

The hardware is a Raspberry Pi 3B (1.2, no plus):

Raspberry Pi Details: Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Sony

======

When I try to run the python script, I always receive an error:

pi@merry:~ $ python3 bin/upsPlus.py

------Current information of the detected Raspberry Pi------

Raspberry Pi Supply Voltage: 5.196 V Raspberry Pi Current Current Consumption: 993.103 mA Raspberry Pi Current Power Consumption: 4888.141 mW

-------------------Batteries information-------------------

Voltage of Batteries: 4.208 V Battery Current (discharge) Rate: -146.098 mA Current Battery Power Consumption: 478.049 mW

Traceback (most recent call last): File "bin/upsPlus.py", line 65, in aReceiveBuf.append(bus.read_byte_data(DEVICE_ADDR, i)) File "/home/pi/.local/lib/python3.7/site-packages/smbus2/smbus2.py", line 433, in read_byte_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error

========

Here is full /boot/config.txt:

For more options and information see

http://rpf.io/configtxt

Some settings may impact device functionality. See link above for details

uncomment if you get no picture on HDMI for a default "safe" mode

hdmi_safe=1

uncomment this if your display has a black border of unused pixels visible

and your display can output without overscan

disable_overscan=1

uncomment the following to adjust overscan. Use positive numbers if console

goes off screen, and negative if there is too much border

overscan_left=16

overscan_right=16

overscan_top=16

overscan_bottom=16

uncomment to force a console size. By default it will be display's size minus

overscan.

framebuffer_width=1280

framebuffer_height=720

uncomment if hdmi display is not detected and composite is being output

hdmi_force_hotplug=1

uncomment to force a specific HDMI mode (this will force VGA)

hdmi_group=1

hdmi_mode=1

uncomment to force a HDMI mode rather than DVI. This can make audio work in

DMT (computer monitor) modes

hdmi_drive=2

uncomment to increase signal to HDMI, if you have interference, blanking, or

no display

config_hdmi_boost=4

uncomment for composite PAL

sdtv_mode=2

uncomment to overclock the arm. 700 MHz is the default.

arm_freq=800

Uncomment some or all of these to enable the optional hardware interfaces

dtparam=i2c_arm=on

dtparam=i2s=on

dtparam=spi=on

Uncomment this to enable infrared communication.

dtoverlay=gpio-ir,gpio_pin=17

dtoverlay=gpio-ir-tx,gpio_pin=18

Additional overlays and parameters are documented /boot/overlays/README

Enable audio (loads snd_bcm2835)

dtparam=audio=on

[pi4]

Enable DRM VC4 V3D driver on top of the dispmanx display stack

dtoverlay=vc4-fkms-v3d

max_framebuffers=2

[all]

dtoverlay=vc4-fkms-v3d

hdmi_force_hotplug=1

dtparam=spi=on

dtparam=i2c_arm=on device_tree=bcm2710-rpi-3-b.dtb dtoverlay=i2c-rtc,ds1307

enable_uart=1

dtoverlay=tft35a:rotate=270

hdmi_group=2

hdmi_mode=1

hdmi_mode=87

hdmi_cvt 480 320 60 6 0 0 0

hdmi_drive=2