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: No output when load is connected using arduino uno

Part Number: INA219

Hii;

I am working on voltage and current sensing for my LED project for which i am using INA219 module for testing. 

The only problem is it does not shows any voltage or current (i.e 0.00V and 0.00mA) on serial monitor of arduino IDE.

The i2c communication is correct which i checked using I2C scanner code.

Is there something that i am missing? please help me out.

Note:This one is my 2nd module and both of them are not working

  • Hello Prince,

    Thanks for choosing TI. We certainly want to determine your problem. Would you please send us more information on your circuit and how you are configuring the INA219? Basically what is power supply, shunt resistor, current level and current frequency?

    Also, what are you setting your calibration register to? What speed is your I2C communication set to?

    Any more information would be helpful. Thanks Prince.

    Peter Iliya
    Current Sensing Applications
  • Hii Peter,

    I am using INA219 for measuring current for LED [ rated 12v 350mA ] which is powered using similar rated LED driver.

    I am using the module and configured it as shown in tutorial by adafruit using arduino uno and even i tried it with adafruit INA219 library, circuit diagram is also as shown in the tutorial.

     

  • Hey Prince,

    Can you please confirm that you are able to read and write to the registers? I assume you are using the Arduino code from here:
    learn.adafruit.com/.../arduino-code

    If you could also send your Arduino code so I know how you are setting up the registers would help as well.

    Sincerely,
    Peter Iliya
    Current Sensing Applications
  • Yes, I am using adafruit arduino code from the link u have mentioned above.

    This is the example code that is included in the library.

    Note:Since the .ino file can not be uploaded i am pasting the code below

    #include <Wire.h>
    #include <Adafruit_INA219.h>

    Adafruit_INA219 ina219;


    void setup(void)
    {
    Serial.begin(115200);
    while (!Serial) {
    // will pause Zero, Leonardo, etc until serial console opens
    delay(1);
    }

    uint32_t currentFrequency;

    Serial.println("Hello!");

    // Initialize the INA219.
    // By default the initialization will use the largest range (32V, 2A). However
    // you can call a setCalibration function to change this range (see comments).
    ina219.begin();
    // To use a slightly lower 32V, 1A range (higher precision on amps):
    //ina219.setCalibration_32V_1A();
    // Or to use a lower 16V, 400mA range (higher precision on volts and amps):
    //ina219.setCalibration_16V_400mA();

    Serial.println("Measuring voltage and current with INA219 ...");
    }

    void loop(void)
    {
    float shuntvoltage = 0;
    float busvoltage = 0;
    float current_mA = 0;
    float loadvoltage = 0;
    float power_mW = 0;

    shuntvoltage = ina219.getShuntVoltage_mV();
    busvoltage = ina219.getBusVoltage_V();
    current_mA = ina219.getCurrent_mA();
    power_mW = ina219.getPower_mW();
    loadvoltage = busvoltage + (shuntvoltage / 1000);

    Serial.print("Bus Voltage: "); Serial.print(busvoltage); Serial.println(" V");
    Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV");
    Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V");
    Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA");
    Serial.print("Power: "); Serial.print(power_mW); Serial.println(" mW");
    Serial.println("");

    delay(2000);
    }

  • Prince,

    It looks like you are not calibrating the device. Both optional lines to calibrate INA219 with .setCalibration are commented out. Although this will not be enough. You will need to modify the Adafruit_INA219.cpp source file such that you input the correct calibration value. How to calculate this value is explained in the comments of Adafruit_INa219.cpp source file and also in section 8.5.1 of datasheet.

    Sincerely,
    Peter Iliya
    Current Sensing Applications
  • Hii,

    I will definitely look for it and update you if its working.

    Thanks for your help.