Using a UPS with PiAware

I would like to add a UPS to regulate the power for the RaspberryPi running PiAware and to be able notify the RaspberryPI and PiAware to shutdown as the time left on the UPS power hits 5 minutes (or some other number of minutes) so instead of just loosing power, it will do a clean shutdown.
I’ve tried on other RaspberryPi to connect the USB cable from the UPS to the RaspberryPi, but have not been able to get it configured to alert the RaspberryPi to shutdown.

Any assistants in setting this up will be greatly appreciated.

That’s completely unnecessary.

I understand most of the time it will come back up cleanly, but I have had times when the power was pulled that I had to re-create the SD card.I try to have clean shutdowns whenever possible.

1 Like

nut (“network ups tools”) is probably the package you’re after.

2 Likes

Depending on your UPS there is some utilities that work. Though I don’t know off hand if they work on ARM. Cyberpower for example has some nice utilities. If not, NUT like obj mentioned is a good alternative.

There are a number of UPS hats for the Pi. I drew up some cases for this guy and use his: https://www.tindie.com/products/xorbit/lifepo4weredpi-2/

It’s pretty sophisticated and configurable. It can shut down the Pi gracefully on power loss, after some time, or when the battery gets low. There’s a daemon that runs on the Pi that does the shutdown. It also gives you a soft button to shut down the Pi gracefully locally - handy in headless configurations. It also uses a much safer than lithium FePO4 battery.

Graceful shutdowns are much preferred over just pulling power since the Pi is a sophisticated multitasking, multiuser computer that will have a number of files open at any given time. The OS and file system can generally recover after abrupt power cuts but you can occasionally lose the drive and have to re-image. Hopefully people snapshot their images so they don’t also have to rebuild and reinstall software. But a UPS can cut those risks down to just wearing out the SD card.