help with a circuit please :D

Hi all,
In advance thanks for any help. Due to the safe voltage being 5volt input I want to seek guidance and help for a circuit as I am no good with electronics. I am not selling anything on, I am just trying to make something to test on my old classic car.
I have:
Arduino R3 board
2 sensors that take a 12v supply

I am wanting to read the output from the sensors this can be anything from 0-12v with an accuracy of 0.1v

I was wondering if somebody could suggest a circuit I know this is cheeky but I would be really grateful

I'm a programmer by trade and electronics are not my thing so thanks again for helping

Hi,

The two items you'll want to read up on are a potential or voltage divider circuit, and the analogRead() function. The potential divider is two resistors, with values that ensure that with your 12V in, when tapped between the two resistors you get 5V out.

Plugging the input voltage of 12.6V for a fully charged car battery (you might use something slightly higher to be conservative) and 5V as the output into this online resistor calculator (the 2nd calculation) gives 560 and 390 Ohms as two possible resistor values to use.

Alternatively, you can use a potentiometer rather than two discrete resistors, and dial it in until the centre pin outputs a measured 5V at the maximum voltage input.

The analogRead function will return a value of 0-1024 corresponding to the range of voltage from 0-5V on your analog input pin so the resolution for 12.6V would be 0.012V steps. You can also feed the 12V power supply itself into a potential divider to feed into the AREF pin on the Arduino. Then tell the Arduino to use this as the reference point for maximum using the analogReference() function. This will ensure that your returned value relates correctly to the sensor output, even as your car battery drops in voltage from completely charged.

Cheers ! Geoff