modmypi / PiModules

GNU General Public License v3.0
54 stars 26 forks source link

Negative battery percentage and UPS function not working #38

Closed dexluce closed 5 years ago

dexluce commented 5 years ago

Hello,

I have soldered the TO-90 Temperature sensor, the two POGO pins, the fan. I'm running on a custom raspbian on which I applied the installation procedure:(https://github.com/modmypi/PiModules/wiki/UPS-PIco-Installation).

The fan is running fine, but the battery is not okay. UPS function is not working at all. The PI shutdown as soon as the usb cable is unplug.

And when I run the pico_status_hv3.0.py I got this strang value for the battery:

***********************************
      UPS PIco HV3.0A Status       
***********************************

  UPS PIco Firmware.....: e0
  UPS PIco Bootloader...: 53
  UPS PIco PCB Version..: 43
  UPS PIco BAT Version..: LiPO (ASCII: S)
  UPS PIco BAT Runtime..: 2 MIN
  UPS PIco r232 State...: OFF

  Powering Mode.........: RPi POWERED
  BAT Percentage........: -426.666666667 %
  BAT Voltage...........: 0.2 V
  RPi Voltage...........: 5.0 V
  NTC1 Temperature......: 42 C
  TO-92 Temperature.....: 41 C
  Extended Voltage......: 0.0 V
  A/D2 Voltage..........: 0.0 V

  PIco FAN Mode.........: ERROR
  PIco FAN State........: OFF
  PIco FAN Speed........: 320.0 RPM

***********************************
         Powered by PiCo           
***********************************

So I tried to use the image you give: https://github.com/modmypi/PiModules/wiki/UPS-PIco-Installation And with this image, the UPS behave correctly.

What could I have done wrong in my custom raspbian image?

thank you

dexluce commented 5 years ago

Okay so, a few infos about this. My custom image is a raspbian with a proprietary solution of digital signage (It's piSignage. Server is open source but client is proprietary). I have found that if I install everything but the "UPS PIco HV3.0 Hardware RTC", my solution of digital signage is working, but the pico HAT is not okay. At startup, the picofssd service is started and

service picofssd status

is returning

* picofssd.service - LSB: PiModules(R) UPS PIco file-safe shutdown daemon
   Loaded: loaded (/etc/init.d/picofssd; generated; vendor preset: enabled)
   Active: active (exited) since Fri 2019-02-15 15:42:20 CET; 59s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 339 ExecStart=/etc/init.d/picofssd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/picofssd.service

Feb 15 15:42:20 pi-image-player systemd[1]: Starting LSB: PiModules(R) UPS PIco file-safe shutdown daemon...
Feb 15 15:42:20 pi-image-player systemd[1]: Started LSB: PiModules(R) UPS PIco file-safe shutdown daemon.
Feb 15 15:42:22 pi-image-player picofssd[447]: <INFO>: Started
Feb 15 15:43:11 pi-image-player picofssd[447]: <INFO>: Stopped

As you can see, last log is "Stopped" and indeed, the HAT is not working as espected. Leds UPS, BAT and FAN are lighted. The HAT and the PI are shutdown as soon as the power supply is out.

If I do

service picofssd stop
service picofssd start

The CHG led light up, the BAT led unlight, and the UPS light is blinking. And now the HAT is working properly, the battery is charging and save the PI from hard shutdown.

This is not always working with a

service picofssd restart

After a reboot, the pico service is failing again to load.

AND as soon as I install the "Hardware RTC" my digital signage service is unable to sync playlist and start playlist. And it is not fixing the HAT.

Sooooo. Several questions: Is it important to install the "Hardware RTC"? Why? Do you have a great idea to ensure picofssd is well started at startup and if not, start it?

Thank you and have a good day

dexluce commented 5 years ago

After all, the issue is obviously comming from another service who somehow send a SIGTERM to picofssd.

You can find the fix here: https://github.com/colloqi/piSignage/issues/73

I'll close the issue for now. I'll add more info if I find a better fix and more infos.