Difference between revisions of "Raspberry PI UPS"

From Electriki
Jump to navigationJump to search
(Version 0.1 of page - work in progress)
 
(v0.2 - we are getting there)
Line 20: Line 20:
  
 
After only 10 days, the package was in my hands, lets connect this baby up! the connectors even fit directly, unplug charger from Raspberry PI, connect that to Sofun, connect cable that came with sofun from sofun to Raspberry PI, how easy.
 
After only 10 days, the package was in my hands, lets connect this baby up! the connectors even fit directly, unplug charger from Raspberry PI, connect that to Sofun, connect cable that came with sofun from sofun to Raspberry PI, how easy.
 +
 +
BILLEDE AF PAKKE / INDHOLD
  
 
=== The problem ===  
 
=== The problem ===  
Line 31: Line 33:
 
First up: measure the drop-out time and how long the Raspberry PI can run of the on-board 220 uF on the 5 V rail.
 
First up: measure the drop-out time and how long the Raspberry PI can run of the on-board 220 uF on the 5 V rail.
  
As
+
BILLEDE AF DROPOUT UDEN EKSTRA LYT BILD4839
 +
 
 +
As we can see, the 220 uF starts to discharge quickly for 1.4 mSec ( X-division 1.5 to 2.2 with 2 mSec/div ). after that it discharge slower. This is an indication of the lowest voltage the Raspberry PI will operate on, once we go below this limt she switch off and the power-consumption drops hence the slower discharge.
 +
 
 +
Moving on, we can the Sofun 1 is providing power after 7 mSec ( X-divison 1.5 to 5.0 with 2 mSec/div ). This is the time we need to take care of buisness ourself, by increasing the on-board capacitor.
 +
 
 +
As the load remains the same no matter the capacity, we can simply extrapolate:
 +
 
 +
7 mSec / 1.4 mSec = 5 times MOAR capacity is need, we have 220 uF, we need a total of 1100 uF, an extra 880 uF.
 +
 
 +
Adding a 1k uF // to the 220 uF did the trick, Raspberry PI now continues to operate when mains is disconnected, the voltage drops to 3.7 V, still enough to keep things running but a USB device will likely not find it funny, but just to be safe, lets add another 1k uF, to a total of 2220 uF. This time the voltage drops to 4.1 - 4.2 V, thats ok, not USB-power specs OK, but hey, nobody is perfect. Problem solved(tm).
 +
 
 +
 
 +
=== Stamina ===
 +
How much you ask? glad you ask, its Tau-time!
 +
 
 +
220 uF gives us 1.4 mseconds from fully charged ( 4.7 Vdc ) to 3.3 V, a discharge of ( 3.3 / 4.7 ) 70.2 %.
 +
 
 +
70.2% equals ( e(100-70.2) ) 1.35 Tau
 +
 
 +
1.4 mSec = 1.35 Tau, thus 1 Tau = 1.04 mSec
 +
 
 +
Tau = R x C, rewrite to R = Tau / C
 +
 
 +
R = 1.04 mSec / 220 uF = 4.7 Ohm
 +
 
 +
4.7 V / 4.7 Ohm = 1 A (that was easy..)

Revision as of 13:47, 26 October 2013

UPS for Raspberry PI

The concept

If you have a Raspberry PI running as a server, or just like it to keep running during power-outs/burn-outs, you will need some kind of battery backup.

Now the easy solution would be to just plug in the mains adapter into a ordinary UPS, if you already have such a device keeping other hardware safe, all good, but if not this would not be an ideal thing to do. The Raspberry PI use very little power, less than 5 W. an UPS will quite easy use that in idle, thus double your costs of running it. I know, I know, 5 W 24x7 is 43.8 kWh / year, depending on prices around the world, it is about one visit to BurgerKing with sideorders. but still, why should it cost 2 times that? :)


The solution

If not doing the backup on mains, but directly on the 5 V USB, we will save quite a lot (relatively..) on switching losses from mains -> 5 Vdc One aproach would be to just whip up some batteries, a charger circuit and interface circuit to the USB input on Raspberry PI, a so-called on-the-line UPS. This means that the mains->USB charger is connected to your battery-bank that in turn is connected to the Raspberry PI. When mains goes away, the batteries will keep everything running.

Losses is of course still a "problem" but they can be made to be much less, it will be whatever your interface circuit needs to operate and regulate a 5 Vdc output and what your charger circuit needs to keep the batteries charged ( Trikel-charge(tm) ).

Searching for ideas for the circuits, I stumbled oppon this beauty: The Romoss Sofun 1 - this device is meant as a on-the-road extra battery pack for your phone, mp3-player, tablet or other device that runs of 5 Vdc. Found one on ebay for 6.29 UKP. not bad, assuming batteries are not made of wet cardboard and vinegar.

After only 10 days, the package was in my hands, lets connect this baby up! the connectors even fit directly, unplug charger from Raspberry PI, connect that to Sofun, connect cable that came with sofun from sofun to Raspberry PI, how easy.

BILLEDE AF PAKKE / INDHOLD

The problem

Surely, I was naive to think this would go so easy. And yes, there was a problem:

When disconnecting the USB cable from charger to simulate a power-loss, the sofun takes a few mSec to switch over to batteries, enough for the Raspberry pi to reboot due to low voltage...

Right boys and gals! its electronics time!

First up: measure the drop-out time and how long the Raspberry PI can run of the on-board 220 uF on the 5 V rail.

BILLEDE AF DROPOUT UDEN EKSTRA LYT BILD4839

As we can see, the 220 uF starts to discharge quickly for 1.4 mSec ( X-division 1.5 to 2.2 with 2 mSec/div ). after that it discharge slower. This is an indication of the lowest voltage the Raspberry PI will operate on, once we go below this limt she switch off and the power-consumption drops hence the slower discharge.

Moving on, we can the Sofun 1 is providing power after 7 mSec ( X-divison 1.5 to 5.0 with 2 mSec/div ). This is the time we need to take care of buisness ourself, by increasing the on-board capacitor.

As the load remains the same no matter the capacity, we can simply extrapolate:

7 mSec / 1.4 mSec = 5 times MOAR capacity is need, we have 220 uF, we need a total of 1100 uF, an extra 880 uF.

Adding a 1k uF // to the 220 uF did the trick, Raspberry PI now continues to operate when mains is disconnected, the voltage drops to 3.7 V, still enough to keep things running but a USB device will likely not find it funny, but just to be safe, lets add another 1k uF, to a total of 2220 uF. This time the voltage drops to 4.1 - 4.2 V, thats ok, not USB-power specs OK, but hey, nobody is perfect. Problem solved(tm).


Stamina

How much you ask? glad you ask, its Tau-time!

220 uF gives us 1.4 mseconds from fully charged ( 4.7 Vdc ) to 3.3 V, a discharge of ( 3.3 / 4.7 ) 70.2 %.

70.2% equals ( e(100-70.2) ) 1.35 Tau

1.4 mSec = 1.35 Tau, thus 1 Tau = 1.04 mSec

Tau = R x C, rewrite to R = Tau / C

R = 1.04 mSec / 220 uF = 4.7 Ohm

4.7 V / 4.7 Ohm = 1 A (that was easy..)