-
Notifications
You must be signed in to change notification settings - Fork 153
Description
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.
Adafruit_INA219/Adafruit_INA219.cpp
Lines 391 to 395 in ce59837
| void Adafruit_INA219::setCalibration_16V_400mA() { | |
| // Calibration which uses the highest precision for | |
| // current measurement (0.1mA), at the expense of | |
| // only supporting 16V at 400mA max. |
But according to line 416 the current LSB you are using is 0.00005:
Adafruit_INA219/Adafruit_INA219.cpp
Line 416 in ce59837
| // CurrentLSB = 0.00005 (50uA per bit) |
My main question is about the voltage limitation. In these lines you calculate the maximum power:
Adafruit_INA219/Adafruit_INA219.cpp
Lines 454 to 457 in ce59837
| // 8. Compute the Maximum Power | |
| // MaximumPower = Max_Current_Before_Overflow * VBUS_MAX | |
| // MaximumPower = 0.4 * 16V | |
| // MaximumPower = 6.4W |
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?