I've been through tags "power-supply" and "power" of this website and surfing on a lot more but I did not found any answers or information about the subject I'm about to talk about.
So, I'm looking forward to design and implement a solution that will :
1 - detects when the power-supply can't supply anymore (like a power shutdown from the building) and gives a bit to one of RPi's GPIOs.
2 - when detecting (1), having a script to "sudo halt" the Pi.
3 - supply enough power and buy enough time for the Pi shutdown properly
Please find below what HW and OS I have : HW : - RPi rev B - Power supply : 5V - 1500mA - Class 10 SD card, SanDisk 16GBytes - Wifi Dongle (no reference, sticker ran away)
OS : Raspbian (updated, a few packages added)
The main purpose of this is to protect the Pi's SD card from getting corrupted.
The second part of the project is to add a timer (at least the time for the Pi to shutdown) that will block the power-supply (with a relay or MOS-FET transistor) for the Pi to boot again when power will be available again.
I already have a few ideas but none of them seem to be time-resistant.
Here are the questions :
Does a 10 seconds power-supply will get the Pi enough time to "sudo halt" ?
Might a relay on the power input be dangerous for the Pi ?
Thanks for your time, knowledge and help.
Raspberry Pi-ly yours,