Sorry if this is a duplicate
So I am in the process of installing a Raspberry Pi into my car and have designed a simple circuit to delay power on and off to it to allow sudden turn-offs while starting the car (since my car will turn off accessory power temporarily when starting the car, a double power on if you will) and to allow enough time for a proper shutdown when the car turns off. The design takes the place of a navigation system that I took out in lieu of the RPi. The entire circuit is not very complicated and could probably be improved but works for the time being. It uses a 555 and capacitors to delay both on and off.
The delay-on is taken care of and works without issue. But I can’t come up with a simple solution to initiate power off when the car is turned off. I was looking into gpio-shutdown and using a transistor to short pins 5 and 6, but the transistors I have on hand don’t really work (not to mention the fickleness of whether or not the Pi wants to shut down when they’re shorted anyway).
To avoid damaging the Pi, my first thought was to separate the power circuit and Pi using a PNP driven by the 555 output which would theoretically short the two pins when the output goes low (pin 5 on E, pin 6 on C, 555 output on B). But the transistor I have on hand does not short them and an NPN for testing purposes also fails. I’m guessing the diode drop from the BJT is the culprit somehow. I would have tried a MOSFET if I had any, and since I am not totally familiar with GPIO, I wanted to avoid a straight 12 - 3.3v converter from ACC or the 555 output to provide a signal for shutdown (though I am not unwilling to try if my fears are unwarranted).
I would like the Pi to shutdown peacefully when the car is turned off but have been unable to come up with anything else. I am wondering if anyone has come up with a solution for something like this and would be kind enough to share. I have posted my design here.
Thanks in advance!
Schematic Details:
- The system is 12v DC
- VCC is always on
- ACC is on when the key is in the 2 position and when the car is on
- The CPC1718J is a solid state relay
- The J2 at the end plugs into a separate 12v - 5v converter to power the Pi
- In practice, the circuit turns on around 4 seconds after receiving ACC, and turns off about 40 seconds after ACC is cut
gpio-shutdown
for this or do I need to use something else?