If powering a RaspberryPi is as simple as plug in a PSU, switch it off may become a real problem because system needs to be halted correctly before (mainly in headless mode).
Solutions exist but may be expensive or complex to make if you're not a specialist.This solution is cheap and simple : it only uses 6 common components and 2 bargain boards.
Making would be as accessible as possible.
When RaspberryPi detects PSU off, it sends a delayed stop order to UPS and then switches off itself. UPS will then switch off itself.
If UPS detects PSU off, it will switch off itself after a specific delay to protect Lipo against under voltage.
UPS Script running on RaspberryPi. Communication with Nano through i2c bus.
See web site for details : http://technroll.blog.free.fr/index.php?post/2018/02/12/UPS-for-Raspberry-Pi-4
UPS program running on Arduino Nano. Communication with RaspberryPi through i2c bus.
See web site for details : http://technroll.blog.free.fr/index.php?post/2018/02/12/UPS-for-Raspberry-Pi-4