ADC and Op amp definition - Page 1
Forum section: electronics / beginners

author: werewolf_here
author_rank: Newbie
timestamp: March 24, 2015, 01:12:15 pm
content: Hi all.I am trying to build a ampere meter that ranges from -30A to 30A. The resolution is 50 mA. I am willing to do it with a 12 bit ADC, a shunt resistor and op amps.In the datasheet of the ADC, says that I can get +- 1.5 bits INL. So, here comes question number 1: Must I consider only 11 bits of the conversion to get a good linearity read?I intend to use a shunt resistor of 60mV/40A (1,5 mOHms) as a source tension to the op amp, and then, after the gain and offset, send the signal to the uC. So, my second question is: Must I use a precision op amp to do this job? I was thinking in use the LM358. Is it enough ?Thank you all in advanced.

author: katzohki
author_rank: Frequent Contributor
timestamp: March 24, 2015, 02:32:18 pm
content: I have a feeling that differential amplifier would be good here, but I can't explain why. I need to have some coffee lol.If I'm reading your math right, you're expecting a drop of 0-60mV across your shunt resistor and then you will use the amplifier to gain it up to an appropriate level for the ADC (e.g. 0-5V). For your 12 bit ADC at a level of 60mV you're going to want to a resolution of 15 microvolts or better on your opamp. So that means you need to have a good input offset voltage better than that. Or maybe I'm barking up the wrong tree here.Edit: And then there's gain bandwidth product.

author: macboy
author_rank: Super Contributor
timestamp: March 24, 2015, 03:32:30 pm
content: Quote from: werewolf_here on March 24, 2015, 01:12:15 pmYou do not need to throw away bits unless the DNL is greater than 1 bit. Even then, the spec will be for maximum DNL error, not typical, and at a reasonable temperature and other conditions, you might expect much better performance than the maximum worst case spec. FYI, the DNL is "differential non-linearity" and tells you the maximum error when going from one step to another (ideally each step is 1/(2^N) of full scale). The INL is "inherent non-linearity" and is the maximum error at any point in the scale, usually occurring around mid-range. If you graphed the input voltage vs. code, you would see a bow or curve instead of a perfectly straight line. Higher INL gives greater bow, higher DNL gives the appearance of "noise" or jumps in this curve (but has nothing to do with the noise performance of the ADC) since each step is not the same size.It is OK to have some offset in you op-amp, but the offset should be constant so that you can calibrate it out. If the offset changes over temperature, voltage, or other conditions, then you will get drift and error in your readings. Using a precision op-amp instead of a general purpose one is usually a good idea when making DC measurements like this.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 24, 2015, 03:47:55 pm
content: Quote from: katzohki on March 24, 2015, 02:32:18 pmYes, and furthermore, if this is a differential amplifier configuration, you need resistors matched at least as well -- 0.01% or better, most likely! Those aren't cheap.GBP doesn't matter for DC level, of course, but one would presume you want to measure at least some modest frequency, so that matters. Going from 60mV to 5V is almost 100x, so for a 1MHz bandwidth, you need 100MHz GBP (assuming a dominant pole voltage type opamp, that is).If you need high bandwidth and low offset (without having to calibrate it), it can be worthwhile to use two or three gain stages: the first uses a modest bandwidth, very low offset amp; the second is working with mV rather than uV so it doesn't have to be very precise, and you can choose a higher GBP type, to provide the majority of the gain without breaking the bank.You didn't mention if the shunt resistor is to be ground-referenced or floating, which is the biggest limitation to this measurement.Worth noting, if the measurement is entirely AC, a current transformer is probably a damn sight easier and more precise to use, than a shunt and amplifier. They're available from line frequency to MHz bandwidths, so you can pick pretty much whatever you need.As for linearity, it depends what you're doing. INL means INL -- if you are looking at large swings in the signal, it will manifest as a nonlinear gain error. If you are looking at small changes in the signal, DNL is the figure you'll be more interested in; generally, ADCs are monotonic, so that as the input rises smoothly, the output changes a step at a time, the height of that step not always being equal, but as long as it's close enough, you can make some very nice measurements from those small changes.The most basic calibration is a slope-offset type, which can also be done in analog with trimpots, or digitally, the same way. The next step up from that depends on how you want to attack it, and what the nature of the error is; a Taylor series approximation would use an n-order polynomial, so the next correction is x^2 (quadratic), and so on. Or you could use Chebyschev polynomials (which are still polynomials, but they produce a different curve fit, which is often handy), or trigonometry (sin/cos correction tables, and polynomials working from them).For basic errors of an ADC, you're probably far, far better served by just buying a better one and plugging it in. 16 bit SPI ADCs are cheap enough, and stand-alone parts are ALWAYS quieter and more precise than on-board types.The numerical approaches can be very handy for inputs that are inherently nonlinear, though. Measuring resistance using a voltage divider. Measuring temperature using a thermistor (NTC or PTC).Tim

author: werewolf_here
author_rank: Newbie
timestamp: March 24, 2015, 05:46:46 pm
content: Thank you all for the reply. Already got some good hints that you gave me!Let me be the most specific that I can. I am attaching a photo of this part of the circuit (sorry ... I made it on paint brush. hehehehe).I am expecting a drop of -45mV to 45mV on the shunt resistor (-30A to 30A). And as you pointed perfectly, I intend to use the amplifier to gain it up to an appropriate level for the ADC.Here, I use a ADC with an input range from zero to Vref (3v3 in my case). So, I have not only gain the level up, but I have to offset it as well. In my thinking, I have to offset to half of Vref (Fix the op amp output on 1.65V when there is no current across the shunt), hence the Ra and Rb on the non inverting input. In that manner, I can get the signal to run within 0.15V to 3.15V (making the op amp gain = 33).Since I am trying to get a 50mA resolution, the drop on the shunt for that current will be 75uV. So, I wonder if the LM358 can handle such low level input voltage without jeopardizing the signal (noise stuff).I am looking to measure DC voltages (DC current), so, bandwith is not one of my concerns.Well ... thanks again ! Looking forward hearing from you.

author: katzohki
author_rank: Frequent Contributor
timestamp: March 24, 2015, 06:41:15 pm
content: Using adifferentialsetup you can measure the current and take advantage of the full range of the opamp instead of offsetting it.I guess the short answer to your repeated question is, in my opinion, yes you need something better than an LM358. We're trying to help you figure this out on your own, so I'll give you some relevant information to consider.LM358 input offset voltage = typical 2mVLM358 input noise = 40nV/?HzLow level output voltage = 2mV typicalTempco of input offset voltage = 7uV/°CInput voltage range = 0 to Vcc-1.5V