I am working a problem that seems to be fairly popular with the Raspberry Pi community. In essence, I am designing a circuit that will utilize a DS3231, a 555 timer, and a load switch to cut power from the pi when it is off as well as schedule the next time power will be re-applied.
On to my point, How long do I need to wait after a "sudo shutdown -h now" to safely pull power? I am determining the time delay of a 555 timer to propagate the low-going edge of a GPIO pin to the enable of the load switch.
I have also read about the UART TX pin being active in certain states of the OS, namely a halt where the SD card might still be doing something but an active high GPIO might already be pulled back low again. I can't find anything about that right now to figure out if I can leverage this as a final check. I will also have a DS3231 in the circuit to be able to schedule the next wakeup of the pi (we have a headless situation where the pi needs to have programmable control over when it wakes back up).
1) How long do I need to wait after a shutdown command before I can safely remove power?
2) Is using a GPIO pin with the python library RPI.GPIO the best solution for this?
3) Is there any other pin like the UART TX that will provide any information as a final analog circuitry check to ensure the power loss won't result in any damage to the SD card?
Once I have this circuit finalized and tested, I'll be uploading my schematics along with PCB layout to the community.