User avatar
Wizardling
Posts: 37
Joined: Wed Nov 16, 2016 4:22 pm
Location: New Zealand
Contact: ICQ Yahoo Messenger AOL

Any reason not to use a USB power bank as an UPS?

Sun Nov 20, 2016 1:36 pm

It just occurred to me today, worrying about SD card corruption if my new Pi 3 has it's power cut (and there was a power cut just a couple days before the Pi was delivered, so it's on my mind).

But is there any reason not to use a USB power bank as an UPS, with the power bank plugged in to be kept charged 24/7?

I suppose I'd need a power bank that used smart enough circuitry so as not to turn off charging (once fully charged) until unplugged and replugged in (as my Nintendo 3DS does, for example).

Thoughts? :-)
Frog blast the vent core!

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: Any reason not to use a USB power bank as an UPS?

Sun Nov 20, 2016 2:38 pm

Yes, this is a good idea, and one that I have been pursuing for quite some time.

The problem is finding something that actually works.

Most of the ones I've tested have had the problem that when you unplug the charging side of the battery (simulating a power-cut), the pi crashes/reboots.

One that I tested did actually work - and I was quite happy with it - until, after a few months running (24/7), it stopped working. Specifically, the "low power" squares started showing up. So, I stopped using it.

This (https://www.modmypi.com/raspberry-pi/br ... s/ups-pico) looks promising, but is currently out of stock.

P.S. A lot of these "UPS solutions" seem focussed on "shutting down the computer when there is a power glitch". I'm not interested in that functionality, because all of my power glitches are less than a second long. The last thing I want is for some "helpful" software to shut down the machine just because the power went out for an instant.
If this post appears in the wrong forums category, my apologies.

UK_Ham
Posts: 41
Joined: Fri Nov 18, 2016 3:00 pm
Location: Surrey

Re: Any reason not to use a USB power bank as an UPS?

Sun Nov 20, 2016 3:53 pm

Don't know how well it would work but quite a few people use capacitors on dashcams so there may be a method for those little glitches that shut down your Pi.
Name is Mike, Radio Ham and Weather Nut.
Total Beginner with Rpi Zero

User avatar
Wizardling
Posts: 37
Joined: Wed Nov 16, 2016 4:22 pm
Location: New Zealand
Contact: ICQ Yahoo Messenger AOL

Re: Any reason not to use a USB power bank as an UPS?

Sun Nov 20, 2016 4:58 pm

Yeah Martin, that's the kind of thing I'd like.

I googled some more since my OP, and this looks promising https://raspi-ups.appspot.com/en/index.jsp as a solution to our problems.
Frog blast the vent core!

geoffr
Posts: 80
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

Re: Any reason not to use a USB power bank as an UPS?

Sun Nov 20, 2016 10:47 pm

UK_Ham wrote:Don't know how well it would work but quite a few people use capacitors on dashcams so there may be a method for those little glitches that shut down your Pi.
I'm starting to look at this issue for the irrigation controller I am building using a Pi Zero. I don't really care about losing 24VAC power (it doesn't help to be able to open a solenoid valve if my pump, which runs off 240VAC won't run), but I do store a lot of data in RAM file systems.
To go the capacitor route, I would need to spend, at a first guess about $25 on capacitors (a bank of 15000 uF aluminium caps) will do the trick. (The 1000uF cap I use to smooth the feed coming out of my rectifier already gives a little over a second of power.) Caps will work fine in my instance, as I can charge them from feed straight out of my bridge rectifier, which is about 35VDC, which is then fed into a buck converter which produces the regulated 5VDC feed for the Pi. As long as the voltage out of the caps is high enough for the buck converter to provide a regulated 5VDC feed, I am OK.
To use capacitors effectively, you need a higher voltage input feed - you need to then feed the output of the caps into a regulator to provide a constant 5DC feed. - In my scenario I have the higher voltage input feed because I need the 24VAC feed to operate my solenoid valves. It makes more sense to rectify that and produce a 5VDC feed than use a second wall wart.

The USB Powerbank solution is simpler: it costs somewhere between $10 and $25 and anyone can implement it. I just don't know if it will be as long-lived as a solution using capacitors.

mosespi
Posts: 473
Joined: Mon May 12, 2014 3:35 pm
Location: 34,-118
Contact: Website

Re: Any reason not to use a USB power bank as an UPS?

Mon Nov 21, 2016 4:48 am

A lot of USB powerbanks will momentarily 'blip' the power output when the input changes. You can try to add some capacitors to the output to help it out. I have a little bit of experience with USB powersbanks, the ones I tried didn't do too well. Charging and powering a Pi my powerbanks got very hot, even with minimal load.

I got tired and made my own.

For a true Pi UPS see:
http://www.allspectrum.com/mopower/

There is a supercap write up too if you are interested
http://www.allspectrum.com/mopower/supe ... -info.html

Regards,
-Moses
Power problems? MoPower UPS for the Pi
http://www.allspectrum.com/mopower/

Ongelma
Posts: 113
Joined: Wed Dec 03, 2014 6:46 am

Re: Any reason not to use a USB power bank as an UPS?

Mon Nov 21, 2016 6:58 am

I suppose I'd need a power bank that used smart enough
What you need is a power bank thats STUPID engough. If theres some kind of a brain inside the power bank, it will:

-Shuts off when sharged fully
-Shuts off charging side when a device is connected to draw power
-restarts charging when you plug in a charger to charge the power bank (connection is lost for a millisecond or similar and your pi looses power)

I have a couple of 2600mah chinese power banks that are all the way stoopid and let me charge them at the same time my pi uses them. I can even chain these so i have two banks connected to each other and a pi to one side and a charger to the other side making for example a portable timelapse camera easy to manage.

I have no idea of the type/ model/ brand of these banks. Just order a bunch from Ebay (2$ a piec or similar) and try them out.

texy
Forum Moderator
Forum Moderator
Posts: 5094
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Any reason not to use a USB power bank as an UPS?

Mon Nov 21, 2016 7:55 am

Ongelma wrote:
I suppose I'd need a power bank that used smart enough
What you need is a power bank thats STUPID engough. If theres some kind of a brain inside the power bank, it will:

-Shuts off when sharged fully
-Shuts off charging side when a device is connected to draw power
-restarts charging when you plug in a charger to charge the power bank (connection is lost for a millisecond or similar and your pi looses power)

I have a couple of 2600mah chinese power banks that are all the way stoopid and let me charge them at the same time my pi uses them. I can even chain these so i have two banks connected to each other and a pi to one side and a charger to the other side making for example a portable timelapse camera easy to manage.

I have no idea of the type/ model/ brand of these banks. Just order a bunch from Ebay (2$ a piec or similar) and try them out.
Do you have an ebay link for the one's you have?
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Wizardling
Posts: 37
Joined: Wed Nov 16, 2016 4:22 pm
Location: New Zealand
Contact: ICQ Yahoo Messenger AOL

Re: Any reason not to use a USB power bank as an UPS?

Mon Nov 21, 2016 3:32 pm

Ongelma wrote:
I suppose I'd need a power bank that used smart enough
What you need is a power bank thats STUPID engough. If theres some kind of a brain inside the power bank, it will:

-Shuts off when sharged fully
-Shuts off charging side when a device is connected to draw power
-restarts charging when you plug in a charger to charge the power bank (connection is lost for a millisecond or similar and your pi looses power)

I have a couple of 2600mah chinese power banks that are all the way stoopid and let me charge them at the same time my pi uses them. I can even chain these so i have two banks connected to each other and a pi to one side and a charger to the other side making for example a portable timelapse camera easy to manage.

I have no idea of the type/ model/ brand of these banks. Just order a bunch from Ebay (2$ a piec or similar) and try them out.
Wouldn't that severely decrease the life on the Li-ion cells? And maybe even be a tad dangerous? I don't have a lot of faith in cheap Chinese electronics and parts off auction sites, or even off Amazon. I sometimes buy that stuff if it's simple or harmless enough that it can't hurt to try before a more expensive option. But power banks seem a little worrying to go ultra bargain basement auction hunting. To me anyway *shrug*

I'd rather spend a bit more and have a power bank that behaves as well as, say, my old iPod touch's battery (I use the touch as my alarm clock always plugged into a USB wall charger).
Frog blast the vent core!

ejolson
Posts: 1572
Joined: Tue Mar 18, 2014 11:47 am

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 1:01 am

Wizardling wrote:But power banks seem a little worrying to go ultra bargain basement auction hunting.
As demonstrated by the Boeing 787 and the Samsung Galaxy Note 7, well paid engineers can have problems with Li-ion batteries and thermal runaway. The Li-ion batteries in a Tesla S electric car are shielded by titanium as the original 1/4" aluminum housing did not offer enough protection. Power banks were engineered to be cheap and portable rather than cheap and durable. They are also designed for intermittent rather than continuous use. For a home-built UPS using NiMH batteries as suggested above is a good idea. Even lead-acid batteries with the explosion risk that results from the hydrogen gas are likely safer.

grandrew
Posts: 6
Joined: Thu Apr 18, 2013 4:34 pm

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 7:47 am

It is impossible to use a Li-Ion power bank as an UPS source by itself simply because Li-ion requires a separate controller to charge the batteries and they are completely disconnected from power output when charging. If you find a "smart enough" power bank that actually does output anything while charging - you'll have to solder an LC-filter to cover the power disruption when the controller switches from charge to discharge and to cut noise from the controller itself.

As of my experience it is really possible to find a stable LC configuration for a specific Pi workload (because CPU has its own power draw pattern for your task) but you still have a risk of occasional crashes.

achrn
Posts: 282
Joined: Wed Feb 13, 2013 1:22 pm

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 8:27 am

grandrew wrote:It is impossible to use a Li-Ion power bank as an UPS source by itself simply because Li-ion requires a separate controller to charge the batteries and they are completely disconnected from power output when charging. If you find a "smart enough" power bank that actually does output anything while charging - you'll have to solder an LC-filter to cover the power disruption when the controller switches from charge to discharge and to cut noise from the controller itself.
Mine works fine.

I bought this: https://www.amazon.co.uk/gp/product/B00EAOH05K

It works. The pi to which it is plugged in continues to work when I pull the power supply from the mains, continues to work for the 10 minutes or so that is the longest I've had it disconnected, and continues to work when I plug it back in. I have done no soldering to this unit - it has a pihut wallwart plugged into this power bank, and this powerbank plugged into my pi.

I shall tell it to stop doing the impossible.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 8:35 am

achrn wrote: Mine works fine.

I bought this: https://www.amazon.co.uk/gp/product/B00EAOH05K
That looks a lot like the one I had - that worked - for a while.

How long have you had yours running?
If this post appears in the wrong forums category, my apologies.

achrn
Posts: 282
Joined: Wed Feb 13, 2013 1:22 pm

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 6:03 pm

Martin Frezman wrote:
achrn wrote: Mine works fine.

I bought this: https://www.amazon.co.uk/gp/product/B00EAOH05K
That looks a lot like the one I had - that worked - for a while.

How long have you had yours running?
Not long - about six weeks, with probably a dozen interruptions in power, of up to 10 minutes each. I actually just bought it to play with rather than for any especially serious application. I was just curious about how well it would work, but don't intend to deploy it to anything where it matters.

I have one Pi where I do want it to have a UPS-like behaviour. For that one I have a 12V supply that trickle-charges a bank of NiMH cells, the NiMHs and power supply both feeding into a switched mode regulator via a diode network so that the regulator always sees enough input voltage to keep the 5V output going. The power supply also puts a 'power good' signal into a GPIO pin (just via a voltage divider) so the Pi knows when power has gone down, and it has a fairly dumb process running that assumes the batteries charge at 3.5%/hour all the time the power supply is on, and discharge at 80%/hour when power is off. It shuts down the Pi if this assumption leads it to conclude the battery is both less than 50% and has dropped by 20% in the current outage. It shuts down immediately as soon as it thinks battery capacity is below 20%. It writes human-readable logging into a /var/log file that it also checks to decide what state the battery is in when it powers up. Derivation of all these figures is pretty pessimistic (ie, it really charges at about 0.05C, it discharges at quite a lot less than 0.8C).

The Pi process actively switches on the battery bank (via a FET) so that if the power supply is off, when teh Pi shuts down the battery disconnects, and thus the voltage into the pi is cut, so when mains comes back the pi restarts on its own without intervention.

That has been performing happily for a couple of years.

MarkTF
Posts: 251
Joined: Tue Mar 03, 2015 4:59 pm

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 8:35 pm

If I may be allowed to mention a RPi "competitor", the NextThing CHIP SBC has an integrated LiPo controller that makes this sort of thing trivial. When provided power via the USB it will charge an attached battery and will use the battery if USB power drops. It will also use the battery as a supplement for momentary power peaks. It's a single core ARM, so roughly comparable to a Pi1A+, but with integrated wifi and bluetooth. Most importantly they seem to have gotten their supply chain problems sorted so one can be had within a month or so of ordering.

User avatar
Douglas6
Posts: 4346
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 8:50 pm

If we're mentioning 'competitors', the Adafruit Feather series also have onboard hot-swappable boost converters and charging.

stevend
Posts: 168
Joined: Fri Oct 11, 2013 12:28 pm

Re: Any reason not to use a USB power bank as an UPS?

Tue Nov 22, 2016 10:45 pm

Meanwell do a range of combined battery chargers and power supplies which are particularly useful if you need 12V or 24V and derive the Pi's power supply from it. You hook up a lead-acid battery of appropriate size for the backup time you want. Cost a little more than USB power banks and the like, but designed for the job. This is about the smallest they do, at 40 watts; up to this range at 150 watts, with various options in between.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Any reason not to use a USB power bank as an UPS?

Wed Nov 23, 2016 12:53 am

grandrew wrote:It is impossible to use a Li-Ion power bank as an UPS source by itself simply because Li-ion requires a separate controller to charge the batteries and they are completely disconnected from power output when charging. If you find a "smart enough" power bank that actually does output anything while charging - you'll have to solder an LC-filter to cover the power disruption when the controller switches from charge to discharge and to cut noise from the controller itself.

As of my experience it is really possible to find a stable LC configuration for a specific Pi workload (because CPU has its own power draw pattern for your task) but you still have a risk of occasional crashes.
Not true, my RS powerbank explicitly says that it can be used as such in the documentation.

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 52 guests