User avatar
kneekoo
Posts: 19
Joined: Mon Dec 29, 2014 7:08 am

1A battery as UPS

Sat Nov 04, 2017 1:26 am

Hey everyone! :)

I want to use a rechargeable battery as a UPS for a VPN server based on Raspberry Pi Zero W. The first thing I checked was the Power Requirements, and the battery I'd like to use outputs 5V, 1A - just under the recommended PSU current capacity.

However, I don't need any interfaces and I will make sure they're all disabled. And I will also use the "lite" release of Raspbian. Would this battery output enough power to have the Pi Zero W running non-stop safely? At least in theory, of course. Under these circumstances I think it should, but not knowing how much power the interfaces+Xorg require, I thought it would be best to ask here.

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: 1A battery as UPS

Sat Nov 04, 2017 4:32 am

The only problem is that there is no way for the Pi to do a shutdown and save info. They make Hat's to be used as a UPS.
Last edited by broe23 on Sat Nov 04, 2017 8:25 pm, edited 1 time in total.

W. H. Heydt
Posts: 10910
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: 1A battery as UPS

Sat Nov 04, 2017 4:33 am

You need to look at the Watt-hour capacity, not just the amount of current it is capable of handling. I use a 4Ah (which is 4Ah * 3.7v = 14.8Wh) "powerbank" to run a Pi0W and a 3.5" LCD. It runs for about 12 hours.

Now for the "gotcha". You don't say what sort of battery it is but I suspect you're looking at a Li Ion or LiPo one. *Most* such batteries cannot be charged and discharged simultaneously. The charging circuitry for Li Ion an LiPo cells in not straightforward and circuits to handle pass-through charging are somewhat complex, especially if you don't want any interruptions in the provided power. You will need to look for systems specifically designed to be a UPS. The good news is that such devices exist though I don't know of any off hand specifically intended for a Pi0W.

So...the first consideration is: how long does your device need to run without an external source of power? How much current will your device use, on average and at peak load? From those figures, you can determine the needed battery capacity. Then go looking for a battery that is intended to be used as a UPS and has sufficient capacity (remember to allow for discharge limits and any losses in voltage conversion).

User avatar
kneekoo
Posts: 19
Joined: Mon Dec 29, 2014 7:08 am

Re: 1A battery as UPS

Sat Nov 04, 2017 7:43 am

Thanks for your replies! :)

@broe23: As this Pi0W rarely has to write on the microSD card, I'm less worried about having it shutdown properly before it runs out of power completely. So when the power comes back, I assume the battery will start the Pi back up. I'd have to test this anyway, but my first thought was if the battery can at least supply the required power for normal operation.

@W. H. Heydt: The battery is an Energizer XP2000 (Lithium Polymer), and the back of the battery says max. 8WH. As I implied in my reply to broe23, I'm not worried about 100% availability. Basically what I want is to give this Pi0W a chance to remain powered during a short power outage, but before considering how long it can power the Pi I wanted to be sure I won't harm it by giving it a charge that is less than the recommended value. Besides, I have no tools to measure the power consumption and I wouldn't know how to use them even if I had them.

User avatar
Gavinmc42
Posts: 3758
Joined: Wed Aug 28, 2013 3:31 am

Re: 1A battery as UPS

Sat Nov 04, 2017 8:17 am

Most "battery" power banks have a 3.7-4.2 Lithium Ion cell in them.
It has a circuit to boost this up to 5V on the USB output and another to charge the battery.
Both circuits normally don't work at the same time :(

The Zero needs 5V for the HDMI but otherwise should work directly from the cell at 3.7-4.2V.
A DIY or UPS hat would be better, something like this
https://shop.pimoroni.com/collections/r ... or-pi-zero
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

alphanumeric
Posts: 2080
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: 1A battery as UPS

Sat Nov 04, 2017 9:23 am

The Adafruit Powerboost "c"'s can charge the battery and provide boost voltage at the same time. I have a 1000c in one of my Pi projects. It also has a low battery warning pin/output that can be used to shut the Pi down before the battery dies. I haven't made use of it myself, but its there. I have a 6600 MAH LIPO battery https://www.adafruit.com/product/2465 y.

User avatar
kneekoo
Posts: 19
Joined: Mon Dec 29, 2014 7:08 am

Re: 1A battery as UPS

Sat Nov 04, 2017 10:25 am

Thanks for your suggestions, they're great and I will probably use both in the future. But as I already have this battery at hand, before I start testing I'd just like to know if it's safe to power the Pi Zero W.

I won't use HDMI either, so I will only plug the power cable and have a Raspbian Lite installed and managed over SSH. I wish there were more official details about the power requirements of the Pi components and interfaces. That would help a lot.

alphanumeric
Posts: 2080
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: 1A battery as UPS

Sat Nov 04, 2017 11:18 am

Some info can be found here, https://www.raspberrypi.org/help/faqs/#topPower Pi Zero W bare board current is 150mA.

What you need to determine is, can you keep the battery charged while powering your Pi from it? As mentioned, some power banks can't do both at the same time. If you can't charge the battery (keep charged) while powering a device it isn't going to work for you the way you want it to.

User avatar
Gavinmc42
Posts: 3758
Joined: Wed Aug 28, 2013 3:31 am

Re: 1A battery as UPS

Sat Nov 04, 2017 11:54 am

I normally use PiCore for PI's that can have power cuts.
It loads from SD into ram and runs from ram, also much smaller and boots fast.
Will need to check out those Adafruit PS's.
Any have RTC and alarm power wakeup?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

alphanumeric
Posts: 2080
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: 1A battery as UPS

Sat Nov 04, 2017 12:06 pm

The Adafruit PowerBoost doesn't have a RTC. I used their DS3231 Precision RTC Breakout. I just mounted it to a Proto Hat.

NotRequired
Posts: 195
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: 1A battery as UPS

Sat Nov 04, 2017 12:13 pm

Most of the small battery solutions for the Raspberry are only good for "safe shutdown". You are talking about a VPN server - such an installation will most likely require an internet connection which again requires some sort of router or modem to work. So it is not only the Pi which needs to be kept up, but also the router / modem - or else it makes no sense.

I am experimenting with a solution where I'm using a closed lead-acid battery from a moped (or motorcycle). It is relatively small (15x15x7 cm) and can hold a whopping capacity of 12Ah @ 12V! I use voltage regulators to step down the voltage to 5V (78S05 2A) for the Pi and 9V for the router. The battery can both charge and discharge at the same time, so it is always charging while powering the Pi + router. I have tried to disconnect the charger and even after a two days, the voltage of the battery did not drop below unsafe levels.

So if you really want some serious backup power for your VPN server, this may be a solution for you. It may be bulky, but with a little bit of handy-work, it can be tucked away nicely to achieve WAF! ;-)
Please do not ask questions in private messages, they will not help others.

alphanumeric
Posts: 2080
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: 1A battery as UPS

Sat Nov 04, 2017 12:20 pm

I'm guessing that's a Gel Cell? It would be what I'd want to be using as it doesn't off gas when being charged. I'd also want it to be deep cycle, less chance of damage if you run it right down.

NotRequired
Posts: 195
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: 1A battery as UPS

Sat Nov 04, 2017 12:28 pm

alphanumeric wrote:
Sat Nov 04, 2017 12:20 pm
I'm guessing that's a Gel Cell? It would be what I'd want to be using as it doesn't off gas when being charged. I'd also want it to be deep cycle, less chance of damage if you run it right down.
A gel battery would probably be an even better sollution :) The one I use(d) is an old one (label has come off, dunno part number), which is similar to this one: https://www.amazon.co.uk/YTX16-BS-Exide ... B00AO2S36C I do not believe that gasses are an issue with this type of closed (maintenance free) battery.
Please do not ask questions in private messages, they will not help others.

alphanumeric
Posts: 2080
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: 1A battery as UPS

Sat Nov 04, 2017 12:50 pm

I honestly don't know?

User avatar
kneekoo
Posts: 19
Joined: Mon Dec 29, 2014 7:08 am

Re: 1A battery as UPS

Sat Nov 04, 2017 2:57 pm

As much as I enjoy the info posted in this thread, my main concern remains unanswered. :D

Q: Considering the Recommended PSU current capacity of 1.2A indicated for the Raspberry Pi Zero W, would it be safe to have it powered by a 1A LiPo battery capable of max. 8WH?

I don't want to damage the Pi by under-powering it, that's all. Once I know it's safe, I can easily test if the battery can both power the Pi and charge itself without running out of juice while doing so.

As for keeping the router powered, in my specific case it's not necessary. If the power goes out, the networking equipment of my ISP would also go offline so there would be no internet connection at all. And having a mobile connection as a backup is not required, as this VPN server only needs to serve occasional connections when I will be away.

NotRequired
Posts: 195
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: 1A battery as UPS

Sat Nov 04, 2017 3:14 pm

Yes, it is safe but it will, however, not be useful to power the Pi for longer hauls. It may work for a couple of hours before the voltage drops and the Pi cuts out. The Pi itself will not be damaged by too low voltage, but the SD card is quite sensitive to power outages.

Btw. Watt = Amps * Volts. 8w @ 5v = 8 / 5 = 1,6 amps.
Please do not ask questions in private messages, they will not help others.

alphanumeric
Posts: 2080
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: 1A battery as UPS

Sat Nov 04, 2017 3:56 pm

The 1.2 A is the "Recommended" PS current capacity. That doesn't mean the Pi is going to draw that much current. I take the typical bare-board active current consumption to be the minimum you would dare to use. For the Zero W its only 150 ma. If you set yours up as you stated in your first post I don't see you even coming close to 1 A.
From the FAQ https://www.raspberrypi.org/help/faqs/#topPower
The specific current requirements of each model are dependent on the use case: the PSU recommendations are based on “typical maximum” current consumption.

Keep in mind that when talking about a regulated power supply specs, the voltage is fixed, in this case its 5 volts. That's regulated to stay at that value. The current rating is the max it can supply. Up to that value but not above it. Your power pack can supply "up to" 1A depending on the load. The load only draws what it needs though. Some Pi models draw more current than others. Plug devices into the USB ports and you have to add in what current they draw to the total. The recommended current rating for the Pi poser supply takes into account what you might plug into your Pi. It's just a quid line, its not etched in stone. Most power supplies are current limited, you can't get any more out of them than what they are rated for. Assuming its not some junk from e-bay etc. Usually the voltage drops when you try to draw to much current. Or they just turn off.

Paul Hutch
Posts: 390
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: 1A battery as UPS

Sat Nov 04, 2017 5:34 pm

kneekoo wrote:
Sat Nov 04, 2017 7:43 am
The battery is an Energizer XP2000 (Lithium Polymer), and the back of the battery says max. 8WH.
That is NOT a battery, that is a USB power bank which contains a 2000mAH LiPo battery, charge control circuitry and an output regulator circuit to provide a steady 5VDC that meets USB voltage specs. The confusion is created because manufacturers want to claim a high mAH rating but advertising rules in many countries say you can't lie in specifications. With this particular device the output that you can use is fixed at 5V. If they called it a 2000mAH USB power bank it would have to provide 10WH (5V * 2000mAH). It actually has an average voltage at the battery during useful life of 4V which = 8WH (4V * 2000mAH). Converting the batteries average voltage up to 5V also causes some loss of power so even the full 8WH is not available at the output. The amount actually available is dependent on the boost converter design and is AFAIK never specified by power bank manufacturers. If you assume 90% efficiency, not unreasonable, there will only be 7.2WH available.

From a practical standpoint there are many factors in a power bank design that can impact whether it can be used as a DIY UPS. There are a few other threads on this forum with details. A big factor is if the power bank can pass through power or if it can only discharge/charge the internal battery. If it can only discharge or charge it is not usable at all.

I'm currently experimenting with a generic power bank someone gave me that does pass through power. The second hurdle I've also passed is it responds quickly enough when switching over from pass through mode to battery power so that the RasPi0W doesn't crash. Still have to test out length of back up time and figure out if it recharges while passing through power. Assuming it turns out to be usable I'm thinking I'll put a transistor circuit on the power input side that will signal a GPIO pin when power in is lost. Then the RasPi can time how long power has been off and automatically shut down before the power bank runs out of power.

W. H. Heydt
Posts: 10910
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: 1A battery as UPS

Sat Nov 04, 2017 5:38 pm

kneekoo wrote:
Sat Nov 04, 2017 7:43 am
Thanks for your replies! :)

@broe23: As this Pi0W rarely has to write on the microSD card, I'm less worried about having it shutdown properly before it runs out of power completely. So when the power comes back, I assume the battery will start the Pi back up. I'd have to test this anyway, but my first thought was if the battery can at least supply the required power for normal operation.
Raspbian writes a time record periodically and *any* writes have the potential to trigger wear leveling activity on the card itself. So while you will *probably* get away with sudden power drops, over a long enough term, it carries some real risk.
@W. H. Heydt: Besides, I have no tools to measure the power consumption and I wouldn't know how to use them even if I had them.
Tool...cheap: https://www.adafruit.com/product/1852 There was a relatively recent post that showed a version of this that displays voltage and current simultaneously, so there are variations that will work.

The one I linked to alternates the display between voltage and current. The voltage should be steady at 5v (or very close to it) so you pay attention to the current.

User avatar
rpdom
Posts: 15238
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: 1A battery as UPS

Sat Nov 04, 2017 5:44 pm

Some rough back of envelope calculations based on the spec of that Energizer unit:

It has a 2Ah LiPo cell. That will give about 7.2Wh at 3.6V (nominal). Lose 20% (worst case) for converter losses and you get 5.76Wh. At 5V that will be 1.15Ah which could power a Pi Zero at 150mA for around 7.5 hours. But you don't want to run the battery down completely, so make that 6 hours maximum.

That's without the Pi working too hard and no peripherals.

Others have already gone over the charging while in use problem, so I don't need to add anything to that.

irdroid3
Posts: 3
Joined: Wed Jun 05, 2013 11:42 am

Re: 1A battery as UPS

Fri Jul 26, 2019 4:57 pm

Paul Hutch wrote: ...
I'm currently experimenting with a generic power bank someone gave me that does pass through power. The second hurdle I've also passed is it responds quickly enough when switching over from pass through mode to battery power so that the RasPi0W doesn't crash. Still have to test out length of back up time and figure out if it recharges while passing through power. Assuming it turns out to be usable I'm thinking I'll put a transistor circuit on the power input side that will signal a GPIO pin when power in is lost. Then the RasPi can time how long power has been off and automatically shut down before the power bank runs out of power.

Paul, how did that work out in the end? - and what make/model of power bank was it?

Cheers, Ian
.

Paul Hutch
Posts: 390
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: 1A battery as UPS

Fri Jul 26, 2019 5:51 pm

irdroid3 wrote:
Fri Jul 26, 2019 4:57 pm
Paul, how did that work out in the end? - and what make/model of power bank was it?

Cheers, Ian
.
It works great!

Unfortunately even after taking it apart to read the PCB I was unable to figure out who made it. My sister had bought 10 of them from an eBay seller for $20 in 2015 and that seller is not around anymore.

The one I have looks like this one:
https://www.ebay.com/itm/2600mAh-Portab ... 1927385192

User avatar
rpdom
Posts: 15238
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: 1A battery as UPS

Fri Jul 26, 2019 6:18 pm

I know there are some powerbanks that look like that that do pass through power.

I've bought about ten from different suppliers trying to find one, but been unsuccessful. None of the ones I bought can supply power and be charged at the same time.

Also, I believe that the few that do handle pass through manage it by dropping the voltage on the output briefly to see if the supply remains constant. If it does they know they are on "mains" and can charge the battery instead of draining it.

Big Clive on youtube did an investigation on those. (I can't remember the link right now. It was a few years ago. I'll link to it if I can find it)

Return to “General discussion”