As you know, if you use Raspberry, the operating system on SdCard is very fragile, that the reason you need to power off properly the system to avoid corrupt files system. This small circuit can help you.
There is no PCB, all component was recycling, coming from old stuff, 10000uf capacitor, 3A diode from computer power supply, the battery from cell phone or old wearable device, except the StepUP converter and the battery charger are from ebay, for 1$ (shipping included).
The main power supply feed the relay coil and the Raspberry through D3, big capacitor is here to avoid voltage drop out, and D3 is here to avoid voltage feedback and latch delay for the relay.
Vcc 5.5v is converted to 6.5v. During this time the TP4056 li-po charge the battery. If main power fail, the relay RL1 turn to initial state, 3.7v from battery can feed MT3608, and keep supply the Raspberry, in my test i can still have Rpi under good power condition during around 10min, so it’s work fine with “short” power failure.
I plan to implement a power management system to power off properly the Raspberry (through GPIO), 10 minutes or more is just enought, may be with a Arduino Nano, or with a simple timer with capacitor and transistor.
My testing conditions was with a Rpi B1, and wifi dongle, with LCD touch screen, the power was +5.5v 2A.