INA219 Shunt Resistor

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jschof78
 
Posts: 4
Joined: Mon Apr 30, 2012 4:23 pm

INA219 Shunt Resistor

Post by jschof78 »

Hi,
The INA219 Shunt resistor can be replaced with a 0.01 ohm resistor to change the max current to 32A

" Advanced hackers can remove the 0.1 ohm current sense resistor and replace it with their own to change the range (say a 0.01 ohm to measure up 32 Amps with a resolution of 8mA"

My question is, If i where to Omit that resistor completely. could I then use an external resistor Via screw down terminals?
I.e. 100A Shunt? or 500A shunt?
I have tried connecting my 100A shunt with the resistor in place and I get odd results.

Thanks in advance for an advice

Jason

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: INA219 Shunt Resistor

Post by adafruit_support_bill »

You have to remove the resistor if you want to connect an external shunt. Otherwise they would be in parallel and the resistance would be RT = 1 / ((1 / R1) + (1 / R2))

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: INA219 Shunt Resistor

Post by john444 »

Hi Jschof,
jschof78 wrote:I have tried connecting my 100A shunt with the resistor in place and I get odd results.
Odd how?

I have been using the Adafruit digital panels meters on my solar installation
with 100-A / 100-mV shunts without problems.
I plan to use the same shunts with some recently ordered the INA219s.

Be aware, most 'instrument' and 'meter' shunts are intended to produce
50-mV at their max current rating.
What that means is, if you use 50-mV shunts, you will need to use some
Ohm's Law to work out how much current is flowing at a given voltage drop.

Good Luck, John

User avatar
jschof78
 
Posts: 4
Joined: Mon Apr 30, 2012 4:23 pm

Re: INA219 Shunt Resistor

Post by jschof78 »

The reading i was getting was just out to lunch.

Code: Select all

shuntvoltage = ina219.getShuntVoltage_mV();
busvoltage = ina219.getBusVoltage_V();
current_mA = ina219.getCurrent_mA();
loadvoltage = busvoltage + (shuntvoltage / 1000);
the Shunt that I have is a Deltec 100A/100mV, 0.001Ohm
having 1A going through the shut will produce 1mV accross the resistor. I was getting readings of 89.6mV on the shunt voltage and a current reading of 4245mA, how ever I was not using the above math witch now make complete sense as I was using a voltage divider previously to get voltage readings via Arduino ADC, before buying the INA219.

My application is similar, I will be using the 100A shunt to mesure current and voltage comming from the solar pannels, and a 500A/50mV shunt for measuring the load to the inverters

Thanks for the replies.

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: INA219 Shunt Resistor

Post by john444 »

jschof78 wrote:My application is similar, I will be using the 100A shunt to mesure current and voltage comming from the solar pannels, and a 500A/50mV shunt for measuring the load to the inverters
That does sound familiar. Although, your setup sounds larger that mine.
I am using two 24-V banks of 300-Ahr cells to drive a self-built 4,800-W inverter.
Also, I only have a 180-W solar-panel. Takes a long.... time to charge fully.
But, it is only used for emergency / temporary power.

Glad you found the issue.
Joh

User avatar
jschof78
 
Posts: 4
Joined: Mon Apr 30, 2012 4:23 pm

Re: INA219 Shunt Resistor

Post by jschof78 »

My setup is quite small, only 3-20Watt 12V pannels, and 2 300Watt inverters. 2-100Ah Batteries
Im a bit of a beginner when it comes to electronics. I know Ohm's law and some other basic's.
Microcontrollers have allways been a facination and over the last few months I have learned alot from reading the posts on here and other sites. The goal of this project is for information, Datalogging. How much is being generated and how much is being used.
Eventually i would like to grow the project. I certinly dont have the knowledge to build more complex devices right now.

I have included images of my eagle file, I would like an opinion on it. most of this has been breadboarded, 5v power, UNOR3, 1-INA219. etc.
and it works. I havent taken the shunt resistor off yet to try it. but this is how I want to look like/operate.

any sugestions would be great, there will be some mistakes on here as some thing where complete "Guesses" I think my use of Diodes is wrong, I think I have them in the wrong places. as im not using them on the breadboard yet. I also don't have anything made for the reset button yet on the eagle file.

Thanks again for your reply's

Jason
Attachments
Power Supply
Power Supply
Power.png (9.71 KiB) Viewed 8056 times
Input Section
Input Section
Input.png (9.01 KiB) Viewed 8056 times
Eagle File
Eagle File
image.png (10.02 KiB) Viewed 8056 times

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: INA219 Shunt Resistor

Post by john444 »

jschof78 wrote:I think my use of Diodes is wrong
What are you trying to do with the diodes?
The diodes on the output will reduce the voltage supplied by ~¾-V.
jschof78 wrote:I certinly dont have the knowledge to build more complex devices right now.
I don't know. Sounds like you are moving right along.
jschof78 wrote: I havent taken the shunt resistor off yet to try it
I am considering leaving the 'on-board' shunt resistor in place and
compensating for the resulting 1% error in software.
jschof78 wrote:I have included images of my eagle file, I would like an opinion on it.
The input section looks good to me.
But, I am just learning about micros also.

John

User avatar
jschof78
 
Posts: 4
Joined: Mon Apr 30, 2012 4:23 pm

Re: INA219 Shunt Resistor

Post by jschof78 »

I have been having problems with voltage at ground. if I remove the +5v line from my lcd it stays on, now yes. there is 5v from the data lines. but also if i remove the ground from it the same thing happends, it stays on. Also just reverse polarity protection. as far as i understand Diodes are one ways valves, I didnt consider the voltage drop.

I also took off the .1ohm resister today, and I'm still getting odd results. some of there results I'm sure is the calibration since now the resistor has changed and the extra resistance in the leads going to the shunt. the primary problem now is mainly inconsistant results.
the shunt is showing 4.6mA accross it, but at the screw down terminals im showing 8.4mA. The lcd screen shows a shunt voltage of anwhere between 4.62mA to 12.69mA changing with every screen update. I thought at first noise from my inverter so I filtered the input as per Datasheet, but it really didn't change anything.


Confused!

User avatar
john444
 
Posts: 443
Joined: Sun Mar 04, 2012 2:42 pm

Re: INA219 Shunt Resistor

Post by john444 »

jschof78 wrote:I also took off the .1ohm resister today, and I'm still getting odd results.
Instability in your readings is occurring with or without the 0.1-ohm resistor.
That means that neither the 0.1-ohm or 0.001-ohm shunt is the problem.
Also, if you parallel the 0.1-ohm with a 0.001-ohm shunt, then 99% of the current is going through the 0.001-ohm while 1% goes through the 0.1-ohm.
Yes, you need good connections between the shunts, but it should be stable.
jschof78 wrote:The lcd screen shows a shunt voltage of anwhere between 4.62mA to 12.69mA changing with every screen update.
I presume that you mean the calculated current through the shunt,
based on the shunt's voltage drop, varies between 4.62-mA to 12.69-mA.
Those do not seem to be reasonable numbers from a 1-milliohm shunt.
12-mA would cause a voltage drop of 12-microVolts. That can not be right.
At maximum gain the INA219 has a resolution of 80-microVolts.
It simply cannot measure that small a voltage.
I am misunderstanding you somehow.

Setting the shunt issue aside for a moment.
Your schematic implies that you have separate, isolated power connections,
The solar-shunt and the load-shunt.
One possible problem is that they are connected together through the batteries.
If you do not have a 'common' ground, then all kinds of strange,
voltage fluctuations can occur between the various 'grounds'.
jschof78 wrote: if I remove the +5v line from my lcd it stays on,
This is a symptom that you do not have all the grounds connected together.
jschof78 wrote:Also just reverse polarity protection. as far as i understand Diodes are one ways valves
It depends on the type of diode but, all diodes have some voltage drop.
You cannot afford that voltage drop on your 5-V & 3.3-V supply outputs.
Once you have the two supplies connected correctly, the input diodes are not needed.
Insufficient voltage to the Mega and/or the INA219 can cause erratic readings.

Start by removing the diodes in the 5 & 3.3-V supplies. If it is still not working,
Then you might approach this by disconnecting things until it starts behaving.
Begin in the middle. Disconnect the 'Load-Shunt' and everything else associated with it.
This way you can isolate the problem. Get to some point that the parts
do what they are supposed to do, even if it means going all the way back
to the first INA219.

Good Luck, John

User avatar
Hansipete
 
Posts: 40
Joined: Tue Aug 12, 2014 10:39 am

Re: INA219 Shunt Resistor

Post by Hansipete »

Hi,

I'm also struggeling getting the INA219 to measure up to 10A at a max of 13V, 14V (Car battery).

Am I right that I have to tell script the following variables:
  • calibration value (INA need this to make the right measurements internally)
  • current divider (SCRIPT need this to output the right value)
  • power divider (same here)
Hope you can verify this. To me, It's a bit blurry what I can configure and what are my variables in the setup...

Bye bye,
Ha s

User avatar
PlayersZ28
 
Posts: 1
Joined: Fri Nov 27, 2015 2:52 pm

Re: INA219 Shunt Resistor

Post by PlayersZ28 »

I know this is an old thread but it's the only pertinent one.

I'm using the INA219 breakout with a 500A/50mv shunt. Using the calc's I've come up with 40960 as my calibration register value. It's a 16-bit register so 65535 is the max for it.

Using a 12v battery and a fog light for a load to test my ammeter shows 4.00A, fluctuating by maybe +/- .02A. The number reported by the INA219 is 1.5A and fluctuates quite a bit. The shunt voltage varies between 0.14mV & 0.19mV and I'm using the 40mV gain setting.

Nothing special about my test setup. The original 0.1ohm resistor is still on the board but in parallel to the 0.0001 ohm shunt it only changes the total shunt resistance by a tiny amount and that shouldn't account for the fluctuations.

EDIT: Cal reg max is 32767 for sign allowance. I set it to 32767 right now to see if I can get steady shunt voltages.
EDIT2: After running for a few minutes the shunt voltage has a min of .31mV and a max of .36mV, the load draw stays flat @ 3.98A. The leads from shunt to breakout are about 4" long.

Thanks for any help anyone can provide.

Steve

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”