## Cheap 'n simple UPS

vempele
Posts: 9
Joined: Wed Feb 15, 2012 11:50 am

### Re: Cheap 'n simple UPS

I'm sure someone else also will have a need for UPS for the Raspberry Pi in their intended use, so I thought to share this idea.

So what it is and what it does?

This circuit uses the LM317s to limit the voltage and current for charging the battery wired to it's output. It charges battery at a set current untill a set voltage is reached, after that it starts to limit the current so that voltage doesn't rise anymore (CC/CV charging, suitable for li- and lead batteries).

Values for resistors are calculated using the following formulas:

R1= 1,25/Maximum amperes (in A)

R2= (96 x output voltage) - 120

C1 could be around 1uF and C2 ~10uF when using 1A max currents (it works without these, but may shorten the life expectancy of your battery).

For R1 use 5W resistor, R2 can be  1/4W.

It has it's limitations (max ~1,5A, Watts are wasted, system load needs to be roughly known...) but it's cheap 'n simple, maybe even something that could be assembled by students themselves.

gjs
Posts: 148
Joined: Fri Dec 02, 2011 8:04 pm

### Re: Cheap 'n simple UPS

This appears to be a battery charger, not a UPS, no?

BjarkeHedegaard
Posts: 12
Joined: Fri Feb 03, 2012 11:06 pm
Contact: Website

### Re: Cheap 'n simple UPS

I actually just thought of using a battery like this:

http://www.ebay.com/itm/DC-5V-.....3f0c7378ae

I know it's a bit expensive, but it may be essential for at least one of the projects I'm doing with the RaPi! It's not really a "real" ups I know, but it may just work as one. I know the RaPi will not know wether the power is off or not, but for my use that will probably not be that important. I think it will run for 20-30 hous off that battery.

grumpyoldgit
Posts: 1452
Joined: Thu Jan 05, 2012 12:20 pm

### Re: Cheap 'n simple UPS

There are several threads on here where people have discussed powering the Pi from four AA batteries. Sounds like a cheaper option.

vempele
Posts: 9
Joined: Wed Feb 15, 2012 11:50 am

### Re: Cheap 'n simple UPS

BjarkeHedegaard said:

I actually just thought of using a battery like this:

http://www.ebay.com/itm/DC-5V-.....3f0c7378ae

I know it's a bit expensive, but it may be essential for at least one of the projects I'm doing with the RaPi! It's not really a "real" ups I know, but it may just work as one. I know the RaPi will not know wether the power is off or not, but for my use that will probably not be that important. I think it will run for 20-30 hous off that battery.

Just remember that 8800mAh is not probably what you get out from a device that weighs 106 grams

gjs said:

This appears to be a battery charger, not a UPS, no?

This is only the schematic for the charger side. Attach a wallwart, battery and a 5V regulator, and there's your UPS for Rpi.

I wuold guess that most people only need 5V and for that purpose devices like the one on eBay link are just fine. This schematic though can be used if you need e.g. 12V or 24V for something that needs to run with Rpi.

aeiah
Posts: 24
Joined: Tue Nov 08, 2011 2:00 pm

### Re: Cheap 'n simple UPS

and what happens when the battery starts to run out during a prolonged power outage? a true UPS should warn of low power and shutdown safely at some point too, before it gets too weak :p

BjarkeHedegaard
Posts: 12
Joined: Fri Feb 03, 2012 11:06 pm
Contact: Website

### Re: Cheap 'n simple UPS

@vempele

Well the 8800 mAh is only at 5 volts, so it's not like it's a whole lot of energy anyway. But it's probably a bit optimistic, no doubt!

@aeiah

That's so true, as I mentioned earlier, it's not at all a true UPS, but it will be a backup in caes where the power may be out a couple of hours sometimes, which may just be the case for my project. It would of course be better with some sort of battery indicator that is software controlled like on a laptop.

flipdewaf
Posts: 24
Joined: Wed Sep 14, 2011 7:38 pm

### Re: Cheap 'n simple UPS

If this is so that the Pi is still powered if the leccy goes does that mean it will work for powering the Pi from a solar source? keep it going at night and then recharge during the day?

Fred

error404
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm

### Re: Cheap 'n simple UPS

flipdewaf said:

If this is so that the Pi is still powered if the leccy goes does that mean it will work for powering the Pi from a solar source? keep it going at night and then recharge during the day?

Fred

Yes, however it is extremely inefficient when charging and will only work when the input voltage > battery voltage, so it's not really suitable for solar where every watt is precious. You want a switchmode (or better, MPPT) charger.

A solar setup to run the Pi 24/7 will cost much more than the Pi itself.

vempele
Posts: 9
Joined: Wed Feb 15, 2012 11:50 am

### Re: Cheap 'n simple UPS

aeiah said:

and what happens when the battery starts to run out during a prolonged power outage?

Something that would have happened hours or even days earlier without any battery backup

Batteries are naturally at risk without any cut-off circuitry. GPIO could possibly be used to monitor input side (diode and a voltage divider before battery) and trigger timed shutdown(?)

In my intended applications the need is just to try to make it until AC is available again. If AC isn't restored in time then there would have been nothing more I could have done (data would have gaps or cameras would have been off-line anyway).

Jawloms
Posts: 16
Joined: Wed Dec 28, 2011 2:11 pm

### Re: Cheap 'n simple UPS

I think I'd use one of these as I intend to plug my Pi (for power) in to a USB port either in a laptop or my Wii.  The problem here is that when the devices are rebooted and stuff, the USB power goes off for a second.  This presumably would eliminate that issue?

vempele
Posts: 9
Joined: Wed Feb 15, 2012 11:50 am

### Re: Cheap 'n simple UPS

Jawloms said:

I think I"d use one of these as I intend to plug my Pi (for power) in to a USB port either in a laptop or my Wii.  The problem here is that when the devices are rebooted and stuff, the USB power goes off for a second.  This presumably would eliminate that issue?

This would become unnecessarily complicated way of achieving that. When using this circuit you need input voltage to be about 2 Volts (or more) higher than output. You would need a booster for the input.

Four AA batteries and couple of diodes in series might do the trick in your case. Diodes would bring voltage (1,5V x 4) below that of the USB (voltage drop of about 0,7V/diode), so it wouldn"t use batteries when USB power is available. Also diodes prevent you from charging those AA batteries.

Edit:

Item# from eBay (or similar): 150757563832 + 180793144685 (+ 250951383019 if Rpi doesn't work on 4,2V). Cheap and not so DIY solution.

Jawloms
Posts: 16
Joined: Wed Dec 28, 2011 2:11 pm

Thanks