Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Gracefully Shutdown

4 Posts
2 Users
0 Likes
368 Views
(@andrew-simpson17)
Posts: 77
Estimable Member Customer
Topic starter
 

Hi

 

Using: Witty Pi 4 L3V7 on Raspberry Pi Zero 2WH.

I have a webservice running on the device.

It is powered by a USB Power Bank.

What i want to happen is when the Power Bank is disconnected that the service shuts down and then the RPi shuts down. Then just by connecting a fully charged USB Power Bank it all starts up OK.

I had originally set the low threshold to 4.2v.

When I disconnect the power bank everything shuts down straight away. 

QUESTION > But is my service shutting down gracefully?

I then changed the low threshold to 3v. This time if i remove the power bank the applicatioj runs smoothy. The Rpi will then shutdown when battery reaches 3v.

QUESTION > Again is my service shutting down gracefully?

I cannot see how my service is shutting down garcefully and indeed I have had to reimage the SD card as it would not boot up.

 

So... should I set the threshold to 3v and in my service 'query' the battery voltage that if there is no power bank supply and if the voltage reaches say 3.5v that I code in my service to shutdown the Rpi manually?  Would that work? Can it be done? How can I read volatage of PowerBank and Battery to follow then the logic of my code.

 

Any suggestions gratefully appreciated...

 

 

 
Posted : 16/11/2023 2:58 pm
(@admin)
Posts: 442
Member Admin
 

Besides of connecting the power bank to your Witty Pi 4 L3V7, you also connected a 3.7V Lithum battery to it right?

If you confirm the battery is already connected to Witty Pi 4 L3V7. You can also connect a voltage meter on it to monitor its voltage.

Most probably, when power bank is removed, the voltage of your battery drops so much that it can not keep your Pi running. If it is the case, either the battery is not well charged, or it could not deliver enough current to run the Pi.

 

 
Posted : 16/11/2023 3:39 pm
(@andrew-simpson17)
Posts: 77
Estimable Member Customer
Topic starter
 

Thanks for replying.

 

Yes, there is a 3.7  lithium battery connected.  

To avoid all doubt I run the test again.  I can see from yor interface that he battery is NOT 'charging'.

I changed the thre4shold to 4.2v.

I disconnected the USB Power Bank.

This time the Rpi took about 5 seconds to shutdown. I could see the green light flicker in the RPi board. That did not happen last time. So, this could be indicative that the original test was using a lithium battery not fullyt charged.

 

So, potentially happy i reconnected the USB Power Bank. But the Rpi did not start up. I had set the 'default state when powred'  to 1 and Auto-On to 'yes'.  I had to press the button on the UPS to start the Rpi up again.

 

What am I doing wrong?

 
Posted : 16/11/2023 4:39 pm
(@admin)
Posts: 442
Member Admin
 

I am not sure if it was the reason, but the low voltage threshold should not be set to 4.2V.

A 3.7V Lithium battery can be charged up to 4.2V. Setting the low voltage threshold to 4.2V means the battery is considered low-voltage almost all the time.

 
Posted : 18/11/2023 10:14 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.