Potential Issues of Using a USB Powerbank as a UPS (2021)

(goughlui.com)

205 points | by walterbell 562 days ago

23 comments

  • eternityforest 562 days ago
    Hard to believe USB-PD upses aren't a common products.

    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.

    • Dalewyn 562 days ago
      >USB will give us standards for power banks

      USB Energy Provisioning Aggregate Network 4.3 Revision 11 Gen3x4 48gbps SuperCharge-C.

      • dividedbyzero 562 days ago
        Sorry, can't do better than 5W with that pricey Revision 12 Gen4x4 cable of yours.
        • Dalewyn 562 days ago
          Electricity is measured in gbps as ordained[1] by the USB-IF. We must be universal.

          [1]: https://cdn.arstechnica.net/wp-content/uploads/2022/09/USB-p...

          • dividedbyzero 562 days ago
            Yes, but between Revision 11 and 12, all manufacturers on the consortium unanimously voted to up all voltages by 0.4V to increase incompatibility. Still the same gbps though.
            • RHSeeger 562 days ago
              There's something sort of horrifying in the fact that I can't tell if the posts in this thread are real ... or fake in pretending to be a bureaucratic, ridiculous joke.
            • therein 562 days ago
              Traumatizing.
      • justinjlynn 562 days ago
        Nah, it'll be USB-P PB (LiIon Annex 3) UP 2+++ over USB-C (constant cycle) USB-P 2+++-compatible (certified) connectors.
    • sorenjan 562 days ago
      Anker has a power bank with integrated charger[0], or charger with built in power bank. Don't think it's made to be used as a UPS, but maybe it can be.

      > 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.

      [0] https://www.amazon.com/dp/B085CFD3Z9/

      [1] https://youtu.be/fUdlfc1nJcY?t=117

      • reaperducer 562 days ago
        The ChugPlug saved my bacon more than once when stuck in the desert at night a hundred miles from power around 2005: https://www.ilounge.com/index.php/mac/entry/lenmar-chugplug

        Weighed more than my MacBook, but indispensable. Too bad they don't make them anymore.

        • wlesieutre 562 days ago
          Laptops can run off of any USB-C power bank now, so it's no surprise there's no market for something like this. Cool product though!

          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?

          • Scoundreller 562 days ago
            My MacBook Air will happily draw 5w at 5V from a USB-A power bank from years ago through the laptop’s USB-C connector.

            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.

    • jacknews 562 days ago
      Exactly, even 5000mah in your standard USB-PD 60w adapter would be a huge boon, especially for laptops where the internal battery has begun to fail and replacing the battery means replacing half the laptop, app..cough..le
      • nicolaslem 562 days ago
        > replacing the battery means replacing half the laptop, app..cough..le

        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.

        • jacknews 562 days ago
          I did not say it's justification for throwing away old equipment, but at some point, the high cost of replacing a battery (high because it requires a 'repair') offers less value than buying a newer model. This is especially the case with, say, Apple laptops where the official battery replacement means the entire top-case and keyboard has to be replaced.

          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.

      • Dalewyn 562 days ago
        >replacing the battery means replacing half the laptop

        And that's assuming you can even find a decent replacement battery.

      • dylan604 562 days ago
        I just did a battery replacement on a 2017 MBP. While there were a lot of screws needing to be removed and lots of lifting/prying to get to cables, half the laptop did not need to be replaced.

        Now, if you said the keyboard...

        • GekkePrutser 562 days ago
          The keyboard and the whole topcase if you do it the official Apple way.

          I can see how someone would call that half the laptop.

      • snerbles 562 days ago
        > where the internal battery has begun to fail

        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).

    • hoseja 562 days ago
      For some reason I still cannot fathom, the 50-cent saving is a point of great pride to electrical engineers. They repeat some phrases about million-unit manufacturing runs and I just seethe with anger that we can't have nice things.
      • kube-system 562 days ago
        You can have nicer things, you just have to pay for it.

        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.

        • m463 562 days ago
          As far as I can tell, there are a few no-name DC-only ups systems, but it would be really nice to have a USB-only DC-only ups that did things like USB-C with PD.
          • GekkePrutser 562 days ago
            APC has a DC UPS but iirc it's 12V only. Mainly intended for routers etc.
      • walterbell 562 days ago
        Good case study for Harvard Business School. When a design engineer wants to cut a feature to save a few pennies, they are teamed with a marketing pair-analyst to assess the TAM and margins, considered holistically with other feature subsets.
      • spookthesunset 562 days ago
        > 50-cent saving is a point of great pride to electrical engineers

        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.

      • llampx 562 days ago
        Its more the operations/supply chain/bean counting department.

        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.

      • babypuncher 562 days ago
        I imagine it's a similar feeling of pride felt by the engineers who design outdoors equipment that only fits in the provided container when folded precisely how it was at the factory with no margin for error.
        • eternityforest 562 days ago
          An Engineer's favorite thing to do seems to be replacing something easy that just works with something that requires special training.

          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.

      • goodpoint 562 days ago
        No, they are required to do that by management.
      • xani_ 562 days ago
        It's not EEs, it's beancounters, EE's are just paid to please them. Just like developers really
    • unqueued 562 days ago
      I was amazed when I learned that most powerbanks do not function that way. Some of them will switch modes if you unplug them, but there is still an interruption.

      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.

    • xani_ 562 days ago
      > Hard to believe USB-PD upses aren't a common products.

      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.

      • flutas 562 days ago
        > 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.

        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)

      • moolcool 562 days ago
        > 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.

        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.

        • kube-system 562 days ago
          > wouldn't it be nice if your charger and your battery bank were the same device?

          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

          • dude3 562 days ago
            I tried this it does provide power like a ups but it cuts out for a moment and restarts the device.
      • dotancohen 562 days ago
        There may be a market for an ATX USB-PD power supply. My desktop has no spinning rust nor discrete video card. A 60 watt power supply could power it easily, especially if there were a small lipo for the occasional burst.
      • eternityforest 562 days ago
        Solar generators aren't specified to be UPSes. Some work, some don't, just like power banks. I love them, but they're not always perfect.

        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.

      • GekkePrutser 562 days ago
        > The only devices that are not are stuff like say, raspberry Pi

        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.

  • axiolite 562 days ago
    Get a 12V SLA battery, solar charge controller, 14-20V AC adapter, and a USB car charger if you need 5V output in addition to 12V. DONE!

    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.

    • greggsy 562 days ago
      Why over complicate it with electronics? It’s a computer.

      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.

      • unregistereddev 562 days ago
        The router is one of the first things I put on a UPS. The telco equipment likely has fallback power as well.

        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.

      • axiolite 561 days ago
        > Just have your device shutdown when it can no longer poll another device.

        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.

      • justsomehnguy 562 days ago
        And couple of months later you are investigating why the branch gone dark in the middle of the day.

        No.

        Devices should survive powerloss, devices can have a graceful shutdown from an external source.

        Key is in your "might".

        • greggsy 562 days ago
          If you’re proposing to support a whole branch without a proper UPS, then your employer needs to reevaluate their hiring choruses.
          • justsomehnguy 561 days ago
            It's more common for the employer to cheap out and not to buy UPS than for a sysadmin to propose a lack of UPS.

            In your example even simply updating router OS/FW would case the router to reboot and your script will gladly shutdown the server.

      • tenebrisalietum 562 days ago
        I heard of connecting an old modem to a serial port for this purpose. If it doesn't respond to any AT commands then power may be out.
        • Nextgrid 562 days ago
          Any networked device will do - switch, router, etc. If there's no link on the port, power is down. USB-C Ethernet adapters with power pass-through will generally power the Ethernet module off the USB-C power port even if no host device is plugged in. USB-to-Ethernet adapters may also light up the port even if only connected to power (and not a host device).
      • goodpoint 562 days ago
        And you call that "simple"?
        • greggsy 562 days ago
          Much simpler than sourcing and jury rigging some components into a usb interface. You’d need to set up some scripting for that anyway.
        • asdff 562 days ago
          You could do it with a bash one liner
          • goodpoint 561 days ago
            ...while also keep a number of network devices always connected, reachable and correctly configured.

            Have one router break or someone disconnect one cable and your servers will power down.

            "simple".

            • asdff 560 days ago
              That's not hard to do, for some networked devices that step amounts to just plugging it into a power source and connecting it to the network. I haven't had to touch the configuration of my wifi printer for example since I plugged it in to the wall years ago.
    • jacknews 562 days ago
      Sure but you'd need bigger pockets, probably even a bigger backpack.
      • dicknuckle 562 days ago
        Also a much bigger timeframe for testing and development. This isn't something you slap together in a weekend and call good. More like building an experimental drone than putting together a 3d printer kit or building a PC
        • axiolite 562 days ago
          No idea what you're talking about here. Solar charge controllers are quite mature and do exactly what is needed. You're literally putting a few wires on the right terminals, and a few connectors.

          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.

    • crashingintoyou 562 days ago
      Sure the "DC UPS" are basically "simple dumb batteries", but the sort of loads that you'd probably run off them and the expected runtime of each tends to be quite different.

      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.

    • rwmj 562 days ago
      I got a large power bank (Bluetti EB55) to get me through the expected power cuts this winter. Supports charging from mains or solar while supplying power. Of course at £900 it's hardly a cheap option ...
      • fy20 562 days ago
        If Europe has rolling blackouts this winter, the purpose is to reduce energy, and hence gas, consumption.

        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.

        • axiolite 562 days ago
          That would only be true if people are charging huge batteries that sustain their full home energy usage. If they're only charging small batteries to sustain the most important devices in their homes, the usage will still be much lower.

          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.

  • ryan-c 562 days ago
    This exists, and has monitoring, but won't do USB-PD: https://www.mini-box.com/OpenUPS

    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.

    • walterbell 562 days ago
      > something like this that can fit in my backpack with just shy of 100Wh

      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

    • dividedbyzero 562 days ago
      I'd also expect airport security to be quite a hassle with (partially) homemade electronics containing large batteries.
      • brk 562 days ago
        It is surprisingly not. I travel frequently with random ESP32 projects in various stages of looking highly suspicious and never get hassled about them. 4oz of an unfinished bottle of water though is absolutely not getting through security.
      • bick_nyers 562 days ago
        A nice 3D printed case and some fake branding would probably minimize any possible hassle.
        • jdavis703 562 days ago
          In London security will sometimes specifically ask if you or anyone else has made repairs or modifications to any electronics. Depending on how honestly you answer, this could still be a hassle.
      • ryan-c 562 days ago
        The secret is to travel with such a large quantity of homemade electronics that you get classified as "harmless nerd".
  • planede 562 days ago
    What's the typical circuit found in a laptop or phone? They all have to deal with this stuff internally.

    IMO a cheapo x64 laptop is better than a raspberry PI + some jerry-rigged UPS setup for a low-power home server setup, YMMV.

    • mschuster91 562 days ago
      > What's the typical circuit found in a laptop or phone? They all have to deal with this stuff internally.

      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...

      • deckard1 562 days ago
        I always see recommendations on /r/HomeServer for using a laptop and I always shudder a bit. I had a battery swell on a Macbook. The thought of leaving a laptop running unattended for months at a time, possibly stuffed in a garage or closet where you won't be watching it for awhile just sounds like a disaster waiting to happen.

        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.

    • selfhoster11 562 days ago
      That depends on the amount of stuff you're running, and how much you care about the UPS working. If the answer to both is "very little" or "not much", I'd take the Pi setup any day.
      • mbreese 562 days ago
        It also depends on how often you expect to lose power. If that answer is “somewhat often” or worse, then even a minor annoyance can be worth avoiding. There’s a reason laptops used as a server were known as “California servers”. (aka a server with a built in UPS)
  • sys42590 562 days ago
    I really love the fact that the presented circuitry avoids fully charging the battery cells to extend their lifespan.

    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.

    • UniverseHacker 562 days ago
      Lithium batteries are awesome, but I think lead acid just makes a lot more sense for a UPS- they like to be fully charged, last virtually forever when maintained that way, and don't require any complex charge management circuitry.
      • Merad 562 days ago
        > they like to be fully charged, last virtually forever when maintained that way

        If that's the case why do the lead acid batteries in consumer UPS's never last more than 3-5 years?

        • UniverseHacker 562 days ago
          I think cheap batteries, poorly designed starter circuits, and occasional full discharge in use, which all coordinate to damage the batteries early. Also if your power is low quality, it causes the device to switch to battery often, and can put a lot of cycles without actually having a power outage. High quality lead acid batteries in solar systems, car starting, and commercial UPSs often last a decade or longer.
          • 1-6 562 days ago
            VRLA batteries are commonplace for commercial UPS units. For lithium, I’d explore LiFePO4 batteries. Not all lithium chemistries are alike and LiFePO4 are considered safe. It doesn’t have great capacity to weight ratio but it wasn’t meant for consumer electronics anyway.
            • Brusco_RF 561 days ago
              I've been a LiFePO4 evangelist for years! I always prefer that chemistry over Li-Ion for IOT devices and recommend it to all my clients. Energy density is rarely the driving constraint except in EV or flight applications
  • exikyut 562 days ago
    Tangentially related question I'm actually trying to answer in earnest at the moment:

    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.

    • rektide 562 days ago
      One of those plagues of shitty consumerism & no market pressure: there's a standard that works great but no one implements it, cause they suck & are no good & there's no consumer pressure to do basic shit.

      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!

      • joshspankit 562 days ago
        > StopChargeAtCapacity

        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

        • ralphhughes 561 days ago
          I do this with the Home Assistant app on my phone. When the battery level gets to 80% it triggers the smart plug the charger is connected to, to switch off. My phone is 3 years old now and according to AccuBattery still has a battery health of 2499mAh out of a design capacity of 2700mAh (Based on 977 charge sessions for 1,215,025 mAh total)
        • seized 562 days ago
          I do this with my Android phone using the Automate app (Tasker would work too) and a flashed smart plug. Phone hits 80% charged and it turns off the smart plug. Charger is plugged in obviously.
        • rektide 562 days ago
          Seems like you want the charger to be aware of the hosts state of charge. Typically telemetry only flows from device to computer, which this violates.

          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.

          • joshspankit 562 days ago
            With USB-C, communication (and even charging) can be bidirectional. It’s built in to the spec
            • rektide 561 days ago
              Charging can be yes.

              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.

              • joshspankit 561 days ago
                Yes I agree that my wish is unreasonable and your plan is much more attainable.

                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

    • nine_k 562 days ago
      Something like OpenUPS2 [1] seems to provide data over USB, and even has Linux software to support that. It does not seem to have an enclosure though; it's apparently intended to be put into an enclosure of the device it supports. Also, pricey.

      [1]: https://www.mini-box.com/OpenUPS2

    • dicknuckle 562 days ago
      Find someone locally who has a 3d printer. If you don't already know how to model 3d objects, they will likely charge you for that time and then 3d print a test. Then when you have it right, there are plenty of pro shops that can produce a more permanent 3d object through Laserjet Fusion or other methods.
  • dtx1 562 days ago
    If you are going to use lithium batteries for UPS purposes, you should look into lifepo batteries. Much safer for that purpose
    • gambiting 562 days ago
      What makes them safer? Can you explain please?
      • AzN1337c0d3r 562 days ago
        Basically, they are much less likely to vent violently.

        https://en.wikipedia.org/wiki/Lithium_iron_phosphate_battery...

      • dtx1 562 days ago
        They are in no particular order more resistant to under and overvolting, much more cycle resistant, much more resistant to storage under high charge level, much harder to get to explode etc. For UPS purposes they are the correct choice all around-
  • INTPenis 562 days ago
    The title makes me remember my raspberry pi camera I made for my apartment in 2011. I hooked it up to a simple USB powerbank at the time, and then the powerbank to the power outlet. Thinking if anyone cut the power to my apartment it would still record for 15 minutes.

    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.

    • xani_ 562 days ago
      I remember some article of someone trying it, only to discover their power bank cut power for few milliseconds when you disconnected the external power supply, resetting the device...
      • rldjbpin 561 days ago
        i can attest to that. all of my cheap power banks demonstrate this behaviour.

        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.

  • roboben 562 days ago
    Market gap! Someone should produce USB UPS for the raspberryPi server setups of this world. I’d buy one!
    • swores 562 days ago
      Already exists, e.g. using the PiJuice HAT as explained here: https://howchoo.com/pi/raspberry-pi-ups-uninterruptible-powe...

      (Disclaimer: no experience myself, just remembered seeing multiple HATs in this area in the past so did a quick search)

      • roboben 562 days ago
        A HAT seems to by way to complex and less flexible then a small black box you can plug your USB charger in and a USB cabel comes out
        • dicknuckle 562 days ago
          Then you have a string of devices that need to be connected together in a more n rigid fashion, either in separate compartments of a bag or case with a USB cable between, or strapped together with tape.
        • rwmj 562 days ago
          Really? I'd far rather have a UPS hat than another external brick, assuming the hat provided passthru so it didn't block the addition of further hats.
          • swores 562 days ago
            And indeed that one does:

            "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.

      • Ductapemaster 562 days ago
        I used one of these for about a year on my PiHole, but switched to a standard UPS because the hat's LiPo started bulging from all the heat generated by the Pi's processor.

        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.

        • swores 562 days ago
          Good to know, thanks!
    • crashingintoyou 562 days ago
      Not really a market gap.

      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/

    • ramraj07 562 days ago
      Not usb but mini UPS to keep your modem going is a common thing in India nowadays given constant power interruptions.

      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.

    • dividedbyzero 562 days ago
      Not quite that but I ordered an Eaton 3S 850, which is a beefy power strip with built-in battery and looks like a decent compromise for cases where you don't really need a huge noisy rack-mounted UPS, but something that can do a bit more than just a Raspberry Pi (i.e. several Pis plus the router).
      • roboben 562 days ago
        That's my point. Why having all the setup (and size!) for doing 110/220V when you just need it for 5V USB.

        Still a nice option!

        • dividedbyzero 562 days ago
          But would you only need 5V? DSLAMs here have an hour or so of UPS capacity as well, so if the router stays up, so does the internet connection, same with 4G/5G routers. Though I guess a 5/12/24V DC mini-UPS would still be a lot easier than actual 110/220V AC.
  • neilv 562 days ago
    For some non-UPS but related use cases... I don't think it's uninterrupted, but I use this Anker PowerCore Fusion III as my main wallwart USB-C fast-charger, with the bonus that it also keeps its own internal 5 Ah battery charged: https://www.amazon.com/gp/product/B085CFD3Z9/ Current model might be: https://www.amazon.com/dp/B01K702S66/
  • riobard 562 days ago
    > To treat the cells well requires sacrificing some capacity to reduce the voltage stress on the cells.

    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

  • cat_plus_plus 562 days ago
    If you have corruption or super long reboots on brief power loss, you have a bigger and unnecessary problem, because UPS can also fail and for many applications a brief service loss is otherwise acceptable. For example, I often handle California power outages by running an inverter off my car and powering up my home network through a cord run through kitchen window. If my NAS got borked in between, that would be very unfortunate. Your point stands in regards to equipment like security cameras where continuous availability is the point. But would a Raspberry Pi usually be the best choice vs special design equipment with built in backup batteries and low idle drain or say a cheap Android phone running an appropriate app?
  • Melatonic 562 days ago
    I have made a standard USB-PD powerbank into an ACTUAL UPS by connecting a small board that allows you to manually select the voltage of the output. By selecting 12V you can then wire up any 12V device of reasonable power (say a wireless router) to the USB powerbank. There is no loss converting to and from AC and the power bank internals still handle all the complicated charging and whatnot. All the little IO board does is request a specific voltage (in the same way that any device with PD will negotiate) and keep it there.

    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.

  • yencabulator 562 days ago
    > Herein lies the problem – just because you have pass-through charging does not mean that your output is uninterrupted.

    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!

  • aristus 562 days ago
    Living in Mexico City around a lot of construction, I've had my heart (and kit) broken by dirty, inconstant power. For small things like a Wifi repeater a 10Ah battery inline works ok. But for anything beefier or without its own internal battery, eg a NAS / printer / modem, you still need a proper UPS.

    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.

  • walterbell 562 days ago
    ZMI no20 claims to support uninterrupted UPS mode, but doesn't seem to be available for purchase, https://www.macworld.com/article/539605/zmi-powerpack-no-20-...
    • rektide 562 days ago
      My ZMI PowerPack 20k & 20k Pro's are still my daily drivers (good for 45W/65W only, but fine for my use), but I did snag one of these off the indiegogo (for the high-speed dual port capability). I hadn't realized it has this uninterrupted capability- awesome. I use USB-C to dc-barrel jack adapters, and this it an makes an affordable, reasonable capacity UPS.

      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).

    • Snuupy 562 days ago
      ZMI Ambi (10k mAh/18W) does as well. Likely discontinued and replaced by a newer model now though. Perfect for a rpi UPS.
  • heythere22 562 days ago
    Dave from EEVBlog had the same issue. His mains power battery does not do 0ms switching: https://www.youtube.com/watch?v=5JT8M8v_zNg

    Semms like, if you want the features of an UPS, you should get a UPS.

  • seltzered_ 562 days ago
    Aside from what one thinks personally of him, it's worth noting esr's attempt to start an open source ups project (upside): https://gitlab.com/esr/upside
  • DarthNebo 562 days ago
    This is something one of my side projects aims to fix. Basically make a programmable battery source out of 18650 cells, USB Type-C, with automated charge & discharge control to keep it between 30-80% for UPS or Solar augmented use cases
  • joshspankit 562 days ago
    Andreas Spiess (and community) have put a lot of work in to this space as well. Feels like a good teamup.
  • StuGoss 562 days ago
    Wouldn't stringing two USB power banks together effectively be a UPS for a Raspberry Pi?
    • avidiax 562 days ago
      No, if they both have the cutout problem, they'll just cutout in sequence.

      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.

  • mmastrac 562 days ago
    About 10 years ago I tried using an Anker power bank for a UPS. It had some issues w/shutting itself down when switching power modes. I reached out to their support line and they completely misunderstood my questions, sending me a brand new battery instead despite my protest. I was hoping to just send some feedback on what I thought were firmware issues.

    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.

  • permo-w 562 days ago
    >Herein lies the problem – just because you have pass-through charging does not mean that your output is uninterrupted

    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?

    • dividedbyzero 562 days ago
      Knowing very very little about battery technology I wouldn't expect an interruption when starting to charge a pass-through power bank either. I'd expect charge controllers to handle this seamlessly, like the ones I get on those microcontrollers that support batteries out of the box (which are dirt cheap too), or the one in my laptop, or the one in pretty much all other battery-powered devices; those don't switch off when connecting/disconnecting to/from mains power. If that's so well-understood, why would a decent power bank not do this as well?

      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.