INA219 shunt resistor change to 0.01 ohm

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
olleman
Normal user
Posts: 53
Joined: 27 Aug 2017, 08:10

Re: INA219 shunt resistor change to 0.01 ohm

#11 Post by olleman » 25 Jun 2018, 19:44

Hello!

I have just receieved a 75mV, 50A external shunt and I'm also using 2 INA219 connected to the same wemos mini d1.

Can I use this above code along with the latest beta to get this working? I know that it wasn't long ago that a bug was fixed that lets you use more than one INA219 on the same ESP.

Also, can I use the exact same code as above since my shunt is also 75mV or do I need to make some calibrating since mine i for 50A?

,Olle

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: INA219 shunt resistor change to 0.01 ohm

#12 Post by TD-er » 26 Jun 2018, 13:25

To set the proper range for the shunt, see page 5 of the datasheet: http://www.ti.com/lit/ds/symlink/ina219.pdf

You may have to convert the measured value and don't forget to remove the present shunt if there is one.

olleman
Normal user
Posts: 53
Joined: 27 Aug 2017, 08:10

Re: INA219 shunt resistor change to 0.01 ohm

#13 Post by olleman » 26 Jun 2018, 19:20

Hi!

Thankyou for your answer!

Present resistor is removed but I'm clearly on deep water here since the only thing I find on page 5 that would be the formula on top of the page. I'm afraid I don't really understand what I need to do to get the right figure.

Also I'm really not sure what I need to alter in the plugin code. currentDivider seems important as well as calValue but again I'm really out of my league here. If it's not to much trouble would somebody care to help me a bit further? What I'm trying to measure is a 12V system with normal currents of 5-15 A but with possible peaks at 30-40 A. This is with a 50A/75mV shunt.

olleman
Normal user
Posts: 53
Joined: 27 Aug 2017, 08:10

Re: INA219 shunt resistor change to 0.01 ohm

#14 Post by olleman » 26 Jun 2018, 23:20

OK! I'm making some progress. Did manage to flash one of the older builds of ESPEasy MEGA and replaced the INA plugin code with the one in this thread and it's actually working :) Even though, the current reported is off by a factor of 2-ish. So any help I could get in configuring the plugin for my setup would be greatly appreciated :)

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: INA219 shunt resistor change to 0.01 ohm

#15 Post by TD-er » 26 Jun 2018, 23:35

There are two options to approach this:

1)
You have to know the value of the original resistor and compare it with the new shunt.
50A/75 mV means the shunt resistance is R = U/I => R = 0.075/50 = 0.0015 Ohm.
Lets for example assume the original resistor was 0.01 Ohm and the max current was 3A.
This means the max voltage is then U=I*R => U = 0.01 * 3 = 0.03 V = 30 mV.
Then the voltage range is probably set at 30mV, which gives you a range of I = U/R => I = 0.03A / 0.0015Ohm = 20 A.
So you could add two of these shunts in parallel to be able to process 40A with a range of 0...30 mV

Ofcourse you also have to adjust the output reading then. The output should then be multiplied by ( 0.01 / 0.0015) = 6.67.

2) Make sure you set the range of the INA219 to cover the range 0 ... 75 mV, which is described on the datasheet.
This means you have to change the source, build a new version and also compute a correct factor to output the measured current as described above.


So 1) can be done with minimal effort and knowledge.

And maybe we should add some settings to allow to change the shunt and enter some output factor.

olleman
Normal user
Posts: 53
Joined: 27 Aug 2017, 08:10

Re: INA219 shunt resistor change to 0.01 ohm

#16 Post by olleman » 27 Jun 2018, 07:04

Thanks Td-er, I really value your input!

This thread describes a changed plugin that was made for 30A and 2.5 mohms. So using the same formula: 30*0.0025=0.075. The shunt in the changed plugin is also 75mV.

So after some trial and error and input from this page I got this numbers which gave me pretty accurate results.
https://stackoverflow.com/questions/397 ... alibration

MAX power (don't expect much above 25A) 25
Resistor 0,0015

LSB MIN 0,000763
LSB MAX 0,006104

Choosen LSB: 0,001

cal value= (0,04096/0,001) / 0,0015 = 27 306

Current divider= 1000 / 1000 = 1mA

Next step is to try these values in a newer version of the plugin where Td-er have made the necessary changes to use several INA219 on the same setup.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 137 guests