Introduction: World's Easier Battery Meter Up to 5v in MAh

About: Linux - Arduino - Linux Shell - Code & Soldering.

An Arduino and a resistor is all we need to build this design that creates a capacity meter for voltage batteries up to 5v. Acid, alkaline, NiCd, Li-ions and Lipo batteries can be used. The market is full of fake batteries claiming huge capacity but delivering a fraction of the promised, tired of the situation this project helps discover the actual capacity of the available batteries when some Chinese 8800 Li-ions did not even have 650mAh in fact.

It is necessary to be careful and prevention on discharge, rechargeable batteries should not be discharged beyond 20% of its nominal voltage, this can cause irreversible damage to your unit.

Step 1: Putting All Together in Just One Easy Step.

The indicated resistors are 22R / 10W or 10R / 10W, we use the latter because it presents less analysis time. To test smaller batteries like the CR2032 a 47R / 2W resistor can be used with a slow discharge, avoiding heating battery.

For accuracy, only two adjustments need to be made in the code. The variable "vcc" should receive the measured direct voltage value on the Arduino board. The "resistor" variable must receive the exact value of the resistor in Ohms and decimals numbers can be used.

In a easy way Serial Monitor from Arduino IDE was used as an interface, showing values read every 1.8s, so the PC should remain connected to the arduino while the test is performed, the window can be minimized allowing the use of the computer for another purpose, even So the design can be easily modified to accept a 16x2 LCD or a 4-digit 7-segment display.

The time of 1.8s was chosen because it allows a quick update and because it is multiple of 60, representing 0.0005 of the hour, which facilitated the calculations.

In addition to being the simplest this solution was also the cheapest among others that were researched.

Step 2: The Code.

float vcc = 5.0; // Real voltage value on arduino board - measure with multimeter
float soma = 0.0;

int analogInput = 0;

float vout = 0.0;

int value = 0;

float resistor = 10; // True value of resistor in ohms, measure with multimeter -

// used in design: 10 Ohms / 10 Watts

void setup(){

Serial.begin(9600);

pinMode(analogInput, INPUT);

Serial.println("Reading every 1.8s");

delay(1800);

}

void loop(){

value = analogRead(analogInput);

vout = (value * vcc) / 1024.0;

float cout = vout / resistor;

float parcial = cout * 0.0005;

soma = soma + parcial;

Serial.print("Current read: ");

Serial.print(cout);

Serial.print(" Amp. ");

Serial.print("Measured so far: ");

float msoma = soma * 1000;

Serial.print(msoma);

Serial.println(" mAh");

// wait more 1.8 seg

delay(1800);

}

Step 3: