Go Down

Topic: Arduino Voltmeter (Read 1 time) previous topic - next topic


Hey does anyone know how to wire a arduino to measuring Car battery voltage ?


Yes - do a google search for voltage divider - you will find what you need. :-)
Mrs Drew
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.


charging is about 14-15 volts, so you would want to allow for a higher voltage than just the battery.

if you set the maximum for 20v to be safe,
and you have a 5v input,  
then R1=4/5 and R2-1/5

4k and 1 k ?

12v will be near the middle of the range so you should be able to see that maximum value when charging.

you would want to add a zenier to limit the voltage in the event the charging circuit failed.


I should have been a smart-a-- and just relied  "YES"


I think with a 4k and 1k resistor, the voltage at the Arduino will be 20V multiplied by 1k divided by 5k (i.e. the value of the two resistors added) which is 4V.  To get 5V from 20V, the resistors would be 3k and 1k.

But one of the nice things about using the Arduino for this is that you don't have to worry about getting exact value resistors anyway. 

You could use the more common 3.3k and 1k values, test the voltage divider with the battery, measure the actual battery voltage with a multimeter and see what corresponding value you get from analogRead().

Then adjust the value you use in your code to convert from analogRead() result to volts.  Something like this ...

Code: [Select]

const float conversionFactor = 0.xxxx  // set this value depending on test results
float batteryVoltage = conversionFactor * analogRead(BATTERY_PIN);



Hackscribble.  Writing about making things.
arduino@hackscribble.com | www.hackscribble.com



V in = Arduino Battery pin
R1 = 4k Resistor
R2 = 1k Resistor
V out = Battery + terminal ?

Then i need a code in vodi loop to give me info about voltage


No.  In the diagram that dave-in-nj posted, Vin is the car battery + terminal.  Vout = Arduino analog pin.  R1 is for example 3.3k or 3.9k resistor, R2 is 1k resistor.  You will also need to connect an Arduino GND to the car battery - terminal.

But please take note of the advice to use a zener diode to protect the input from an unusually high voltage from the car battery charging circuit.
Hackscribble.  Writing about making things.
arduino@hackscribble.com | www.hackscribble.com


Having the lower resistor about 10k will be more power-efficient and isn't too large
for the ADC.  10k and 33k would divide by 4.3, 10k and 22k would divide by 3.2

You can use larger resistances (might be useful if you want to avoid long term
current drain), but you then should add a 0.1uF capacitor too to reduce the impedance
seen by analog input (otherwise readings can be rather off the correct value).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up