JuiceBoxZero / LowBatteryShutdown

This script, when run with a connected JuiceBox Zero will trigger an automatic shutdown sequence when the attached Li-Ion battery reaches 3.2v.
MIT License
10 stars 10 forks source link

Detect when main power is disconnected #5

Open th3fallen opened 5 years ago

th3fallen commented 5 years ago

Is there any way to programmatically know when the main power has been disconnected and the pi is now running on battery power?

tbitson commented 5 years ago

I assume you want to detect when the USB power is removed and it's running on battery.

The only interface I see on the schematic is the connection to GPIO 16 (can be switched to GPIO 25), which is the low battery signal. You would need to solder a connection from one of the GPIO pins to VBUS through a resistor divider, since VBUS is a 5V signal and GPIO pins can only handle 3.3V.