how to read continuous voltage of 12v Lead acid Battery by arduino?

2.5k Views Asked by At

Thank you in advance. I am beginner in Lead acid batteries.

Actually I Am using solar energy to charge my 12v sealed lead acid battery. and the thing is I need continuous monitoring of my battery voltage. I used a voltage divider to do that.

Now my Question is, Can I connect voltage divider continuously to the battery?

And the calculated voltage is fluctuating, how to reduce this fluctuations?

Thank you.

3

There are 3 best solutions below

0
Makoto On BEST ANSWER

Yes you can connect the battery continuously to the voltage divider. Make sure you use very big resistors. Current output = V/R . so if you want I<0.1mA you want 0.1mA < 12/R. This means you must use Resistors in the Mega Ohm range.

To reduce fluctuations you can average the voltage readings. A simple scaled average would work nicely.

V[0] = 0.4V[-1] + 0.3V[-2] + 0.2[V-3] + 0.1V[-4].

this will smooth out your readings.

7
Amir On

Yes you can connect your voltage divider to one of Arduino's analog pins!

In fact, I've answered the same question last night in Arduino forum.

Have a look at it and don't hesitate to ask if you have further questions.

// number of analog samples to take per reading
#define NUM_SAMPLES 20

int sum = 0;                    // sum of samples taken
unsigned char sample_count = 0; // current sample number
float voltage = 0.0;            // calculated voltage

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    // take a number of analog samples and add them up
    while (sample_count < NUM_SAMPLES) {
        sum += analogRead(A2);
        sample_count++;
        delay(10);
    }
    // calculate the voltage
    // use 5.0 for a 5.0V ADC reference voltage
    // 5.015V is the calibrated reference voltage
    voltage = ((float)sum / (float)NUM_SAMPLES * 5.0) / 1024.0;
    // send voltage for display on Serial Monitor
    // voltage multiplied by 11 when using voltage divider that
    // divides by 11. 11.132 is the calibrated voltage divide
    // value
    Serial.print(voltage * 11.002);
    Serial.println (" V");
    sample_count = 0;
    sum = 0;
}

in setup() a serial communication is being initialized. so that the output can be displayed in serial monitor.

in loop() n reading of the analog pin is taken and the sum is stored. then the voltage is calculated and the results is reported back to the user.

since we are in void loop the process will be repeated till power is disconnected from the Arduino board.

1
Dileep On

I found this useful site for my project. Have a look at it, If are interested. It's a "solar charge controller". They used best coding techniques to "calculate 12v battery" and solar panel voltage. Thank you.

http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-20/?ALLSTEPS