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

Other Parts Discussed in Thread: INA219, TEST2

Hello,

We build a board 2 INA219. 

We are using ESP32 with python library (from here https://github.com/chrisb2/pi_ina219/blob/master/ina219.py. We are using on board 0.1 ohm shunt 

Everything works fine on I2C, but the current and power output are always ZERO. 

I checked step by step the library and regarding the current I saw that reading from registry is returning always zero. Below is some output with and without battery. 

Any idea why we got ZERO amp? 

Thx

ina219 loaded
[65, 68]
DEBUG:INA219: gain set to 0.04V
DEBUG:INA219: shunt ohms: 0.010, bus max volts: 16, shunt volts max: 0.04, max expected amps: 0.200A, bus ADC: 3, shunt ADC: 3
DEBUG:INA219: calibrate called with: bus max volts: 16V, max shunt volts: 0.04V, max expected amps: 0.200A
DEBUG:INA219: max possible current: 4.000A
DEBUG:INA219: max expected current: 0.200A
DEBUG:INA219: __CURRENT_LSB_FACTOR 32800 current_lsb: 6.250191e-05
DEBUG:INA219: current LSB: 6.250e-05 A/bit
DEBUG:INA219: power LSB: 1.250e-03 W/bit
DEBUG:INA219: max current before overflow: 2.0480A
DEBUG:INA219: max shunt voltage before overflow: 20.4800mV
DEBUG:INA219: calibration: 0xfffd (65533)
DEBUG:INA219: calibration: 0xfffd
DEBUG:INA219: write register 0x05: 0xfffd 0b1111111111111101
DEBUG:INA219: configuration: 0x019f
DEBUG:INA219: write register 0x00: 0x019f 0b110011111
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
Bus Voltage : 0.860 V
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x04: 0x0000 0b0
DEBUG:INA219: _current_register: 0
Bus Current : 0.000 mA
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x01: 0x0000 0b0
Supply Voltage : 0.860 V
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x01: 0x-001 0bb1
Shunt voltage : -0.010 mV
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x03: 0x0000 0b0
Power : 0.000 mW

WITH BATTERY

ina219 loaded
[65, 68]
DEBUG:INA219: gain set to 0.04V
DEBUG:INA219: shunt ohms: 0.010, bus max volts: 16, shunt volts max: 0.04, max expected amps: 0.200A, bus ADC: 3, shunt ADC: 3
DEBUG:INA219: calibrate called with: bus max volts: 16V, max shunt volts: 0.04V, max expected amps: 0.200A
DEBUG:INA219: max possible current: 4.000A
DEBUG:INA219: max expected current: 0.200A
DEBUG:INA219: __CURRENT_LSB_FACTOR 32800 current_lsb: 6.250191e-05
DEBUG:INA219: current LSB: 6.250e-05 A/bit
DEBUG:INA219: power LSB: 1.250e-03 W/bit
DEBUG:INA219: max current before overflow: 2.0480A
DEBUG:INA219: max shunt voltage before overflow: 20.4800mV
DEBUG:INA219: calibration: 0xfffd (65533)
DEBUG:INA219: calibration: 0xfffd
DEBUG:INA219: write register 0x05: 0xfffd 0b1111111111111101
DEBUG:INA219: configuration: 0x019f
DEBUG:INA219: write register 0x00: 0x019f 0b110011111
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
Bus Voltage : 0.860 V
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x04: 0x0000 0b0
DEBUG:INA219: _current_register: 0
Bus Current : 0.000 mA
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x01: 0x0000 0b0
Supply Voltage : 0.860 V
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x01: 0x-001 0bb1
Shunt voltage : -0.010 mV
DEBUG:INA219: read register 0x02: 0x06ba 0b11010111010
DEBUG:INA219: read register 0x03: 0x0000 0b0
Power : 0.000 mW

  • Hello Cata,

    We are currently looking into this problem. Could you please share a simple schematic and if this is a high or low-side application? Also, your code is saying the Rshunt is 0.01Ohms, is this correct?

    Sincerely,
    Peter Iliya
    Current Sense Applications
  • Hello Peter,

    Here are the schematics:
    drive.google.com/.../view

    and INAs soldered:
    drive.google.com/.../view


    Regarding the results below you can find a fresh set... I copy& paste a wrong test result. My apologies for this.

    TEST1 UART connected and NO battery and NO Solar MPPT

    ***********************************************************
    INA addr 65
    DEBUG:INA219: gain set to 0.32V
    DEBUG:INA219: shunt ohms: 0.100, bus max volts: 32, shunt volts max: 0.32, max expected amps: 3.000A, bus ADC: 3, shunt ADC: 3
    DEBUG:INA219: calibrate called with: bus max volts: 32V, max shunt volts: 0.32V, max expected amps: 3.000A
    DEBUG:INA219: max possible current: 3.200A
    DEBUG:INA219: max expected current: 3.000A
    DEBUG:INA219: current LSB: 9.146e-05 A/bit
    DEBUG:INA219: power LSB: 1.829e-03 W/bit
    DEBUG:INA219: max current before overflow: 2.9970A
    DEBUG:INA219: max shunt voltage before overflow: 299.6981mV
    DEBUG:INA219: calibration: 0x117e (4478)
    DEBUG:INA219: calibration: 0x117e
    DEBUG:INA219: write register 0x05: 0x117e 0b1000101111110
    DEBUG:INA219: configuration: 0x399f
    DEBUG:INA219: write register 0x00: 0x399f 0b11100110011111
    DEBUG:INA219: read register 0x02: 0x06b8 0b11010111000
    Bus Voltage : 0.860 V
    DEBUG:INA219: read register 0x02: 0x06da 0b11011011010
    DEBUG:INA219: read register 0x04: 0x-003 0bb11
    DEBUG:INA219: _current_register: -3
    Bus Current : -0.274 mA
    DEBUG:INA219: read register 0x02: 0x06da 0b11011011010
    DEBUG:INA219: read register 0x02: 0x06da 0b11011011010
    DEBUG:INA219: read register 0x01: 0x-001 0bb1
    Supply Voltage : 0.876 V
    DEBUG:INA219: read register 0x02: 0x06e2 0b11011100010
    DEBUG:INA219: read register 0x01: 0x-002 0bb10
    Shunt voltage : -0.020 mV
    DEBUG:INA219: read register 0x02: 0x06da 0b11011011010
    DEBUG:INA219: read register 0x03: 0x0000 0b0
    Power : 0.000 mW


    ***********************************************************
    INA addr 68
    DEBUG:INA219: gain set to 0.32V
    DEBUG:INA219: shunt ohms: 0.100, bus max volts: 32, shunt volts max: 0.32, max expected amps: 3.000A, bus ADC: 3, shunt ADC: 3
    DEBUG:INA219: calibrate called with: bus max volts: 32V, max shunt volts: 0.32V, max expected amps: 3.000A
    DEBUG:INA219: max possible current: 3.200A
    DEBUG:INA219: max expected current: 3.000A
    DEBUG:INA219: current LSB: 9.146e-05 A/bit
    DEBUG:INA219: power LSB: 1.829e-03 W/bit
    DEBUG:INA219: max current before overflow: 2.9970A
    DEBUG:INA219: max shunt voltage before overflow: 299.6981mV
    DEBUG:INA219: calibration: 0x117e (4478)
    DEBUG:INA219: calibration: 0x117e
    DEBUG:INA219: write register 0x05: 0x117e 0b1000101111110
    DEBUG:INA219: configuration: 0x399f
    DEBUG:INA219: write register 0x00: 0x399f 0b11100110011111
    DEBUG:INA219: read register 0x02: 0x06d2 0b11011010010
    Bus Voltage : 0.872 V
    DEBUG:INA219: read register 0x02: 0x06d2 0b11011010010
    DEBUG:INA219: read register 0x04: 0x-001 0bb1
    DEBUG:INA219: _current_register: -1
    Bus Current : -0.091 mA
    DEBUG:INA219: read register 0x02: 0x06d2 0b11011010010
    DEBUG:INA219: read register 0x02: 0x06d2 0b11011010010
    DEBUG:INA219: read register 0x01: 0x0000 0b0
    Supply Voltage : 0.872 V
    DEBUG:INA219: read register 0x02: 0x06da 0b11011011010
    DEBUG:INA219: read register 0x01: 0x-001 0bb1
    Shunt voltage : -0.010 mV
    DEBUG:INA219: read register 0x02: 0x06d2 0b11011010010
    DEBUG:INA219: read register 0x03: 0x0000 0b0
    Power : 0.000 mW



    >>>>>>>>>>>TEST2 UART and LipO 6600Mah Battery connected but NO Solar MPPT

    INA addr 65
    DEBUG:INA219: gain set to 0.32V
    DEBUG:INA219: shunt ohms: 0.100, bus max volts: 32, shunt volts max: 0.32, max expected amps: 3.000A, bus ADC: 3, shunt ADC: 3
    DEBUG:INA219: calibrate called with: bus max volts: 32V, max shunt volts: 0.32V, max expected amps: 3.000A
    DEBUG:INA219: max possible current: 3.200A
    DEBUG:INA219: max expected current: 3.000A
    DEBUG:INA219: current LSB: 9.146e-05 A/bit
    DEBUG:INA219: power LSB: 1.829e-03 W/bit
    DEBUG:INA219: max current before overflow: 2.9970A
    DEBUG:INA219: max shunt voltage before overflow: 299.6981mV
    DEBUG:INA219: calibration: 0x117e (4478)
    DEBUG:INA219: calibration: 0x117e
    DEBUG:INA219: write register 0x05: 0x117e 0b1000101111110
    DEBUG:INA219: configuration: 0x399f
    DEBUG:INA219: write register 0x00: 0x399f 0b11100110011111
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    Bus Voltage : 3.936 V
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x04: 0x0000 0b0
    DEBUG:INA219: _current_register: 0
    Bus Current : 0.000 mA
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x01: 0x-002 0bb10
    Supply Voltage : 3.936 V
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x01: 0x-002 0bb10
    Shunt voltage : -0.020 mV
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x03: 0x0000 0b0
    Power : 0.000 mW



    INA addr 68
    DEBUG:INA219: gain set to 0.32V
    DEBUG:INA219: shunt ohms: 0.100, bus max volts: 32, shunt volts max: 0.32, max expected amps: 3.000A, bus ADC: 3, shunt ADC: 3
    DEBUG:INA219: calibrate called with: bus max volts: 32V, max shunt volts: 0.32V, max expected amps: 3.000A
    DEBUG:INA219: max possible current: 3.200A
    DEBUG:INA219: max expected current: 3.000A
    DEBUG:INA219: current LSB: 9.146e-05 A/bit
    DEBUG:INA219: power LSB: 1.829e-03 W/bit
    DEBUG:INA219: max current before overflow: 2.9970A
    DEBUG:INA219: max shunt voltage before overflow: 299.6981mV
    DEBUG:INA219: calibration: 0x117e (4478)
    DEBUG:INA219: calibration: 0x117e
    DEBUG:INA219: write register 0x05: 0x117e 0b1000101111110
    DEBUG:INA219: configuration: 0x399f
    DEBUG:INA219: write register 0x00: 0x399f 0b11100110011111
    DEBUG:INA219: read register 0x02: 0x1eca 0b1111011001010
    Bus Voltage : 3.940 V
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x04: 0x0000 0b0
    DEBUG:INA219: _current_register: 0
    Bus Current : 0.000 mA
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x01: 0x0000 0b0
    Supply Voltage : 3.936 V
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x01: 0x-003 0bb11
    Shunt voltage : -0.030 mV
    DEBUG:INA219: read register 0x02: 0x1ec2 0b1111011000010
    DEBUG:INA219: read register 0x03: 0x0000 0b0
    Power : 0.000 mW
  • Hello Cata,

    Could you please probe the shunt and bus voltages of U2 and U4 and when you are taking these I2C readings? I can't see anything wrong yet.

    Best,
    Peter Iliya
    Current Sense Applications
  • Hey Cata,

    Have you resolved your issue? If not, please reply back with more information. Also attach your schematics as pictures and not links to storage drive.

    Thanks,
    Peter Iliya
    Current Sense Applications
  • Hello Peter,

    For the moment we fixed... we will continue with the testing phase.

    Thank you,
    Cata