Raspberry Pi UPS: Safe Shutdown
<< Previous
First
2
3
Last
Next >>
Raspberry Pi UPS: A Very Simple Solution Raspberry Pi UPS: Trickle Charger Raspberry Pi UPS: Safe Shutdown Raspberry Pi UPS: Software
Power Fail & Safe ShutdownThe first parts of this article describe a simple uninterruptable power supply using a DC/DC converter, NiMh rechargeable batteries and a simple trickle charging circuit. We can take this a step further now by adding a little circuitry to allow your Raspberry Pi to detect that the mains power has failed and to shut off the battery power after a safe shutdown has been performed. The diagram below is the final circuit of the complete UPS and safe shutdown unit. You might notice that some of the component numbering has changed from the earlier circuits on previous pages. ![]() D1, Z1, R1, R2, T1 and R3 detect a failure of the main 12V supply. Transistor T1 is normally turned on when the 12V is present so the voltage delivered to the Raspberry Pi GPIO pin is normally low or logical zero value. When the 12V drops out T1 is turned off and the GPIO pin goes high or logical '1'. The 5.6V Zener diode Z1 together with the LED D1 and resistors R1 and R2 set the switching voltage at the base of T1. when the 12V input drops to about 8-9V T1 will switch off. If this voltage was set any lower then it would take too long for the input voltage to decay to the switching voltage.
When T1 switches off T2 turns on and illuminates the LED D4. This serves as an indication that power failure has been detected. The battery of the UPS is connected to the main input supply through the relay contacts RL1 and isolated from the 12V supply by the diodes D2 and D3. The relay is kept energised by transistor T3 which is turned on by a GPIO pin from the Raspberry Pi. When the 12V power fails the Raspberry Pi senses it on it's GPIO. Using software detailed on a later page the computer senses the power fail and initiates an orderly system shutdown. When the shutdown is complete the "Run" signal from the computer drops to a low value turning T3 off. The relay drops out and the battery power supply is disconnected. The 5V supply then collapses and all is quiet.
<< Previous
First
2
3
Last
Next >>
Raspberry Pi UPS: A Very Simple Solution Raspberry Pi UPS: Trickle Charger Raspberry Pi UPS: Safe Shutdown Raspberry Pi UPS: Software |
Now subscribe to our newsletter and don't miss a thing |
|
Comments (66)
your scheme is really helpful for me. Thanks a lot.
But, i want to ask. what should i do, if i want to connect with 4 raspis all at once? should i just change fuse to be 8 A?
Thank you, I hope you will answer my question.
Thank you
Thank you
Thank you
Thank you again!
Thanks,
Borut
I would suggest to include another option: let the RPi know what the status of the battery is, or: add a similar circuitry as implemented for the 12VDC status. So pass a signal to the RPi "Battery_OK" . If this signal is going low it is really time to power down and deactivate the relay avoiding a complete failure of the batteries. This allows for even bigger battery packs.
Arthur
This is a simple and understandable ups for my raspberry.
I wonder what to modify to make it work as a UPS for my 12V picoPSU powered NAS ?
The aim would be to hard shutdown the NAS when power drop while using an external 12V battery.
To be as simple as possible, it would be acceptable if the circuit don't deal with battery charging.
Could you give some advices about the simplest way to achieve this ?
Many thanks
Does the charge is stopped to prevent any overcharge ?Regards,
And would they lose charge over time ( even if main power is always on ? )
I was thinking of the first version of the ups, what prevents the battery from discharging while on main power ?
And should minus on the battery connect to 0V ?
Is ground the same as 0V in this setup ?//P
Excellent explanation and functionality.
Maybe you can rearrange with power bank with 18650 batteries as they already have charger on them.
What do you think?
Thanks
Andrijan
Because I found and buy 2 batteries with 4V and 1.3mAh. I plan to connect it series(ony by one).And I didn't get with wich formula you calculte value for R10.Thanks!
i am not interested to switch between the two modes. i will do only with the disconnection of battery at the end. it is only interesting to keep the battery on if you have for example an arduino with the RPI.thanks again.
nuno
thanks .
nuno
very nice feature!
i will build this circuit and test in my rpi.
thanks again!
regards
nuno
did you try this circuit?
Add Comment