Sense Automotive 12V Circuit from 3.3V microcontroller safely
Use a pullup on the input. Put a diode reverse-biased on the input. When 12V is applied to the cathode no current will flow and the input will be pulled high. When 0V is applied to the cathode the input pin will be pulled to 0.7V, triggering a low.







simulate this circuit &ndash; Schematic created using CircuitLab