Dec 1, 2016

Raspberry Pi UPS from junk box

I've been using the Raspberry Pi 1 as an ssh shell for Irssi and as a web server for my IP cameras and self-made IoT gadgets. Maybe I had just a bad luck with the corrupting SD cards, but I ended up to put the Arch Linux and other files to 120 GB SSD (although the SD card is still needed for bootloader), which was connected to RPi via 2.5" USB HDD box. Some time ago the SSD died and I got a good reason to upgrade the whole system, so I bought the RPi 3 and replaced the SSD with an 250 GB Samsung 840 basic. The extra performance (1x 700 MHz vs. 4x 1.2 GHz ARM cores) is nice especially when rendering timelapse videos from my IP camera photos.

Click to enlarge
To get some extra reliability, I thought that some kind of UPS could be nice. There's plenty of complete kits on ebay, but I happened to have some suitable parts in my junk box, so I didn't bother to wait 2 weeks. It wouldn't need any fancy features, but obviously should have at least an overcharging protection and under-voltage cutoff if the power outage is long enough. So there's the plan:

Click to enlarge
To keep it simple, there's no separate charging circuit for the 12 V sealed lead acid battery. I had couple of 12 V power supplies so it could charge the battery up to 12 volts. However fully charged battery would sit around 14.2 volts, so charging it only to 12 volts would waste about half of it's full capacity (2.9 Ah). For me, that's not a problem because the RPi would stay on more than long enough even with 1.45 amp-hours. We can limit the charge current of the battery with the 47R resistor, but allow higher discharge currents through the schottky diode, when the primary power supply cuts off. Theres also a protection diode for the 12 V power brick, so it cannot draw current from the battery when the main PSU is down. At these voltages we don't have to care about overcharging the battery.

RPi requires 5 volts, so there's also a regulator. Because the voltage drop from 12 V to 5 V is quite large when considering the 400-1000 mA operating current, I chose a buck switch mode power supply module instead of regular LM7805 linear regulator. That Murata module is pin-compatible with LM7805 but the efficiency is a lot better as it's an SMPS.

The undervoltage cutoff prevents the output of 5 V SMPS module to fall down slowly by causing all kind of unwanted effects for the RPi. When the battery voltage reaches ~6 V, the relay disconnects the battery, which is connected again when the main 12 V supply returns. The coil of the relay is rated for 5 volts, so there must be a series resistor to limit the current. The value of the resistor sets the cutoff voltage. But why there's a capacitor in series with relays coil? I noticed that when the resistor value would be good in terms of cutoff voltage, the relay didn't switch on even at 12 volts. So the capacitor works as a high-pass filter which bypasses the 270R resistor and provides the "kick" to the relay coil when the main PSU turns on, but after that, the current passes only via the resistor, as the capacitor cannot pass DC current. After the transition, everything abouve 6 volts is enough to keep the relay switched on.

Click to enlarge

* The picture above still with the RPi 1 model B.

21 comments:

  1. Great blog! I really love how it is easy on my eyes and the information are well written. I am wondering how I might be notified whenever a new post has been made.
    Paddle Wheel Flow Meter

    ReplyDelete
  2. Wow this look good and good thinking of rather than waiting for 2 weeks when you can made one for yourself. Thanks for sharing the blog.

    ReplyDelete
  3. Can you please enlist the components name and values please

    ReplyDelete
  4. Indexel is manufacturers and suppliers of control panel, SCADA system, VFD system and much more.
    Kindly find the below services:
    Control Panel manufacturers in India
    SCADA system manufacturers in india

    ReplyDelete
  5. The Amazing product that meet your need to withdraw btc coin through world's bitcoin atm card it works as normal atm card at all over the world
    This can be also use to convert bitcoins into real money with current market rate at any ATM Machine.

    ReplyDelete
  6. Here you will find best Latest Ghana music where you can download videos about culture lifestyle of nigerian people african citizens and much more. Thanks for visiting this website

    ReplyDelete
  7. The UK's most visited estate agents.Our Experts can help you buy, sell, rent and let property with branches across the UK. largest online letting agent uk .We will list your property on the main property portals such as Rightmove, Zoopla & PrimeLocations.let your property within the first 48 hours.largest online letting agent uk.

    ReplyDelete
  8. bitcoin mobile recharge and top up credits quickly and easily any where in the world. this is a top up phone with bitcoin best telecom mobile network operator worldwide.Every thing we have explained is so simple to understand. We provide you 24 hours service. Many of our clients have actually fixed their bitcoin amount for their mobile credit. If you also do not use your cryptocurrency for any cause as yet then we have told you the best way to utilize your money

    ReplyDelete
  9. One of the top website for organic SEO, where you can easily Drive More Traffic To Website within a month. Yes, it's time to increase your clients/visitors on your website and earn more and more money from your website or business. Visit for more details.
    drive more traffic to website

    ReplyDelete
  10. Our offer is very effective when compared with the listed list. You create a very site and boost your google rankings web site, but this site does not require anyone to use your site. This is the first place for SEO services to allow users to access your site.

    ReplyDelete