PiSupply / PiJuice

Resources for PiJuice HAT for Raspberry Pi - use your Pi Anywhere
https://uk.pi-supply.com/collections/pijuice/products/pijuice-portable-power-raspberry-pi
GNU General Public License v3.0
437 stars 104 forks source link

When Pijuice runs out of battery #996

Open jorgrde1 opened 1 year ago

jorgrde1 commented 1 year ago

Hello! I'm working with Pijucie and their solar panels, I've configured the Pijuice settings so when it arrives at 15% of battery it shut downs the Rpi and turns on again when reaches the 25%, but I have noticed that it reaches 0% and it does not turn on anymore. Could be possible that if the pijuice reaches 0% do pijuice orders reset?

tvoverbeek commented 1 year ago

How do you shut down the Rpi at 15%? If you use e.g. SYS_FUNC_HALT the Rpi shuts down, but the Pijuice keeps supplying 5V to the Rpi. The Rpi GPU is still on and also peripherals will continue using the 5V supply -> battery reaches 0%. Use SYS_FUNC_HALT_POW_OFF instead which will cut the 5V to the Ppi after ca 30 seconds. Then the PiJuice goes to low power mode (slowly blinking very weak LEDs).

jorgrde1 commented 1 year ago

I use SYS_FUNC_HALT_POW_OFF, but I dont know why it seems it doesnt work all the time, I monitor the information via mqtt and the battery data regarding time are as follows, in principle it works correctly, it looks like it oscillates between the values ​​25 and 15 because it turns off and on, but then there comes a moment where it does not turn off and drops to 0 and from there it never turns on again despite the fact that it is charging due to the solar panel. Captura desde 2023-07-24 13-24-42

jorgrde1 commented 1 year ago

Also this is my system task from pijuice_cli Captura desde 2023-07-24 13-28-22

And system events: Captura desde 2023-07-24 13-29-30

bjohas commented 1 year ago

Hi @jorgrde1,

We also had problems with this, and we've found that the settings set via the API do not always correspond to what the gui shows. At least I couldn't make sense of it, see https://github.com/PiSupply/PiJuice/issues/995.

If you're familiar with python, then the script we wrote here https://github.com/OpenDevEd/rpi-zero-basestation/blob/main/bin/pijuice_tools/reboot.py might be of use to you.

Generally speaking, the low power shutting down function doesn't seem to be a function of the firmware running on the PiJuice, but seems to be a function of the PiJuice monitoring software run on the Pi. So we run our python script (via crontab) instead. Our script sets up the wake function (both based on timer and charge level), and (if power is low) runs a sudo halt, followed by PiJuice cutting power to the Pi.

OhSoGood commented 1 year ago

Thank you, @bjohas for sharing your scripts