cumulative mah

Hello,

I’m a novice in electronics. I’m doing a project and I need to mount a panel which can calculate total cumulative mah preferably to more than one decimal places. Is there an easy step by step guide I can follow and parts I need to buy for this project? Thanks.

You can buy digital multimeters with a USB interface.

You need on read the current in mA, say once per second, and sum the values. Every 3600 readings, divide the sum by 3600 to get mAh.

The technique above will work fine. If using integer math (rather than floating point) you can improve the accuracy by saving the remainder of the division, and using this as the initial value for the next sum of readings. This will allow faster updates without increasing the drift due to division rounding error. The rounding error just keeps getting pushed to the next interval until there is enough built up to give a full count.

Another way to do it is to use the current (amps) to control the charging rate of an analog integrator which trips a comparator when the integrated current reaches some value, this then fires an interrupt to the uC (which just counts the pulses) and resets the integrator. This would not be good for very low current, as you’d need to make a very low drift integrator. The advantage here is that you never have to digitize the current, so no ADC, digitizing errors, etc.