George shares how to make a battery backup circuit for your RPi via repairhub.co.uk:
This is a step by step instructions on how to make a battery backup circuit for your Raspberry Pi computer. For more information about Raspberry Pi visit the Foundation’s website.
First I’d like to explain a little bit about what I tried to achieve with this design and also pros and cons of this approach. I’m using my Raspberry Pi as a backup device with two hard drives connected to it, to back up various online servers that I administer. I use automated backup scripts based on Rsnapshot, and also I’m using this particular Pi as an Apple time machine server. Because Raspberry Pi is a very low power device, I thought it would be possible to design a cheap backup power supply using a 9V rechargeable battery, and this way prevent any abrupt shutdowns during power cuts or when someone accidentally unplugs it from the mains. As an added feature it also will provide a convenient way to safely power the device off without adding a hardware button or logging-in remotely and issuing a shutdown. But what this circuit doesn’t currently do is monitor battery levels, nor provide any kind of low voltage cut off, but there is a time limit/delay after which it will automatically power off and disconnect the battery.
The finished circuit does the following:
- Trickle charge the battery while on mains power
- Send a signal to Pi GPIO pin when mains power is disconnected
- issue a shutdown after a few minutes if power haven’t returned (Done via software)
- disconnect the battery from the circuit after shutdown is completed (this is to prevent discharging the battery below its limit)
- keep a log file with all the time stamps and alerts for mains power, shutdowns and restarts of the Pi
Check out the full tutorial here.