Safely detecting 12v on/off in car

+1 for optocoupler

you may also google for ruggeduino...