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: Can't seem to change INA219 PGA gain

Part Number: INA219

So, this is most likely an issue with my understanding, but would like to clarify.

I have a board with a few INA219 devices on and I would like to configure them for different PGA gains.

Currently I am able to read from all devices with the default settings, and I can correctly change the over-sampling, which results in more stable readings as expected, so I know I am writing and reading to the devices correctly.

So, with a fixed current flowing I would expect the values read back from the shunt to change as I change the PGA, but that is not what I see.

My sequence is as follows, device address is 0x40...

//Set pp_hv IMON as 8x, 32x over sampling
wr 0x40 0x00 0x3e 0xef

Loop reading from register 1. Values returned follow my current as expected, yielding 1mA values across the 10mR sense resistor.

If I change the PGA gain to 1x with the following then loop reads again I would expect the values returned to be 8x the first test, but they are identical.

//Set pp_hv IMON as 1x, 32x over sampling
wr 0x40 0x00 0x26 0xef

I am sure I am missing something obvious, but for the life of me can't spot it !!!

BR,

Steve

  • Good evening Steve,

    The first byte of your write command is the physically set slave address for A0 and A1. Ensure both of these pins are grounded on the device to match your software.

    Can you also ensure the R/W’ bit is low before each write and read of data?

    These conclude the obvious culprits; please let me know if this helps!

    Manuel Chavez

  • Manuel,

    Thanks for reviewing.

    I think I know what the issue is, and it is with my understanding.

    I can read and write to the device correctly. The address and R/W are correct.

    I now believe the devices is in fact doing what it should, but that it 'hides' the change in PGA gain by sort of 'self correcting' the returned result to automatically compensate for the gain setting. The result is that all the gain really does is change the full scale range (and associated accuracy), but the value returned in the read register is already re-calculated to account for the PGA.

    Table 7 in the datasheet clearly shows this behavior, I just didn't read it correctly !!!

    If you pick a voltage in Table 7 you can see that no matter what the PGA setting that the value returned is always the same. What DOES change is the voltage at which the readings overflow and clamp.

    Therefore, I think I understand the behavior now. The INA219 is just being more helpful than I am used to :)

    BR,

    Steve

  • Great, Steve! I'm glad it's working.

    Happy engineering,
    Manuel Chavez