A simple and cheap uninterruptible power supply


17 posts
by awjlogan » Wed Aug 06, 2014 11:50 pm
Hello all - I had a couple of weeks off recently, which happily coincided with the release of the HATS specification (which is a great initiative!). There are a few UPS boards you can buy out there, but they're incredibly expensive (more than the Pi itself) for what they are and overly complicated. Here is a new design for a simple and cheap UPS using sealed lead acid batteries as the backup. It has an integrated trickle charger for the battery, and indication to the RPi (or other microcontroller) when the backup is being used, and when the battery is running low. There are no microcontrollers to program, it's entirely analog. I've put together a schematic and a preliminary board layout, and would be really keen to develop this with suggestions and comments from other Raspberry Pi users. The schematic and board are below.

Image
Image


For some reason, these have come out very small but you can get the larger version of the schematic and layout by clicking on the respective links. Sorry! As the RPi is all about education, I'll be updating this project at the link below with a full explanation of the values, packages, and components chosen.

http://awjlogan.wordpress.com/

Look forward to any suggestions, and of course happy to answer any questions!

[moderated by mahjongg, increased picture size, pictures can also be further increased by opening in different window (right click)]
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by Burngate » Thu Aug 07, 2014 10:33 am
Nice idea
I have a few questions, however.

Following the link to your wordpress site, and thence to your chosen battery, it appears to be a 12v one. How, then, does your 9v source charge it? Or have you gone for a lower-voltage battery? (see below)

You're using a switching circuit to generate 5v, to save power, which is good. But to power the EEPROM you're using a shunt regulator, which is even less efficient than a normal linear regulator - is there a reason for this?

I'm not at all sure how your 55mA trickle-charge circuit works.
9v through "CHRG" (a switch?) through 910R into LED gives ~1.5v on the transistor base? So (9v - 1.8v - 0.6v) = 6.6v across 22R, gives me 300mA.
Or should the 910R and the LED be swapped? 55mA across 22R gives 1.2v, plus 0.6v = ~ 1.8v - reasonable for the LED
Then, I assume, the rest of that bit is a shunt regulator to limit the battery voltage when it's fully charged. It seems to limit at about 7v, though there doesn't seem to be a part number for IC3
User avatar
Posts: 4752
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by awjlogan » Thu Aug 07, 2014 3:30 pm
Thanks for the reply - I'll go through top to bottom

[C]hosen battery, it appears to be a 12v one. How, then, does your 9v source charge it? Or have you gone for a lower-voltage battery?


Yes, I should have made that clear. This was intended for use with 3-cell lead-acid batteries, so the nominal voltage is 6 V, rather than the 6-cell 12 V batteries. The picture of the big car battery on the Wordpress site isn't particularly helpful in that regard! An example of the SLA battery I meant is here although there are many types you can use. I was going to expand on this in a later post for altering the design.

But to power the EEPROM you're using a shunt regulator, which is even less efficient than a normal linear regulator - is there a reason for this?


The 3V3 supply is generated by the TL431 shunt regulator (good spot of the labelling too, I'll fix that), and is also used as a stable reference for the "battery low" condition. I chose the shunt, rather than a linear regulator of voltage reference, as it's much more flexible if people want to use different batteries, for example, and all it takes is a change of resistors. The TL431 is incredibly cheap for its accuracy, and also very widely available unlike some niche regulators and references. The dropout voltage is inherently low as well, limited only by the current source (R1, in this case), which is a potential issue on battery power (not with an SLA, but I wanted the design to be as flexible as possible). The 3V3 is only drawing 10-15 mA (dependent on voltage), and that's something that can be optimised as a well if you're massively concerned about draw. My thinking was that the RPi draws at least 300 mA, so it's not a bit extra draw, especially with a large lead acid battery. Finally, it's inherently short circuit proof (although R1 may disagree with you!) and so is more robust, especially when not used with an RPi with fixed IO configurations.

Or should the 910R and the LED be swapped?


Good spot, thanks! IC3 is a TL431, so Vref = 2.495 V. This is set to stop the charge for an SLA at 25-30 C, again something I would like the end user to be able to change if they're using it at temperatures other than ambient.
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by Burngate » Thu Aug 07, 2014 5:08 pm
Thanks for that, makes sense now.
User avatar
Posts: 4752
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by awjlogan » Sun Aug 10, 2014 1:10 pm
Any more comments or suggestions? I'm going to write up part II over the next few days, so any input would be great!
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by awjlogan » Sat Aug 16, 2014 7:35 pm
I've started writing up a more detailed explanation of the component choices. It turned out to be more in depth than I'd anticipated, so for the time being I've only written about the trickle charger. You can find the full write up here on the Wordpress site. I've updated the layout and schematic with some changes. As before, any comments or suggestions most welcome. Hope you enjoy it :)
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by awjlogan » Sat Aug 23, 2014 1:46 pm
There's been a steady trickle of interest, so I'm pressing on. I guess people want to see a board soon! While writing things up, I've come across problems and simplifications, so it's been a good process for me as well. In this part, the supply source and battery state indication are developed. I've updated the schematic and board to accommodate these alterations. You can find the latest instalment here. As ever, I hope you find it informative :)
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by mahjongg » Sat Aug 23, 2014 2:52 pm
I get why you use the shunt regulator for a precision 3v3, but why power the eeprom with the precision voltage too, instead of the normal 3v3 voltage from the PI?
User avatar
Forum Moderator
Forum Moderator
Posts: 9152
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands
by awjlogan » Sat Aug 23, 2014 4:26 pm
mahjongg wrote:I get why you use the shunt regulator for a precision 3v3, but why power the eeprom with the precision voltage too, instead of the normal 3v3 voltage from the PI?


Good suggestion - I hadn't thought of that, that would certainly allow a few extra mA to be trimmed off the shunt if required. Thanks :)
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by awjlogan » Mon Sep 08, 2014 12:26 am
Ok, the final part regarding the circuit design is now here :) Questions and suggestions welcome!

I've ordered some boards, so next up will be the build and testing.
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by chmrr » Thu Oct 02, 2014 1:57 am
awjlogan wrote:Ok, the final part regarding the circuit design is now here :) Questions and suggestions welcome!

I've ordered some boards, so next up will be the build and testing.


Thanks for the interesting step through of your design on your blog! It was enlightening, and also seems well-suited for my use case. Any news from the testing front?
Posts: 3
Joined: Thu Oct 02, 2014 1:52 am
by awjlogan » Fri Oct 03, 2014 2:28 am
chmrr wrote:
Thanks for the interesting step through of your design on your blog! It was enlightening, and also seems well-suited for my use case. Any news from the testing front?


Well, the boards arrived yesterday, so good timing! Very glad you liked the blog posts, hopefully I'll be able to get these made up in the next week and let you know!

Image
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by chmrr » Fri Oct 03, 2014 2:30 am
awjlogan wrote:Well, the boards arrived yesterday, so good timing!


Oooh, shiny!

By the way, what were you planning on using to provide the 9V supply from the mains?
Posts: 3
Joined: Thu Oct 02, 2014 1:52 am
by awjlogan » Fri Oct 03, 2014 2:36 am

Oooh, shiny!

By the way, what were you planning on using to provide the 9V supply from the mains?


Heh, it's a trick of the light, honest ;) Probably a decent 9 V supply, such as this one. That's pretty heavy duty, so up to the user really. The trickle charger is only 50 mA, so you can cut back to a 2 A supply without penalty.

After going over the boards again, actually the part I'm most concerned about is the diode OR. At the full 3 A, that's going to be burning 1.8 W, which is probably a bit much for those little surface mount diodes, but will check when I finalise the parts and BOM>
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by chmrr » Fri Oct 03, 2014 5:48 am
awjlogan wrote:After going over the boards again, actually the part I'm most concerned about is the diode OR. At the full 3 A, that's going to be burning 1.8 W, which is probably a bit much for those little surface mount diodes, but will check when I finalise the parts and BOM>
What's the source of the 3A number? Even the B+ Pi only draws 2A max, right?

Wouldn't a Schottky diode and/or P-FET be better, power-dissipation-wise, than a plain 1N4001? For example, this is a similar use case, and uses an IRF7526D1 P-FET/Schottky, whose power dissipation of ground through the Schottky is 0.78W @2A, or 0.8A @2A from the battery through the P-FET.
Posts: 3
Joined: Thu Oct 02, 2014 1:52 am
by awjlogan » Fri Oct 03, 2014 12:46 pm
3A is basically what the switching supply is set up for at it's maximum. I went with that so peripherals could be powered without worry, and so 3 A continuous is probably pushing it a bit. A Schottky is a drop in replacement, so you could save a bit of power there. I like that component you linked, only problem would be the Vgs of the MOSFET is about 1 V, so your "main" input would have to be 1 V below the battery input before it switched (unless I've missed something).
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am
by awjlogan » Tue Nov 11, 2014 3:09 pm
Apologies for the very slow updates - I've just moved country and am lacking in certain workshop essentials. First board is nearly built up, and of course a few problems cropped up, namely device packaging (wrong footprints) but otherwise pretty smooth. Once I've got some replacement parts ordered, I'll get the testing done. In the meantime, some work-in-progress shots (right click for link to bigger pictures). I've had a few device ideas, which I'll put together into a new Wordpress post soon. Questions and suggestions welcome as ever!

Image

Image
Posts: 22
Joined: Sun Mar 02, 2014 12:11 am