This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

INA219: current value

Part Number: INA219

Hi team,

We find the current value that INA219 register show is twice the actual measured. The following are How we calculate current.

  1. 4.88e-05(Current_LSB) = 1.6(max_expected_current) / 2 ^ 15
  2. 0.5375(current value A) = 2b14 (register value) * 4.88e-05

The shunt voltage value that INA219 register show is approximately same as actual measured. Value is 10.75mV.  Rshunt  is 40 m ohm

        Current value = 10.75 / 40 = 0.268 A

Is there something wrong?

BR,

Comi

  • Hi Comi, 

    Do you mind sending a full register readout so I can see the configuration registers? This would help me figure why you're getting certain values. 

    Best,

    Mohamed 

  • Hi Mohamed,

    The following are registers value and the real value we calculates.

    WILSON-P1D>5% mdevice read 0 length=2 id=INA219:114

     0(0): 9f39             // Configuration register (big endian to little endian) 0x399f

    Read 2/2 bytes from mdevice INA219:114

    WILSON-P1D>6% mdevice read 1 length=2 id=INA219:114

     1(0): b607            // Shunt Voltage register 0x07b6

    Read 2/2 bytes from mdevice INA219:114

    WILSON-P1D>7% mdevice read 2 length=2 id=INA219:114

     2(0): 3a5d             // Bus voltage register 0x5d3a

    Read 2/2 bytes from mdevice INA219:114

    WILSON-P1D>8% mdevice read 3 length=2 id=INA219:114

     3(0): 6430             // Power register 0x3064

    Read 2/2 bytes from mdevice INA219:114

    WILSON-P1D>9% mdevice read 4 length=2 id=INA219:114

     4(0): 5c50              // Current register 0x505c

    Read 2/2 bytes from mdevice INA219:114

    WILSON-P1D>10% mdevice read 5 length=2 id=INA219:114

     5(0): d6a3             // Calibration register 0xa3d6

     

    WILSON-P1D>0% ina2xx show

    Power: 12.220703 W

    Current: 1.027490 A

    Shunt Voltage: 19.750000 mV

    VBus Voltage: 11948.000000 mV

    Calibration: 0x51eb

    BR,

    Comi

  • Hi Comi,

    I'm seeing two different calibration registers. 0x51EB as well as 0xA3D6. 0xA3D6 is approximately double 0x51EB. Which value do you mean to be using? This could be the reason you are getting doubled the value in your current measurement. 

    Best,

    Mohamed 

  • Hi Mohamed,

    0x51EB = (0xA3D6 >> 1)

    Cause the bit0 of calibration register is a void bit and will always be 0.. CALIBRATION is the value stored in bit15:bit1 .

    BR,

    Comi

  • Hi Comi,

    Which value are you using in the math? Because I did the math using 0x51EB and got the current value in Amps of 0.49A, which is around half of your current value of 1A. Also, when I utilized Ohm's law with your shunt voltage of 19.75mV and a 40mOhm shunt, I was able to get 0.49375A which is similar. Could you be using the wrong calibration register in your current math? 

    Best,

    Mohamed 

  • Hi Mohamed,

    I didn’t use the value in math.

    Could you show the formula to calculate the current by using 0x51EB.

    The below is my method to calculate.

    Now we use 1.6 A as the Maximum Expected Current

    1. Current_LSB = Maximum Expected Current / 2^15.
    2. Current = Current register value * Current_LSB.

    BR,

    Comi

  • Hi Comi,

    I used the theoretical current register value for the math, to ensure I was using the correct shunt_cal: 

    From this, I calculated the current register to be 10106. I then multiplied your Current_LSB by that value to get 0.4934A. I compared that to an Ohm's law value of 19.75mA / 40mOhm and got a similar value of 0.4937A. 

    Best,

    Mohamed 

  • Hi Mohameed,

    1.The current value is calculated to be 10106. But I read it out from register is 20572(0x505c). Almost twice as much as the theoretically calculated value. Do you have any suggestion about this situation?

    2.Are there any errors about my steps to calculate the current value?

    BR,

    Comi

  • Hi Comi,

    The reason why the current and power register readings are incorrect is because the calibration register was programmed with the wrong value.

    When programming Cal register, please don’t shift bits. 51EB (or 51EA) should be written to it directly. All the numbers will line up correctly afterwards.

    Regards, Guang