I have needed for some time to create a clean shutdown circuit for a pi that i have in my car. I finally took the time today to prototype it. Looking at the hand drawn schematic that is attached, you see a P-Channel FET, IRF9540, sourcing 12 volts to a 5 volt regulator. When you close the ignition switch, the N-Channel FET, BS170 pulls the P-channel FET gate low, turning it on, delivering 12 volts to the 5 volt regulator. This powers up the pi.
Simultaneously a small 12volt coil relay has a pair of normally closed contacts which will open. So far so good. The pi powers up. When you turn the car ignition switch off, the relay contacts will immediately close, grounding the i/o pin that has been programmed to trigger a clean shutdown of the pi. The code for this is posted elsewhere.
However the parallel connected 49 MF capacitor and 1 meg resistor on the gate of the BS170 will take about 2 minutes to fully discharge. This holds the power to the pi on for about 90 seconds after the ignition switch has been turned off, which should be plenty of time for the pi to shut down cleanly.
Simultaneously a small 12volt coil relay has a pair of normally closed contacts which will open. So far so good. The pi powers up. When you turn the car ignition switch off, the relay contacts will immediately close, grounding the i/o pin that has been programmed to trigger a clean shutdown of the pi. The code for this is posted elsewhere.
However the parallel connected 49 MF capacitor and 1 meg resistor on the gate of the BS170 will take about 2 minutes to fully discharge. This holds the power to the pi on for about 90 seconds after the ignition switch has been turned off, which should be plenty of time for the pi to shut down cleanly.
Statistics: Posted by wstein25 — Sun Apr 28, 2024 12:42 am