Help me with this op amp circuit please

Discussion in 'General Electronics Chat' started by ltkenbo, Nov 15, 2011.

Thread Status:
Not open for further replies.
  1. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    I am stuck, analog electronics are not my favorite (much better with digital) but I need a single supply op amp circuit to amplify a 110mV - 130mV input to 0 - 5 Volts (approximately). I can't seem to get a circuit that works with a steep gain in this range. I also manage to hit just outside it. The following circuit works great from like 125 mV to 220 mV region:
    [​IMG]


    But in the region I need, it is still in the zero (not really zero but pretty flat) region of the amplification right before it reaches the slope. I have been playing around with the resistances but it seems to get further away as I mess with it. This one is close, it just needs to be shifted "left" a little bit.

    I am reading this with a microcontroller using the 10 bit ADC, so it doesn't have to be strictly from 110 mV to 130 mV, but it must cover that region, and be decently precise. It also need not be precisely 0 - 5 volts, just near this (once it is able to amplify properly I will characterize an equation for it to be used in my software). Please help, I can't seem to figure it out. I'm using a TI-OPA2350 rail to rail IO dual op amp chip (using the other op amp for another part of my circuit).
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Try it like the attached.

    The LMC648x family is rail-to-rail input and output. The LMC6482 is a dual, the 84 is a quad. I just happened to have the LMC6484 model handy.

    U1b gets a ~110.5mV input from the voltage divider made up of R3, R4, U1 (the latter should have been labeled VR1).

    U1b is wired as a voltage follower. You can see in the upper plot on the right that there is a slight difference between "subin" and "sub", which is caused by the opamp input offset voltage. The input offset can vary, which is why there is a pot to adjust the voltage of the divider.

    This is the inverting (-) input of U1a; and your input signal goes to the noninverting (+) input. U1b's output is subtracted from your input signal. R1/R2 give U1a a gain of 250. Since U1b's output is subtracted from U1a's input, instead of 110mV to 130mV you effectively wind up with 0mV * 250 to 20mV * 250, the latter equals 5v.

    Now, the output won't go exactly to 0v, nor exactly to 5v. However, it will be within a few mV under light loads.

    Note that there should be a cap from "subin" to ground, and another across the power pins of the opamp; they were left out for clarity.
     
  3. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Man that's smooth, wish I could be that good with analog stuff, guess it just takes time and practice. Thanks a lot I'll try it out and let you know!

    One thing though, I've been using spice to simulate some of these single op-amp things I've been doing, I used DC step to get a graph and the graph doesn't match what I get with my real circuit. Now I know spice will simulate unrealistic things and doesn't account for imperfect components (offset, etc.), but I should see something close, but it is usually quite far off. Don't know why this is happening. I also initially tried to design these circuits following TI's "Op Amps for Everyone Guide" but found after following there process, the equation I constructed did not match the behavior of my op-amp circuit.

    It sucks cause in school they don't teach you how to design op-amp or analog circuits for that matter, just how to analyze them.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You're welcome. I've been at this a couple of weeks longer than you have. ;)

    Well, I'm not quite certain what you expected out of your circuit?

    I knew I need a fixed voltage reference to subtract from the 110mV - 130mV input, and then multiply the result by 250. I also needed to subtract the input offset, and the opamp I chose to use in the simulation didn't have separate inputs for input offset compensation - so I just added that in to the fixed voltage reference.

    The fixed voltage reference needed to be actively held at the reference voltage; a simple resistive voltage divider wouldn't work as you found out. The feedback from RF2 will introduce errors that a passive circuit won't be able to compensate for.

    Now, I "cheated" in my simulation, as 250k Ohms is not a standard value of resistance. However, 100k and 150k resistors could be used in series to get 250k. Everything else is more-or-less pretty reasonable.

    Don't expect the output to drive very much, or it won't swing near the rails. Sure, it's advertised as an RRIO opamp, but that's only to within 20mV of the rails with a 100k load. I have a 251k load on my output due to the feedback network.

    Everything you do in a SPICE simulation is an approximation. Lots of "shortcuts" are taken along the way, as trying to model ALL of the parameters of a device would not only be very labor-intensive, you would wind up with a very complex mathematical model that would take just about forever to run. You might as well just build the thing to begin with.

    The important thing to realize is that what I've given you is a starting place. I worked out the math, and then threw together a model in SPICE using components of reasonable values; and I left out anything that was not absolutely necessary for the simulation to run (like the supply cap and node "subin"'s cap.) An actual circuit should perform reasonably close to what is shown in the simulation - subject to tolerances of components, etc.

    Everything in a simulation is ideal, unless you provide for the parasitics.
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Your original idea is pretty good, just need to adjust the values:

    [​IMG]
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    (Sorry SgtWookie, we're cross posting here. I'm still slow today.)

    I should tell you how these values were computed, huh?

    The gain is easy. The change in input is just (130mV - 110mV), so you need a gain to change 20mV to 5V

    Gain = Vo/Vin = 5V / 20mV = 250

    A non-inverting amp has a gain of

    Av = ( RF2 / RG2 ) + 1 = 250

    249 = RF2 / RG2

    249 * RG2 = RF2

    So if we pick 1K for RG2 we get 249K for RF2.

    Your voltage divider idea is very good, I've done similar things and they work well. You need to get a divider of 5V in and .11V out.

    Actually getting off the shelf values for this can be tricky, so here's the trick: Standard resistor values are very close together around 1, 10, 100, etc. So we'll pick 100 ohms for R11. That is as large as we want that resistor as it's impedance does act in series with RG2; 10 ohms would be better but will draw more current from the 5V.

    OK, so given r11 is 100 ohms, what should R9 be?

    Vd = voltage at C8

    Vd = .110mV = 5V * R11 / (R11 + R9)

    Now comes the trick: solve that equation and find the nearest standard value for R9. Now enter the equation into something like Excel, and give it various values for R11 and R9. I found that with the values on the schematic I got a pretty exact divider ratio (0.01%).
     
  7. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Thanks guys for the quick replies. Unfortunately ErnieM, your circuit does not work for me because, as SgtWookie mentioned the feedback from Rf generates errors in the voltage at the inverting input. Instead of 110mV at that input there is about 131mV (in spice and in a real circuit) :(. The only solution for this circuit I can see would be to increase the Rf/Rg ratio until Rf shunts any current therefore not affecting the voltage at the inverting input. However, Rf and Rg would have to be about 100 times larger for this to happen, and then I suspect this might cause other issues.

    So I will build the first circuit SgtWookie posted now and test it.
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    ErnieM,
    That's OK; don't mind the cross-posting.
    However, as our OP has confirmed your mod won't work due to what I posted in repy #4:
    I DID neglect to add calibration instructions:
    1) Connect the noninverting input of U1a to a fixed source of 110mV (node "in").
    2) Adjust pot U1 (should be VR1) until you obtain an output of exactly 0v. If you cannot obtain 0v, then replace R3 with a 3.9k resistor, U1 with a 1k pot, and try again. If still no-go, ensure that R4 measures 100 Ohms.
    3) Once 0v output is obtained, connect node "in" to a fixed source of 130mV. You should measure ~5v on the output with no load; within about 20mV.

    Your output linearity on the high end will improve significantly if you can raise the Vcc to 6v or more.
    Your output linearity near 0v will improve significantly if you can use a negative rail of -1v or more.
     
    Last edited: Nov 16, 2011
  9. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Yeah I mentioned that problem too. If it is excessive you have two choices: change the impedance ration till it isn't significant (which has it's own problems if you either drop the divider or raise the amplifier).

    What I would really suggest is to just replace RG2 with a short circuit, then size R9 and R11 such that their parallel combination equals the value required for RG2. Poof away goes the interaction. One less op amp, and a more accurate voltage then when using the amp.

    That also introduces some subtleties keeping me from posting it as I don't know if the input is DC or AC or what other limiting conditions exist.
     
  10. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Input is a variable DC voltage, that varies in the millivolt range. Constructed the dual one, seems to work good, I've got a lot of noise unfortunately at my input so it seems to dance around a lot.
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, do you need a fast response time?

    If not, you could use a low-pass RC filter on the noninverting (+) input of U1a. Resistor in series, cap to ground.
     
  12. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Yeah the response time needs to be fairly quick, so I dunno I could always try.

    I am really having trouble getting this circuit to do what I want to do though. Ok so I adjusted the values of circuit to increase the input range (and also that way the offset would become negligible due to the increased range because as long as I can get a somewhat accurate 0-5V response from a millivolt input, it will be satisfactory. Also I increased this range because I found the input voltage tends to drift some). I made (part references referencing your spice circuit) R1 = 220k, R2 = 1k, R3 = 5k, & R4 = 100 with no potentiometer for the reason mentioned above.

    Well I found I could get 0-5V but it seemed very steep between about like 105mV-110mV (went from like 220mV to 4.98V there) and then if I went below 105mV it slowly tapered down towards 0, so I figured maybe yeah the offset is causing it to be shifted to far left. I checked "Ub1" output voltage (created by divider circuit and buffered) and it was at an expected somewhere around 98mV. I was generating this input voltage using the same resistor I am trying to measure in the rest of my circuit, but since this has a short range (from like 100mV to 125mV) I tried using a voltage divider and vary my input voltage, I found that the thing seems to go up and down and always be about .2 V from 0 and then all of sudden get really steep (as mentioned at the top of this paragraph) and the nstay there.

    So I made R1 = 100k to decrease the gain and therefore increase my range starting from around 98mV (all depending on offset of course) but now I don't even get close to 5 Volts (which is ok) except that there is like a "dip" in the gain. Here is small table I made in the region I am concerned with: (continued post)
     
    Last edited: Nov 17, 2011
  13. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    (See the attached file for the graph and table)

    See the big dip? And this doesn't seem that I am within the proper linear region of my line, because if you were to fit a line along the "linear" part of that graph you get a slope of about 1.7, not 100 like I am expecting.

    I don't understand what is wrong. Sorry for all the information, just figure the more I provide the easier it will be to help me solve this problem.
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Let's backtrack a bit.

    What is your input signal coming from?

    It sounds like it might be a strain gauge of some sort, that should be in a Wheatstone bridge configuration.

    If your signal is in fact coming from a Wheatstone bridge, the you really do need to use an instrumentation amplifier. Otherwise, you will have really lousy problems that you will have a very hard time solving.

    Also, need to see the entire circuit. The circuit I proposed depends upon the 5v supply being ROCK solid - not varying so much as a millivolt. If it does change, it'll throw your output way off. So, if it's changing, we will need to do something different with the reference; like start off with a precision voltage reference instead of a simple voltage divider.
     
  15. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Well I can't post the entire circuit as it is a potential design for work (sorry if this this is counter helpful), but I will answer any questions about it for you. I am measuring voltage from a JFET in series with a 49.9 ohm resistor. First I measure the voltage across the JFET and resistor in series (which varies like by 300 mV over 0-5V at the gate) with respect to ground, but the resistor only varies by like 20mV over the 0-5V input at the gate. I am able to amplify the total voltage (JFET and resistor wrt ground) accurately, using a similar configuration to my original post (just with different R values) but I am having trouble measuring the resistor voltage wrt ground (the resistor is grounded on one side and connects to the JFET on the other). Basically I am using a microcontroller to read the outputs of the op amps (the two amplified voltages) and then in software I am "deamplifying them" based on there characteristic equations and then use a reverse voltage divider formula to solve for the "resistance" of the JFET. The JFET is acting as a voltage controlled resistor, but since in the mode I am operating it, the gate voltage vs. it's "resistance" is non linear so I need to actively measure its "resistance" and use control methods to get the setpoint I am looking for.

    The output from the op-amps (the amplified voltages at the transistor) will change as I vary the gate voltage at the transistor (using the microcontroller), but while the gate voltage is constant, they shouldn't varry (other than effects from noise). Again sorry I can't post the whole circuit, if you can't help me with what I've given you then it's ok I understand if you need a full schematic.

    And the 5V supply is steady but I don't know about rock solid. I figured it was ok because my reference is that same 5 Volt source.
     
    Last edited: Nov 17, 2011
  16. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Found some instrumentation amplifiers that were floating around here at my work, so I'm going to try those.
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Are those Analog Devices instrumentation amps as well?

    Have a read through Intersil's AN1298; it's a really good intro to instrumentation amplifiers, and why you should not try to "roll your own" from discrete opamps and resistors:
    http://www.intersil.com/data/an/an1298.pdf
     
  18. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    Yes how did you know? lol

    Yes I think that has been a good lesson. Oh quick question, with these instrumentation amplifiers to get the "line" exactly where I want it (not the gain but the offset or shifting to the right, I know the gain is set with a single resistor) I should still use a voltage divider at the non inverting input right?
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No. The instrumentation amplifier will reject whatever is common to both inputs, and amplify what is different.

    If you are in a noise-rich environment, you may need to go to using shielded twisted-pair conductors, with an actively driven shield. You can look in the datasheets for Texas Instruments' INA118 or INA128 on the bottom of page 11; it shows an instrumentation amplifier used for an EKG, with an actively-driven shield and active return for the subject.
     
  20. ltkenbo

    Thread Starter Active Member

    Sep 11, 2008
    30
    0
    So how do I get a 0-5 Volt from my 90mV to 130mV input (expanded it from what I originally told you as mentioned in previous posts) if all I can do is control the gain (slope)?

    It doesn't have to be exactly that, but just close so I can get at least like 300-400 points of resolution between those voltages. Is that what I use the ref terminal for?
     
Loading...
Thread Status:
Not open for further replies.