+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Newbie level 5
    Points: 92, Level: 1

    Join Date
    Aug 2019
    Posts
    8
    Helped
    0 / 0
    Points
    92
    Level
    1

    Differential amplifier measure -32V to +32V with single 3.V supply

    I have something that I thought is a trivial problem and I have been trying to resolve for a while now with no success, thus I decided to reach out to you for help.

    I知 trying to create a little device that will measure voltage 0-32VDC (preferably -32V to +32VDC so in this way no polarity needs to be observed when connecting to voltage source)
    Im truing to accomplish that by providing an offset of about 0.9V from the output of the differential op-amp.
    There is an issue with the ADC converter of the uC that I知 using. It has a dead band from 0V to 0.15V therefore will not measure in this range. The full scale of the ADC input (linear) is about 2.4V. So ideally I知 trying to stay in the boundaries of 0.15V to 1.95V on the input of the ADC and have a middle point 1.05V if possible to be able to measure positive and negative voltages. I知 trying to offset the input to the ADC so I can do proper measuring starting from 0V to 1.8V.
    I hope that makes sense, but to summarize I need to have:
    Single 3.3V power to the op-amp.
    Input of the op-amp from -32V to +32V
    Output of the op-amp 0.15V when -32V and 1.95V when +32V. I should be able to measure with or without the negative input of channel 1 or channel 2 connected to ground.

    I tried to do it the following schematic (resistors are not calculated for the voltages indicated above):
    Click image for larger version. 

Name:	PastedGraphic-1.jpg 
Views:	10 
Size:	71.6 KB 
ID:	156482
    Unfortunately with my offset improvisation on differential amplifier schematic only 徒ind of works. The R5 and R13 resistors are there for illustration of what happens if I try to measure shared ground sources. Let's presume the R5 and R13 are not in place first. If I have the input open, I get starting point of the ADC (12bit) about 940 on both channels. If I connect the input to a PS and start increasing the voltage it works as expected and I can get the ADC value rising with the voltage rising until I reach 4095 saturation value. If I connect the PS in reverse, I get the value of the ADC to decrease. Obviously I知 not quite in the middle but that can be rectified easy. So far, so good.
    The issues start when I add any R5 or R13 resistors simulating that the power source and the voltage source share the same ground. immediately I get the value of the ADC with nothing connect the op-amp input, increase from 940 to about 1,115. Obviously that can稚 be good. I figured that in this case, grounding the negative input of the schematic will bring the potential of the op-amp negative inputs 1IN- and 2IN- to 0V vs. the 0.9V that I知 having there when R5 or R13 are not in place. This is a result of the op-amp trying to compensate for the offset voltage.


    So how do I avoid that shift and have an offset on the output of the op-amp to allow me to take proper measurement with the ADC?
    Is there a way to do an offset with a single stage op-amp and allow me to ground an inout without the shift?

    Do I have to create two stages, where the first stage is simple diff op-amp scenario getting fed 0 to +32V and outputting 0-1.8V and feeding that into second stage buffer op-amp that will shift the output to 0.15V to 1.95V? This I think will work except I can稚 connect the input in reverse and measure it.
    Is it possible to measure -32V to +32V or should I stick with 0V to 32V on the inputs?

    Is there a simple (or not that simple ) way to accomplish what I need with single VCC3.3V power to the op-amp?

    I hope that you can help,
    Thank you in advance for your time,

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 79,121, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,059
    Helped
    3635 / 3635
    Points
    79,121
    Level
    68

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    Hi,

    There is an issue with the ADC converter of the uC that I’m using. It has a dead band from 0V to 0.15V
    I've never heard about a microcontroller ADC with this (big) problem.
    Why don't you tell us the exact part name and vendor, or post a link to the datasheet?

    Picture: are you able to read the part values? I am not.

    Input of the op-amp from -32V to +32V
    No. The Opamp will (or should) never see +/-32V. Only the input resistors will see this big voltage.

    I should be able to measure with or without the negative input of channel 1 or channel 2 connected to ground.
    Makes no sense.
    * You build a "differential" amplifier circuit ... but then don't want to use the inverting input.
    * every voltage measurement needs to have two lines. One signal input and one signal as reference.
    * if you want to "misuse" your circuit by referencing to GND --> you need to connect the inverting input of your circuit to GND. Without additional resistor.

    (resistors are not calculated for the voltages indicated above):
    Why not? Sooner or later you need them. I see no benefit in trying the circuit with random values. It doesn't save time.
    --> especially when you are not experienced with analog circuits I recommend to use a (free) simulation software.

    If I have the input open,
    This is no useful option. Connect them to the voltage you wat to refer your voltage measurement.

    immediately I get the value of the ADC with nothing connect the op-amp input, increase from 940 to about 1,115. Obviously that can’t be good.
    Again. OPEN connections are not useful. Especially with your circuit, because the (unconnected) non inverting input tries to pull its voltage away from GND. It will not be zero.
    Both inputs of your circuits
    * don't have equal input impedance
    * don't pull to the same voltage
    If you want to avoid this, then you need to use a true "instrumentation amplifier (circuit)" (=INA).
    But still with an INA: don't leave (unused) inputs floating. At least install a high ohmic resistor to GND. But the result with a "high ohmic" input will be noisy and prone of errors.

    Is it possible to measure -32V to +32V or should I stick with 0V to 32V on the inputs?
    Definitely YES.

    If you want to use your circuit:
    * reverse the inputs:
    Use the non inverting circuit input as (GND) reference and the inverting as signal input.
    For sure the digital output is reversed, too. Just invert it on the digital side by software.

    Klaus

    - - - Updated - - -

    Hi,

    Added:
    Your circuit has some issues:
    * use a bulk capacitor and ceramics decoupling at the power supply
    * don't leave unused inputs floating. This is true for digital inputs as well as analog inputs. Like at your unused Opamp.
    * Don't connect capacitors directly to Opamp outputs. Either add a series resistor or use the capacitor at the Opamp input or the Opamp feedback.

    Klaus
    Please donエt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  3. #3
    Advanced Member level 5
    Points: 11,940, Level: 26

    Join Date
    Aug 2015
    Location
    Melbourne
    Posts
    1,953
    Helped
    713 / 713
    Points
    11,940
    Level
    26

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    for negative input voltages you need a neg supply for the op-amp unless you level shift the op-amp or the input.

    assuming the CM i/p range of the op-amp is nearly 3V, you have to divide down the +32V to just under 3V for the op-amp inputs to be able to handle the signal, lets say 100k in and 5k to gnd ( and f/back R ) this gives a diff-amp gain of 5/100 or 5% or 1/20th, 1/20th of 32V = 1.6 V out of the op-amp. 9k375 as the R to gnd ( & f/back) would give 3V from 32V in.

    If you sit the op-amp on +/- 1v5 then you need a f/back R of 9k375/2 to get +/- 1v5 out for +/-32V in - assuming the op-amp is a true rail to rail type ...



  4. #4
    Newbie level 5
    Points: 92, Level: 1

    Join Date
    Aug 2019
    Posts
    8
    Helped
    0 / 0
    Points
    92
    Level
    1

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    Hi Klaus, thank you for taking your time to respond, I did find your comments useful but they brought some more questions...

    Quote Originally Posted by KlausST View Post
    Hi,


    I've never heard about a microcontroller ADC with this (big) problem.
    Why don't you tell us the exact part name and vendor, or post a link to the datasheet?
    https://www.esp32.com/viewtopic.php?t=2881
    Picture: are you able to read the part values? I am not.
    this should be better and the resistors are with the values I calculated for -32 to +32V input
    Click image for larger version. 

Name:	4 Analog input.jpg 
Views:	4 
Size:	447.1 KB 
ID:	156486
    No. The Opamp will (or should) never see +/-32V. Only the input resistors will see this big voltage.
    Agree, what I meant is the voltage applied to the input resistors not to the input of the opamp
    Makes no sense.
    * You build a "differential" amplifier circuit ... but then don't want to use the inverting input.
    * every voltage measurement needs to have two lines. One signal input and one signal as reference.
    * if you want to "misuse" your circuit by referencing to GND --> you need to connect the inverting input of your circuit to GND. Without additional resistor.
    Let me explain better the use case: I would like to do a 4 or 6 channel analog input module that converts analog voltage signals to digital. So far, so good. The issue is that these voltages could be at 20,30, or more feet from each other but share common ground (the negative of 12V battery) First I did just simple restore divider circuit feeding ADC. I ran into ground loop issues where some of the voltages being measured started to vary if big DC load was turned on i.e. Pump on/off. The disturbing factor obviously was how good id the ground wire connection was to different sub-circuits and how well the wire was sized. Anyhow, this being outside of my control, I decided to design the differential input cirquit to avoid the ground loop problem. Now I have no ground loops problem (tested and proven), but on the test bench I'm measuring all these shiftings in ADC values so I'm not sure I got better solution yet.
    Another thing that you guys might picked up on is that if I measure PS on one input and battery on another, as soon as I connect their two grounds together, I get 10-15% reading difference on the battery voltage. the PS reading remains good. So in this case the grounds of the PS and the battery are not connected to the GND of the circuit. so that's another "gotcha" right there.
    Why not? Sooner or later you need them. I see no benefit in trying the circuit with random values. It doesn't save time.
    --> especially when you are not experienced with analog circuits I recommend to use a (free) simulation software.
    The attached picture is with the values I calculated and used in my tests. I did simulation, but did not see these possible shifts...

    This is no useful option. Connect them to the voltage you wat to refer your voltage measurement.

    Again. OPEN connections are not useful. Especially with your circuit, because the (unconnected) non inverting input tries to pull its voltage away from GND. It will not be zero.
    Both inputs of your circuits
    * don't have equal input impedance
    * don't pull to the same voltage
    If you want to avoid this, then you need to use a true "instrumentation amplifier (circuit)" (=INA).
    But still with an INA: don't leave (unused) inputs floating. At least install a high ohmic resistor to GND. But the result with a "high ohmic" input will be noisy and prone of errors.
    I will try some more measurements with inputs connected to V source, not floating.

    Definitely YES.

    If you want to use your circuit:
    * reverse the inputs:
    Use the non inverting circuit input as (GND) reference and the inverting as signal input.
    For sure the digital output is reversed, too. Just invert it on the digital side by software.

    Klaus
    Is this what you recommend in your last paragraph?
    Click image for larger version. 

Name:	4 Analog input Negative.jpg 
Views:	6 
Size:	373.1 KB 
ID:	156487



    •   AltAdvertisement

        
       

  5. #5
    Super Moderator
    Points: 261,989, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,786
    Helped
    13918 / 13918
    Points
    261,989
    Level
    100

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    The asymmetrical input structure implies unequal input impedance. I prefer a true instrumentation amplifier (either 2 or 3 OP design) for differential voltage divider measurement circuits.

    The choice depends on your performance requirements which haven't been specified yet.



  6. #6
    Newbie level 5
    Points: 92, Level: 1

    Join Date
    Aug 2019
    Posts
    8
    Helped
    0 / 0
    Points
    92
    Level
    1

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    I'm using the NCV20074DTBR2G 4 channel amplifier
    As per Klaus' recommendation I changed the schematic to invert. Have I done this correct?
    Can you please reference the resistors values that you are recommended to the R1, R2, etc on the picture?
    Click image for larger version. 

Name:	1 Analog input.jpg 
Views:	4 
Size:	293.7 KB 
ID:	156490

    Quote Originally Posted by Easy peasy View Post
    for negative input voltages you need a neg supply for the op-amp unless you level shift the op-amp or the input.

    assuming the CM i/p range of the op-amp is nearly 3V, you have to divide down the +32V to just under 3V for the op-amp inputs to be able to handle the signal, lets say 100k in and 5k to gnd ( and f/back R ) this gives a diff-amp gain of 5/100 or 5% or 1/20th, 1/20th of 32V = 1.6 V out of the op-amp. 9k375 as the R to gnd ( & f/back) would give 3V from 32V in.

    If you sit the op-amp on +/- 1v5 then you need a f/back R of 9k375/2 to get +/- 1v5 out for +/-32V in - assuming the op-amp is a true rail to rail type ...
    - - - Updated - - -

    Actually I'm trying to achieve low cost voltage measuring solution. I know that INA is better solution but it becomes expensive quickly...
    the requirements are to be able to measure with approx., 5-10uV accuracy. That shouldn't be a problem with real 12 bit ADC but I'm using one in ESP32 that has some "issues by design", this the need for offset to be able to start measuring from 0V up... https://www.esp32.com/viewtopic.php?t=2881
    Again, I'm not going to external ADC to save cost. We are implementing some calibration in the SW in order to get best accuracy and linearity out of the built in converter.

    Quote Originally Posted by FvM View Post
    The asymmetrical input structure implies unequal input impedance. I prefer a true instrumentation amplifier (either 2 or 3 OP design) for differential voltage divider measurement circuits.

    The choice depends on your performance requirements which haven't been specified yet.



  7. #7
    Super Moderator
    Points: 79,121, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,059
    Helped
    3635 / 3635
    Points
    79,121
    Level
    68

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    Hi,

    The more sophisticated solution is to use an INA. But with your application I see no need for it.

    If you want the middle point to output 1.05V (when both inputs are properly connected) then you need to change the reference circuit (Vref_OA1) to generate 1.05V, too. (your circuit as well as INA circuit)

    My "inverted solution"..
    I just reviewed it. Sadly it doesnエt give the desired benefit. I was wrong with my assumption. Sorry for that.

    When you use your circuit and properly connect both inputs, then you donエt need a split power supply. You may use a single 3.3V supply.

    But the better solution with INA needs a negative supply.


    Klaus

    - - - Updated - - -

    Hi,

    added:
    the requirements are to be able to measure with approx., 5-10uV accuracy. That shouldn't be a problem with real 12 bit ADC
    Your calculation surely is wrong. Just have a look on "resolution" (overall accuracy will be worse).
    With a 12 bit ADC you have 4096 output steps.
    Multiply this with 10uV then you just get 40mV of measurement range. But you want +/-32V = 64V. So you are off by a factor of 1600.

    Klaus
    Please donエt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  8. #8
    Super Moderator
    Points: 53,243, Level: 56

    Join Date
    Apr 2011
    Location
    Minneapolis, Minnesota, USA
    Posts
    13,015
    Helped
    2588 / 2588
    Points
    53,243
    Level
    56

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    Quote Originally Posted by JordanS View Post
    Output of the op-amp 0.15V when -32V and 1.95V when +32V
    Easy method to attenuate and level shift. Two potentiometers mix a portion of the incoming signal, and a portion of the supply voltage.

    Click image for larger version. 

Name:	two pots level shift 32VAC to positive region under 2V .png 
Views:	2 
Size:	20.0 KB 
ID:	156495



  9. #9
    Newbie level 5
    Points: 92, Level: 1

    Join Date
    Aug 2019
    Posts
    8
    Helped
    0 / 0
    Points
    92
    Level
    1

    Re: Differential amplifier measure -32V to +32V with single 3.V supply

    thank you all for the responses. I establish that if I not leave the input floating, my solution works even when I connect the Vin- to GND. The shift only occurs when I don't have any voltage source on the input.
    The accuracy of the ADC is another issue, that we will be struggling with, but at least the inout analog portion appears to be working correct now.



--[[ ]]--