Current Shunt  - Page 1
Forum section: electronics / beginners

author: yashrk
author_rank: Frequent Contributor
timestamp: April 07, 2014, 09:46:20 pm
content: 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.Thank You.

author: mariush
author_rank: Super Contributor
timestamp: April 07, 2014, 10:49:34 pm
content: 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..5vnote: some chips have 1.1v reference, others have 2.56v or something like that.

author: pa2ees
author_rank: Contributor
timestamp: April 08, 2014, 12:56:10 am
content: 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).

author: David Hess
author_rank: Super Contributor
timestamp: April 08, 2014, 07:15:47 am
content: 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.

author: yashrk
author_rank: Frequent Contributor
timestamp: April 08, 2014, 07:24:28 am
content: 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 ?

author: FrankBuss
author_rank: Unknown
timestamp: April 08, 2014, 08:01:59 am
content: 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.

author: David Hess
author_rank: Super Contributor
timestamp: April 08, 2014, 08:15:24 am
content: Quote from: yashrk on April 08, 2014, 07:24:28 amThe 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.QuoteI did this 20+ years ago when I was in high school as part of a solar powered battery charger.

author: Rudane
author_rank: Regular Contributor
timestamp: April 08, 2014, 06:26:49 pm
content: 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.

author: tszaboo
author_rank: Super Contributor
timestamp: April 10, 2014, 09:10:02 am
content: 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/

author: yashrk
author_rank: Frequent Contributor
timestamp: April 10, 2014, 06:55:36 pm
content: @FrankBuss @David Hess Thanks for the reply guys@Rudane Thanks for the appreciation Rudane, 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.

author: yashrk
author_rank: Frequent Contributor
timestamp: April 28, 2014, 06:15:48 pm
content: hey guys I tried it using op07 but still its not workingWhat ever gain I set (by changing R1) the opamp gives me 2.29v(see pic below)can you share any working diff amp circuit so I refer it?

author: tszaboo
author_rank: Super Contributor
timestamp: April 28, 2014, 06:24:22 pm
content: 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.

author: yashrk
author_rank: Frequent Contributor
timestamp: April 28, 2014, 06:28:26 pm
content: can you suggest any opamp ? @NANDBlog

author: lewis
author_rank: Frequent Contributor
timestamp: April 28, 2014, 07:08:43 pm
content: 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.

author: yashrk
author_rank: Frequent Contributor
timestamp: April 28, 2014, 07:30:21 pm
content: Is there any problem the way I am hooking them in the circuit ?and which one is the formula for it1) Vout = (R2/R1) (V2 - V1)OR2) Gain = (R2/R1) + 1

author: lewis
author_rank: Frequent Contributor
timestamp: April 28, 2014, 07:35:15 pm
content: Think about which way round the inverting and non-inverting inputs need to be.Also:

author: Rick Law
author_rank: Super Contributor
timestamp: April 28, 2014, 08:23:12 pm
content: Quote from: yashrk on April 07, 2014, 09:46:20 pmI have done a project using anATMEGA328 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 a0.1ohm shuntso I am not dealing with too small a voltage so as tolessen the impact of noise.2. You must not rely on USB powersince 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 theADC 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 accuracyhttps://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/#msg316233Good luck, you should find it a fund thing to do.Rick

author: yashrk
author_rank: Frequent Contributor
timestamp: April 29, 2014, 12:29:39 pm
content: @Rick Thanx Rik it will help a lot

author: miceuz
author_rank: Frequent Contributor
timestamp: April 29, 2014, 01:12:17 pm
content: 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.

author: David Hess
author_rank: Super Contributor
timestamp: April 29, 2014, 01:38:33 pm
content: Quote from: miceuz on April 29, 2014, 01:12:17 pmThis 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.

author: tszaboo
author_rank: Super Contributor
timestamp: April 29, 2014, 02:53:00 pm
content: Quote from: yashrk on April 28, 2014, 06:28:26 pmI already suggested that you should not use an opamp but a specialty amplifier. The AD8205 looks just like something I would use for it.

author: yashrk
author_rank: Frequent Contributor
timestamp: April 29, 2014, 03:12:48 pm
content: @NANDBlog thank you for your input and can I know about your upcoming blog ?

author: zapta
author_rank: Super Contributor
timestamp: May 02, 2014, 12:02:14 am
content: 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 onehttp://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 onehttp://datasheets.maximintegrated.com/en/ds/MAX4172.pdf(it convert the high side shunt voltage to ground relative amplified voltage).

author: tszaboo
author_rank: Super Contributor
timestamp: May 02, 2014, 10:04:38 am
content: Quote from: zapta on May 02, 2014, 12:02:14 amBoth 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?

author: yashrk
author_rank: Frequent Contributor
timestamp: May 02, 2014, 10:16:02 am
content: @NANDBlog true but not too fussy about thatThanx @zapta

author: zapta
author_rank: Super Contributor
timestamp: May 02, 2014, 12:54:28 pm
content: Quote from: NANDBlog on May 02, 2014, 10:04:38 amYes,I meant ltc2943 (there are also many others). High side has the advantage in some applications because you can share ground but is more difficult to implement unless if you use one of these ICs.Sent from my Nexus 5 using Tapatalk