Tuesday, July 08, 2014

Using an Adafruit PowerBoost 500 charger as UPS for a Raspberry Pi

 

One of the main tasks of a Raspberry Pi I have is monitoring my automatic backup generator and sending out alerts via SMS and email when the generator kicks in. This works fine, with up to now 1 glitch: when the outside power to the house is cut off, it takes at least a minute for the generator to kick in and start providing electricity to the house. So, under that scenario, the Raspberry Pi reboots and although the monitoring applications start up again, it just didn't seem to me as though it was foolproof.

So, I had been searching for a long time for a reliable, affordable Uninterruptable Power Supply (UPS) for this Raspberry Pi. I could probably have used one for a PC, but that was just too bulky and expensive. I even went so far as to try and design e backup power circuit using supercapacitors (after all, I don't need backup power for more than a minute), however, 'miserable fail' is the only term I can accurately and honestly use to describe that effort. Theoretically, it should have worked, in practice my circuit couldn't supply power for more than about 15 seconds, before the voltage dropped below acceptable levels and the Pi conked out.

Enough about that. By having Adafruit on my Twitter feed, I became aware of their PowerBoost 500C charger. Digging a little deeper, I found that this could also act as a UPS for Raspberry Pi, Arduino, etc. So, I decided to purchase one.

It arrived in mere days, which is pretty much a miracle when you realize it had to cross the US-Canada border. I soldered the USB connector in place (this is the output side from where the power is fed to the micro USB connector on the Pi), plugged in the Lithium Ion Polymer Battery I purchased at the same time and plugged the whole ensemble into the wall outlet via a standard USB wallmount charger. No smoke! On the contrary, the on-board LEDs lit up (and bright they are). I had to wait a little while until the yellow LED (indicating battery is charging) was replaced by the green LED (indicating battery charged).

Following that, a made a little YouTube video illustrating what happens when you plug a Pi into the output side, and then unplug the wall power etc.

In the video, I only have the Pi running off the battery for a short while (approximately 30 seconds), which should be sufficient for my purposes. However, in a subsequent test, I had the wall plug removed for more than 3.5 hours and the battery (2500 mAh) was still going strong.

So I think I finally have a reliable solution for my UPS problems.

5 comments:

Derek said...

Would you be willing to share how you set-up your pi to monitor your generator? Hardware/software ? I have been wanting to attempt this for some time now but i am a Pi newbie. :-)

Keith Hekker said...

Derek,

Just go back to my blog postings of January 2013, I explain it all in fairly great detail. Anything else, let me know.

Panther.ph said...

I've been surfing online more than 3 hours as of late, 
yet I by no means found any fascinating article 
like yours. It's lovely worth enough for me. Personally, if 
all webmasters and bloggers made good content as you probably did, the 
web can be a lot more useful than ever before.

Anonymous said...

I found that the power draw of the Pi is enough that the battery constantly will slowly drain and not be topped up by the power supply. After about a week the battery would drain to the point the Pi would lose power and shut down unexpectedly, causing corruption of the SD card.

Very disappointed as this product looked promising.

Gus Smith said...

I got one yesterday. Not using for a Pi for an other low power application.
I drained it using a dummy load pulling 300ma. Got the red led (low power) lighting. The BAT level is below 3.2v and the LBO output is then 0v. I am charging this now for a few hours and measured 4.2v on the BAT pin. But yellow led is still on and no green led. I am expecting the green led to be on.
Any ideas?