Raspberry Pi UPS: A Very Simple Solution
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
A battery, 2 diodes and a Buck converter![]() As a freelance electronics engineer I get to see a lot of applications for small and inexpensive microcomputers like the Raspberry Pi and the Beaglebone. In fact this new breed of smart hardware is perfect for a large number of projects that previously might have been done with discrete components or not been done at all because of the cost of the hardware. The availability of cheap computer power on a tiny board is a huge step forward but it's all too easy to neglect some important considerations when designing with them. The Raspberry Pi is a great learning tool that can be highjacked to create real products solving real problems but there are some important challenges that need to be addressed before you can use them safely in unattended situations.
Computers need to be shut down in an orderly fashionAnyone who has ever used a Windows, Linux or OSx machine know the drill. Shutdown first then turn off the power. If you aren't aware of why this needs to be done then just stop for a moment and consider what might happen to your computer if it were to be turned off while it was in the process of writing to a file. If it happens to be an important system file then it may well refuse to boot up the next time you turn it on. The Raspberry Pi and Beaglebone and other similar machines are no different. Switch off the power without shutting down at your peril! Some of my clients solve the problem by simply providing general purpose UPSs to keep all of their equipment alive during power outages. Some ignore the problem altogether thinking that it probably won't happen very often and if it does then they will simply re-program the SD card. They have considered the risks and decided that a UPS is more trouble than it's worth. Some people are starting to use one of the "Smart Raspberry Pi UPSs" that are slowly becoming available. In this article series I'm going to concentrate on developing a simple "dumb" UPS and safe shutdown circuit. Hopefully it will be easier to understand and build and perhaps cheaper than one of the smart versions. At a later date I might even develop a smart UPS that you can build out of an Arduino or something. A very simple Raspberry Pi UPSThere are two basic ways to solve the problem. You can either switch to battery power when there is a mains power outage or you can detect power fail and shutdown while running on batteries for a short time. I'm going to be posting a series of articles here over the coming weeks looking at aspects of uninterruptable power supplies and power failure detection and I'm going to start with the simplest solution that I know of. ![]() The circuit above is in fact more complicated than it needs to be because resistor R1 and LED D3 are not strictly necessary. They are there only to indicate that the 5V output is present. The DC/DC device is a 'Buck' converter which supplies 5V at up to 3A (I haven't tried it at a full 3A) for the Raspberry Pi if either the 12V or 9V supply is available. The 3A 1N5404 diodes D1 and D2 prevent the 12V supply from overcharging the battery and the battery from discharging into the 12V power supply when the mains fails. This is as simple as it can get and may be more than adequate for your situation but there are three features that you might expect to find on a commercially available UPS that are not catered for in this circuit. Power fail detect, auto shutdown and battery charging. It doesn't do either of those but it will continue to run your Raspberry Pi for a time when the mains power fails which could be long enough to avoid the Pi experiencing any unexpected poweroffs. I would suggest that you use rechargeable batteries for this. Shutdown your Pi once a week and recharge or replace the batteries. I used 8 AA size NiMH batteries to give me 9.6V which works well. With a capacity of 2900mAh and assuming your Pi consumes around 350mA they should run a Pi for up to 8 hours. I would assume that time would be more like 4 hours to be on the safe side though. ![]() To connect from the 5V Out terminals on the Buck converter you can use a standard USB A to micro USB B connector and cut off the A connector. I bought one from a pound shop and it works fine. Strip back the insulation and use just the red and black wires. These are the power connections in the cable. Solder the black wire to Out- and the red wire to Out+. In following articles I will be looking at charging the battery, detecting the power failure and allowing the computer to turn off the power when it has completed it's shutdown procedure.
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