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: Calibrating INA219 for different shunt resistor

Part Number: INA219

Hi ALL

I am using an INA219 to monitor a DC load(24V and 10 A).

I am asking, what is the correct value for configuration register and calibration one to measure this load.

  • Hello Hani,

    Thanks for considering to use Texas Instruments in your design. I will give you an example that you may be able to use or tweak for your system.
    Assuming your max current is 10A and you want the highest precision (12 bits) with PGA= /8. Assuming you choose your shunt to be Vshunt_max/10A = 0.032 ohm. Then your current_LSB = (10/(2^(ADC bits)*2^(gain bits))=10/(2^15)=0.000305. Then you are able to get cal = 0.04096/(0.000305*0.032)=4194.304 (binary: 1000001100010).

    Gain bits:
    PGA = /1 : 0
    PGA = /2 : 1
    PGA = /4 : 2
    PGA= /8 : 3

    From this your configuration register (assuming no sample averaging) is: xxx1110001000xxx
    Your calibration register is: 0010 0000 1100 010x
  • thanks Patrick, BTW if I am using a shunt resistor = 0.01 ohm , in this case my calibration will be = 13429? Am I right?
  • Hello Hani,

    I am not exactly sure how you got that value. With your shunt, your max measurable current is 320mV/0.01 ohm = 32A assuming PGA = /8. Your current LSB would then be ~ 0.000977A. For 9 bit ADC resolution cal = 524, cal@10bit =1048, cal@11bit=2097, cal@12bit=4194.

    Could you show me how you got your value?
  • Hello Hani,

    I have not heard a response from you in a while. As such I presume you do not need further support on how the calibration works and will therefore close this thread. However, if in fact you do need further support, please respond below or open a new thread.
  • Hello Patrick,

    I calculated this value as follow , since I am using Rshunt = 0.01 ohm. so the calibration = 0.04096/(0.000305 * 0.01) = 13429. with 12 bit precision.
  • Hello Hani,

    From you calculation I presume you are using PGA = /8 and your max current is ~10A.  You can do that.  However you should be aware that although your calibrated current resolution or current_LSB is 305uA, you will not actually achieve such resolution as the voltage across the shunt is what is measured and the Vshunt_LSB is ~10uV while your current_LSB*Rshunt = 3.5uV.  Another thing to consider is that there is a voltage offset that also heavily contributes to error in the lower current measurements.  For a common mode voltage of 12V, this is typically 40uV; however, it can be as high as 200uV if you are using INA219A.

    For additional clarity, I am including a picture below of excel calculations, showing what you may expect to see on the lower end of your current measurement range.  The first column corresponds to the ideal discrete current values derived from calibration.  Column B corresponds to the ideal shunt voltage that corresponds to those measurements.  Column C corresponds to the shunt voltage with the offset included.  Column D is the INA219 typical shunt voltage LSB.  Column E are the corresponding number of codes or count you would expect to see in the Vshunt register.  Column F corresponds to the current derived from your measurement.  Lastly column G shows the error.

    /cfs-file/__key/communityserver-discussions-components-files/14/4722.INA219_5F00_Error_5F00_Calculation.xlsx

  • Hello Patrick,

    I hope you are doing, I am using R shunt 0.01 ohm and cal@4096. the configuration register is the default value (399F) . when i am reading the volt value it seems correct. but the current value is floating and sometimes reach to 65 A . the current LSB = 0.001 . any ideas what cause this problem.
  • Hello Hani,

    I am looking into your issue and I should have a response for you tomorrow.
  • Hello Hani,

    Can you adjust your configuration register such that you acquire a shunt and bus voltage off of a trigger and tell us if your still observe a discrepancy in your current measurement? Also when the current value is floating in the INA219, what current value are you actually expecting to see and did you verify with a separate meter?
  • Hello Patrick,

    yes i am using a separate mater to verify the value. when the load current is about (4 A) the reading value seems correct, when the load current around 0.7 A the reading value around 1.5 A. will it be a problem if the load is controlled by PWM with frquany (60 HZ).
  • Hello Hani,

    In your previous post you said that the device readings floated up to 65A.  I do not see how that is possible if you are using a current LSB of 0.001 with PGA=/8 and the 12 bit ADC.  Based off of those settings you can read 32.768A (Current_LSB*2^15) at most.   Regardless, I presume your register is giving you the max current value.  If this is only sometimes then it may be because you are not averaging and may occasionally sample during the high portion of your duty cycle (I presume this is related to your other post here). If you do not apply a PWM and just have a static 0.7A load, does it still look like 1.5A?

  • Hello Hani,

    We have not heard from you in a while. Consequently, we presume your issue is resolved and will close this thread. However, if you need further support, please respond below.