Author Topic: Shunt current sense monitor with INA216  (Read 4078 times)

0 Members and 1 Guest are viewing this topic.

Offline Ludo3.14Topic starter

  • Newbie
  • Posts: 5
  • Country: us
Shunt current sense monitor with INA216
« on: July 21, 2016, 08:22:27 pm »
Dear all,

I'm very new to electronic circuits experiments and I'm trying to measure a current over a load using a shunt resistor.
In particular my components are:
- Voltage Output Current Shunt Monitor INA216 (http://www.ti.com/product/ina216) with related Evaluation board (http://www.ti.com/tool/INA216EVM)
- an Arduino to generate a 3.3V voltage;
- a Volteq voltage generator;
- a multimeter to read the output voltage of the board.

Now, to get familiar with the board, I read the user guide (http://www.ti.com/lit/ug/sbou086/sbou086.pdf) and I'm trying to create a configuration without shunt (image enclosed)with the INA216A1 (with 25 gain coefficient).

My Vcm is 3.3V given by Arduino and the Vdiff is 3.2V generated with the Volteq. If I'm not wrong, with a 25x coefficient, I should be reading 2.5V in the Vout.

In Vin+ I put the Arduino 3.3V supply and the black (-) electrode of the voltage generator.
In Vin- I put the red (+) electrode of the voltage generator.

I carefully followed the instructions but it seems like the only thing I can read in Vout is a difference between the two voltage I'm applying. I tried several combinations (trying different GND) but the amplifier seems not to cooperate.
Am I missing something? Is there a threshold I'm going above so it doesn't work?

Thank you all.
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #1 on: July 21, 2016, 08:38:02 pm »
My Vcm is 3.3V given by Arduino and the Vdiff is 3.2V generated with the Volteq. If I'm not wrong, with a 25x coefficient, I should be reading 2.5V in the Vout.

In Vin+ I put the Arduino 3.3V supply and the black (-) electrode of the voltage generator.
In Vin- I put the red (+) electrode of the voltage generator.

That doesn't sound right at all.  Why do you think you should be reading 2.5V?  If Vdiff is 3.2V, and the gain is 25x, the output would be 80V.  Of course the INA216 can't output 80V so you'd just get the rail.  Also, the INA216 can only read positive differential signals, so why are you applying negative 3.2V?  You also didn't mention where the ground from your Arduino 3.3V supply is going, I'm assuming the board ground?

You should be applying the Arduino ground to the board ground and the Arduino 3.3V to Vin+.  Now as for the voltage generator, if you set it to 0.1V you can attach the negative to Vin- and the positive to Vin+.  If instead you set it to 3.2V, you need to attach the negative to the board ground and the positive to Vin-, so that Vin- is at 3.2V and Vin+ is at 3.3V, so the INA216 is amplifying the 0.1V difference.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #2 on: July 21, 2016, 08:48:23 pm »
An LED will take 20 mA, more or less.  We want the .02A LED current to create a 0.1V drop between Vin+ and Vin- so a 5 ohm shunt resistor seems about right.  Assuming 2V drop across the LED and assuming 3.3V at Vin+, we need a 100 ohm resistor between Vin- and the anode of the LED.  The cathode goes to common ground.

This 0.1V drop, times 25, should give you about 2.5V at Vout.  But that's making some assumptions about how close the amplifier can get to the 3.3V Vin+ rail.

Working backwards, with 3.3V on the Vin+ terminal, you can't have more than 3.3/25 volts dropped across the shunt - 0.132V and that assumes the amplifier can work to the rails.  I would keep the drop in the 0.05-0.1V range.  Shunts aren't suppose to drop a lot of voltage because that leaves less for the load.
 

Offline Ludo3.14Topic starter

  • Newbie
  • Posts: 5
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #3 on: July 21, 2016, 11:46:22 pm »
My Vcm is 3.3V given by Arduino and the Vdiff is 3.2V generated with the Volteq. If I'm not wrong, with a 25x coefficient, I should be reading 2.5V in the Vout.

In Vin+ I put the Arduino 3.3V supply and the black (-) electrode of the voltage generator.
In Vin- I put the red (+) electrode of the voltage generator.

That doesn't sound right at all.  Why do you think you should be reading 2.5V?  If Vdiff is 3.2V, and the gain is 25x, the output would be 80V.  Of course the INA216 can't output 80V so you'd just get the rail.  Also, the INA216 can only read positive differential signals, so why are you applying negative 3.2V?  You also didn't mention where the ground from your Arduino 3.3V supply is going, I'm assuming the board ground?

You should be applying the Arduino ground to the board ground and the Arduino 3.3V to Vin+.  Now as for the voltage generator, if you set it to 0.1V you can attach the negative to Vin- and the positive to Vin+.  If instead you set it to 3.2V, you need to attach the negative to the board ground and the positive to Vin-, so that Vin- is at 3.2V and Vin+ is at 3.3V, so the INA216 is amplifying the 0.1V difference.

I tried the two configuration you suggested and in the first case I get 3.31V in output (which is the Arduino voltage) and in the second case I got 1.67V (which I couldn't relate to anything).

I attach a picture of the first configuration but I can't really grasp why it's not amplifying.

An LED will take 20 mA, more or less.  We want the .02A LED current to create a 0.1V drop between Vin+ and Vin- so a 5 ohm shunt resistor seems about right.  Assuming 2V drop across the LED and assuming 3.3V at Vin+, we need a 100 ohm resistor between Vin- and the anode of the LED.  The cathode goes to common ground.

This 0.1V drop, times 25, should give you about 2.5V at Vout.  But that's making some assumptions about how close the amplifier can get to the 3.3V Vin+ rail.

Working backwards, with 3.3V on the Vin+ terminal, you can't have more than 3.3/25 volts dropped across the shunt - 0.132V and that assumes the amplifier can work to the rails.  I would keep the drop in the 0.05-0.1V range.  Shunts aren't suppose to drop a lot of voltage because that leaves less for the load.

I haven't tried to use a shunt resistor yet, I was more into trying the amplifying effect, but I'll surely use this case as soon as I understand what's going on.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #4 on: July 22, 2016, 12:11:16 am »
I haven't tried to use a shunt resistor yet, I was more into trying the amplifying effect, but I'll surely use this case as soon as I understand what's going on.

As long as your external voltage simulating the drop across the shunt doesn't exceed about 0.1V, you should be good.  0.1 * 25 is about 2.5V and that's about as far as you can go with the 3.3V supply.  If your PS will do it, set it down to 0.05V.  That way the x25 scale should give you 1.25V

The + lead of the external supply goes to Vin+ and the - lead goes to Vin-.

You really should have any more than 0.1V between Vin+ and Vin-
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Shunt current sense monitor with INA216
« Reply #5 on: July 22, 2016, 01:40:35 pm »
In Vin+ I put the Arduino 3.3V supply and the black (-) electrode of the voltage generator.
In Vin- I put the red (+) electrode of the voltage generator.


The Vins (or the electrodes) are the wrong way around. suicidaleggroll has it right.

How are you measuring the 0.1V, a PSU displaying "0.1V" doesn't mean much.

You'd be better of with 2 resistors in series across the 3.3V, 100R and 3K3 would give you about 0.1V, which you could measure exactly across the 100R, multiply it by 25, which should be the Vout of the INA216A1.
The 100R has to be at the 3.3V end to keep the INA216A1's inputs above 1.8V.
.  That took much longer than I thought it would.
 

Offline Ludo3.14Topic starter

  • Newbie
  • Posts: 5
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #6 on: July 24, 2016, 11:25:17 pm »
I haven't tried to use a shunt resistor yet, I was more into trying the amplifying effect, but I'll surely use this case as soon as I understand what's going on.

As long as your external voltage simulating the drop across the shunt doesn't exceed about 0.1V, you should be good.  0.1 * 25 is about 2.5V and that's about as far as you can go with the 3.3V supply.  If your PS will do it, set it down to 0.05V.  That way the x25 scale should give you 1.25V

The + lead of the external supply goes to Vin+ and the - lead goes to Vin-.

You really should have any more than 0.1V between Vin+ and Vin-


Is exactly as you said. I can't fully control the range of voltage between 0 and 0.1 V but I see that while I turn the handle of the voltage supply in that range, the Vout actually gives me a value between 0 and 3.3V. As soon as I reach 0.1V it saturates so I guess that's the maximum it can handle.

I also tried with the Arduino classic 5V in Vin and it has the same behavior. While playing with the handle, I also empirically noted that the Vout jumps from 1.2V to 3V around a certain value.

I still can't explain why, even if the expected Vout should be 2.5V, it saturates to 3.3V of the Vin+.

In Vin+ I put the Arduino 3.3V supply and the black (-) electrode of the voltage generator.
In Vin- I put the red (+) electrode of the voltage generator.


The Vins (or the electrodes) are the wrong way around. suicidaleggroll has it right.

How are you measuring the 0.1V, a PSU displaying "0.1V" doesn't mean much.

You'd be better of with 2 resistors in series across the 3.3V, 100R and 3K3 would give you about 0.1V, which you could measure exactly across the 100R, multiply it by 25, which should be the Vout of the INA216A1.
The 100R has to be at the 3.3V end to keep the INA216A1's inputs above 1.8V.

Unfortunately the Volteq is used to supply higher voltage, so I can't precisely control the values between 0 and 0.1V. 

The resistors you're talking about should be used as a shunt? Would you mind drawing a sketch of the circuit? I can't fully grasp it.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Shunt current sense monitor with INA216
« Reply #7 on: July 24, 2016, 11:38:00 pm »
You'll have to measure directly across the 100R to find it's exact voltage ~100mV, then multiply this exact reading by 25 etc.
.  That took much longer than I thought it would.
 

Offline Ludo3.14Topic starter

  • Newbie
  • Posts: 5
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #8 on: July 25, 2016, 05:49:40 pm »
You'll have to measure directly across the 100R to find it's exact voltage ~100mV, then multiply this exact reading by 25 etc.

This worked! Thank you StillTrying and everyone!

If I want to use a more powerful version of the amplifier (50x) should I replace the 3.3V of the Arduino with the 5V and the 3K3 with a 5K resistor.
Is this reasoning correct?
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #9 on: July 25, 2016, 06:11:00 pm »
If I want to use a more powerful version of the amplifier (50x) should I replace the 3.3V of the Arduino with the 5V and the 3K3 with a 5K resistor.
Is this reasoning correct?

No, you would just drop the 100R resistor to 50R to cut Vdiff in half.

Switching to a 5V source with a 5K resistor would just leave you with the same 0.1 Vdiff that you have now, it wouldn't do anything to help with staying in range on a higher gain amp.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Shunt current sense monitor with INA216
« Reply #10 on: July 25, 2016, 06:25:53 pm »
You would pick a higher gain if you designed in a smaller shunt resistor.  You would use a smaller shunt resistor (for a given current) if you couldn't afford the voltage drop of a high value resistor.

Eventually, you need to get down to Ohm's Law and start from the beginning.  In your application, what are the voltage and current requirements of the LOAD?  From the voltage requirements, you figure out how much voltage budget you have to lose across a shunt.  Given this allowable voltage drop (and it should be 0.100V or less), you pick the shunt resistor based on the load current.  At full load current, you drop full shunt voltage (<= 0.100V).

It's pretty clear that these high value resistors you are using won't even allow an LED to glow.  They are great for getting something to work but they probably won't work for a real application.

 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Shunt current sense monitor with INA216
« Reply #11 on: July 26, 2016, 01:15:38 am »
This worked!

Marvelous, you should have given us the exact 100mV and 2.5V values so we could see how accurate its X25 was. And then used a very low resistance of about 2R2 to check that its X25 is still accurate at the very low end of its output range at about 50mV.
You shouldn't need the X50 version unless you're planning to measure quite high currents - over 2.5Amps.
I'm looking at INA219.pdf at the moment - looks very complicated!
.  That took much longer than I thought it would.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf