Pages: [1]   Go Down
Author Topic: Arduino Voltmeter  (Read 345 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Scotland
Offline Offline
Edison Member
*
Karma: 26
Posts: 1325
Have you had your Arduino fix today?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes - do a google search for voltage divider - you will find what you need. :-)
Logged

Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

Offline Offline
God Member
*****
Karma: 29
Posts: 977
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.



* vd.png (2.21 KB, 178x168 - viewed 14 times.)
Logged

Offline Offline
God Member
*****
Karma: 29
Posts: 977
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
God Member
*****
Karma: 57
Posts: 940
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
const float conversionFactor = 0.xxxx  // set this value depending on test results
float batteryVoltage = conversionFactor * analogRead(BATTERY_PIN);

Regards

Ray

Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So

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
Logged

Offline Offline
God Member
*****
Karma: 57
Posts: 940
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

0
Offline Offline
Shannon Member
****
Karma: 207
Posts: 12194
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: