Go Down

Topic: Monitoring battery power (Read 762 times) previous topic - next topic


I have a project where I am using an Arduino Deucillima which ties the Aref to the 3.3v supply for a 3.3v gyro.

Also I am powering this with a 12v dry cell battery tied directly to the Arduino (the arduino uses its onboard 5v regulator) but I would also like to continuously monitor the 12v battery for battery level and to calculate remaining battery charge life.

Is there an easy way to do this?

Thanks in advance for helpful advice...


Use a resistor-divider to convert the 12V battery voltage to about 3V, then feed that to another analog input.  A divider using a 10k and a 33k would divide 12.0V down to 2.79V, which with AREF at 3.3V gives analogRead() of 866 (72 per volt).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


in your code you need to check this value e.g. once per hour or so

some code inspiration ;)
Code: [Select]

unsigned long previous = 0;

void loop()
  if (millis() - previous > (3600L * 1000L))  // or other timing
  previous = millis();
    int voltage = analogRead(A0) * 12 * somefactor /1024;  // somefactor to be determined
    // write to display
    if (voltage < 10 ) 
       // alarm!!!
  // additional things here
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Let's go back a step.

Dry batteries are generally non-rechargable, unless you are using something like ni-cads, NiMh, SLA etc which are all rechargable but not generally referred to as "dry"

In either case you are wasting battery power by dropping 7 volts across the arduino regulator ie wasting something like 60% of the current feeding the arduino.  You'd be better using a switching regulator to drop the 12 down to 5v or 3.3 and waste less than 20% of the battery power.

There isn't a simple way of calculating battery life unless the manufacturer can provide you with an accurate datasheet of battery terminal voltage versus state-of-charge.  Terminal voltage is also dependant upon current drawn so open circuit terminal voltage won't tell you what you want to know, and it's likely that neither will terminal voltage when under load.

Go Up