Hello E2E community!
I am planning to use the INA226 for a battery application as a real time monitor and Coulomb counter. I am asking for best practices to get as high precision as possible for the voltage and current reading.
My goal is to have accurate values for average voltage and current over 100 ms intervals, continuously. This is so I can display those values, but also so the Coulomb counter works well (accumulated energy over time)
Initially I planned to set the AVG and VBUSCT registers as close to 100 ms as possible, for example AVG=64, VBUSCT=1.1 ms: 1.1 ms x two conversions x 64 = 140.8 ms. Then program my MCU to read from INA226 at exactly 100 ms intervals over I2C. But then I realized that I will read the same value twice at irregular intervals. Also, the conversion time is specified with low precision (can vary 10%), which makes things more complicated. So if there happens to be a large current spike at the moment I read the same value twice, it will distort my long time average, making the Coulomb counter less accurate.
At each read I could also read the CNVR (conversion ready) bit, then estimate how far out of phase my read is, and then do a weighted average between the new and the previous value. Or I could read at 1 ms intervals, then let the MCU calculate an average every 100 values, but that would result in a lot of I2C activity. Perhaps better to ask the community first about the best practice for this.
Using a conversion ready interrupt from the alert pin is not an option in my case. If I can't find a good solution, I could fall back on using the INA226 accumulated power register, but I'd prefer to use my MCU to do the power calculations.
Regards,
Bjorn Moren