UPS / Battery Backup

Hi,
Is anyone running a battery backup hat or similar? I've done some searching but dind't find anything specific to an OctoPi /3D Printer setup. I read about some hats but they only put out 2.1/2.5A which might not be enough with a camera.

Mano

@tedder42 is designing something pretty cool.

Personally, I use an APC brand of UPS that powers both the printer and the Raspberry Pi 3B itself.

That's the setup I have now as well. The APC will only run about an hour though. Allot of power is lost in the DC-AC-DC conversion. A 3000mAh battery will power the Pi for hours compared to what an APC will put out. This gives the Pi time to see that the printer lost power, depending on the hat even log power went out, and shutdown gracefully when power hit's a certain point.

Yea, it's probably overkill but if it's an option I'd like to give it a shot.

For what it's worth, the apcupsd is nicely documented and easy enough to install on Raspbian, something like sudo apt-get install -y apcupsd, in fact. It requires a couple tweaks to the configuration files but the documentation describes this. All this of course requires the original USB cable from APC to connect to the Pi, as you might expect.

This then gives you an interface which may be queried to determine a variety of current settings. It also gives you scripts which are run during significant events so that you could pause your job and gracefully shutdown OctoPrint and Raspbian.

1 Like

I was literally fussing with this last night, it isn't compatible with my CyberPower UPS, which is apparently proprietary. They provide some linux builds but.. meh. Not worth it.

What UPS(es) do you have, Guru?

I've gone for a supercapacitor based UPS. It will only run the PI long enough to shut down. This is less for power failures than to allow me to just turn the printer off without shutting the Pi down first.
When main power is lot, the Pi is signalled to shutdown, the power in the supercapacitors gives it time to do that.
I actually still waiting to recive the UPS unit having ordered it last wek. I'll post results when it arrives.

I have about three of the APC branded ones, mostly Back-UPS of some kind. I'm still working on the plugin which will talk to them; I'm just super-busy these days.

If I knew the overall resistance of the Raspi 3B as a load I could probably calculate the size of capacitor it would require for something like that. But then again, I'd probably just rig something up with one of these and back-power it like that.

I have one of these. By back-powering you mean if I plug it into a standard USB port it will cover the pi till the power comes on?

Not exactly elegant but if it works...

Device I've ordered is this one. It signals the Pi to shutdown once primary power is lost.

I'm running the UPSpico on my 3B+.
Don't have a UPS on the printer itself yet, but don't have any issues with the Pi corrupting the SD card anymore if we get a power surge, and if power does go out, it stays running u til it's battery drops below a certain percentage, then it does a proper shutdown on the Pi

1 Like

In theory, it could be possible to power a Raspberry Pi 3B via the micro USB port and also power it via either of the two 5V GPIO pins to ground. It may be necessary to verify that all of this works since you'd be technically providing two 5V power supplies at once; depending upon the circuitry of both sources, this may just work out fine. If the main power drops off, it would fall completely to the battery side of this. There's a possibility that this might try to charge the battery but I don't think soβ€”the average powerbank has two outlets and they only connect to in/out as isolated like this.

Or... reverse that with the main power coming in on the micro USB and bringing the powerbank in via the 5V-to-ground GPIO pins. Just make sure that you're using the correct connector on the powerbank or you'll accidentally just charge it and nothing more. (I'm wondering whether it would be necessary to add anything to discourage the powerpack from providing power most of the time...)


Second option might be to back-power it via a Type-A USB port...

Per this page...

We did mention earlier that the new Raspberry Pi 2 & B+ can't be back-powered via the USB ports due to new regulation on the boards. However, this is a bit of a half-truth, as it "can" be done in a roundabout way.

If you apply power to the USB port when you Pi is off, it will not boot. However, if you apply power to your Pi via one of the standard methods (e.g. the micro USB port), then apply power to USB ports and remove the original supply, it will stay on and functional.

It should be noted that USB ports have a current limit of 500mA, so we would not recommend you attempt to supply more than this via the USB!

Note the power limitation at 500mA for the Type A ports versus the micro USB port. You're looking for enough current to successfully write outstanding clusters to the microSD card and to finish negotiating with the serial line and to power the processors for a successful shutdown. It might work. And then again, you could split the Type A into two, plug them both in and now you have 1A instead of just 500mA. Three would be 1.5A (and still shy of the typical 2.5A peak).

But remember that these are the specs. Reality is often a bit different from the specifications. (For example, I'm not supposed to be able to use 5V for a PN532 RFID module from the Raspi in I2C mode but it works just fine, perhaps better even since it now has enough power to quickly wake up that coil.)

1 Like

The "apc" in "apcupsd" is because only APC UPS(es) are supported :sob:

You might try https://networkupstools.org/ instead.

The primary goal of the Network UPS Tools (NUT) project is to provide support for Power Devices, such as Uninterruptible Power Supplies, Power Distribution Units, Automatic Transfer Switch, Power Supply Units and Solar Controllers.

Eh, yeah, but you know there's more to it than that, such as a compatible protocol.

I tried NUT, it wasn't worth my time, as I said they pretty much require installing a blob of code from cyberpower and then interface with that. Which seems excessive for a USB serial/HID interface.

I might go with a tripp-lite 2U or something like that. But at this point I'm just putting a (flashed) Sonoff POW R2 in a 1U PDU to get my stats.

Maybe I said that wrong. The stated goal of the apcupsd developers is to only support APC devices and protocols. They aren't interested in supporting anybody else's UPSes.

NUT supports a much larger collection of UPSes including APC and it doesn't surprise me that configuration is more complicated.

For what it's worth, the garage sale and flea market landscape is littered with second-hand APC brand UPSs with a battery that's now dead/expired. They have no idea that you can replace the battery easily. People will basically give them away if you take them (since they're so heavy). And then, I go over here locally and buy the replacement 12V battery from a place I know and they charge me $24 for the battery (minus $5 if I bring the original as a "core"). You're just hoping to find an APC with the original instructions packet (unopened) which still has the USB cable itself (that's the hard part).

1 Like

Hi, and sorry for joining the party so late...

Did you get any further with the APC plugin?

Cheers!

Andy B

I have the parts, the UPS, the knowledge but just have been too busy so far. Sorry.

Just thought I'd ask before attempting my own solution...

Just need to pause the print and shut the printer down on power failure.

Apcupsd works without issue, the Pi is powered using a PoE hat from my UPS backed core and has a relay on the mains supply to the printer (separate UPS) using the PSU Control plugin - just need to "cobble" it all together...

1 Like

Cyberpower has linux flavors of their interface. I know nothing about it, but just snagged 2 of their discontinued units from the local e-waste bin. One is fine the other needs a good battery before it'll power on.

There's also this how-to I just found that shows how to set up a Pi to monitor a cyberpower using NUT and send email alerts.

1 Like

I use apcupsd with my Cyberpower UPS for my fileservers. It emails me when power is lost and it shuts down all my servers.