Power supply back-up

I just got home to find that yet again there had been a short power supply failure in our village. this does happen on average a couple of times a week. This time I had left my Pi based music player on and have had all sorts of issues recovering it from the ‘hard shutdown’.
Because my Pi has an IQAudio Digiamp hat attached my power supply unit is 19 volts which is the recommended supply for this setup.
I have been trying to find info. on some way of protecting against power cuts by using a very small ups to allow the safe automatic shut down of the Pi. The normal soft shutdown only takes a matter of a few seconds so I would not need much capacity in the ups.
the only units I have found ready made have been 5 volt units, presumably for standalone Pi boards.
Any ideas?

It wouldn’t be all that cheap but a computer UPS would power it. Getting it to auto shut down the Pi might be tricky though? How long does the power go out for? The above UPS would likely run for hours before the battery gets low. If power is restored before that there would be no need to shut down.
I have PowerBoost’s in several of my Pi projects. They will work like an UPS but thats not how I use them. I use them for portable battery power.

The power can be out from seconds to hours. Never can tell. However all I really need is some sort of ‘buffer’ or ‘damper’ to give a few vital seconds to allow the boards to shut down the correct way. This would need some sort of detection to know that the mains supply had failed. That part I could deal with using micro relay board(s) in the 240 volts line.
I am sure that somewhere in my distant past I built something along the lines of a 5 second buffer for some tape recording equipment ( I know, long time ago)
As an alternative and by spending a fair bit more money I use a conventional mains voltage ups which would have the advantage of being able to supply my tv equipment as well.
I will have to look further into it.

The Pi can be commanded to shut down via GPIO.
With a 3B+ its a config.txt edit and shorting GPIO 3 to ground. I’m not sure that also works on a 3B(non +).
It can be done via GPIO on any Pi via python. I do it that way on several of my Pi’s.
I can hunt up my code if you want it. I have several headless setups running on a powerboost. I press a button to tell Raspbian to shut down, then use another switch to turn off the powerboost.

Found this, https://uk.pi-supply.com/products/pi-ups-uninterrupted-power-supply-raspberry-pi

There was a little hint in the last Bilge Tank video that Pimoroni may be working on something similar. LIPO battery though. An On Off shim and LIPO shim and battery recharge function.

Hi again.
Thanks for your advice. I did look at the link you gave and yes that sort of thing could work.
BUT - the device, as with a couple of others that I found, is for a 5 volt supply to the Pi board only.
My combined Pi and DAC/amp hat use a 19 volt supply. The hat is fed with the 19v and the Pi is fed vio the Pi 5v gpio pins from the hat. Maybe I could separate the supply to the Pi and give it it’s own 5v supply via the ups unit. I will have to look onto it some more. I also noticed that the unit has the ability to run either safely shut down the Pi or run it from the battery backup. I would only want to perform a safe shutdown in the event of mains power failure, because both the Hat with it’s separate 19v supply, and also an installed hard drive I am using with an independant 12v supply would not be powered.
I am already using a pushbutton to close gpio3 and ground for a soft shutdown and this works without problem. I have also installed an led which is on when the Pi is active, and stays on while the Pi is going to sleep. It goes out when it is safe to kill the power.

Yeah, thats not going to work for your setup. I forgot that the DAC / Amp was powering the Pi etc.
I power several of my Pi’s via the GPIO pins, I feed +5V in via Pins 2 and 4. All my stuff is 5V powered though.

Hi again.
A few issues to overcome I think. I will work something out and report back again.