Author Topic: Current Shunt  (Read 15916 times)

0 Members and 1 Guest are viewing this topic.

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Current Shunt
« on: April 07, 2014, 09:46:20 pm »
I want to measure 0-3A current for my power supply (which will be monitored by diff op-amp and will be giving output to arduino ADC)so I took 0.01ohm resistor then

@3A (max current) there will be voltage drop of 30mV which should be 5V (1024 - max output of ADC) (for arduino which has 10 bit ADC)

So I will need a gain of 167 from the op-amp.   (gain = 5V / 30mV = 166.66)

Are my calculations right? Is this the way to calculate the gain ?  :-//

If yes then can I use LM741 which has max gain of 200 ?

Voltage will be within 0 - 15V.

Please reply soon guys need to make few circuit based on constant current.  :phew:
Thank You.
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5140
  • Country: ro
  • .
Re: Current Shunt
« Reply #1 on: April 07, 2014, 10:49:34 pm »
Why don't you actually TRY it on a breadboard and see what happens?

My suggestion would actually be to not rely on your 5v INPUT voltage as "reference" because your linear regulator that powers the arduino may not be quite 5v or may drift as it heats up.

You have an internal voltage reference inside the chip .. use it : http://tronixstuff.com/2013/12/12/arduino-tutorials-chapter-22-aref-pin/

if you use the 1.1v internal voltage reference, then you could use an opamp to multiply that 30mV to 900mV (30 times) and you'll be able to measure the current with a better precision .. you have 0..1023  for 0..1.1v  instead of 0..5v

note: some chips have 1.1v reference, others have 2.56v or something like that.



 

Offline pa2ees

  • Contributor
  • Posts: 39
  • Country: us
Re: Current Shunt
« Reply #2 on: April 08, 2014, 12:56:10 am »
I'm actually working on a similar project.  I chose to go with a current sense op amp.  They make them with extremely low offset voltage chopper amps in them, with laser trimmed resistors, specifically for measuring current using a very low resistance current sense resistor.  Their gains go from 50 to around 1000, depending on your needs.  They're going to be much better than rolling your own using resistors and amps. 

search digikey or mouser for current sens, and look in the op amps section.  You'll find some.  You can even get some from ST or other places if you have a non-free e-mail address (ie not gmail or msn or yahoo).
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17193
  • Country: us
  • DavidH
Re: Current Shunt
« Reply #3 on: April 08, 2014, 07:15:47 am »
I would use a better operational amplifier.  The gain of the 741 is not a problem but the offset voltage drift will be.  The offset could be an issue as well but I assume you would trim or calibrate it out.

At 15 microvolts per degree the output could change 2.5 millivolts per degree at a gain of 166 which will be 1/2 LSB and that is the best grade of 741.  It could be worse than that especially if the offset voltage is trimmed.

I built a similar circuit long ago and ended up replacing the 741 with a 308 which made all of the difference.  Today the appropriate operational amplifier would be something like an OP-07 or OP-90 if you need single supply operation.  My personal favorite for this sort of thing is the LT1097 but the OP-07 is less expensive.
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #4 on: April 08, 2014, 07:24:28 am »
I made this circuit based on 0.01ohm and 0-5v logic but it didn't worked can you spot any mistake in it ?

thanx for reply @mariush @pa2ees @David Hess

@pa2ees I will end up using those if this doesn't work do you recommend any in DIP package ?

@mariush thanx for the tutorial buddy can you have a look on my schematic and tell me whats wrong in that?

@David Hess can I have a look on your design ?
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2368
  • Country: de
    • Frank Buss
Re: Current Shunt
« Reply #5 on: April 08, 2014, 08:01:59 am »
I can't find it in the datasheet of the LM741, but I think the inverting and non-inverting inputs can't go near the supply rails Vdd and GND. Maybe a more modern "rail-to-rail" OpAmp would work, instead of the historic LM741, but even rail-to-rail means it can go down only to some millivolt above GND and below Vdd. You could try to build a symmetric power supply, with +5V, -some V and GND. Your Arduino can create a PWM signal, then use this idea to create the negative voltage:


Symmetric power supplies makes playing with OpAmps much easier.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17193
  • Country: us
  • DavidH
Re: Current Shunt
« Reply #6 on: April 08, 2014, 08:15:24 am »
I made this circuit based on 0.01ohm and 0-5v logic but it didn't worked can you spot any mistake in it ?

The input common mode range of the 741 does not extend to ground.  The output does not extend to ground either and 5 volts is really too low for a 741.  For this to work you will need to use a single supply operational amplifier like a LM324 or LM358.  An LT1006 or OP-90 would be good.

Further you have the inverting and non-inverting pins swapped.  The output has to feed back to the inverting input.

Quote
@David Hess can I have a look on your design ?

I did this 20+ years ago when I was in high school as part of a solar powered battery charger.
 

Offline Rudane

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
    • Electrical Engineering 101
Re: Current Shunt
« Reply #7 on: April 08, 2014, 06:26:49 pm »
Congratulations, this is something I don't see often but I fully encourage. You are approaching this the correct way; that is, NEVER hook up anything until you know what you expect it to do. You've even simulated it first. Bravo. You may have trouble using a regular op-amps, since they typically have poorer offset voltages than instrumentation amplifiers.
Voltage appears across and current flows through.
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7948
  • Country: nl
  • Current job: ATEX product design
Re: Current Shunt
« Reply #8 on: April 10, 2014, 09:10:02 am »
The LM741 is totally inappropriate for the application. Your opamp could have 6mV input offset, if you amplify it 166 times, there goes your signal. You cannot expect a 20 year old general purpose amplifier to work in a precision application. Not to mention, resistor tolerances will do bad things with your CMRR, and gain. use the proper parts for the job.

this explains why:
http://nandblog.com/current-shunt-monitors/

this helps you select:
http://nandblog.com/types-current-sense-amplifiers/


 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #9 on: April 10, 2014, 06:55:36 pm »
@FrankBuss @David Hess Thanks for the reply guys  :-+

@Rudane Thanks for the appreciation Rudane  ;D , I learn this due to guys like you share your knowledge and experience.

@NANDBlog Thanks for the link, seriously cool blog, interesting and very helpful content.  :clap:
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #10 on: April 28, 2014, 06:15:48 pm »
hey guys I tried it using op07 but still its not working

What ever gain I set (by changing R1) the opamp gives me 2.29v  :bullshit: (see pic below)

can you share any working diff amp circuit so I refer it?


Find me and things I'm working on - https://www.yashkudale.com/
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7948
  • Country: nl
  • Current job: ATEX product design
Re: Current Shunt
« Reply #11 on: April 28, 2014, 06:24:22 pm »
The OP07 is not a rail to rail opamp. It will never output 0V, not even close to it. Opamps are not ideal, measuring low side shunts is far from being trivial application.
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #12 on: April 28, 2014, 06:28:26 pm »
can you suggest any opamp ? @NANDBlog
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline lewis

  • Frequent Contributor
  • **
  • Posts: 704
  • Country: gb
  • Nullius in verba
Re: Current Shunt
« Reply #13 on: April 28, 2014, 07:08:43 pm »
I've used LM2904 and MCP6L01 very successfully in commercial designs for low side current sensing.

Also, you don't necessarily need to make a proper diff-amp. Here's a snippet from one of my schematics:

R61 is the current sense resistor, pin 5 of the op-amp is the supply. It's just a simple non-inverting amplifier - no diff-amp necessary because the bottom of the current sense resistor is ground referenced anyway.

« Last Edit: April 28, 2014, 07:14:21 pm by lewis »
I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #14 on: April 28, 2014, 07:30:21 pm »
Is there any problem the way I am hooking them in the circuit ?

and  which one is the formula for it

1) Vout = (R2/R1) (V2 - V1)

OR

2) Gain = (R2/R1) + 1
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline lewis

  • Frequent Contributor
  • **
  • Posts: 704
  • Country: gb
  • Nullius in verba
Re: Current Shunt
« Reply #15 on: April 28, 2014, 07:35:15 pm »
Think about which way round the inverting and non-inverting inputs need to be.

Also:

I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.
 

Offline Rick Law

  • Super Contributor
  • ***
  • Posts: 3486
  • Country: us
Re: Current Shunt
« Reply #16 on: April 28, 2014, 08:23:12 pm »
I want to measure 0-3A current for my power supply (which will be monitored by diff op-amp and will be giving output to arduino ADC)so I took 0.01ohm resistor then

@3A (max current) there will be voltage drop of 30mV which should be 5V (1024 - max output of ADC) (for arduino which has 10 bit ADC)

So I will need a gain of 167 from the op-amp.   (gain = 5V / 30mV = 166.66)

Are my calculations right? Is this the way to calculate the gain ?  :-//

If yes then can I use LM741 which has max gain of 200 ?

Voltage will be within 0 - 15V.

Please reply soon guys need to make few circuit based on constant current.  :phew:
Thank You.

I have done a project using an ATMEGA328 volt/current logger (see link below), and I have some do's and don'ts suggestion:

1. The top-half of your ADC is going to be your more accurate half.  The top quartile (ADC reading >=1023/4) will be near or better than 0.5% accuracy, and the bottom quartile will be heading toward 5% error and approach infinity as you move lower.

So - you want accuracy, spread the reading in ranges rather than measuring 0-3A with one setup.  My project does  +- 0.2V +2.5V +-5V +15V and +30V (approx) so I can get to the best range.  (see link below)  I use a 0.1ohm shunt so I am not dealing with too small a voltage so as to lessen the impact of noise.

2.  You must not rely on USB power since they vary too much from machine to machine.  In fact – I made sure my FT232 board’s V5 is NOT connected to my “DinoMeter” board. (That's what I called my project)  The swing between different USB ports just kills your accuracy.

3.  Good compensation will do more than good OpAmp.  I use tables of compensation factors to deal with linearity and accuracy.  In practical term, my strategy is to use the ADC reading as index into a table of pre-measured voltage, and interpolated within for finer results.  So, linearity is of no concern and actual “opamp multiplier” is of no concern making life a lot easier.

3a. For best results, make sure each ADC has it own set of tables; and for each multiplier setting for that ADC, it has its own table.  With my learning project, I have 5 multiplier settings and 4 channels (ADC) = 20 tables, so I had to do some trade-offs.   I have 1:1 (1 compensation factor for each ADC reading each ADC) until 250 and 1:5 from 251 to 1023 (1 reading for 5 ADC count and interpolate within) with 16 bit per entry.  I also build a volt-sweeper so I can collect compensation data automatically.
 
I achieved +-2% easily when ADC>30 and I use a lowly 2902 Quard OpAmp.  I merely use the worst case figures.  In fact, with my setup most ADC readings achieve better that 1% and in the 0.5% range, but I use the worst case to be conservative.

4.  If you do view the video of my learning project...  My big mistake was to lazy out and not use bipolar power supply.  It would have given me better results for negative.  I learned a lot from doing that project.


A close up look at ADC accuracy
https://www.eevblog.com/forum/microcontrollers/atmega328-adc-accuracy-graph/

An Implmentation of ATMega328 volt logger (a learning project)
https://www.eevblog.com/forum/microcontrollers/an-implementation-of-atmega328-volt-logger-the-dinometer-a-learning-project/msg316233/#msg316233

Good luck, you should find it a fund thing to do.

Rick
« Last Edit: April 28, 2014, 08:26:47 pm by Rick Law »
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #17 on: April 29, 2014, 12:29:39 pm »
@Rick Thanx Rik it will help a lot  :-+
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Current Shunt
« Reply #18 on: April 29, 2014, 01:12:17 pm »
I've done experiments similar to this. Use LM358 as it's jellybean and its output can go nearly to ground, note, it will *not* to to 0V for 0A current unless you add a negative supply for the opamp, but probably that will be ok for the experiment, you'll learn about opamp non-idealiness.

Use noninverting opamp configuration to amplify the shunt voltage.

All the earlier comments still apply, but I'm more targeting what you can do without waiting for specific parts to arrive.

Generating negative voltage for opamp and getting rid of 0A error could be a nice learning challenge as the next step after you get the basic amplification working.

Note that LM358 output will not go higher than ~3.5V with 5V power supply, but you probably won't bump into it if you'll use internal 1.1V or 2.56V reference.

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17193
  • Country: us
  • DavidH
Re: Current Shunt
« Reply #19 on: April 29, 2014, 01:38:33 pm »
Generating negative voltage for opamp and getting rid of 0A error could be a nice learning challenge as the next step after you get the basic amplification working.

This can be done with an optocoupler like a cheap 4N25 and a resistor.  Just use the optocoupler output transistor as a photodiode to pull a constant current from the operation amplifier output to below ground.

The real trick is to do the same thing with just a transistor like a 2N3904 and a resistor . . .

There are improved versions of the LM358 like the LM1013 which can drive its output closer to ground.
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7948
  • Country: nl
  • Current job: ATEX product design
Re: Current Shunt
« Reply #20 on: April 29, 2014, 02:53:00 pm »
can you suggest any opamp ? @NANDBlog
I already suggested that you should not use an opamp but a specialty amplifier. The AD8205 looks just like something I would use for it.
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #21 on: April 29, 2014, 03:12:48 pm »
@NANDBlog thank you for your input and can I know about your upcoming blog ?
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6289
  • Country: 00
Re: Current Shunt
« Reply #22 on: May 02, 2014, 12:02:14 am »
OP, instead of messing with op amps (electronics, yak!), you can get a chip that will do the sensing and a/d for you so you can read it with the MCU's I2C interface. For example something like this one http://www.adafruit.com/products/904  (there are several other chips that do the same, e.g. LTC1943).

If you want to go analog, you can get high side current sense like this one http://datasheets.maximintegrated.com/en/ds/MAX4172.pdf  (it convert the high side shunt voltage to ground relative amplified voltage).
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7948
  • Country: nl
  • Current job: ATEX product design
Re: Current Shunt
« Reply #23 on: May 02, 2014, 10:04:38 am »
OP, instead of messing with op amps (electronics, yak!), you can get a chip that will do the sensing and a/d for you so you can read it with the MCU's I2C interface. For example something like this one http://www.adafruit.com/products/904  (there are several other chips that do the same, e.g. LTC1943).

If you want to go analog, you can get high side current sense like this one http://datasheets.maximintegrated.com/en/ds/MAX4172.pdf  (it convert the high side shunt voltage to ground relative amplified voltage).
Both current sense monitors you proposed use high-side sensing, while yashrk wanted low side sensing, well at least according the SCH he posted. I'm not sure about the LTC1943, typo maybe?
 

Offline yashrkTopic starter

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Current Shunt
« Reply #24 on: May 02, 2014, 10:16:02 am »
@NANDBlog true but not too fussy about that

Thanx @zapta
Find me and things I'm working on - https://www.yashkudale.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf