Adafruit_INA219 icon indicating copy to clipboard operation
Adafruit_INA219 copied to clipboard

Are the considerations for setCalibration_16V_400mA() correct?

Open wollewald opened this issue 3 months ago • 0 comments

Hi, thanks for your library!

First a minor issue: In Adafruit_INA219.cpp, in function setCalibration_16V_400mA(), you say you are using the highest precision 0.1 mA.

https://github.com/adafruit/Adafruit_INA219/blob/ce59837b4a8feccd767c67d26806a0bd89d1d8eb/Adafruit_INA219.cpp#L391-L395

But according to line 416 the current LSB you are using is 0.00005:

https://github.com/adafruit/Adafruit_INA219/blob/ce59837b4a8feccd767c67d26806a0bd89d1d8eb/Adafruit_INA219.cpp#L416

My main question is about the voltage limitation. In these lines you calculate the maximum power: https://github.com/adafruit/Adafruit_INA219/blob/ce59837b4a8feccd767c67d26806a0bd89d1d8eb/Adafruit_INA219.cpp#L454-L457 Why is 16 V the limit? Here, some calculations using 400 mA / 32 V:

  • The LSB of the Bus Voltage Register is 4mV, so the Bus Voltage Register would be 8000 at 32 V.
  • Using an 0.1 ohm shunt the value in the shunt voltage register would be 4000 at 400 mA (= 40 mV shunt voltage)
  • The value in the Current Register would be : Shunt Voltage Register x Calibration Register / 4096 = 4000 * 8192 / 4096 = 8000.
  • With these values, the Bus Power Register would be: Current Register * Bus Voltage Register / 5000 = 8000 * 8000 / 5000 = 12800, which is 12.8 W.

So, I can't see any overflow or other issue and therefore I would say there is no limitation to 16 V in this mode. Or have I forgotten anything?

wollewald avatar Mar 24 '24 15:03 wollewald