Arduino In Car

Hello,
I was wondering if someone could help me with hooking up my Arduino Leonardo in my car. So first off, I’ve followed this schematic (http://www.zolalab.com.br/eletronica_projetos/auto_shutdown_enus.php using the relay method) the question I’ve got it, I want to wire this up so when the key is in accessory mode it turns on, and when the key is taken out. It’ll activate the relay to turn it off.

My whole idea of this is to turn it on when the keys in, but when I take the key out I want it to remain on until I lock the car (using it to flash the light to let me know it’s locked then turning off)

Achieving this is going to be vehicle dependent. You will need information from the BCM, or you could tap into the door "lock" actuator circuit to verify when the vehicle has been locked. Also, depended on the vehicle, most have a switch in the ignition lock cylinder that senses when the key is inserted, you would need to tap into that circuit. Good luck.

Ed