Idea of a Shutdown-Protector
Create a signal for a GPIO of a running Raspi as soon as the supply voltage is interrupted to trigger a software which immediately starts a controlled shutdown. And to build some sort of “energy source” for a few seconds, until this shutdown is finished.
Instead of batteries, we use small super capacitors of 10-15 Farad.
Diagram for the “Protector”
The two super caps have parallel resistors to “bleed” them in case of power loss. If the power is away for a few minutes, the Raspi boots if power is applied again.
Some viewers also suggested some sort of over current protection from the USB plug to the super caps. This can be done with a small resistor. However, thin USB cables have a similar effect.
Link to another proposal: http://www.hackerspace-ffm.de/wiki/index.php?title=Raspi_EDLC_UPS