Swap out button for ignition

Hello Everyone,
I was wondering if anyone could help me figure out how do I switch from using a button in this example to using a car ignition?

Zola Lab (Using the relay method)

I'm wanting the circuit to turn on when the key it turned to accessory and when it is removed the circuit will wait like 5 seconds then turn off.

I'm not sure whether it's a good idea what you want to do. If the Arduino looses power, for some reason, the car will stop immediately.

You have to detach the cables from the ignition switch, and connect the relay contacts instead of the switch. Then connect the ignition switch to the Arduino, instead of the button.

I think you’ve got the wrong idea, the car isn’t going to run through the Arduino, as I said. I want the car to turn on and the Arduino to turn on, but when I turn the car off. I want this script I linked to, to commence which will set a timer which will then turn the Arduino off.

So to hopefully make this more simple, all I need help with is finding out how to swap the button out from that post I linked to for the ignition switch. So instead of a button being pressed to close the circuit, it’ll be the cars ignition that will close the circuit.

Such a replacement requires to measure the ignition voltage, i.e. the voltage turned on and off by the switch. If the switch goes to +12V of the car, put a voltage divider from the switch to Gnd, which transforms the 0-12V into 0-5V, and connect it instead of the button. Add protective circuitry to the input pin, because the switched voltage can become much higher than 12V. A 10k resistor to the input pin may be sufficient. And of course the Arduino Gnd must be connected to the car ground (0V).

Could you maybe draw up a rough diagram because I don’t know how this will fit into my idea.