Potential Issues of Using a USB Powerbank as a UPS (2021)
goughlui.com
goughlui.com
There's no reason anymore that a power bank should ever even have an off mode unless it's so cheap there's no passthrough, which shouldn't be a thing either because it's annoying and probably saves 50 cents.
It's microamps with a good eco mode switcher.
Inline USB ultracapacitor banks seem like a reasonable product too though.
Hopefully USB will give us standards for power banks someday so you can get certified ones with a defined form factor and behavior.
USB Energy Provisioning Aggregate Network 4.3 Revision 11 Gen3x4 48gbps SuperCharge-C.
[1]: https://cdn.arstechnica.net/wp-content/uploads/2022/09/USB-p...
> Inline USB ultracapacitor banks seem like a reasonable product too though.
I actually saw just that in a GreatScott Youtube video about Aliexpress gadgets just the other day[1]. Not sold as a UPS, but rather a power filter or buffer.
Weighed more than my MacBook, but indispensable. Too bad they don't make them anymore.
It's on the line voltage side like any other UPS, so not as efficient as you could be with a solution that didn't have to convert AC to DC then back to AC then to DC again in the brick. But with Apple's proprietary charging connector soldered to the device end of the brick, what else can you do about it?
In short, it will take whatever it can get and boost.
Kinda inefficient to run 2x boosts, but it does the job.
Will buy you time during use and slowly charge while closed.
These kind of comments are surprisingly common on HN and annoy me slightly.
Yes, most phones and laptops do not have user replaceable batteries anymore. It's a pity. That does not mean a dead battery is a justification to throw away fine equipment.
Any phone repair shop or computer shop can replace batteries. They usually have all the equipment and spare parts, even more so for popular Apple devices. It usually takes half an hour and costs way less than replacing the whole device.
I always recommend that to friends and family because most of them are not even aware this is possible. They usually thank me later saying how painless and affordable it was to give a second life to their devices.
A good way to keep these devices in use would be with an external battery, and one built into the power adapter would be very convenient. Just an hour of power would be enough to move around to meetings without multiple reboots.
And that's assuming you can even find a decent replacement battery.
Now, if you said the keyboard...
I can see how someone would call that half the laptop.
Assuming the default failure mode of the battery is degraded capacity. Over the years I've had an alarming number of lithium-polymer batteries puff out in consumer devices ranging from my Dell XPS 13 (9343 model, battery was replaced three times) to the Moto Z Play phone (dislocated the screen, replaced twice by Asurion, third time they claimed it was a warranty issue and played support tennis with Verizon) to an iPod Touch (also popped the screen out).
But because of economies of scale, you don’t just pay the difference in BOM cost, you pay that difference plus the difference in fixed costs divided by a much smaller unit run.
USB UPSes exist, and they’re really not that niche. Amazon has one for $50. That’s mass-market pricing as far as electronics are concerned.
As an engineer you are given a power budget, a thermal budget, a size budget, a weight budget and a monetary budget, among many other constraints. This means, like any engineering endeavor, there are tradeoffs to make. That 50-cents you saved on some power controller might be "spent" somewhere else that has a higher impact on the product.
There is a near infinite set of things you can do to make the product better somehow. Unfortunately you don't get to do them all. Many of the things conflict with eachother--more battery life might mean more weight and size that you have to "steal" from some other aspect of the product to balance out. Faster, better charging might cost 50-cents but that might mean in order to stay on budget you'd have to use a lower quality plastic shell that is more prone to damage. That faster, better charging might also eat into your thermal budget, meaning you'll need to spend more on cooling, weight and size.
It's all tradeoffs. There is no free lunch.
It goes like "They'll never know the difference!" and pretty soon you've gone from a premier brand to a cheapo outsourced-to-China generic product.
Usually it's to make things simpler... but occasionally they will add complexity as long as it makes stuff harder...
Their second favorite is complaining when people make things easier.
I was able to find a device that actually functions as a USB UPS: https://www.amazon.com/gp/product/B07ZS3WYZY/
It is so nice to be able to unplug my Pi to move it, and have it stay on. I also use them for my usb powered wifi security cameras. So far they have not failed me.
Insanely easy to believe. The role of UPS is to prevent data loss when power fails. If something is powered by USB-C it almost always already have its own battery preventing from that.
The only devices that are not are stuff like say, raspberry Pi
Also, there literally are devices like that, just aimed more at stuff like camping, so much bigger battery, usually an inverter on board and solar input.
> Hopefully USB will give us standards for power banks someday so you can get certified ones with a defined form factor and behavior.
If it will be like USB-PD then it will be insanely overcomplicated and nobody will be able to get it right.
That's a very narrow minded approach to both UPSs and items using USB as their power plug imo.
A UPS isn't just "to prevent data loss when power fails." It's also to keep critical (for home, not DC) things running in the event of power outages. Current uses for USB-C power banks as UPSs I have (or have recommended to friends) that aren't "to prevent data loss".
- Power bank running as a UPS on (a few critical) wireless security cameras (that use USB-C for power).
- Power bank running as a UPS on my cats water fountain (uses USB for power), if the power goes out she still needs to drink water, and I may not be home to put down a standard bowl.
- Friend has a baby monitor and took my idea of using a USB power bank as a battery backup on the camera and monitor so that if his power goes out he can still keep tabs on his child. (no sense waking her up to move her if he doesn't have to)
That's a moot point though, IMO. Like if you're travelling, wouldn't it be nice if your charger and your battery bank were the same device? Just because it doesn't have the same specific utility as a UPS, doesn't mean that it's not useful in other ways.
Like this?
https://www.anker.com/products/a1621
There’s a lot of these devices. “Wall plug power bank” worked as good keywords for me on Amazon.
These could still be different in operation than a UPS though
Raspberry Pis are common though. They've taken over like half of DIY electronics and home servers, for a good reason, everything else is way more hassle and less supported.
Not sure why you say PD is overcomplicated. Until you get above 30 to 60w where not everything supports it, stuff just works. Their only big mistake I see is not keeping the 12v power tier.
WAY too many things run on 12v and losing the ability to easily run legacy stuff sucked. But they'll fix that when 12v PPS trigger modules are available, for some reason they are not currently.
Or IP cams, I have some here that sounds really benefit but I'm worried about the safety of a powerbank plugged in 24/7 that's not meant for it.
I could see it being a thing. A niche thing but a thing.
The "DC UPS" units you can find for sale (as well as USB power banks) don't have any monitoring/data connection. Real UPSes have them to tell your systems to perform a clean shutdown when the battery gets low. Since they're all just simple dumb batteries anyhow, you might as well roll your own for less cost and much more runtime...
To make it a proper smart UPS, you would just need to add a low-voltage trigger that talks over USB, RS-232 or Ethernet. Something like a 12V relay could act as a "contact closure" signal, though you'd have to test the cut-off voltage and perhaps try a few different values of resistors to fine-tune the low-battery signal.
Just have your device shutdown when it can no longer poll another device. For example, if the router or some other network device isn’t contactable for longer than two minutes, it might indicate that the power is out.
Sure, you could find some device that isn't on a battery backup and ping it regularly. But this approach forces the device on your UPS to shutdown as soon as power is lost. That buys you a clean shutdown, but you don't get the added benefit of being able to run without interruption during a brief brownout.
Most people want their devices to stay up and running on battery as long as they can, not just shut-down immediately after utility power goes down. Without somehow measuring the battery voltage, you can't estimate how much run-time your devices have to work with.
No.
Devices should survive powerloss, devices can have a graceful shutdown from an external source.
Key is in your "might".
In your example even simply updating router OS/FW would case the router to reboot and your script will gladly shutdown the server.
Have one router break or someone disconnect one cable and your servers will power down.
"simple".
Only the low-battery signal would require a bit of work, but that is option and isn't found on ANY devices available off-the-shelf so it's not possible to buy your way around that.
Guessing the average AC UPS that someone might back a desktop with might last 5 minutes (or in a data centre long enough for the generators to kick in). A "DC UPS" running a router or a raspberry pi likely has a runtime measured in hours. Still would be nice to have monitoring info available, but more time for human intervention to shut down if need be.
"you might as well roll your own for less cost and much more runtime..."
Depends on how much gear you want to power. If you just want to keep a raspberry pi online a few hours I doubt you'd save much money (if any) rolling your own. Could be fun as a project though.
If everyone were to charge a battery bank when the power is on, to see them through the time when it is off, the net result would be increased energy consumption, due to efficiency losses.
Additionally, peak/off-peak is a thing. The grid may have excess power from wind and solar when conditions are idea. Charging your batteries during those times will not have any negative effects.
There are, however, USB-PD sources that can run from a fixed voltage DC supply.
I would actually really like something like this that can fit in my backpack with just shy of 100Wh (airline limit) of energy storage, a retractable cable to plug into an outlet, and monitoring via USB. In theory, I could build this myself around OpenUPS, but sourcing a pack, retractable cable and suitable enclosure is really annoying.
This appears to fit the bill, if you can find it for sale, https://www.macworld.com/article/539605/zmi-powerpack-no-20-... & https://www.zmi.com/products/powerpack-no-20-qb826g-25000-ma...
> 90 watt-hour (Wh) / 25,000 milliampere-hour (mAh) battery. USB-PD + UPS: 5V/3A, 9V/3A, 12V/3A, 15V/3A, 20V/5A 100W MAX
https://www.tsa.gov/travel/security-screening/whatcanibring/...
IMO a cheapo x64 laptop is better than a raspberry PI + some jerry-rigged UPS setup for a low-power home server setup, YMMV.
Most phones and laptops operate at the "micro-cycling" mode that the author describes, it's part of why portable devices regularly end up in the news for swelling batteries. There's no brand that didn't have complaints by people.
Additionally, the power quality of shoddy chargers [1] makes life even worse for circuit designers - voltage ripple or, worse, spikes that rise fast enough to hit the battery... the list of problems is quite endless.
[1] https://www.righto.com/2012/10/a-dozen-usb-chargers-in-lab-a...
The other thing is that if you have a laptop worth using as a server then you have a laptop probably worth selling. Use that money to buy a proper UPS and cheap server and you may even have money left over. You also can't plug routers or cable modems into a laptop, so it's rather pointless anyway.
I have a UPS because I'm hit with short brownouts every summer (yay, California). But if my grid was better and I only saw outages every few years then screw it. Let the server crash. This isn't the 1980s. Nearly all filesystems and databases (ACID, anyway) recover just fine today. Use ZFS if you're truly paranoid.
SO many consumer electronics intentionally charge lithium cells to their limits to boast long battery run times and high capacities in the specs while severely shortening the products lifespan.
If that's the case why do the lead acid batteries in consumer UPS's never last more than 3-5 years?
I want to put together an EDC portable Linux box using something like a Radxa Zero or OrangePi Zero, with the idea that it'll run for some nominal amount of time away from a wall outlet.
A power bank is obviously the answer, but I don't want "push the status button and guess at what the 5 LEDs are saying" to be my answer to "how much power is available?". I want something I can ideally turn into an ETA, so that I can then monitor that ETA and send myself alerts when the battery is critically low.
I've found RPi hat "UPSes" that seem to provide exactly this data over I2C... but none of these seem to also provide an all-important enclosure that would ensure I don't accidentally short anything out and literally burn a hole in my pocket. Not viable.
I've not yet explored the world of 3D printing, but I do understand enough to be know that my first 3 or 5 or 28 prints will be slightly janky. :)
So, I'm trying to find a premade solution to this problem - either a power bank that provides Actual Data™ over the USB connection (!), or some kind of devkit-style solution that'll viably/safely fit into a standard enclosure of some kind.
USB HID has all kinds of sensors & telemetry it can do. USB HID includes a whole sub-spec on Power Devices, with all kinds of information that chargers & batteries can report. To take one example, the Battery System Page (x85) can report Current, Voltage, Temperature, Absolute/RelativeStateOfCharge, RemainingCapacity/FullCapacity, RunTimeToEmpty, ChargerConnection, OutputConnection, ChargingIndicator, and CycleCount (among many other factors) to tell you what is happening. You can set RemainingCapacityLimit or RemainingTimeLimit to trigger a USB alarm condition when capacity falls under threshold. You can monitor individual inputs & outputs separately.
(The one ask I have that's not supported by the spec: a StopChargeAtCapacity setting for batteries, so I can stop my UPS's 5000mah battery at 4200mah to extend it's life drastically)
It's a stupid senseless world where the obvious never happens. Consumers aren't educated enough to have sensible asks. What is possible is ignored. I'll try to break out 'lsusb' more in the future when charging, but my impression is that basically no one- not batteries nor chargers- implements the ancient, obvious, sensible, & easy spec for power devices to report the basics about what they are doing. For shame!
I’d also love to see this on power bricks so that I can tell the charger to stop charging my phone and tablet at 80%, regardless of what the device manufacturer gives in terms of software control
Most laptops/tablets/phones/&c do know their state of charge & can in software disable charging, although only some expose this to users. This is often available in Linux but I dont think any particular scripts/apps for controlling this have risen to notice yet.
But you are still asking for a complete rewrite of how everythinf works, for it all to be totally different. It's not a totally unreasonable ask, it's just not in reach. Unlike my discussion above, which proposes a plan entirely doable with standards we have.
USB-PD negotiates power delivery, but it doesnt communicate battery or other status. It uses a different sideband to nevotiate outside regular usb communications, and conveys very limited information. There's no battery informatuon conveyed.
My above post spoke to how multi-decade old USB HID standards can be used to present current battery status for battery packs. We'd have to flip the relationship around- make the charger be a host that can manage an attached battery, the laptop be a peripheral that exports it's power status, to invert tbe control system as you want, to make the charger responsible for battery managememt & not the device. Or we'd need to radically revamp usb-pd & layer in a lot more capabilities.
It'd be cool, in some ways. Plug in any device & it'll only 85% charge. But it's also far more complicated & rewrites all the rules in every way, unlike what I was talking about, which is just battery packs & chargers kind enough to export their status over some very very old simple specs.
I don’t want to flip everything on it’s head (OK that’s a lie: I would love to flip almost everything in the name of having better solutions). But what I mean to say is I know what I’m asking for is unreasonable and certainly unrealistic in a 1-3 year timespan, but I know it’s possible and I like to dream because sometimes moonshots actually land you on the moon
https://en.wikipedia.org/wiki/Lithium_iron_phosphate_battery...
Of course had anyone cut the power to my apartment it would have no way to upload the recordings because I didn't add a 3G failover.
more importantly, as the article suggests, it can be hard to know if the battery itself is powering the device while plugged in (while getting charged) or if there is a passthrough, a la laptop charger.
(Disclaimer: no experience myself, just remembered seeing multiple HATs in this area in the past so did a quick search)
"PiJuice will use up to just five of your GPIO pins (just power and I2C), the rest are free to diversify your project. The stacking header allows you to continue to use your existing HATs and add-ons with PiJuice." from https://uk.pi-supply.com/products/pijuice-standard
But sure, some people/projects might prefer to shift the hardware to not be attached to the Pi. I wouldn't be surprised if you could find a product that does that too, or at worst I presume a basic plastic box (there's probably pre-made ones for the size of various Pi HATs? and of course 3D printing) and some fairly simple DYI wiring to connect the 5 pins through a cable wouldn't be too tricky.
The hat is a great idea in principle, but because the battery is sitting right on top of the processor, it doesn't stand a chance given that lithium batteries are fairly temperature sensitive.
I'd go with another option.
Hit Amazon.com and search for "raspberry pi UPS" and you'll find plenty of options. Or more generically try search terms like "mini ups" or "router ups" or "dc ups" - loads of options at places like Aliexpress as well.
Here in South Africa with rolling blackouts happening fairly regularly these days a lot of homes have something similar to keep internet connectivity live when it happens, with a lot of those options having USB outputs as well.
I'm currently using one of these to keep my pi 4 + hdd setup online: https://acconet.net/product/ups-rp7500a/
If it's just PoE you're looking for there are other options available - e.g. https://www.amazon.com/Battery-Uninterruptible-Security-1000...
One thing to be wary about though is max power if you're trying to run a raspberry pi with hard drive attached off one of these devices. A lot of these devices cap output on the USB ports at ~5V/2A (which I think was the USB2 max whereas USB3 allows for more). If you're running off an SD-card or SSD you should be fine, but 2A isn't enough to start a pi from an attached 2.5" HDD in my experience.
https://aliexpress.com/item/1005003164049579.html, https://aliexpress.com/item/1005004107179526.html (POE)
https://aliexpress.com/item/32964061367.html (wall wart style)
https://aliexpress.com/item/1005003765804094.html (looks like a power bank with always-on output like the article is describing)
https://aliexpress.com/item/4001204992959.html (BYO 18650s and enclosure)
https://aliexpress.com/item/32421259702.html (looks interesting but sadly "dead", was cached in google search results from however long ago)
Ironically I got mine before I learned of the power cuts in my new home while building it. I was just merely thinking of edge cases of how a smart thief could undo my security cameras and figured cutting off the power would be one option I need to prepare, so got this UPS to backup both the modems (and redundant internet connections) and the home bridge for the battery backup security cam.
Still a nice option!
Battery-power devices like smartphones should have a mandatory control of what percentage of battery it should be charged up to.
For Mac there's this nice utility AlDente https://apphousekitchen.com
I also found a small fanless inverter that I wired to this setup which gave me a tiny and completely silent AC power device. Super small, super portable. Easily powers a few LED bulbs or strings.
Okay, so this Framework laptop I'm typing on can power from any of its 4 USB-C ports. Ignoring that it already has a battery (you can buy just the motherboard and a non-laptop case), doesn't that work around this neatly?
Plug one USB-C directly to wall, plug second USB-C to powerbank.
For absurdity, repeat until you have a highly available array of 3 powerbanks. You can even put them on timers so you don't need pass-through charging!
The end result is we have a 750-100VA box under every desk and one in the comms closet. Unsurprisingly even small office supply stores around here have a wide selection of UPS and power kit.
It seems to still be available on alibaba and ebay. https://www.aliexpress.com/i/3256802290206038.html?gatewayAd...
It is truly excellent seeing battery packs with >1 input-output USB-C port (100W and 45W combined).
Semms like, if you want the features of an UPS, you should get a UPS.
You'd probably do better to have a supercapacitor or float charge a battery with an amenable chemistry between the power bank and the load.
In the end I got two beefy Anker power banks that didn't work as a UPS, and eventually migrated myself over to using PoE power for the Pis (AliExpress gigabit -> 5V/3A PoE extractor), with a Unifi Dream Machine Pro SE powering them.
My UPS is now a used, enterprise Dell 1300W monster that pretty much runs the entire local networking stack + servers for nearly an hour without power.
the author says this as if the two are easily confused, when its him that makes the association in the first place. why would you assume this at all?
Actually, my big Anker 521 (256Wh) does provide pretty much uninterrupted power when connecting/disconnecting to/from mains, though it did switch off randomly once after a few days.