New to electronics; capacitor-based UPS for Atomic Pi for shutdown
I'm quite new to electronics. I ordered an Atomic Pi, and would like to be able to make a very small UPS to give the computer time to shut down gracefully when the power is cut off. I'm pretty sure I could do any of the pieces in isolation, but I don't know how to put them all together. I'm also not sure how to size the capacitor(s). The power requirements are 5v and 2.4A max. Here are the things I know, or at least think, need to happen:
1. The capacitor(s) need to charge when the power is connected.
2. A signal needs to get sent to a GPIO pin, either when the power is connected or when the capacitor is providing power, whichever is easier. I can write something to monitor this.
3. When the power is disconnected, 5v needs to be provided by the capacitor(s) via a boost converter.
I think I could achieve any one of those things in isolation, but I don't know where to begin designing a circuit to do all of them. My guess is that a lot of this could be achieved with diodes.
As for the minimum size of the capacitor, I assumed everything works ideally and that the computer will take less than 5s to shut down when power loss is detected. I used P=I•V and E=P•t to get E=I•V•t = 5•2.4•5 = 60J. I then used E = 1/2•C•V^2 with E=60J and V=5v (assuming I charge one capacitor until it reaches 5v) and got C=4.8F. Obviously, there's power loss through the boost converter and other things. I'm unsure how much bigger the capacitor needs to be for that. I'm also not sure that the capacitor should be charged to 5v or to slightly less.
Part of me thinks it's as easy as putting in parallel the power supply on one side of a sufficiently large capacitor, a buck/boost converter on the other side, then using a diode and an optocouple to monitor the voltage from the power supply on a GPIO pin. And the rest of me thinks that's too easy!
Thoughts? Thanks in advance!
I'm not sure if you've looked around... but capacitors in this range are kindof monsters. The largest you usually find are measured in tens of MILLIfarads.
2.4A is... honestly quite a lot. Is there a way you can reduce that?
You have a few other options:
- A UPS. Just grab literally the smallest UPS that APC (or whoever) sells. Consider asking relatives if they have a bad one and replace the battery.
- Pros: Easy, has a signalling system to initiate shutdown... but you likely have hours of power.
- Cons: Bulky, hard to weatherproof, slightly ridiculous (12V DC inverting back to AC to get rectified to 5V DC to power the device).
- A powerbank.
- Pros: Easy, smaller than a ups.
- Cons: Expensive. You need one with simultaneous charge/discharge, with fairly high current. These are the nicer, more expensive power banks. Power cutoff detection still needed, and slightly tricky.
- An off-the-shelf pi-power board such as PiJuice.
- Pros: Still easy, but you have more control over the battery selection.
- Cons: Somewhat pricy, $20-$50 or so. Stuck with its featureset.
- A lipo-based circuit.
- Pros: Relatively Cheap... the first DIY I'm mentioning here.
- Cons: Lipos can be fiddly, needs a charge management circuit... this is basically a DIY of the previous option.
- A rechargeable battery circuit.
- Pros: Pretty cheap and fairly easy, less explody than lipos.
- Cons: Requires quite a few batteries to meet 12W+ of power draw for a few seconds.
- A circuit wrapped around CR123s to provide power...
- Pros: Cheapish, less explody than lipos
- Cons: Not usually rechargeable... but may be a good option for the base of the previous option.
"A resistor makes a lightbulb and a capacitor makes an explosion when connected wrong"
"There are two types of electrical engineers, those intentionally making antennas and those accidentally doing so."
Hi! Thank you for your quick reply!
I got the 2.4A from what I read about the device online. From what I've read, that's actually slightly below the minimum they recommend. 2.4A is the listed max current for the power adapter that comes with the "off-the-shelf" power option I saw.
Yes, I did notice that the capacitance I was looking was waaaay higher than what I've seen in capacitor tutorials and such online. I actually got the idea to use a supercapacitor from web search results for DIY UPS backups for SBC shutdown. I assumed supercapacitors would be wildly expensive, but in the range I think I would need, they're about five to ten bucks on Digi-Key. If I'm missing something there, please let me know.
I'm not in a rush to get this working -- I can just remember to shut the device down properly until this project is done! I'm willing to do some learning.
Of course, if a supercapacitor or two are an inappropriate solution to this problem, well, that's another story! It seemed like the simplest option that was within reach for my current knowledge level and skill set and a good way to grow both.
Regarding batteries, I keep seeing web pages with things like, "how to charge a LiPo battery without burning your house down!" That's not exactly approachable!
Is there a reason to avoid pursuing the supercapacitor approach?