Raspberry pi, routers, wireless nodes, NAS, some lights, all of mine have one thing in common: they need 5V power supply and could use one that is backed up. Now, I am not looking for hours of backup since i find the local electricity very reliable, I cannot remember when power was out for more than 10 minutes, but 1h should be ok for extreme cases. Since everything is already powered from a 5V supply with ample power reserve, i thought that a 5V in, 5V out version is best.
At first I tried using my 4×18650 batteries portable phone charger with both charger in and output on. It turns out that it will only work for some hours: as the step up converter is drawing power from the battery, even though it gets charged, the charger has a timeout. No matter what, the charger gives up and you are left consuming the battery and then it’s over. This takes more than a day if I start with a full battery, so it might fool you at the beginning. I tried looking for options to power the step up converter from the 5V input directly, but it turned out the compact PCB was making things worse.
I turned to my parts bin and searched for ingredients that would be needed to make one: A battery charger, a battery, and a step up converter. A 2.5Ah 18650 battery was just right, but i did not have a case for it so I 3d printed this one. The step up is an unknown DC/DC converter from ebay, it claims to be able to supply 5V at 1.2A, from a lithium battery, but that is about it. The charger is a 1A charger, which would charge the battery fast, while not overloading my 5V 2.4A supply.
Important: LiIon batteries can be very dangerous if mistreated, because of this I have used a protected cell: the battery contains over voltage, over current and over temperature protection circuits inside it, so in case something happens from the outside, it is safe. Please use a protected cell if you are replicating this design. I am not responsible for any consequences resulting from somebody using the information presented here, you are at your own risk!
Next up, let’s build the schematic:
I have not been able to find this design online, hence the article. It is pretty straightforward: a step up DC/DC converter gets its input either from the battery or from the original 5V supply. When 5V_IN is available, because the battery is a lower voltage than this, D2 conducts and provides power to the converter while D1 blocks the battery from discharging. There is about 0.3V dropped on the diode and some on the cable, in my tests the input of the converter dropped till 4.5V. If power fails, there is no 5V_IN available and D1 conducts and powers the converter.
Precisely for this voltage drop, I decided to use the step up converter after generating the uninterrupted supply at the common cathode of the diodes. I could have connected the schottky diode D2 between the output and input, and provide power to the output through it. This is seen in some other designs online. The drawback is that it requires the step up converter to be tuned to a voltage that is always lower than the supply reaching the UPS, otherwise the battery might supply the pi. With 4.5V from a nominal 5 reaching the UPS, I would have to tune the step up to about 4V which might not be enough for some attached peripherals, while running on backup battery.
I plugged everything on a prototype board and started doing a couple of tests. I loaded the circuit to about 1A mimicking a Pi and some things around it, with a 4.9Ω resistor(precise measured value). After a while it looks like the step up module reached a stable temperature of about 75°C maximum. This is rather high, so i recommend using it in a well ventilated enclosure, possibly with forced cooling. This is an extreme case, the Pi will be the greatest consumer at about 0.7A. On the right you can see the output voltage, on the left the battery voltage, in this case it is being charged.
The LEDs on the modules provide a good impression of the status: the one on the step up converter signals power is available to the PI and any of the ones on the charger(charging/full) signal AC power.
Time for Pi tests:
Efficiency results: Normally, the pi draws 2.8W from the mains while being idle, with a HDMI screen connected and Ethernet. While using the ups, after the battery is charged the total power draw is 3.2W, which means an efficiency of 87%. The actual lost power means 3.5KWh/year.
Idle power: Just the UPS alone draws 0.2W from the mains, after the battery is charged. All power numbers include the first 5V power supply, they are measured directly as power drawn from the mains with my sensitive power meter.
Backup time: as mentioned in the above test, the pi with only display and Ethernet is backed up for about 2 hours with a single 2.5Ah battery. The precise number of my 2 experiments is always between 2 and 2:15 hours, as I checked the status every 15 minutes.
Trust: I really don’t trust these eBay modules for a long time operation, the thing here is just for a proof of concept. As soon as I will get the chance I will purchase some “brand name” ICs to rebuild this with proper quality components.
Note: at some point i have used some step up modules that did not have a common ground between input and output. I suggest avoiding those.