Author Topic: Raspberry Pi server with diy UPS  (Read 38164 times)

0 Members and 1 Guest are viewing this topic.

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Raspberry Pi server with diy UPS
« on: October 20, 2012, 06:52:50 am »
Hi everyone,

I bought a Raspberry Pi a while ago to build a server for backups(using Crashplan), network attached storage and a Git repository. After setting everything up and testing it for a few days it somehow lost power without properly shutting down and some data on the external hdd was corrupted. So I decided to build a small UPS for it to always give it enough time to shut down during a blackout. Since everything has been working perfectly for the last two months I wanted to share the design so that anybody can build one.

I know the design is far from perfect but hey, it works!

Here are some pictures without the 2.5" hdd(fits under the pcb)




How it works:
The external "power supply" is a 12V/600mA lead acid battery charger that charges the 12V/0,8Ah lead acid battery inside the case. My circuit is connected in parallel to the battery so that I don't have to detect the loss of mains power but just monitor the battery voltage to send a shutdown signal(via GPIO) to the Raspberry Pi if the voltage drops below a threshold. Once the battery voltage drops below a 2nd, lower threshold, the circuit cuts it's own power to prevent discharging the battery too far(the Raspberry Pi doesn't cut it's own power after the shutdown is complete). The circuit is also connected to a switch that acts as both a boot and shutdown button(again, the Raspberry Pi on it's own doesn't have one) and some duo-led's to indicate battery power, Raspberry Pi powered, a fuse status and a "successfully booted" status (via GPIO).

A simple shell script runs in the background and monitors the battery voltage/power button and sets the "successfully booted" status.

Code: [Select]
#!/bin/bash

 # The GPIO ports use the BCM GPIO pin numbering scheme.
 # This means that the 'gpio' command must use the '-g'
 # flag in order to use the right ports!

 # Outputs
system_running_led=14
system_shutdown_led=15

 # Inputs
battery_low_signal=18

gpio -g mode $system_running_led out
gpio -g mode $system_shutdown_led out
gpio -g write $system_running_led  1
gpio -g write $system_shutdown_led 1
gpio -g mode $battery_low_signal in

while true; do
  if [ `gpio -g read $battery_low_signal` = 0 ]; then
    gpio -g write $system_shutdown_led 0
  else
    gpio -g write $system_shutdown_led 1
    shutdown -h now
    sleep 10
  fi
  sleep 1
done

And here's the schematic:
https://dl.dropbox.com/u/678261/PiSupply.pdf

Oh by the way, the BOM is around 70€ including the charger, battery, case, and everything else except the Raspberry Pi and and the HDD
Let me know what you think.
UPDATE2:
Link to parts

If anybody wants to build it, I have some more pcbs that I don't need and would send them to you for only the shipping cost.

UPDATE + UPDATE 3:
I just did some research on the shipping costs.

Germany:
2.95€ (incl. insurance)
Worldwide:
3.5€ (incl. insurance)

(You can check the prices here: click Sorry but i think this site is only available in German)
Please also add around 1€ for the Paypal fees.

-Daniel
« Last Edit: October 23, 2012, 11:19:38 pm by daywalkerdha »
 

Offline karlmag

  • Contributor
  • Posts: 33
  • Country: no
Re: Raspberry Pi server with diy UPS
« Reply #1 on: October 20, 2012, 09:03:57 pm »
Hi,

That is a really nice project!

I would certainly want a PCB

Details in PM.

Thank you! :-)
--
Karl Magnus
 

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Re: Raspberry Pi server with diy UPS
« Reply #2 on: October 20, 2012, 10:00:17 pm »
Hi,

I'll wait for a few days before sending out the pcbs to see if others want one as well.

By the way, the case is this one
 

Offline peter.mitchell

  • Super Contributor
  • ***
  • Posts: 1568
  • Country: au
Re: Raspberry Pi server with diy UPS
« Reply #3 on: October 21, 2012, 05:11:12 am »
I thought i'd link this: http://www.tracopower.com/products/tsr1.pdf

I was wondering if linear or smps so I had a quick look, nice product!
 

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Re: Raspberry Pi server with diy UPS
« Reply #4 on: October 21, 2012, 05:42:39 am »
I thought i'd link this: http://www.tracopower.com/products/tsr1.pdf

I was wondering if linear or smps so I had a quick look, nice product!

Yes, I had one here already. With a bigger charger you could also use a 7805 or something similar. But i wanted to keep the power consumption low, too. It's slightly under 5W on average after 2 months (including the losses in the charger).
 

Offline peter.mitchell

  • Super Contributor
  • ***
  • Posts: 1568
  • Country: au
Re: Raspberry Pi server with diy UPS
« Reply #5 on: October 21, 2012, 04:18:32 pm »
With a larger power supply you could use a 7805, yes, but you'd need a heatsink and get less than half the battery life from the UPS!
 

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Re: Raspberry Pi server with diy UPS
« Reply #6 on: October 21, 2012, 08:13:47 pm »
Sure, you would. I wanted to point it out because this Traco smps is pin compatible with the 7805 and others could save 8€ if power consumption isn't an issue.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 6961
  • Country: nz
Re: Raspberry Pi server with diy UPS
« Reply #7 on: October 21, 2012, 08:31:58 pm »
It occurred to me while reading this thread that two of those boost caps in series would work quite well for a raspberry pi ups battery.

Two in series would be 5.2V max and 1300Farrad
The pi draws around 300mA idle so  0.3A/1300F = 0.000230769V drop per second = 0.2V per 15min
So you'd get at least that out of it before the volts dropped a bit low.

If you included a boost converter down to say 2V it would last 5.2 - 2 = 3.2V/0.2V = 16 lots of 15min.
16*15min = 4 hours

4 hours is probably more than most people need, so you could use smaller boost caps to reduce the size of it.

And the best part is you'd never need to replace worn out SLA batteries. (i hate buying new ups bats every 2 years)

« Last Edit: October 21, 2012, 08:41:53 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Re: Raspberry Pi server with diy UPS
« Reply #8 on: October 21, 2012, 08:59:18 pm »
Do you have a link to those caps?
I thought about using caps, too. How would you charge them / What kind of supply would you use to limit the initial current?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 6961
  • Country: nz
Re: Raspberry Pi server with diy UPS
« Reply #9 on: October 21, 2012, 09:13:18 pm »
There are many sizes but this is the one you see most often.
http://home.comcast.net/~hlandis0/photos/ucap2600f.pdf
You see them come up on electronic goldmine from time to time for ~$10-20 each
They a bit expensive new, so 2ndhand is how most hobby people get them.

I suspect they're used in massive banks of 1000 for high energy physics/research. Every so often they upgrade their cap bank to newer model boostcap. That's when you see lots of 2nd hand ones available.

Because their ESR is so low they will draw lots of current if it's available, so you'd need a charger that is current limited and also voltage limited to their rated volts
« Last Edit: October 21, 2012, 09:16:25 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline peter.mitchell

  • Super Contributor
  • ***
  • Posts: 1568
  • Country: au
Re: Raspberry Pi server with diy UPS
« Reply #10 on: October 21, 2012, 09:29:33 pm »
I was going to mention the current draw thing and the price thing and the size thing.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 15054
  • Country: za
Re: Raspberry Pi server with diy UPS
« Reply #11 on: October 21, 2012, 09:40:29 pm »
I want some of those caps...........

Like the UPS you put together.
 

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Re: Raspberry Pi server with diy UPS
« Reply #12 on: October 21, 2012, 09:54:52 pm »
I was going to mention the current draw thing and the price thing and the size thing.

Especially size and price. And you'd need additional circuitry. I don't know how accurate the specs are, but since the cell only goes through a cycle if there is a blackout, it should last for 3-5 years for under 12€.
 

Offline peter.mitchell

  • Super Contributor
  • ***
  • Posts: 1568
  • Country: au
Re: Raspberry Pi server with diy UPS
« Reply #13 on: October 21, 2012, 11:54:10 pm »
There was a point in time where I worked for a company who installed security systems, even the cheapest, nastiest batteries would last 2 years with a full cycle every 3-6 months and a float charge. Powersonic was the cheapest brand we had used without troubles. 12v 7aH Were about $15 a pop in quantity, $20 single.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 15054
  • Country: za
Re: Raspberry Pi server with diy UPS
« Reply #14 on: October 22, 2012, 12:02:47 am »
Security system manufacturers normally design in a proper power supply, not just a hope it works till warranty is over one. The battery can last over 5 years on one like that, as it is kept at float voltage which means it is always at 95% of capacity, so it does not generate much gas until the one cell decides to go short or open circuit from contaminants in the lead.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 15054
  • Country: za
Re: Raspberry Pi server with diy UPS
« Reply #15 on: October 22, 2012, 12:06:53 am »
If you want to learn a lot more about battery system design, maintenance and operation you will find a lot of very good papers at www.battcon.com where they have all the archived papers freely available for download. I learned a lot from browsing there, and have found it good to know how cells age, why they have the designs they do and how to use them properly.
 

Offline ptricks

  • Frequent Contributor
  • **
  • Posts: 640
  • Country: us
Re: Raspberry Pi server with diy UPS
« Reply #16 on: October 22, 2012, 02:37:32 am »
/url]
You see them come up on electronic goldmine from time to time for ~$10-20 each


They had a large amount of them about 2 months ago and someone made a large order and got nearly all of them, wonder what they built .
 

Offline daywalkerdha

  • Contributor
  • Posts: 49
  • Country: de
Re: Raspberry Pi server with diy UPS
« Reply #17 on: October 25, 2012, 09:56:44 am »
All the remaining pcbs are shipped. If there's enough demand, i'll reorder them but i will have to charge an extra 5€ per board to cover my expenses.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 6961
  • Country: nz
Re: Raspberry Pi server with diy UPS
« Reply #18 on: October 25, 2012, 11:10:20 am »
/url]
You see them come up on electronic goldmine from time to time for ~$10-20 each


They had a large amount of them about 2 months ago and someone made a large order and got nearly all of them, wonder what they built .

It wouldn't surprise me if the geekgroup bought them.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 5743
  • Country: gb
Re: Raspberry Pi server with diy UPS
« Reply #19 on: October 25, 2012, 11:13:42 am »
/url]
You see them come up on electronic goldmine from time to time for ~$10-20 each


They had a large amount of them about 2 months ago and someone made a large order and got nearly all of them, wonder what they built .

It wouldn't surprise me if the geekgroup bought them.

Don't think so. I imagine I'd have heard of it by now.
 

Offline adampielok

  • Newbie
  • Posts: 1
Re: Raspberry Pi server with diy UPS
« Reply #20 on: June 03, 2013, 05:13:26 pm »
Is it possible to order some PCB's ?
 

Offline manu

  • Regular Contributor
  • *
  • Posts: 72
  • Country: fr
Re: Raspberry Pi server with diy UPS
« Reply #21 on: March 31, 2014, 08:06:03 pm »
Nice project!
 

Offline Antoine.

  • Newbie
  • Posts: 2
  • Country: fr
Re: Raspberry Pi server with diy UPS
« Reply #22 on: October 30, 2014, 05:01:23 am »
Hello,
I drew the schematic with KiCad, but I have difficulty with the PCB.
Can you give the PCB, or a more detailed picture of the card.
Thank you.
 

Offline magetoo

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: se
Re: Raspberry Pi server with diy UPS
« Reply #23 on: October 30, 2014, 02:12:44 pm »
Antoine, this project was posted two years ago and the OP hasn't been active in the forum for six months.  It seems unlikely you will get a response.

That said, if it turns out he (or anyone else) wants to pick this up again and make PCBs, I'd be interested.  I have a Pi that I've been meaning to do something with and I really like this idea.
« Last Edit: October 30, 2014, 03:27:31 pm by magetoo »
 

Offline stryker

  • Regular Contributor
  • *
  • Posts: 80
  • Country: au
Re: Raspberry Pi server with diy UPS
« Reply #24 on: October 30, 2014, 03:57:42 pm »
Hi guys

I did buy a couple of these boards for a project that I'll some day get back to.  Will see if I can dig them up this weekend and post a shot of both sides.

Cheers! Geoff
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf