Detect car +12V using Arduino
Knowing that all sorts of weird stuff can happen in automotive power circuits, and not being especially knowledgeable in those systems, I'd err on the side of caution and use an opto-isolator.







simulate this circuit &ndash; Schematic created using CircuitLab

Pin 1 = Car 12v R1
Pin 2 = Car Ground
Pin 3 = NC
Pin 4 = Arduino Ground
Pin 5 = Arduino 5v R2
Pin 6 = NC


With this scheme, your Arduino and the car aren't connected electrically at all. At worst, the optoisolator is destroyed, and you can replace it for less than a dollar. Put it in a socket and you won't even need a soldering iron to perform the repair.

R1 was selected such that input voltage transients up to 120V won't exceed the maximum forward current of U1. D1 avoids exceeding the maximum reverse voltage of U1 if the input voltage is inverted. The value of R2 isn't especially critical, so it might as well be the same value as R1.

You won't need any heat sink. Heat is the result of electrical energy being converted to heat, and power is the rate of energy conversion. Power \$P\$ in an electrical system is the product of current \$I\$ and voltage \$E\$:

$$ P = I E $$

So, the voltage itself doesn't make heat: it also depends on how much current is flowing. In both these circuits, the current is low enough that the power is small and no heatsink is required.