JamesPi123
Posts: 111
Joined: Fri Sep 23, 2016 10:02 pm
Location: Inside my Pi
Contact: Website

Auto poweroff when power bank low?

Mon Apr 24, 2017 5:48 am

Is it possible to use a USB power bank and have the Raspberry Pi automatically (cleanly) shutdown when the power bank's level is critically low?

drgeoff
Posts: 9878
Joined: Wed Jan 25, 2012 6:39 pm

Re: Auto poweroff when power bank low?

Mon Apr 24, 2017 7:48 am

Short answer. No.

Long answer. There is a DC to DC converter between the cell in the powerbank and the output to the RPi. Without opening the powerpack you cannot access the cell terminals to determine the cell's voltage. And even if you did, an unaided RPi cannot measure voltages. You need to add extra circuitry. So yes it is possible but far from being trivial.

tpylkko
Posts: 382
Joined: Tue Oct 14, 2014 5:21 pm

Re: Auto poweroff when power bank low?

Mon Apr 24, 2017 9:14 pm

and then there is also a whole bunch of workarounds for this problem and vendors at various pi-selling shops that sell specialized hardware to do ready-made.

User avatar
xamal
Posts: 56
Joined: Wed Apr 19, 2017 1:42 pm
Location: A Coruna, Spain
Contact: Website

Re: Auto poweroff when power bank low?

Tue Apr 25, 2017 2:22 pm

It depends if you can/want to access to electronic components of the power bank. If you could, the simplest solution would be a voltage divisor (just two resistances) from the battery to a GPIO.

You have a lot of comercial solutions like:

https://shop.pimoroni.com/products/zero-lipo

or

https://www.kickstarter.com/projects/xa ... spberry-pi
(yes, this is mine)

drgeoff
Posts: 9878
Joined: Wed Jan 25, 2012 6:39 pm

Re: Auto poweroff when power bank low?

Tue Apr 25, 2017 4:02 pm

xamal wrote:It depends if you can/want to access to electronic components of the power bank. If you could, the simplest solution would be a voltage divisor (just two resistances) from the battery to a GPIO.
It might be the simplest but it would not be reliable. The threshold voltage of a GPIO input is not well defined nor stable eg variation with temperature.

RidingTheFlow
Posts: 4
Joined: Wed Jan 11, 2017 11:51 pm

Re: Auto poweroff when power bank low?

Tue Apr 25, 2017 9:46 pm

Photosensor on the power bank indicator LED is easiest, reliable and requires no internal bank tinkering.
You either need to detect that "low charge" lights up or that "second to first" goes out (in case of bar-like charge indicator).

User avatar
elkberry
Posts: 167
Joined: Wed Dec 28, 2016 9:21 pm

Re: Auto poweroff when power bank low?

Wed Apr 26, 2017 9:03 pm

In true RPi Foundation style, we should probably add a RPi cam module, and then run some cv app that analyzes the pictures of the power bar status LEDs, shutting itself down when the last LED starts blinking... :mrgreen:
From ZX81 to Raspberry Pi, but wait ... where's the 7805 gone?

Return to “Advanced users”