|
Edited by lesrhorer at 2019-8-19 16:06
In general, a device will not disconnect a battery unless it has special circuitry designed to just that purpose. Any device that does will not be able to power up again when power is re-supplied unless it has a separate switch active when the device is off, or a secondary supply. Think about it. If the battery is disconnected, what is going to cause the battery to be re-connected? What's more, if it is the device itself which controls the battery disconnect, what is going to cause the battery to re-connect, or with inverted logic, how is it to keep the battery disconnected if it is off?
What is needed is a battery isolated by a pair of diodes and a relay from a secondary power source. The secondary power source attaches to the Pi through a diode that prevents the battery from discharging back through the secondary supply when its voltage is lower than the battery's voltage. Whenever power is supplied by the secondary supply, the Pi turns on. The battery is attached through a diode that prevents the battery from over-charging and a Normally Open relay that prevents the Pi from being attached to the Pi at all until a GPIO pin energizes the relay. Code must be run at boot that energizes the relay. Once done, the Pi will remain up until both the battery and the secondary soure are removed, or the Pi is shut down. Once shut down, the battery will be completely isolated until the secondary supply returns and the Pi boots. An alternative is to provide a bypass switch that shorts across the relay, bringing up the Pi. In this case, the diodes are not necessary, but one must either manually hold down the switch until after the Pi has booted, or else provide an external timer (a 555 will do) that keeps the circuit closed until the pi has had a chance to boot. Instead of a timer, one can also employ a latching relay that can be shut down by the Pi using an additional GPIO pin.
I have a pretty slick design - if I say so myself - for a UPS, or I can work with you on a simple automatic battery disconnect. PM me if interested.
/
|
|