Battery measurement false values...

Hello everyone,

For a project I read out 2 LiPo batteries with the Arduino. A simple voltage divider circuit transform the voltage to 0V - 5V ADC.
One battery is also the power source (with a 5V converter in between) of the Arduino, when I read the voltage of that battery I get values which are almost 20% higher sometimes (2/3 readings), only in 1/3 of all the readings I get the right value...

Does anybody know a solution for this?

Cheers,
Dylan

Can you tell which devices are connected to the battery?
Schema?

Of course I can :slight_smile:

Battery LiPo -> ESC 200A + BEC -> Motor
The BEC delivers 5V @ 5A for a controller, in my case an Arduino :slight_smile: The ESC is a motor controller for brush less motors.
The voltage divider is connected in parallel with the ESC to the battery.

I don't think it's the software because I used exactly the same code for the other battery.

Cheers,
Dylan

I can tell you why you are having the problem but you're not going to like it. Basically, in 25 words or less, you can't use the arduino adc to measure the voltage of a battery powering the arduino. You can use any OTHER adc, just NOT the one in the arduino being powered by the same battery. I would recommend the adafruit ads1115 16-bit I2C ADC breakout. If you don't want pay that much you get the 12-bit for $10.
The reason you can't do what you're trying to do is that the adc value is referenced to Vcc. As Vcc drops the count weight increasing reporting higher values than reality . Sorry but that's just how it is. Check it your self. Power the arduino off 5V and take a measurement. Then power it off 3 AA batteries and compare the measurement .-

I already thought that it would be something like that... Damn!
But maybe with a capacitor (1000 uF or more) on the power input I can fix this ?

Cheers,
Dylan

You can't fix it because the load is too great with respect to the regulator capacity. If it was a 5 A Power supply then the voltage wouldn't sag for less than 1A load. But your load is probably close to 50% of your capacity.

You can indeed use the internal ADC to measure the voltage of the battery powering the Arduino, if you select the internal voltage reference (about 1.1 V on a standard Arduino) or use an fixed external voltage reference on the AREF input. You will then need a resistive voltage divider to divide down the maximum expected battery voltage to a bit under the chosen reference voltage, e.g. 5:1. See:

http://forum.arduino.cc/index.php?topic=88935.0

Unfortunately the internal voltage reference of the ATmega chip is not accurately defined and the actual reference voltage (although stable) can be anywhere between about 1.0 and 1.2 V. So, if you go this route, each Arduino has to be individually calibrated.

Yes I know you can go that route but when you can get a 12-bit ADC (ads1015) for $10 or a 16-bit for just under $20 why bother ?

Hi,
I used a voltage stepup/stepdown module from here: http://www.hobbytronics.co.uk/batteries/s7v8a-adjustable-regulator. I feed 4x AA Nimh into this, these start of at about 5.8v the output is adjusted for 7v for the Arduino input, using a potential devider of 2x 10K resistors I get a max input to A0 of 2.9v so in the code I double it and output the battery voltage to the LCD! Even when the batteries are low the Arduino keeps going..

void battCheck()
{
  unit=0.00488;                  //4.88mV per analoge step
  val=analogRead(A2);            //Analogue value
  bv=(unit*val)*2;
  lcd.clear();
  lcd.setCursor(1,0);
  lcd.print("Battery Status");
  val=bv;
  if(val>4.80)
  {
  lcd.setCursor(1,1);
  lcd.print(val);
  lcd.print(" V+ -Full");
  delay(2000);
  }
  if(val<=4.80)
  {
  lcd.setCursor(1,1);
  lcd.print(val);
  lcd.print(" V -Good");
  delay(1000);
  }
  if (val <4.50 and val>4.0)
  {
  lcd.setCursor(1,1);
  lcd.print(val);
  lcd.print(" V -OK ?");
   delay(1000);
  } 
  if (val <4.0 and val>3.70)
  {
  lcd.setCursor(1,1);
  lcd.print(val);
  lcd.print(" V -Low");
   delay(1000);
  }  
    if (val <3.70)
  {
  lcd.setCursor(0,1);
  lcd.print(val);
  lcd.print(" V -Recharge!");
  delay(3000);

Here's a picture.

Regards
Mel.

That's an interesting new twist. I never thought about that but it is actually a good way to get around the issue of the title of this post. (and the price is right too !) . That opens up a lot of possibilities using C & D size batteries for long battery life.

FYI, the correct term for that is "Boost" convertere