Simple opamp circuit linearity problem - Page 1
Forum section: electronics / projects

author: Unixon
author_rank: Frequent Contributor
timestamp: February 18, 2019, 05:56:15 pm
content: I just came across a weird problem with non-linear amplifier behavior on a large scale while doing a simple receiver module for 4-20mA current loop.Basically what I needed the circuit to do is to convert voltage from 0.4-2.0V range to 0-5.0V and 0-3.3V range for two output channels.A textbook circuit for non-inverting configuration with negative offset does Vout=m*Vin-b conversion with m=3.125 b=-1.25 for 5V channel and m=2.0625 and b=-0.825.For the testing I've fed the circuit with ramp signal and plotted Vout against Vin for both channels, positive rail was 5.0V and the negative rail was 0V @GND.The result was that Vout(Vin) significantly deviated from linear function way before positive rail at 5V channel and even earlier on 3.3V channel.My first though was that LMV358 selected out of convenience was way out of line with its biases and tried few other RRIO op amps, but with nearly the same result.So the question is what am I missing here? Probably it's something so obvious that I should have known this from the very beginning.

author: Zero999
author_rank: Super Contributor
timestamp: February 18, 2019, 06:36:18 pm
content: Try removing D1.

author: Unixon
author_rank: Frequent Contributor
timestamp: February 18, 2019, 06:57:49 pm
content: Quote from: Zero999 on February 18, 2019, 06:36:18 pmDo you think this 3.3V zener starts leaking enough current to drive the input away even well below 2V?

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 18, 2019, 07:12:13 pm
content: This is likely.From the datasheet of this zener diode series:https://www.onsemi.com/PowerSolutions/product.do?id=1N5913Byou can see that the 3.3V variant has a huge max leakage current of 100µA @1V! I don't know which one you use, but those low-voltage zener diodes leak like crazy. So with a 10k series resistor...Just measure the voltage @AIN to make sure.

author: magic
author_rank: Super Contributor
timestamp: February 18, 2019, 07:15:12 pm
content: Just checked my Vishay BZX55 series datasheet, leakage is specified only at 1V. I'm surprised too, but your feedback networks seem alright and you tried r2r CMOS chips without any improvement.Note that both channels show identical nonlinearity at different scale, suggesting the input may be wrong.You can probably get away without IC2, TL431 has very low output impedance compared to those kiloohm resistor networks.

author: SilverSolder
author_rank: Super Contributor
timestamp: February 18, 2019, 07:17:15 pm
content: One thing stands out to me: on the 3.3V side, the magnitude of the gain setting resistors R10/R11 are 100x greater than the 2.5V reference divider R7/R8. This is done to reduce any current flowing in R10 to 1% of the current going through voltage divider R7/R8 and thereby keep the error caused by the R10 current to max 1%.On the 5V side, the divider R5/R6 and the gain setting resistors R9/R11 do not follow this principle - they are about the same order of magnitude. This will introduce a significant error as the output voltage goes up and R9 starts to pass current.Try some new values for R5/R6, they should be 3.9K and 1.2K respectively, and R9/R11 should be 200K / 620K respectively, in order to keep the error to 1% like the other side.I can't immediately see why this would influence the 3.3V side, but the 5.0V side is definitely not right. Perhaps fix that first then re-measure everything?Also - What is Vcc in this circuit - is it 5V, guessing by the value of R1? If so, some op amps struggle to work accurately near the supply rails - could that be an issue?

author: Unixon
author_rank: Frequent Contributor
timestamp: February 18, 2019, 07:29:35 pm
content: Quote from: SiliconWizard on February 18, 2019, 07:12:13 pmYeah, you're right. It all was for this little sucker. OK, I can still safely put a 5.1V zener in here and get a lower value R3 to compensate for leakage, but I can't leave the input totally unprotected. The loop is designed to operate at 24V and if things go wrong somewhere else at driver side this voltage must not get through to the output.

author: Kleinstein
author_rank: Super Contributor
timestamp: February 18, 2019, 07:37:24 pm
content: The protection diode should probably get another forward diode in series and an independent bias.For the 0-3.3 V output I would just divide the 0-5 V Version and than buffer.One might get more signal from a 150 Ohms resistor and thus less error from OPs offset, if this is relevant.

author: Unixon
author_rank: Frequent Contributor
timestamp: February 18, 2019, 07:40:43 pm
content: Quote from: SilverSolder on February 18, 2019, 07:17:15 pmYes, it is. The resistors were chosen from fitting standard series values to expressions for amplification (m) and offset (b) while minimizing MSE for (m,b). It turns out that for these particular parameters of feedback loop for 3.3V output both input divider and op amp output divider are about the same order.// case #1.1.1 ($4.3.2): non-inverting amplifier with negative shift// Vout=m*Vin+b, m>1, b<0// m = (Rf+Rg+R1||R2)/(Rg+R1||R2)// |b| = Vref*(R2/(R1+R2))*(Rf/(Rg+R1||R2))All four resistors values in this configuration are heavily interlocked, I can't help it if they are the same order of magnitude for certain conditions.p.s. here in the code comment I'm referring to 'OP AMPS FOR EVERYONE' by Bruce Carter and Ron Mancine (ISBN 978-1-85617-505-0).

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 18, 2019, 07:51:09 pm
content: Quote from: Unixon on February 18, 2019, 07:29:35 pmI'd suggest considering something like this:https://www.semtech.com/products/circuit-protection/low-voltage-esd-protection/uclamp2501tunder normal conditions, your input shouldn't exceed 2V, this one has ultra low leakage @2.5V and would double as ESD protection.

author: SilverSolder
author_rank: Super Contributor
timestamp: February 18, 2019, 09:39:19 pm
content: Quote from: Unixon on February 18, 2019, 07:40:43 pmUnderstood - I thought it was a "rule of thumb" design, but you are clearly way ahead of me here! I'm going to have a look at the book you linked, sounds interesting.Best regards -

author: Unixon
author_rank: Frequent Contributor
timestamp: May 05, 2019, 02:05:43 pm
content: Hi,I found another problem with this circuit. LMV321 based voltage follower for TL431 reference consistently produces about -375mV output offset on multiple boards. This offset looks weird considering the gain and absence of any huge resistance in feedback loop or at an input. What's going on?Last time I tested this receiver by directly providing an input voltage from a signal generator and the output was close enough to expected signal so I didn't even notice this offset. Then I went to testing this circuit against different current loop drivers and found this offset while trying to get voltage-current-voltage double conversion work as precisely as possible for this circuit and an isolated loop driver built on HCNR201 linear optocoupler with TSX561A op amps (the driver schematic is from HCNR201 datasheet/app.note). This isolated driver is a bit off by itself, but it looks like the receiver is also responsible for inserting additional offset into signal by shifting the reference voltage.