differential Op-amp with 1V offset design difficulties  - Page 1
Forum section: electronics / projects

author: SeaMaster
author_rank: Contributor
timestamp: November 14, 2019, 03:56:22 am
content: 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’m 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’m 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’m 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’m 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 +32VOutput 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):Unfortunately with my offset improvisation on differential amplifier schematic only “kind 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’m 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’t 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’m 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’t 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,

author: exmadscientist
author_rank: Frequent Contributor
timestamp: November 14, 2019, 05:20:36 am
content: I don't see why a bog-standard difference amplifier wouldn't do the job. See the attached LTspice simulation results. (Note that to actually build this you'd want to find E96 resistors in the shown ratio -- but using these values shows you where the ratio comes from.)It looks like you can achieve about -16V to +60V of common mode range on your inputs with a +/-32V differential input, assuming a full RRIO op-amp.As to why you're having trouble, are you sure that your R5 and R13 do what you think they're doing? Why do you think that's the right way to "simulate sharing a ground"?

author: MarkF
author_rank: Super Contributor
timestamp: November 14, 2019, 05:48:23 am
content: Vbias can be (+) or (-) depending on which direction you need to move the bias point.I used the configuration on the left by driving Vbias with a DAC and op-amp to offset the output of a signal generator.The op-amp (TL082) converts DAC output of 0-4V to +/-2V.Example:

author: SeaMaster
author_rank: Contributor
timestamp: November 14, 2019, 06:52:08 am
content: Quote from: exmadscientist on November 14, 2019, 05:20:36 amthe issue is that if I don't have an isolated PS powering the schematic and the power is coming from the same power source I want to measure then inevitable the Vin- gets connected to the ground. in the moment that happens, there is a significant shift in the ADC value. As I indicated in my case it is from 940 to 1115 on 12bit ADC.the problem is even more pronounced if I have multiple channels and they all measure the voltages that share the same ground...this is exactly what I'm trying to resolve but don't know how...

author: SeaMaster
author_rank: Contributor
timestamp: November 14, 2019, 07:02:33 am
content: Quote from: MarkF on November 14, 2019, 05:48:23 amBut this is exactly what I have done on my schematic, isn't it? I have the issue when the one of the input connects to ground. It creates shift into the ADC. it is to be expected as the amplifier reacts to the grounding of the input by changing the output to compensate the offset. So if I'm to read the voltage from little 9V battery not connected to my ground it works ok. If I'm to read the voltage of the battery I power the device from , I need to connect the ground to the Vin- and we get a shift (in my case from 940 to 1115 ADC 12bit) so I think that in general the offset works, but I don't think the offset /bias work in my case. So I need some other solution to overcome the problem with multiple channels inputs when connected together or to common ground to prevent shifting from happening.

author: MarkF
author_rank: Super Contributor
timestamp: November 14, 2019, 11:37:03 am
content: Quote from: SeaMaster on November 14, 2019, 07:02:33 amSorry, I didn't look that close at your circuit.You don't say what op-amp you are using. Is it rail-to-rail or single supply?You need to check the datasheet and find out how close the inputs can be to either power rail.In your case, how close can the inputs get to GND with the negative op-amp rail at GND.

author: EEEnthusiast
author_rank: Frequent Contributor
timestamp: November 14, 2019, 02:23:35 pm
content: One thing I noticed it that one of your OPAMPS is driving a 0.1uF capacitor directly. I do not know which OPAMP you are using, but most of them would have difficulties driving a capacitive load directly. They may oscillate. Better to add a small series resistance in the path between the OPAMP output and the cap.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 14, 2019, 03:16:42 pm
content: Quote from: EEEnthusiast on November 14, 2019, 02:23:35 pmYes, this is a common trap when using opamps to buffer reference/bias voltages for instance. Read the opamp's datasheet carefully if you're absolutely going to do that.There's R10 in the OP's schematic though, with a 0 value, but I guess that was some provision to increase the value in case of oscillation?

author: thm_w
author_rank: Super Contributor
timestamp: November 15, 2019, 02:21:25 am
content: Quote from: SeaMaster on November 14, 2019, 03:56:22 amThat would be a show-stopper for me, what possible micro is this? One of the early atxmegas?Is there any way you can change the micro or use an external ADC instead.

author: EEEnthusiast
author_rank: Frequent Contributor
timestamp: November 15, 2019, 03:54:51 am
content: Are you using the CC3200 MCU by any chance?

author: David Hess
author_rank: Super Contributor
timestamp: November 15, 2019, 06:57:23 pm
content: I have used the standard 4 resistor difference amplifier before for that application with good results.When you ground the input, the offset voltage of the operational amplifier is applied to the output.

author: SeaMaster
author_rank: Contributor
timestamp: November 16, 2019, 10:23:19 am
content: I think I got it working finally. We are getting about 30-40mV accuracy, and could do probably better if we use more than offset and ratio calibration. with 10 or more calibration points we should het about 20mV which is plenty accurate for automotive battery measurementhere is the link too the controller we are using:https://www.esp32.com/viewtopic.php?t=2881

author: EEEnthusiast
author_rank: Frequent Contributor
timestamp: November 16, 2019, 12:10:04 pm
content: That ADC curve looks really gross. The INL on that may be few 100 LSBs I think.

author: Warhawk
author_rank: Frequent Contributor
timestamp: November 16, 2019, 06:15:53 pm
content: Guys, I am just walking by but let me make a comment. I believe it is the right place.Differential amplifier - by this the industry typically understands a fully differential amplifierDifference amplifier - a standard opamp with 4 resistors

author: David Hess
author_rank: Super Contributor
timestamp: November 16, 2019, 07:09:04 pm
content: Quote from: Warhawk on November 16, 2019, 06:15:53 pmTexas Instruments did not help by releasing application notes which confused all three terms. Differential amplifiers have differential inputs and outputs. How to distinguish difference from instrumentation amplifiers is more difficult but they both do the same thing while the later has high impedance inputs. There are multiple ways to implement any of them.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 16, 2019, 07:13:36 pm
content: Yup, the terms can be confusing. Always just make sure you know what you are actually using.You can actually find integrated difference amplifiers as well (which basically integrate matching resistors and a single opamp).

author: David Hess
author_rank: Super Contributor
timestamp: November 16, 2019, 08:40:04 pm
content: Quote from: SiliconWizard on November 16, 2019, 07:13:36 pmThere are also difference amplifiers like the AD8130 and LT1193 which have two pairs of difference inputs. A difference signal, typically up to 100 millivolts to a couple volts, is applied to one pair and feedback from the output is applied the other inverting input with the other non-inverting input serving as a reference for the output. They can be configured to do all kinds of interesting things.