Raspiblitz: Research: 5V USB UPS (Power Backup Systems)

Created on 10 Jan 2019  Â·  60Comments  Â·  Source: rootzoll/raspiblitz

I node running in production should be protected from (short) power outages. Like blackouts in cities, downtimes of re-newable powersources or you just unplugging the wrong cable at home. So this is a research topic to look into for the future - input and prototypes welcome.

This wiki shows some inspiration on how to get a UPS for a RaspberryPi going:
https://www.enigma14.eu/wiki/5V_UPS_for_Raspberry_Pi

First step would be to check at least if simple USB Powerbanks can be a first quick and cheap option.

enhancement help wanted

Most helpful comment

@odudex
Hi I'm the guy who makes the LiFePO4wered/Pi+ @normandmickey linked to. The LiFePO4wered/Pi+ has a stackable header version (it's actually the most popular version), so you can still stack other HATs on top. In addition, all GPIOs are still available for other uses, since the LiFePO4wered/Pi+ communicates over the I2C bus and only monitors TX to see if shutdown is complete.

It also has an MPP charger for solar and accepts input up to 20V. Plus it's the only RPi UPS I'm aware of specifically made for LiFePO4 (LFP) batteries, which have long life and don't die after being held fully charged for a year or two, as is the case with most other lithium-ions.

@normandmickey already linked to the manual, let me know if there's anything that needs more detail.

I also saw Andreas Spiess' video, and even though I'm a fan of his channel, I have to say I'm a little bit bummed by this video. It's like he went out of his way to find the least capable options on the market, just to have an excuse to start his project. Which he could do anyway if he wanted, without discounting the work others have done or hiding the capable options already out there.

All 60 comments

Check this Video: "5v USB UPS Module - 12v Solar Shed"
https://www.youtube.com/watch?v=jecgoBqOrhk

Pijuice hat
Output voltage - 3.3V and 5V
https://uk.pi-supply.com/products/pijuice-standard

@PapaCoderNit nice :D will see when back in stock to try out.

Also the Pi-Juice seems to have good software support:
https://github.com/PiSupply/PiJuice

But around 60 EUR - thats half the RaspiBlitz ;)

Also the Pi-Juice seems to have good software support:
https://github.com/PiSupply/PiJuice

But around 60 EUR - thats half the RaspiBlitz ;)

Great if you need all that functionality but seems overkill for 99% of people that just need battery backup for power failure. Better to be an outboard solution that any SBC can use with any case. HAT's are too restrictive depending on which case and other HAT's you have.

Just investing a bit more (around 80 EUR) and you get a standalone UPS at amazon:
https://www.amazon.de/dp/B00T7BYRCK

With such a device you can power backup the Router AND the RaspiBlitz - and procides the chance to even keep your internet up. Router+Blitz should be around 20 Watt - so it should give you around 1,5h power backup. Also it has USB port to connect to the Raspberry and someone could write a small script/service to shutdown the Blitz once the UPS signals low power over USB.

But also still interested if someone can recommend a cheap power bank that is able to load and procide at the same time - that would be the most low cost solution to protect the blitz against small power outages.

The cheapest solution to protect your RaspiBlitz against Power Outages seems still to go with a simple Powerbank that supports "Charge Through" / "Durchgangsladung" .. being able to load and provide at the same time without breakup of power (no switching time) when the main power goes off.

This site shows a great test setup:
https://raspi-ups.appspot.com/en/index.jsp
And there is the interesting idea, that the RaspiPi can detect a power outage by the Network Connection going down for a certain time.

HELP WANTED: We have to find a cheapest brand name Powerbank to order from Amazon, that supports 'Charge Through'. Everything under 20 USD with Prime delivery should be valid. Please post your test-results and Amazon links here or on twitter with @rootzoll - much thanks.

An idea to keep in mind: If the RaspiBlitz has a Powerbank UPS and detects a Network Outage it could at least shutdown the LND/Bitcoin services so that the state of the Lightning Node is stored secure to the HDD, reduces Power Consumption and keeps monitoring if the Network is coming back to restart the LND/Bitcoin services.

HELP WANTED: We have to find a cheapest brand name Powerbank to order from Amazon, that supports 'Charge Through'. Everything under 20 USD with Prime delivery should be valid. Please post your test-results and Amazon links here or on twitter with @rootzoll - much thanks.

Most powerbanks with "charge-through" that I have seen actually break up the power (for a few milliseconds or even a full second) while switching from mains to battery. Not even sure if ones that don't do that exist. In any case, it's never advertised or part of a spec sheet. So we might have to do trial-and-error buying until we find a suitable powerbank.

With a bit tinkering/modding though, even a powerbank with a short switching-time might be feasible. Depending on the power requirements of the storage connected to the Pi an additional larger cap as part of the Pis power supply might help. Idea here: http://www.johnes.eu/rpi/pages/power/kondensator.php

@unic0der because of this little details I was asking for help to find and test the working ones on Amazon :) I like the hack with the kondensator, but first lets see if someone can find a working powerbank - this testsetup seemed to had one without switching-gap: https://raspi-ups.appspot.com/en/index.jsp (but the referenced model is not available on amazon anymore)

If we cannot find any power banks that work fine, we can also look into some cheaper alternatives to the PiJiuce like this one: https://m.reichelt.de/raspberry-pi-usv-rpi-usv-p169883.html or https://alexnld.com/product/geekworm-ups-hat-expansion-board-2500mah-lithium-battery-for-raspberry-pi-3-model-b-2b-b-a/ and see if 2A output is enough.

3A Hats (StromPi2 & StromPi3 by JoyIt): https://www.voelkner.de/products/1182442/Raspberry-Pi-USV-Raspberry-Pi-Arduino-Banana-Pi-Cubieboard-Raspberry-Pi-3-B-Raspberry-Pi-3-B-Raspberry-Pi-2.html http://downloads.cdn.re-in.de/1200000-1299999/001244339-da-01-de-STROMPI_FUER_RASPBERRY_PI_A_B_B_.pdf

A product with Supercaps: https://juice4halt.com/products

@ElCapitano11 that PROLiNK power bank looks promising - had you a change to try it. When the input power cuts out, does it provide still constant output power without switching?

@rootzoll The PROLiNK is on order. Should arrive in a few days. Will let you know.

Would this work? It's simply a lithium battery module...
https://www.aliexpress.com/item/UPS-HAT-Board-Module-2500mAh-Lithium-Battery-For-Raspberry-Pi-3-Model-B-Pi-2B-B/32882666003.html

According to the seller:
"Can be charged and supplied power to raspberry pi at the same time
With 4 LED power indicator
Provides an example code to beginner to demonstrate how to demonstrate battery capacity displays the current battery level in the raspberry pi current program, it can detect the current battery, voltage etc.
Removable battery, user can choose a more larger capacity lithium battery(NOTE: voltage must be 3.7V)
With safety protection circuit to prevent overcharge and over discharge
Retains the raspberry GPIO interface, you still can use all kinds of expansion board
Applicatoin scene 1: You can program to control automatic backup of data at low power and safe shutdown.

Since it's only 5V 2A output, I was thinking on using a Y cable for the HDD. Found this one that seems to be good... But I'm not sure this setup would work. Anyone has experience with this?
https://www.aliexpress.com/item/2017-1PCS-USB-3-0-Male-Dual-A-to-Micro-B-USB-3-0-Y-Cable/32804362019.html

I combined

to power my Raspiblitz (Raspberry Pi 3 B+ with 3.5' display and 500GB USB hard disk). According to the LED it charges the batteries while powering the Raspiblitz. It has a nice on/off switch for the USB output. Since it it just a nerdy looking powerbank with USB output it doesn't occupy the GPIO interface of the Raspi -- but that means that I have no idea how the Raspi could know the actual status of the "UPS" to shutdown gracefully. The Raspiblitz continues running when I pull the plug of the charger. I didn't yet measure the time it runs on the batteries (will try to do it on the weekend). And I didn't test if it works with empty batteries as well.

Edit: The Raspiblitz ran 03:50h on the two 3500mAh batteries. But somehow this test broke the shield or a fuse has blown or so. The battery shield still charges the batteries (they get warm and after a few hours the LED turns from red to green) but there is no output on the USB port anymore, no matter whether I connect a charger or not :/

The Raspiblitz continues running when I pull the plug of the charger. I didn't yet measure the time it runs on the batteries (will try to do it on the weekend). And I didn't test if it works with empty batteries as well.

Nice, looking forward to read your findings. Cheers!

The prolink powerbank has arrived. Not quite what I hoped. Although very nice looking it doesn't do what I bought it for. As soon as I pull the plug the power goes off and on. See GIF.
prolink

@ElCapitano11 much thanks for running this test. Yeah its seems really hard to find a powerbank that is not doing that. Maybe someone can build a capacitor kind of device with usb micro in and out that we are able to put between the power bank and the raspiblitz to bridge/stabelize up to 5 seconds of out time. So specs would be 5V/3A/5s - micro usb plug in & out.

Would this work? It's simply a lithium battery module...
https://www.aliexpress.com/item/UPS-HAT-Board-Module-2500mAh-Lithium-Battery-For-Raspberry-Pi-3-Model-B-Pi-2B-B/32882666003.html

Not sure if it will work, but apparently you guys had this run out of stock 😱

I tried out my old easyacc power bank no: PB 12000A which has 2.1A/5V output and raspiblitz booted just fine when powerbank wasn't connected to power. I have basic raspiblitz parts described here in shopping list and hdd connected straight to raspi. Also I tested that it keeps giving power when power cord is unplugged. I guess they don't sell the old model anymore, but you can get similar for example from aliexpress.

EDIT: Well the raspiblitz got shut down during night, probably because charging of my easyacc is slower than what raspi takes power. The model I linked promises Input: DC 5V 4A(max) though....

also see the research about the raspberryPi power stability on the usb ports --> #368

A take away from there might be that its might be better to have a UPS/Powerbank that has two USB output ports (min 2A each) that can provide with two cables to the raspberry and to the HDD with a Y-Cable like this one: https://en.wikipedia.org/wiki/Y-cable#USB

If going more expensive UPS route (£58.53) on Amazon UK, does this Salicru SPS ONE 500 seem like a good option?

Otherwise, for > $20 does anyone have a good USB Powerbank recommendation? One that doesn't have the off / on switching problem and with at least 3 usb ports? The reason I ask is that apart from using one of the ports to solve HDD voltage stabilization issue, I'd like to look at the network UPS monitoring solution using an ethernet switch like this.

Great thread btw!

@LightningK0ala going with a big UPS box first is cool - I think it will take sometime until we find a good/practical fit in the powerbank-section. Let us know about the monitoring part and how you integrate it with the SBCs/LND shutting down when critical.

Someone is testing also this one: https://de.aliexpress.com/item/Zwei-18650-Lithium-Batterie-Schild-V8-5-V-3A-3-V-1A-Micro-USB-Power-Bank/32968286642.html ... cant wait for the feedback :)

BTW if we find a working mini-UPS but the ampere output is too low, I think its also OK to recommend a setup with SSD (instead of more power hungry HDD) for people wanna use a more resilient RaspiBlitz.

Someone is testing also this one: https://de.aliexpress.com/item/Zwei-18650-Lithium-Batterie-Schild-V8-5-V-3A-3-V-1A-Micro-USB-Power-Bank/32968286642.html ... cant wait for the feedback :)

I did already edit my post above about a week ago:

The Raspiblitz ran 03:50h on the two 3500mAh batteries. But somehow this test broke the shield or a fuse has blown or so. The battery shield still charges the batteries (they get warm and after a few hours the LED turns from red to green) but there is no output on the USB port anymore, no matter whether I connect a charger or not :/

I ordered two new ones and will test at least one of them again in the next weeks when they arrive :)

There is no need for a power bank
Make the system partition Read Only and create a second partition for the blobkchain files. Your system will never breaks with power cuts.

This solution needs some "hacks" :

  • systemd-timesyncd will fail. So you better create your own time sync unit.
  • You wont have logs, you can link them to the rw partition, probably systemd wont accept it...

@nagualcode interesting hack. But its not just the system - if that just gets crashed, just writing a fresh sd card is already a quick fix for that.Its more the state of LND (with all your lightning channel states) that are in danger of getting corrupted or not written from memory to storage during a power cut out.

For £29.99 there's UPS Pico, plug-and-play HAT with 5V 3A power backup and integrated 450mAh battery (bigger ones available).

Has anyone tried it?

https://www.modmypi.com/raspberry-pi/power-1051/ups-boards-1051/ups-pico

have we found a good power bank solution available in the EU, by good i mean reliable, small in size and ofc cheap :D

looking forward as well

The PiJuice is phenomenal. I've been using it for months with zero complaints. It's open source, so if someone can produce them for cheaper that would be awesome. The other solution I found effective is using the official PoE HAT (provides a solid 5V @ 2.5A) connected to an Ethernet switch powered by a traditional UPS. Using the fan requires the latest Raspbian kernel.

Here are two UPS devices I tried that didn't work out:

I think an external UPS solution as apposed to a HAT or case-internal solution would be more flexible, useful and "plug n play" and allowing more cases, heatsinks, LCD's, etc to be used. I just think everything power-wise should just plug into the micro-usb input. Simpler is better for Raspiblitz as we're trying to make it as cheap and easy as possible to run a node. Though an all-in-one box solution is also good, of course people can choose whatever they want.

I had a channel.db corruption on my test node running a BTRFS RAID1 when pulled the power accidentally (no funds involved). Decided to take no more BS, I am going for this one: APC Back-UPS ES - BE700G-UK - Uninterruptible Power Supply 700VA (8 Outlets, Surge protected) https://www.amazon.co.uk/dp/B002RXED6A
Will back multiple devices. Looking forward to experiment with the USB monitoring as well.
https://twitter.com/openoms/status/1117860138432356353?s=19

https://geekworm.com/products/raspberry-pi-x720-ups-hat-18650-power-safe-shutdown-wake-on-lan-rtc-power-management-expansion-board
Dunno if it's any good. Looks like you might be able to stack the 3.5" LCD on top.

UPS HAT (18650 Power)+Safe Shutdown+Wake on Lan+RTC function
Intelligent and safe power management
Integrated second 10/100M fast ethernet
Integrated Hardware Real Time Clock (RTC) with Battery Back-Up
Reserved 40-pin stackable Header for Add-On Boards

D4PUeV3U4AAq_uh

@elimSelttiLa the power bank looks promising with pass-trough feature .. were you able to test if its not having a short off/on-moment when you unplug/replug the loading power?

Because after a long time there was not a real good standard UPS solution to directly attach to the RaspberryPi ... so I added for the v1.3 release at least the support of standard APC UPS by USB Cable. See issue: #707

That can be extended in the future, but I think the APC UPS systems are very common (cheap entry) - the monitoring daemon apcupsd is a standard debian package and you can even secure your router on that UPS box. So its a good start on that topic I think.

There are some interesting recommendations here in the comments too: https://hackaday.com/2019/08/27/fixing-a-cheap-ups-hat-for-your-raspberry-pi-with-a-tiny-daemon/

@fluidvoice no.... the x720 is no good... (and probably also not the x700/x705/x725/x730/x735/x750 from the same company, it uses the same bad hardware design and crappy software...)

See my review and software (workarounds) at

https://github.com/Tristan79/x720/

It can not handle power loss/unplug very well... without damaging the hat itself... and probably the pi...

Hi guys. This is what are you looking for:
millers ml202

NO POWER OUTAGE dzring disconnecting power IN. Can be used as UPS with 2x 1650 batteries :)

@KapriQ thanks for the hint ... will see if I can get my hands on some of this next month for testing :)

@KapriQ was not able to find the Miller ML202 in any shop that delivers to germany - most say its out of stock

I'm not a fan of step-up voltage converters, which are most of Pi UPS hats and powerbanks. So I'm powering my Blitz with 9V and made my own 2S UPS with stepdown voltage regulator using a cheap BMS and a voltage regulator. It part of some hardware features I put on my Raspiblitz:
There's also a PWM controlled fan, and power monitor to safely shutdown if too long without power.

https://github.com/odudex/nodecase/blob/master/Hardware/node_schematic.pdf

@odudex that looks interesting - would be great if we can have a demo of that. There might be a lightning hackday in September - would be great if you can join and show us the solution.

@rootzoll I'll improve documentation and make a small video with the real thing

@normandmickey that looks good, would be better if it was still possible to use GPIOs

Also today Andreas Spiess did a great video and started an initiative on the topic:
https://youtu.be/-SJbdPvgQnE

Pi Sugar 2 Pro
This seems to be perfect. I even has a browser GUI for easy setup

https://www.youtube.com/watch?v=UlirpA-6tCQ

https://www.amazon.com/Pisugar2-Portable-Platform-Raspberry-Accessories/dp/B08D8PPCKN/ref=as_li_ss_tl?crid=2FSJA5GUXM52K&dchild=1&keywords=pisugar2+pro&qid=1598994885&sprefix=pisugar2,aps,149&sr=8-9&linkCode=sl1&tag=e074d-20&linkId=9acb2aeac9cfaae273afc60d5971fa2e&language=en_US

@odudex
Hi I'm the guy who makes the LiFePO4wered/Pi+ @normandmickey linked to. The LiFePO4wered/Pi+ has a stackable header version (it's actually the most popular version), so you can still stack other HATs on top. In addition, all GPIOs are still available for other uses, since the LiFePO4wered/Pi+ communicates over the I2C bus and only monitors TX to see if shutdown is complete.

It also has an MPP charger for solar and accepts input up to 20V. Plus it's the only RPi UPS I'm aware of specifically made for LiFePO4 (LFP) batteries, which have long life and don't die after being held fully charged for a year or two, as is the case with most other lithium-ions.

@normandmickey already linked to the manual, let me know if there's anything that needs more detail.

I also saw Andreas Spiess' video, and even though I'm a fan of his channel, I have to say I'm a little bit bummed by this video. It's like he went out of his way to find the least capable options on the market, just to have an excuse to start his project. Which he could do anyway if he wanted, without discounting the work others have done or hiding the capable options already out there.

@xorbit
Congratulations on your project and work, nice to know it has an stackable header version.
I did my own simple 2S lithium-ions UPS, its running for a few months, but I got worried about what you said about batteries dying, do you know the reason?
Your project seems really good, full featured and reliable. Any suggestion on how someone like me, in Brazil, could get it?
About Andreas Spiess, maybe he don't know your work, you could show him, he seems accessible. And I still think his video and idea are noteworthy because it still would have one new, and super cool feature: to be opensource hardware.

@odudex
Lithium-ion batteries degrade when held fully charged at a high "full" voltage. Not sure about the exact chemical mechanism, there are papers and studies about it. Since the full voltage of LiFePO4 is lower (3.6V vs 4.2V), they don't suffer (or suffer significantly less) from this effect. Plus you get 2000+ cycles (100% DoD) from most LiFePO4 where you'd only get a couple hundred from other Li-ion. An even more dependable chemistry is Lithium titanate (LTO), but they tend to be more expensive.

Can you order from Mouser in Brazil? If so, that would be the easiest I think (lowest hassle with customs etc). Unfortunately they ran out of stock on the stackable 18650 version, working on restocking them right now, so check in a week or so. Otherwise you can order from Tindie as well.

@xorbit your solution looks promissing. For the RaspiBlitz we are searching for something that could work with the following LCD Hat on top ... not adding too much of height: https://www.amazon.de/gp/product/B06X191RX7

Also we need to combine this with a passive heat sink case - at the moment we use this one: https://www.amazon.de/Sertronics-Armor-Gehäuse-Raspberry-schwarz/dp/B07VP6GB4G
(we tried a mechanical fan in the past, but turned out not to be reliebable enough).

If you see anyway how to use your solution within the RaspiBlitz setup (maybe with alternative heatsink case?) let us know.

@rootzoll Not adding height will be the hardest thing. I tried to keep the profile low by having most of the circuitry over the Pi facing down, which worked great for older Pi's. Then the Pi 4 comes along and it can't work at its advertised performance without bulky cooling. :-/

Adding a stacking header like this: https://www.amazon.com/Female-Pitch-Header-Raspberry-Model/dp/B01ITMN6K6/ or this: https://www.amazon.com/Extra-Female-Stacking-Header-Raspberry/dp/B01IRRCEBK/ (you my need the longer one) is probably the easiest option to clear the large heat sink. But it will add height of course. Fitting the LCD on top shouldn't be a problem, other than height.

Since I'm always interested at what customers want and need, and like it to inform my future designs: what would the ideal device for you look like?

@cryptocloaks

What'd we miss?! ;)

My 18650 sized LiFePO4 batteries finally showed up today so I was finally able to test the LiFePO4wered/Pi+ board.  I only tested the the AUTO_SHDN_TIME and AUTO_BOOT features (not runtime). Setting shutdown to 1 minute after power loss and auto boot to 2 minutes after power restoration worked flawlessly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frennkie picture frennkie  Â·  5Comments

2000jago picture 2000jago  Â·  5Comments

shawnyeager picture shawnyeager  Â·  3Comments

rootzoll picture rootzoll  Â·  4Comments

tiero picture tiero  Â·  4Comments