automotive analog inputs

So im thinking about a new way to replace some inputs from my race car to my Arduino,

Currently I have separate inputs for Active high and low

Im now thinking I can use an analog input and use a voltage divider to make 1V ~ on the pin constant, which the Arduino will see as default state, then if its grounded it will show zero, and ill run the 12V (14.7V) through a divider to get 5V~ what would be the best way to protect the arduino from voltage spikes?

Cheers

Use an opto-isolator. Also use an automotive version AVR if you plan on installing anything that will affect how the car runs and still you might want to check as to your own liabilities if this race car is more than a toy. Arduino has specific warnings about automotive use.

How do you use an opto for analog?

To the OP. Can you provide more information? You didn't specify what the divider is doing. Is it for power or for signals? Can wet get some more details please.
If you want to power the Arduino with a voltage divider, that is a bad idea. Use a buck converter or a couple 7805 voltage regulars.

I can use an analog input and use a voltage divider to make 1V ~ on the pin constant, which the Arduino will see as default state, then if its grounded it will show zero, and ill run the 12V (14.7V) through a divider to get 5V~

If the 1V is supposed to be the Reference Voltage, analog conversion of anything > 1V will produce 1023.

What really is the OP trying to communicate here anyway?

Where is the 12V coming from? Is the 12V-14.7V (not counting spikes) supposed to be measured by the Arduino or power it?

Setting the reference voltage to 1 for ADC means anything from 0-5 volts is safe on the pin and anything over .01 volts will have a ADC value. Very possible the ignition system will induce at least that much voltage on the wires heading from the sensors to the arduino so you might need to put filtering capacitors in the circuit as well.

If you place a 14-16 volt zener diode before a 4+ to 1 voltage divider you would end up with a pretty safe input for the 5 volt ADC.

Code wise, reading the ADC is slower than reading a digital pin so that may become a issue.

Isn't the pin safe from 0-5v regardless of reference voltage?
@go for smoke. The 14.7v is charge voltage from the alternator. But spike could be far higher depending on the inductive loads. Such as electric fans or pumps.

LandonW:
Isn’t the pin safe from 0-5v regardless of reference voltage?
@go for smoke. The 14.7v is charge voltage from the alternator. But spike could be far higher depending on the inductive loads. Such as electric fans or pumps.

If the 5.5V or less is > reference then the ADC will read 1023.

Car electric is very dirty. I doubt that any car electronics, especially the system chips, are not behind solid regulation.

Perhaps connect a 7805 to the AUX fuse and test what comes out?
It can’t be too hard when accessory port MP3 chargers work and are cheap though hit a bump and power will cycle with the loose plugins so connect to the fuse block and lose the resets.

I was saying safe from damage on the pin. But yes the value is 1023 for higher than reference voltages.