Reduce input voltage into a simple differential opamp circuit

Discussion in 'Analog & Mixed-Signal Design' started by Travm, Jul 5, 2017.

  1. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    I could... I'm trying to do this with minimum components, and minimum cost. Op amp is actually built into the MCU.
    If I cant figure out the math I will just build it and measure... But that isn't right... The mock-up works well enough and I can calibrate in software, but I want to have a better starting point.
     
  2. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    schematicLabel.jpg
    My radio antennae also appear to have fallen over, I hope you can deal.
    Resistors R5 and R6 exist to drop the voltage at the opamp inputs below 5v. Yes Yes my voltage divider values are wrong, but if we can look past that for now. Just imagine whatever voltage those dividers drop the voltage to, is my target. I can calculate a proper voltage divider (I promise).
    I have a spreadsheet that I use for this exactly, it helps me pick component values by being able to shift around unknowns and plug in numbers to try. I understand how this basic 1 op amp, 4 resistors thing works. But what I need to do is get the voltage at the inputs below 5v. I do not have an issue with configuring the op amp gain, at least until I muck it up by trying to reduce the input voltage.
    The op amp tutorial you linked has been a huge help, however after reading it 2-3 times I still wasn't able to sort out what adding R5 and R6 was doing to my circuit.
     
  3. crutschow

    Expert

    Mar 14, 2008
    22,518
    6,598
    Here's a modification that may work better.
    It's basically an attenuator for both inputs, followed by a differential amp.
    R2 and R4 may seem redundant, but they provide common-mode rejection so that a change in V1 will not have a significant effect on the output voltage.
    Basically the resistors R5 through R8 attenuate the signal and DC level, and the differential amp then amplifies the difference by a gain of 100.

    Note that this circuit is sensitive to common-mode offset caused by resistor tolerance.
    For best performance, they should all be 0.1% resistors.

    upload_2017-7-6_18-22-23.png
     
    Last edited: Jul 6, 2017
    Travm likes this.
  4. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    This is exactly where I was going to go provided I couldn't figure out how my original situation was working out. it just seems that this should be doable with 2 fewer resistors (in fact it is, I did it, and it worked), however the numbers are ever so slightly skewed in simulation. My measurement tools at present are not accurate enough to find a problem ($9 multimeter).
     
  5. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,936
    2,240
    Where I was headed was to first do a basic diff amp ignoring the fact that the opamp needs a 20 V rail, just to get the gain and resistor values correct. The convert the input series resistors to Thevenin equivalents that divide the common mode voltage down to something within the 5 V opamp's range. Then adjust the gain to make up for the attenuation of the diff signal. Messy, but basic steps.

    The *right* way is with an instrumentation amp, something that can attenuate the common mode signal independently of the diff mode signal gain. Analog Devices and Burr Brown have integrated parts that do this, a 15 V opamp with a 100 V common mode range (or something like that). As mentioned above, the basic math of a basic diff amp will not handle both the common mode attenuation and the differential mode gain.

    ak
     
  6. crutschow

    Expert

    Mar 14, 2008
    22,518
    6,598
    Depends upon how you define "worked". o_O
    You can generate a circuit with fewer resistors but it will not have common-mode rejection, so the output will vary with the 15V voltage value.
    Is that okay with you?
    Trying varying the 15V in your circuit and you will see what I mean.
     
    Last edited: Jul 7, 2017
  7. Bordodynov

    Well-Known Member

    May 20, 2015
    2,289
    702
    See
    Draft503_.png
     
  8. crutschow

    Expert

    Mar 14, 2008
    22,518
    6,598
    See what happens when you vary Vcc.
     
  9. Bordodynov

    Well-Known Member

    May 20, 2015
    2,289
    702
    All right!
    Draft503__.png
     
  10. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    I see, this would be completely hidden to me as the physical circuit does actually vary the voltage, but that also reduces the current consumption of the load, so I expect the opamp to adjust its value.
     
  11. Bordodynov

    Well-Known Member

    May 20, 2015
    2,289
    702
    Yes, everything is bad. I made the calculation for the variance of the resistor values 0.1% and 1% for the power supply.
    Look
    Draft503_1.png
     
  12. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    That would be awesome if you want to work through that with me.

    Using an instrumentation opamp being the "right way", is almost like saying buying a car is the correct way to bike into town. I understand they are better, I may end up using one, I want to try to avoid it and exhaust all reasonable options.

    So I will pick some reasonable values for Rsense, and load current, then calculate the opamp resistor values. If we just use my diagram and consider R5 and R6 to be dissapeared, that will be a "standard" differential opamp circuit.
    so if my load is 2A and Rsense is 0.05, so considering Vin will be 15volts, and I want Vout as close to 4 without going over;
    Voltage drop across Rsense will be 0.015v, if R1 and R2 are 2k, then R3 should be about 50k (well pick 50k), which should give us an ideal opamp output of 3.75v.

    Now i want to get voltage at the inputs down below 5v, while retaining the 0.015v relative drop.

    is this what you meant?

    Travm
     
  13. crutschow

    Expert

    Mar 14, 2008
    22,518
    6,598
    No, you don't see.
    I'm taking about an offset error when the voltage changes that will induce an error in the measured current (even if the current also changes with voltage).
    You seem not to understand the concept of common-mode error. o_O

    I showed what I thought needed to be done in post #23, but if you want to go through a bunch of gyrations to eliminate a few resistors and still likely have an inferior performing circuit, have at it.
    AK, it is all yours. :rolleyes:
     
  14. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,936
    2,240
    Can't happen in a single opamp stage. Attenuating the common mode voltage by 75% attenuates the differential mode signal by the same amount; it's what resistive dividers do. That's why Wally's circuit has an opamp gain of 100.

    I realize he threw in the LM358 because it is convenient, but on a 5 V rail its input common mode range does not go up to the necessary 4.3 V. Since you don't need any bandwidth, I recommend a CMOS opamp with "true rail-to-rail" inputs. either that or attenuate the signals more to get the common mode voltage below 3.5 V, and increase the forward gain to compensate.

    ak
     
  15. crutschow

    Expert

    Mar 14, 2008
    22,518
    6,598
    He stated this in post #21 so that may not be an option.
    Don't know what its common-mode range is.
    He originally said 4V but I'm not sure what he based that on.
     
  16. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    This is why I posted my complete opamp schematic off the bat. its totally ok to attenuate the differential signal, provided the math makes sense and I know thats whats happening. If i know I'm going to be attenuating the signal by 75% i can start from a value +75%.
    I just want the math to make sense. I'm driving a proportional hydraulic valve here in an open loop system, not putting a man in space.
    The opamp in question is built into a PIC16F1708. I can change all this if i wan't.
     
  17. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    Sorry for the double reply...

    My inexperience is showing...

    The differential signal does not have to stay precisely at 0.015. It just has to be calculable with math, based on what is going on. If the resistive dividers are changing the differential signal that is fine, as long as it can be calculated with math i know how to do ( a tall order, i know). Temperature compensation can be done in software (or ignored), I just need a reliable system to feed a coil a reasonably consistent amount of current, at maximum cheap, and maximum accuracy. in that order.
     
  18. Travm

    Thread Starter Member

    Aug 16, 2016
    256
    22
    Mega thanks for that in Post 23, I wasn't trying to be a jerk saying i already thought of that. I'm asking the question because i don't understand why adding two more resistors to that would make a difference, there are already resistors there... cant we just adjust the values and make it work?
    Common mode error would be;
    A) V1 = 15v , v2 = 14.9v Vout = 3.215
    B)V1 = 3v, v2 = 2.9v Vout = 2.979
    That is what i understand common mode error to be? yes? Totally made up the numbers.
     
  19. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,936
    2,240
    In #23, R7/R5 and R6/R8 are simple 2-resistor voltage dividers. They attenuate everything, and have an output impedance of 1.36K each.
    https://en.wikipedia.org/wiki/Thévenin's_theorem
    This is the source impedance of the diff amp signal, and should be added to the diff amp's series resistors. From there, the standard diff amp equation gives the gain.

    Note that with 1% tolerance resistors there will be some bleed-through of the common mode voltage to the output signal, and amplitude errors in the differential mode signal. You can calculate this by running the attenuation and gain calculations with various resistors at 101% or 99% of their listed values to see how they affect the output signal. This is the other reason to purchase an fully integrated and laser-trimmed instrumentation amplifier - precision. Whether a single opamp differential amplifier, or a two or three opamp instrumentation amplifier, getting better than 6-bit precision with off the shelf parts is very difficult, and 7 bits is almost impossible. The circuit will drive a 12-bit A/D just fine, but the bottom 5 or 6 bits are garbage.

    That's it. I'm out.

    ak
     
    Last edited: Jul 7, 2017
  20. crutschow

    Expert

    Mar 14, 2008
    22,518
    6,598
    Both AK and myself have tried to explain as best we can, why it won't work properly with fewer resistors but you seem to be tone deaf to that, so I don't think I can be of any further help.
    Unless you can find someone else to help, you're on your own, as AK and I are both out. :rolleyes:
     
Loading...