INA219 and external shunt

Dears,
please need help coding ina219 using external shunt 300A 75mV accuracy class 0.3 ,aleady remove the internal R100 shunt,the maximum current that i will use is 80A the maximum voltage 14V.
How i do claculate the shunt resistance ,Any simple code is welcome.

Thanjs for support

Fouad19764:
Dears,
please need help coding ina219 using external shunt 300A 75mV accuracy class 0.3 ,aleady remove the internal R100 shunt,the maximum current that i will use is 80A the maximum voltage 14V.
How i do claculate the shunt resistance ,Any simple code is welcome.

Thanjs for support

I am guessing you are using a breakout board that has a ina219 on it, not a ina219 directly, since it doesn't have an internal shunt.

If your new shunt gives 75 mv at 300A, will not Ohms law give you the resistance?

Paul

R = E / I
R = .075 / 300 = .00025 ohms

Use the /1 PGA setting and the calibration value should be 32768 for 160 amps maximum.

Will you be using the Adafruit library?

Yes i will use the adafruit library.

Please any one? I need help ti change setting on adafruit library from standard 0.1 ohm to 300a 75mv ,0.5 accuracy class shunt

The mazimum voltage will be used is 14v and maximum current is 80a

Thanks in advance

Adafruit does not make it easy to change the ranges and scaling, you have to edit the library files directly rather than being able to call methods to change the necessary variables.

Here is a hacked library that is scaled for the shunt you describe. I did not rename the library so you'll have to manually replace any existing copy that is in your libraries directory.

Three files have changes.

Adafruit_INA219.cpp
Adafruit_INA219.h
getcurrent.ino

The method "setCalibration_16V_160A(void)' was added and the getPower and getCurrent were renamed to remove the "milli" prefixes, as in mA and mW are now A and W.

Adafruit_INA219.zip (10.6 KB)

Thanks a lot Dude,you saved my day.

Dears,

i finished install the setup ,the code given by wattsthat give only zeros,i have tried to to add the i2c address (0x40) without success,i think that there is something missing.
tried i2c scanner,it detect the breakboard correctly at 0x40.

here is the output
Hello!
Measuring voltage and current with INA219 ...
Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

Bus Voltage: 0.00 V
Shunt Voltage: 0.00 mV
Load Voltage: 0.00 V
Current: 0.00 A
Power: 0.00 W

The code was tested before posting. Since the I2C scanner sees the INA219, it is probably working and just not wired correctly.

The shunt must be connected to the high side of the supply, the datasheet shows the proper configuration on page 10. Please post a photograph of your board and connections if you have any doubts. Depending upon your desoldering skills, you may have damaged the traces that connect to the ic voltage inputs.

If you have a second board, try it without removing the 0.1 ohm shunt, it will not affect the resistance of the external shunt in any significant way.

thanks dude,i have tried 3 different breakboard,all the same ...but when i re-solder the original R100 shunt it worked!!!

hi
im new to the ina219 module; i have 3 mosfets (switches) in my circuit and i want to use ina219 to measure the voltage and current when the switch is open and closed i have a led as load how do i connect the vin+ and vin- of the ina219?
hope someone reply soon
thank you

WattsThat:
Adafruit does not make it easy to change the ranges and scaling, you have to edit the library files directly rather than being able to call methods to change the necessary variables.

Here is a hacked library that is scaled for the shunt you describe. I did not rename the library so you'll have to manually replace any existing copy that is in your libraries directory.

Three files have changes.

Adafruit_INA219.cpp
Adafruit_INA219.h
getcurrent.ino

The method "setCalibration_16V_160A(void)' was added and the getPower and getCurrent were renamed to remove the "milli" prefixes, as in mA and mW are now A and W.

What should I set if I am to use 100A - 75mv shunt?

Rolly:
What should I set if I am to use 100A - 75mv shunt?

It depends upon the bus voltage. Either 16V or 32V are your choices and at 75mv you’d use a PGA setting of 2 for 80mv full scale.

There is no need to replace the 0.1 ohm shunt on the board, just connect your shunt output to the input terminals of the breakout board.

Read the steps for selecting the setup values in Adafruit_INA219.cpp, it’s quite straight forward.

Fouad19764:
Please any one? I need help ti change setting on adafruit library from standard 0.1 ohm to 300a 75mv ,0.5 accuracy class shunt

The mazimum voltage will be used is 14v and maximum current is 80a

Thanks in advance

Why are you using a 300A shunt for 80A? Using a 100A shunt will give better accuracy.

WattsThat:
It depends upon the bus voltage. Either 16V or 32V are your choices and at 75mv you’d use a PGA setting of 2 for 80mv full scale.

There is no need to replace the 0.1 ohm shunt on the board, just connect your shunt output to the input terminals of the breakout board.

Read the steps for selecting the setup values in Adafruit_INA219.cpp, it’s quite straight forward.

Oh my. 16 V and 32 V. The bus voltage I am working on is around 100 volta max. I can't use INA219 anymore, can I?

Rolly:
Oh my. 16 V and 32 V. The bus voltage I am working on is around 100 volta max. I can't use INA219 anymore, can I?

What project are you working on use such a high voltage?dc or ac? are you using ext shunt? but you have too due to high Vbus, maybe you can try voltage divider apply before v+ & v-, (if you using ext shunt) monitor the Vshunt and play around with the coding to match with your output.

felani:
What project are you working on use such a high voltage?dc or ac? are you using ext shunt? but you have too due to high Vbus, maybe you can try voltage divider apply before v+ & v-, (if you using ext shunt) monitor the Vshunt and play around with the coding to match with your output.

I am monitoring a battery pack of an electric vehicle. It is actually 7 battery connected in series.

I tried working with LTC2946 but Analog Devices is not keen in helping me with the code that directly talks to the chip.

Have you seen this library? [GitHub - phishman/LTC2946: Linear Tech LTC2946 Arduino Library](https://github.com/phishman/LTC2946\)

WattsThat:
Have you seen this library? [GitHub - phishman/LTC2946: Linear Tech LTC2946 Arduino Library](https://github.com/phishman/LTC2946\)

Yes, it tks to the demo board. The demo board is pre-programmed to talk to the chip.

I need to sense a less than 0.1mA. How can I use INA219 to measure that? I have replaced the 0.1ohm resistor with 1ohm resistor. How do i calibrate the library for this? please reply.. huge help thanks