Connect with us

magnifying ADC resolution

Discussion in 'Electronic Basics' started by Fritz Oppliger, Apr 19, 2004.

Scroll to continue with content
  1. Yo-
    I am measuring a 0...5 VDC over the full range of an ADC. I would like to
    magnify a sub-range of the same signal for another channel of the same
    ADC. So that I could have the sub-range say from 4VDC to 4.25 VDC scaled
    to the full bit resolution width of the ADC.
    I understand this is done with an OpAmp. I will have to set it up to
    amplify the signal by the correct amount.
    Its output voltage will be zero until the bottom threshold voltage of the
    desired range is reached, and pegs max at the top and beyond...
    How does one shift the new signal such that it refers to the same analog
    ground, as I am using the same ADC chip?

    Does anyone have pointers to ADC interfacing design techniques for
    beginners?

    Thanks in advance...
     
  2. CFoley1064

    CFoley1064 Guest

    Subject: magnifying ADC resolution
    Yo, Fritz. (You wouldn't be from Philidelphia, perchance?) The op amp
    configuration you're looking for is called a "difference amplifier". You can
    google it, or go to www.national.com and look up AN-31 on their website for
    details on basic op amp configurations. I'm assuming you're working with a
    single +5V supply here. If so, you'll need a "rail-to-rail" op amp to do this
    job. Without knowing more about your circumstances, I can't recommend an op
    amp for you, but your basic circuit should look like this (view in fixed font
    or M$ Notepad):

    Difference Amplifier Vout = (Rf/Ri)*(VIN-4V)
    Rf
    ___
    .---|___|----.
    | |
    | VCC |
    Ri | + |
    +4V ___ | |\| |
    o---|___|---o---|-\ | Vout
    ___ | >-----o----o
    o---|___|---o---|+/
    Vin | |/|
    Ri | |
    .-. ===
    Rf| | GND
    | |
    '-'
    |
    ===
    GND

    created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

    All you need to do is figure out values for Rf and Ri (which should be matched
    as closely as possible). If you're trying to get a range of 5V out of 0.25V,
    your gain should be 5/0.25 = 16. That will give you Ri = 10K, and Rf = 160K.

    Good luck
    Chris
     
  3. John Fields

    John Fields Guest

    ---
    Two things:

    1. 5/.25 = 20 :)

    2. The +4V reference needs to be stiff enough so that it doesn't
    change when the voltage on the inverting input follows the
    voltage change on the non-inverting input.

    With Vin = 4.0V that'll be:

    Vin*Rf/Ri+Rf = 4V*200k/10k+200k = 3.8095V

    which is a current _out of_ the reference of

    I = E/R = (4.0V-3.8095V)/10k ~ 19.1µA.

    Then, with Vin = 4.25V, it'll be:

    Vin*Rf/Ri+Rf = 4.25V*200k/10k+200k = 4.0476V

    which is a current _into_ the reference of

    I = E/R = (4.0476-4.0)/10k ~ 4.8µA
     
  4. Don

    Don Guest

    Fritz, I was in a similar situation, but measuring 10-15volts using a
    0-5V ADC. There are a few options:

    1. use two resistors in series to form a resistor divider
    2. use an op-amp to scale the voltage
    3. use a zener diode to "subtract the voltage"

    I chose using a zener. It was easier and gave a bit more accuracy.
    If you want to do this, get a 4v zener diode and a 5k resistor and put
    them in series and attach to your 5V load. Then connect your ADC
    across the resistor. This will "subtract" 4v from your 5v load, and
    give you a range from 0-1 volt.

    My circuit is at http://www.cameronsoftware.com/ev/BMSV0.0.2.html


    Don
     
  5. CFoley1064

    CFoley1064 Guest

    Subject: Re: magnifying ADC resolution
    Oops -- senior moment. Thanks. That would make Ri = 10K, and Rf = 200K.

    <snip>
    2. The +4V reference needs to be stiff enough so that it doesn't change when
    the voltage on the inverting input follows the voltage change on the
    non-inverting input.
    <snip>

    One good way to get a stiff voltage reference would be to use a dual
    rail-to-rail op amp, and use the first as a voltage follower to buffer the
    supply voltage divider. Otherwise, you could use a precision bandgap reference
    IC, and use the first op amp to amplify/buffer that.

    Thanks for the spot, Mr. Fields. I appreciate it. Have a good day.

    Chris
     
  6. John Larkin

    John Larkin Guest

    The other thing that works is to average a lot of measurements to
    improve resolution. For this to work well, the ADC has to be
    reasonably linear, you have to have an LSB or two of fairly random
    noise present, and you have to tolerate the lower effective sample
    rate. You can get 16 bit data from an 8-bit ADC if you're patient
    enough!

    Try this: float the ADC sample as variable S

    Now do

    F = F + (S-F) / N every sample

    F is the smoothed (filtered) result

    N is the smoothing factor; try 16 maybe.

    John
     
  7. Gentlemen,

    Thanks one and all for your suggestions and insights.

    The task is moving from A:
    (a plain 8051 working a 4051 MUX to feed a CS5501 /AD7701 16bit serial ADC)
    to B:
    (Analog Devices ADuC832 with built in 8 channel 12bit ADC)

    The important thing to be accurate about is the output of an AD592 temp
    sensor which will give 1 microAmp per kelvin from input voltages +4 to
    +30volts.
    I am striving for better than 0.05 F precision especially around 99F. I
    would have magnified a window around there, making up for the loss of 4
    bits by OpAmping around it. Seems to me though that given
    - the fact that I am much better versed in programming than in analog
    electronix
    - the considerable speed improvements in the new setup (putative at
    present)
    ... I will DO IT IN SOFTWARE!
    (as first option)

    Thanks again!
    Fritz Oppliger
    in rainy northern California
     
  8. Thank you for mentioning this; I just went through my current code and
    changed from averaging arrays to this smoothing thingy - much less
    horsepower required!
    I'm still grappling with the odd requirement that there should be noise. -
    I am sure there are subtle differences between averaging and various
    smoothing strategies... I will try to find out about this.
    THanks again.
     
  9. John Larkin

    John Larkin Guest

    You can also do a 2nd order version of this... better noise rejection
    and faster settling at the same time. I have some 68K assembly code
    around here somewhere...
    Well, without noise you might wind up averaging the same ADC code for
    an extended interval, and then the data would be quantized to that
    step. 12-bit and up systems generally have enough noise by themselves,
    without having to add any. Since most ADCs have imperfect differential
    linearity (uneven step sizes) several LSBs of noise is nice to
    essentially smooth out the cruddy transfer function curve.

    John
     
  10. It's called an "exponential moving average".

    It averages an indefinite series of numbers, with each multiplied by a
    weighting factor, that decrease according to an exponential relationship.

    It's a quite sophisticated technique, and if the appropriate smoothing
    factor is chosen, it can be very simple to calculate, as well.
     
  11. John Larkin

    John Larkin Guest

    Right. Using integer math, and with N a power of 2, the divide is just
    a shift, and this can reduce to a few lines of machine code.

    This is just a discrete model of a simple R-C lowpass filter.

    John
     
  12. If you're doing it paper-and-pencil, use N = 10.

    (Financial types used to do this with stock prices, and feel wonderfully
    sophisticated.)
     
  13. In the presence of impulse noise that produces outliers, I have added
    a nonlinear trick to this method. I make three measurements and use
    only the middle value to run through such a smoothing filter.
    Discards unusually high and low samples.

    Not much code overhead, but three times the A/D conversions.
     
  14. Bob Masta

    Bob Masta Guest

    I have some articles with explanations you may find helpful:
    "Synchronous Waveform Averaging - Magic Bullet for Noise"
    at <www.daqarta.com/tm01.htm>, and especially
    "Dither - Making a Lemon Into Lemonade" at
    <www.daqarta.com/tm05.htm>

    Hope these help!



    Bob Masta
    dqatechATdaqartaDOTcom

    D A Q A R T A
    Data AcQuisition And Real-Time Analysis
    www.daqarta.com
     
  15. John Larkin

    John Larkin Guest

    If the intent is to expand ADC resolution, I'd be concerned that
    tossing samples would introduce a nonlinearity, when what we're trying
    to do is improve linearity to well below the quantization steps of the
    ADC itself. We sometime need to *add* noise to pull off this trick, so
    why throw it away?

    Hmmm... the middle value of a sample triplet is the median, not the
    mean. So the average of the three is statistically a better
    representation of the voltage than just the middle sample. If impulse
    noise is AC coupled into the system, which it usually is, tossing
    impulses actually introduces an opposite bias into the remaining
    samples. I think.

    John
     
  16. The idea is to keep only the samples that represent gaussian noise
    that average out ot the true value, and discard those contaminated by
    large spikes that include foreign information about something else
    that just happened to coincide with the sample interval.
    This is true only if the noise is gaussian. If the noise has other
    forms, discarding the outliers can give a more accurate average.
    Typically, two of the three samples are valid and differ by only a
    count (so either is a fair addition to the average process. The
    impulse contaminated sample is usually way off. No amount of
    averaging will eliminate this bias if some percentage of samples are
    so contaminated.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-