R-Pi UPS w/intelligent shutdown

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
twelchptm
 
Posts: 49
Joined: Fri Jan 24, 2014 12:33 pm

R-Pi UPS w/intelligent shutdown

Post by twelchptm »

A little while ago I started a project, it was my first time using a Raspberry Pi. It actually was a lot easier then I expected to get it up and running and soon I had my project near completion. It was at this point that I realized a critical issue, The power in our building in the area that would host this project has power that goes off and on through a timer system and cutting the power without shutting down the Pi is not a good idea, especially everyday. Simple answer, get a UPS right? Not so simple as it turns out. An off-the shelf-UPS is big and bulky and pretty much defeats the driving reason I am working with the Pi. So I began a search and came up with only 2 products, the first was a shield for the Pi it was a UPS w/intelligent shutdown BUT it used 6 (SIX) AA batteries and no onboard charging circuit. I would have to replace batteries constantly and it also would significantly increase the size of my final project. The second product, the PowerBoost 500 C from Adafruit. This one is great, it has a rechargeable battery and all those pins for accessing the base functions but to my dismay it does not have an intelligent shutdown feature.

I decided the best course of action was to build my own UPS. I assumed this would be difficult and confusing and my first Idea involved an arduino, resistors, transistors, and a whole mess of other parts. it got to a point where I was pulling my hair out thinking it would never work. No matter what I did some portion of it would glitch. Finally I took a step back and asked a few questions about the parts I was using on a few different forums. collecting all the information I could, I began systematically eliminating parts until I got down to the bare bones. When I was finished I finally got everything working and what was left on the board was amazing.

The finish product is basically a shield, if you solder a female header on the PB500C and some male pins on the Intelligent Shutdown Module or ISM (thats what I like to call it!) you have a very small, very compact UPS w/intelligent shutdown and rechargable battery and the whole thing costs less then $20! I am currently on my third version of the PB500C-ISM and each time I finish one I quickly end up realizing what can be eliminated. The current version is less then half the size of the PB500C and only has an ATTINY85, a TO-92 3.3V regulator, an LED and resistor. The LED blinks out different sequences so I could follow what it was doing and trouble shoot but now that it is 100% working I can eliminate that. The 3.3V regulator is only for the signal to the Pi so if your project already uses a logic level converter or is okay with 5V logic you don't need that either. The ATTINY85 is about as small a chip my tools(and super shakey hands) can work with but if you have the means and the ability there are even smaller IC's out there and the circuit can easily be made no bigger than a fingernail.

How it works, the ATTINY is powered from the Battery using the BAT pin on the PB500C. It runs constantly but draws so little power it doesnt drain the battery. The program on the tiny monitors the USB pin in the PB, if it goes low that means the power to the PB has gone out, it pauses for a few minutes and then checks again, if the power is still out it sends the shut down signal, if the power is back on it goes about its business like nothing happened. It also monitors the LB pin on the PB wich goes low when the battery reaches a critical low point. When this happens the tiny send the shutdown signal to the Pi and blinks SOS in morse cobe via its led. When the Low Battery condition is corrected it restarts the PI. In either condition when it shuts down the Pi is saves that is a variable and after a short delay(long enough for the Pi to shutdown) it connets the EN pin of the PB to ground efectivly turning off all out put from the PB to the Pi, when its time to turn it on it releases the EN pin and the Pi turns on because power has been reconnected.

If any one would like the fritzing diagram or the code just let me know but personnaly i would love to adafruit ad an IC to the PowerBoost so that I can just buy one and avoid the extra work because once I am satisfied I have simplified my circuit as much as possible all of my Pi based projects will use one of these!

twelchptm
 
Posts: 49
Joined: Fri Jan 24, 2014 12:33 pm

Re: R-Pi UPS w/intelligent shutdown

Post by twelchptm »

Sorry guys! found a critical flaw after putting this to full time usage!!! back to the drawing board stay tuned for updates...

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”