-
|
I have been trying out different ideas/strategies for shutting down a Pi4B which has a PiJuice HAT with the standard battery. Power is supplied via the Pi's USB type C connector, as that is the power supply for a Pi4B which I have available. The script below is assigned to be executed as a user function when the No Power event occurs. The code is as follows: When I run this file manually, the LED blinks and the Pi is shut down as one would expect. The last line is the only intended output and what I get when I run the script manually. Using the No Power event with a user function script looks like the most straightforward way to make the Pi shut down on loss of AC Power. No delay timing loops on the Pi and a simple script as a user function. The Pi4 has an SSD attached and according to the PiJuice GUI the currents through the GPIO pins involved are typically over 1 A and close to 2 A and peaking at 2,5 A, which is comparatively high for the standard battery and the PiJuice. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
Enabling System Events solved the problem, although the error messages remain mysterious to me. Maybe in the past - I got this PiJuice HAT already in 2019, but haven't used it after initial testing - you couldn't get the Pi to start upon return of AC power in this configuration where the power supply is connected to the Pi (not much choice, Pi4 has a different connector), but it has worked consistently with the current software 1.8 and firmware 1.6. No need to press any buttons. |
Beta Was this translation helpful? Give feedback.
-
|
You are not enabling the events, but the system task. You can add logging for all shutdowns by using a user function for the system stop event. This event gets triggered when the system task (pijuice service) is terminated as part of the system shutdown => Do not call shutdown from this user function since the system shutdown is already in progress. The initial messages have nothing to do with the PiJuice itself. They are from the Jedi software which must be running on your system. |
Beta Was this translation helpful? Give feedback.
-
|
@ArjenR49 If you shut down with SYS_FUNC_HALT_POW_OFF due to no power disconnected from the PI, the PiJuice continues to supply 5V to the Pi for 30 sec. PiJuice LED L1 is still on (green if battery > 50%). After the 30 sec (60 sec in your USER_FUNC2) L1 goes off and changes to a very weak slow blink. If you reconnect the power to the Pi before the 30 sec has expired the Pi will not boot (since it never was without 5V) and you get the symptoms you observed. Anyway since your user script does what you want keep using it. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, that is the right conclusion. If you know how long your shutdown process takes, set the timeout to just a bit longer. |
Beta Was this translation helpful? Give feedback.
Enabling System Events solved the problem, although the error messages remain mysterious to me.
None of the listed system events needs to be enabled, just the upper box ...
Maybe in the past - I got this PiJuice HAT already in 2019, but haven't used it after initial testing - you couldn't get the Pi to start upon return of AC power in this configuration where the power supply is connected to the Pi (not much choice, Pi4 has a different connector), but it has worked consistently with the current software 1.8 and firmware 1.6. No need to press any buttons.
Based on my experiences today and yesterday, I find the PiJuice HAT the most reliable UPS I know. I have had a few other UPS's. Not the …