Im currently working on an arduino based car alarm.
I´m looking for the best and simple approach to sense when the door switch is put to GND (door opened)
and when the ignition is turned off (also switched to ground)
I was thinking of putting a simple diode between the arduino digital pin and the switch, but I understand that when the circuit to be sensed in the car is left opened there will be 12v at the cathode.
My options (from the top of my head) are, to put a diode like the drawing.
To put a PNP transistor, although i believe it would be the same approach
Make a voltage divider with resistors
or to use an optocoupler.
My idea is to make the circuit as clean as possible using the less parts necessary
How do you guys think it would be the best approach?
Thanks and happy new year