Hello, i am attempting to use an Arduino to measure the voltage of a car battery. I am using the analog pins and therefore need to have the voltage between 0 and 5 volts. The car battery also has a very high current that the Arduino would not be able to handle. Does anyone know what resistor i would be able to use and how much heat it would have to dissipate?
Do you want to mesure the battery voltage or mesure the descharge of the battery?
Use a [u]Voltage Divider[/u] (2 resistors). A 1:3 voltage divider can be made with a 1K resistor and a 2K resistor.
The car battery also has a very high current
The battery is capable of high amperage. [u]Ohm's Law[/u] says 12V / 3K = 4mA. If you start your car the starter will draw a couple-hundred amps, but still only 4mA through the voltage divider (and whatever mA the Arduino is "consuming").
Kinda "extending" on what DVDdoug wrote, you could use an online voltage divider to calculate resistors to bring the 12v down to 5 volt. Then just do the usual "analogRead()" thing. An example for the "r2" value using that online voltage divider could be 10k for example. Set the top box to the battery voltage, the lower one to 5v, and the calculator will provide you the value of the other resistor. To figure out the voltage, multiply the result read by analogRead() by 2.4. For example if you set up the voltage divider, read it and the you get 2.5 (1/2 the 5 you started with), then multiply 2.5*2.4, and you get 6volts (1/2 the 12v you started with.
Be sure the vehicle is off if basing this on 12v since when on and charging, the voltage will be higher! If doing it with the car running, allow for the additional voltage to be divided when using the calculator.
. . . also, based on what you wrote, you may not realize that the "size of" the supply doesn't matter, since the analogRead is just charging a cap, and then checking to see how quickly it discharges to get the voltage (simply put), not grounding the input as "digitalRead" would do. So if it was a 5v battery the size of a house with enough storage capacity to light 20,000 5 volt light bulbs, feeding that directly to the analogRead() wouldn't hurt a thing. Even a little more than 5volts would though, of course.
Hi
I would approach the problem with an LM741 op-amp.
You wire it up to receive maximum 14V and output maximum 4V (for being safe not to damage the board).
Then you could just use map (map() - Arduino Reference) to get your end result.
The 741 would have its +Amplitude on the battery anode. The -Amplitude wouldn't matter since there wouldn't be any negative readings.
Be sure to wire the NON-inverting amplifier with the 741, the inverting is simpler but as I said, we can't read negative analog with the arduino.
Hope it helps.
I would approach the problem with an LM741 op-amp.
I wouldn't be caught dead with an LM741 today.
The safest (and best) way is a divider down to ~1volt, and measure with 1.1volt Aref enabled in code.
Something like 1:14 for a ~16volt range.
3k3 from analogue pin to ground and 47k from pin to +batt could work.
The pin will stay below 5volt, even with 75volt on the divider, with a ratio like that.
Add a 100n cap from pin to ground, and you also remove spikes.
Leo..
raschemmel:
I wouldn't be caught dead with an LM741 today.
How about a LF356?
darkgiuseppe:
How about a LF356?
What would the advantage be over a passive voltage divider.
Or did you have a circuit in mind that converts 10-15volt to 0-5volt. for a higher resolution.
Keep in mind that those opamps don't have rail2rail outputs.
Leo..
I was just mentioning perhaps another opamp that the OP that maybe hey could use. I would personally use the voltage diver as well for simplicity's sake.
Thank you for all the recommendations, i have ordered the correct resistors to use for the voltage divider. Will a 10k and a 20k, 1/4 watt resistor dissipate enough heat with the amount of current flowing through it?
1/4 watt is actually "overkill" since there would be only about 0.0014 amps (0.0196 watts) going to ground at 14volts. A typical smd 1/20 watt would even work. But 1/4 watt won't hurt a thing.
Something "just for the knowing," is that even smaller resistors of the same ratio would also work. I doubt that you're going for "conversion speed" with this application, but the higher the resistor values, the longer it takes for the analog converter inside the arduino to do the conversion, since it involves charging a cap, and then timing the discharge (simplified), and the higher the resistance, the longer it takes for the cap to charge. High enough and the conversion can become distorted. Here's something to read.
justjohn:
Something "just for the knowing," is that even smaller resistors of the same ratio would also work. I doubt that you're going for "conversion speed" with this application, but the higher the resistor values, the longer it takes for the analog converter inside the arduino to do the conversion, since it involves charging a cap, and then timing the discharge (simplified), and the higher the resistance, the longer it takes for the cap to charge. High enough and the conversion can become distorted. Here's something to read.
I doubt that.
The duration of the analog conversion is only connected to its clock rate and the resolution.
The accuracy of the conversion may be influenced by the impedance,
if the signal varies fast, or if more than one channel is used.
Whandall:
I doubt that.The duration of the analog conversion is only connected to its clock rate and the resolution.
The accuracy of the conversion may be influenced by the impedance,
if the signal varies fast, or if more than one channel is used.
You're right - got my "wires crossed." Thanks for correcting me.
maxhuebshcer, sorry for the misinformation concerning that.
Is this a car battery in a car, or in some project.
How are you going to power this Arduino, and display the voltage.
I see you have choosen for the simple 1:2 divider with default Aref (ignored post#7).
Leo..