I have following situation:

Solarpanel with 20 W, 2 12V lead-acid batteries, the solar panel is charing the batteries. I measure the current coming from the panel with a ACS712 in a 3 minute interval.

The output then looks as following:

1.08699;"2015-05-07 12:42:33"
1.09222;"2015-05-07 12:45:33"
1.00338;"2015-05-07 12:48:32"
0.984217;"2015-05-07 12:51:32"
1.06783;"2015-05-07 12:54:33"
1.01557;"2015-05-07 12:57:33"
0.386719;"2015-05-07 13:00:32"

I want to calculate the total ampere hours of a day. I had the followin in mind:

As the ACS712 is very noisy, I set all values below 0.10 amps to 0. I square every value, then sum it, then divide by the amount of values I have for each day. Then I multiply by the amount of seconds that have passed between start and end.

The result is the charging current for that day, I think. Is this a viable approach to this problem, or should I skip the squaring part?


1 Answer 1


Skip the squaring. You are trying to integrate current, not power. And don't bother limiting the low values, either. Just sum them up, multiply by time between samples, and divide by total time.

  • \$\begingroup\$ Thank you for your answer. Are you sure to skip the low values? I have values that can't be true (like +-0,06 amps in the middle of the night) \$\endgroup\$ May 7, 2015 at 22:29
  • \$\begingroup\$ Shrug. Up to you. Do you get negative values as well? Take a look at the total reading for a night, and see if the noise averages out. \$\endgroup\$ May 7, 2015 at 22:31
  • \$\begingroup\$ Yes, negative values too. \$\endgroup\$ May 7, 2015 at 22:32
  • \$\begingroup\$ So give it at try. Since you're not going to be squaring the values, false negatives will probably cancel out false positives. Certainly taking data when you KNOW there's no light will allow you to get an idea of the ACS712's response to zero input. \$\endgroup\$ May 7, 2015 at 22:36
  • 1
    \$\begingroup\$ You are right, I averaged 6 hours of darkness and the result is -0,009 amps, which I think can be ignored. \$\endgroup\$ May 7, 2015 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.