# Arduino Forum

## Topics => Science and Measurement => Topic started by: thexeno on Mar 05, 2011, 07:47 pm

Post by: thexeno on Mar 05, 2011, 07:47 pm
Hi!
I would make something like battery indicator. How can I read the low variance of the voltage battery? (I need to measure differences from 0,1 v or less)
Because I need to report this to a little graphic on a display.
Post by: retrolefty on Mar 05, 2011, 07:53 pm
The typical method is to wire a two series resistor network called a voltage divider and then read the voltage on an arduino analog input pin. What kind of battery is it and what is it's voltage range? How is your arduino board powered with this battery?

Lefty
Post by: thexeno on Mar 05, 2011, 08:29 pm
Yeah, I know the voltage divider method. Because I need to read a Vin=7,2v nominal... It's a Ni-MH battery pack and it's wired to Vin and GND pins of arduino (and some other hardware, like motor, display, sensors, timers..)
With the voltage divider, I still can't appreciate a little variance. My actual voltage reader, is very inaccurate, with dozen of calibrations... I mean, this work with a middle charged battery; but if I make a full charge, I need to reset every variables (which are my "battery segments" on the display), until goes down to a middle charge...
Post by: RanTalbott on Mar 05, 2011, 09:14 pm

and some other hardware, like motor

If you're trying to measure with the motor on, there's a good chance that the electrical noise it generates is causing variations in your readings.  Also,  if the motor is drawing a lot of current, the battery pack voltage will sag significantly.
Post by: Magician on Mar 05, 2011, 09:38 pm
You can get precision of measurements 4.9mV = 0.0049 V
with voltage divider by 2 (so 7.2 and plus would be in the limits 0 - 5 V)
precision still be better than your requirements 0.1, approximately
10 times better = 0.0098
Post by: bubulindo on Mar 06, 2011, 10:38 am
You can switch scales to multiply the bits in the reading... You'll need some relays or analog muxes to switch between resistors that will give different voltage ranges. That works best with an operational amplifier so that you get some isolation between the batery and the analog input on the arduino. That way you can also add offsets to the reading. It is, however, fairly complicated to achieve. :\
Post by: max891 on Mar 06, 2011, 11:30 am
So for example I have 9V battery and I want to read it in 11 degrees how to do that ?
LM 358 is good amplifier ?
Post by: thexeno on Mar 06, 2011, 02:01 pm
reading voltages when there's not activated load (like motors) I can read with precision. But how can I read with the same precision also when motors will be on? Like iRobot, the little vacuum cleaner... I mean, how a cellular, and other electronics can be read battery with precision also with heavy load?

It's a theory:
Maybe, they build a projection of battery life, and it's possible which when an heavy load became on, there's a measure of variance of the potential compared to stand-by mode, and extrapolate the approximate remaining life. That because from a fully charged battery and low battery the REALLY difference is ita ability to keep voltage near to nominal value. Yea, I know that the cell when is low it's 1,2 v and 1,34 viceversa; but when I'll connect a simple led+resistance, the low battery will fall down to 0,5 or little more. And, will fall down at little more than 1,3v, viceversa.

It's a correct intuition?
Post by: Magician on Mar 06, 2011, 02:12 pm
LM358 is good:

"General Description
• The LM358A/B series consist of two independent, high gain
and internally frequency compensated operational amplifiers.
They can specifically designed to operate from a single power
supply. Operation from split power supply is also possible and
the low power supply current drain is independent of the magnitude
of the power supply voltages.

• The LM358A/B is available in SOP-8 and DIP-8 packages.
Features
Applications
• Internally frequency compensated for unity gain
• Large DC voltage gain: 100dB Typical
• Wide power supply range:
Single Supply: 3V to 36 V
Dual Supplies: ±1.5V to ±18V
• Battery Charger
• Cordless Telephone
• Switching Power Supply
• Input common-mode voltage range include ground
• RoHS Compliance"

But you don't need them.
Answering to bubulindo, yes, you can solder chips, mux and resistors to improve ADC.
It's all depends how high precision you'd like to get.
Arduino  provide 10bits, or with 9V battery precision  = 9/1024 = 0.008789062 V.
If you would like better, just buy an external ADC chip, there are 12-bits, 14- ... and higher

In other words, it's not reasonable to solder new circuits (chips, mux and resistors)
if you can buy one for 0.5 \$
Only if you enjoy, and like to know how ADC works from inside.
Post by: thexeno on Mar 16, 2011, 12:49 am
Up!
Post by: Grumpy_Mike on Mar 16, 2011, 05:41 pm
Quote
But how can I read with the same precision also when motors will be on?

The precision of the reading will be the same if the motors are on or off unless you are affected by noise.
Did you mean to say how can you estimate the battery life with precision when it is under load?

Well have you noticed how they do it in commercial equipment? That is not very well.
You could measure the current at the same time as you measure the voltage, in that way you could get a better indication of the state of the battery, but you would need to calibrate the readings to extend that to charge state. Then the problem would be that as the battery ages those calibration figures drift.

I have yet to see an accurate measure of battery life in a varying load environment, just look how accurate the average lap top is.
Post by: thexeno on Mar 22, 2011, 12:10 am
Grumpy, I'm not sure about what you say about you measure. But the voltage isn't the same with motors. There's a variation of the voltage, due to internal resistance of the battery. It's not the same. For firs idea, I was started to measure only the voltage of battery and (if it's constant) I will see the remaining life of battery (according to characteristic of the battery), like exactly the system check of expensive battery chargers. But it's not constant.
Now, what did you mean when you say "Well have you noticed how they do it in commercial equipment? That is not very well."?
and
Quote

I have yet to see an accurate measure of battery life in a varying load environment, just look how accurate the average lap top is.

Sorry, I don't understand..
Post by: thexeno on Mar 22, 2011, 01:23 am

The best we can do is to select some minimum battery voltage below which is not safe for the battery or not reliable for system operation. Then we can monitor the battery voltage and shut down the system at this pre-determined minimum voltage.

First of all: big companies can't make an accurately read. I don't need to make that. I need to make a roughly read, at least. Don't start from the top, but from the barn :D
After all:
Use this way it's impossible. As I say before, in according to basics of electrotechnic, I will see a voltage threshold on load that ruin all sets.. but maybe I've an idea...maybe every reads aren't completely ruined...if this work, I'll post that :)
And so, I found that ic, recommended from the italian forum.. the bq2014
and what you think about MAX712 ?
Post by: wayneft on Mar 27, 2011, 09:36 pm
If you were using a Li-poly battery I could offer you a decent solution.  Try searching for Ni-Mh fuel gauges.
Post by: tkbyd on Apr 02, 2011, 10:07 am
Going WAY back to the two resistor voltage divider....

How satisfactory that is going to be for your needs will depend on what sort of resistors you are using, if the temperature in and around them is variable. Some types of resistor are more affected by temperature than others... BUT... having said that, if BOTH of the resistors are warmed equally, which seems likely, depending on how you have things set up, the RATIO of the resistances would remain (nearly?) constant (I think!), and the effect of the heating would be irrelevant.

But I'd still plan to use temperature-stable resistors. Just one less thing to go wrong!