Embarrassing problem

I say “embarrassing problem” because this is about my battle with that most sophisticated and subtle of analog electronics circuits, the voltage divider. There’s more going on here, for sure, but I’ve been tearing my hair out (what little there is of it) over this. I even resorted to building myself a voltage divider on a breadboard so I could convince myself I wasn’t going completely mad.

This is quite long, so only read if you’re feeling charitable…

Here’s the circuit, which is part of my Teensy Load project, which is a programmable load that’s programmed through an attached Teensy:

This part of the circuit is for limiting the voltage supplied by the device under test attached to the load: The opamp U102C is used as a comparator, and as long as the voltage sensed from the DUT is below a threshold, the opamp output is +3.3V and the diode D301 is reverse-biased. If the DUT voltage rises above the threshold, the comparator output drops to ground, the diode is forward biased and the gate of the FET that controls the current through the load is pulled low, stopping current flow through the load.

That bit’s all OK. The really weird thing that’s going on is to do with the voltage divider for setting the threshold voltage. This is driven from a DAC (U301), and the divider is supposed to convert the output range from the DAC (0 - 3.3V) to a suitable range for the threshold (0 - 2V, because of the way I’ve set things up).

So, when the output from the DAC is 3.3V (i.e. the voltage at point A is 3.3V), what’s the voltage at point B? (All this with no DUT connected at all.)

Naively, I calculate 3.3 x (27K + 33K) / (27K + 33K + 39K) = 2V.

Actual voltage measured at point B = 1.3V!

I tihnk I have a very slightly better idea what’s going on now, but the first time I saw this, I did have a tiny existential crisis. It’s a voltage divider with a 39 kΩ side and a 60 kΩ side, so for a total voltage of 3.3V you’d expect to drop 2V across the 60 kΩ side and 1.3V across the 39 kΩ side. Instead it’s the other way around, with 2V across the 39 kΩ side and 1.3V across the 60 kΩ side!

If you calculate the currents through the resistors, you find that the current through the 39 kΩ resistor is 51.3 μA, and the current through the 60 kΩ serial combination is 21.7 μA. That seems to mean that there is a current of 29.6 μA flowing into the input of the opamp. Can that really be right? The TLV4333 is a CMOS opamp which I assumed meant that it would have a huge input impedance and draw essentially no current.

I’m a little suspicious about what happens at point C, the other input of the comparator, but I tried grounding everything that had some sort of path to there and it didn’t make a difference.

Does anyone have any idea what could be happening here? As yet, I know far too little about opamps to work out what’s happening. Could there be some feedback path through the rest of the circuit that’s causing this? (But that nearly 30 μA of current flowing into an opamp input makes no sense to me at all!)

I’m really hoping this is something amazingly obvious, and someone can just give a one-line answer than sends me slinking off back to my bench. I’m more than happy to make a fool of myself in public if I learn something.

Additional information that might be useful: here’s a spreadsheet that shows what happens when the DAC voltage varies. The chart on the left shows voltages (the “_expect” values are my naive linear expectations), the chart on the right voltages across the 39 kΩ and 60 kΩ sides of the voltage divider as fractions of the total DAC voltage (which I’d have expected to be constant).

Something weird obviously starts to happen when the DAC output voltage gets up to about 1V. Below that, the voltage fractions are constant and what I’d expect. But then, as the DAC voltage increases, they move away from the values I’d expect until they eventually cross over and change places completely!

1 Like

I don’t claim to be an expert here but in my experience, the first thing that I would do is challenge the notion that each of the active devices behave like the ideal models you use in your calculations. You already went there with the input impedance of the opamp.

Also consider the output impedance of the dac. Yes I look at the datasheet and see there is an output buffer but also there is some kind of switchable resistor network after the output buffer. I do wonder if the leakage of that switch is a factor. You can always run some bench tests to mitigate this issue. Do this by measuring currents at various nodes and determine if they match you math. You could also temporarily add in some buffer opamps at various stages to make sure that input/output impedance is not an issue.

For all of these devices, there are non-linear protection devices that could alter their behavior, things like esd clamps, substrate devices that make them behave differently than your perceived ideal model.

What’s U102 being powered from?

Can you disconnect the divider from U102 to check that it has the correct resistors and that your DAC can drive it?

Also, what are 102A and 102B doing, also be sure that they are tied off and not oscillating.

(Shot in the dark but usual lizard brain review stuff)

You probably did, but I have to ask anyway because I have missed this step. Did you physically measure the resistors in the circuit?

Here is an interesting plot from that datasheet
image
which is a clue as to why I’d avoid using opamps as comparators.
Usually because they recommend that you don’t provide more than a certain differential voltage lest the part draws excessive current / fries.

3 Likes

Thanks everyone!

Extra info:

  1. I measured the resistors. They’re OK.

  2. U102 is powered from the same 3.3V supply as the DAC. It’s a supply provided by the Teensy board, generated from the 5V USB input. It’s supposed to be good for 250 mA, which seems well within range here.

  3. The other units in U102 are all in use, all in “inoffensive” opamp roles, i.e. the only unit being used without (obvious) negative feedback is the one that’s giving the problem here.

  4. The DAC output impedance is 1 ohm. I need to take a closer look at the datasheet to see whether there might be something up with the resistor network there.

Oh bugger. I think you might win the prize there. It just seemed so convenient: quad opamp, one left over, need a comparator, off you go. But the equivalent circuit shown in the datasheet for what happens when you overdrive the differential voltage might explain what I’m seeing:

2020-08-08-182038_1920x1080_scrot

I was really wondering how the opamp input could be showing an input impedance in the 10s of kOhm. Looks like that might be the answer!


That figure also explains why things start getting weird when the DAC voltage gets up to around 1V. The bias currents are negligible until the input differential voltage is greater than about 0.8V.

Looks suspicious, no worries it happens to all of us :slight_smile:

1 Like

If you have the space to patch in resistors in both traces running to the opamp inputs, you could try to insert large value resistors. I’m thinking an extra 1MOhm-10MOhm on each leg would reduce the current through the amplifier inputs by a factor 100 - 1000, and should not affect the normal operating range.

That’s an interesting idea. I just had a look at the layout and I don’t think I could do it very easily though. One of the inputs to that opamp comes from a via under the package, so I’d have to dead-bug the whole thing to get at it. I was planning on a respin of this project at some point though, so it’s not a tragedy. I’ll use a real comparator next time!


Lessons learned:

  1. Read the datasheets.

  2. Understand the datasheets.

  3. Opamp != comparator.

  4. Check the assumptions your ideal models of components are based on. Real components aren’t like the “perfect” components in the textbooks!

Thanks everyone! That was incredibly useful. I’d buy you all a beer if we were in the same town!

Also:

  1. you did you math and checked it twice :+1:
  2. you built a circuit without analysis paralysis (and it mostly worked):+1:
  3. you tested your circuit and Identified the problem
  4. you summarized you problem well and asked for help :+1:
  5. you had an open mind👍
  6. etc, etc, etc

Also focus on all the things that you did right!

If it was easy, everyone would do it!

2 Likes

Chopper-stabilized opamps like this one are great for offset but require particular attention to details and quirks as we’ve seen here. Using a standard opamp as a comparator will rarely result in a problem like this.

2 Likes

OK, one more thing to add to my “things to learn about” list! I don’t think I’d even internalised the fact that the TLVx333 opamps are chopper-stabilised. (Before about 10 minutes ago, I didn’t even know what that term meant, so that’s sort of an excuse. I can’t remember why I chose that part for this project.)

Ah, good that you found it.

My initial thought when I looked was that I couldn’t tell what your supply range for the opamp was, and that maybe you were leaking through ESD protection diodes into the rail…

I used to think hidden connections to rails on the schematic was a reasonable thing, but especially with many mixed-voltages these days, being explicit about the rails is helpful.

1 Like

Chopper amps has incredible performance on some parameters, horrible on others

Since you cannot change the layout, find another pin for pin compatible part, and swap that in

It does not seem that your performance of the load depends using this opamp, an opamp with higher Vos could probably do the job, if nessesary combined with some tricks in SW

2 Likes

TSV994A perhaps?
LMV654 if you don’t need full CM range to the positive rail

Not TSV994A - it’s not unity gain stable. That is, at least U102D will most likely oscillate.

Actually not LMV654 either: it has an absolute maximum rating for the differential input of +/- 0.3V.
I suspect that EMI protection diodes start to conduct at that voltage. Yes, if you knew the details around those diodes, you could perhaps add protection resistors in front, but it’s already decided that this layout prevents that.

I’d be more interested in examining e.g. TLV4379. Unity gain, rail-to-rail (25mV typical), 0.8mV offset (typical) - with a caveat that the offset increases 10-fold when the input common mode increases above Vcc-1V.
The datasheet even lists a “typical application” wherein it’s used as a comparator.

1 Like