7
\$\begingroup\$

I am having some trouble with an attenuator circuit as part of an automated test tool I am working on.

As part of the design I need to attenuate a +/-10V input signal down to +/-5mV with some offset, I came up with the below circuit and implemented it however I am having issues I didn't expect where if I set my midpoint reference at half supply I get a non-linear output from my circuit, however if I bump the midpoint reference up to 2V then it responds much better.

The op-amp I am using in my circuit is an OPA330

My Scope plot shows the following

  • Yellow = Input Test signal (Not +-10V but the best I could scrounge working from home)
  • Green = Output voltage with R5 set to 1.2V
  • Orange = Measuring the output with respect to 0V (More or less ends up being just measuring the midpoint)
  • Grey Saved reference trace of green but with R5 set to 2V

I think the vertical drift can be explained by the CMRR of the op-amp (approx 100dB) but dont understand why the shape should change unless I am starting to clip against the supply rails.

To make things easier to read I have re-plotted it as output vs input.

schematic

simulate this circuit – Schematic created using CircuitLab

OpAmp Plot

Excel Plot


So I managed to make a little more progress, going over the datasheet again I noted the section 9.1.6 Achieving Output Swing to the Operational Amplifier Negative Rail where it reccomends applying a small load either to GND or a lower voltage rail if high precision is required close to the negative rail. Lo and behold, I thrown in a 20k resistor and things behave more linearly if pulled down to -5V, and they almost behave if pulled to 0V.

See the below chart for my results. I still have questions though, what in the datasheet should I have been looking at to determine what "Close to the negative rail" means, is 1mV close or is 1V close. Secondly why do I see so much variation in my output in terms of the vertical shift as I change the midpoint reference. I am seeing around 1mV/V of shift which would point at around 60dB CMRR if I worked it out right, way less than the rated 100+ datasheet value.

enter image description here

\$\endgroup\$
8
  • 1
    \$\begingroup\$ I would change a little your circuit. First attenuate your input signal as needed. Then add (opamp adding configuration) an offset at this. Also, use a opamp that can "see" negative signals or use a bipolar supply. \$\endgroup\$
    – Antonio51
    Jul 15 at 9:43
  • \$\begingroup\$ @Antonio51 Hi Antonio do you have any further pointers on why this would be better, my understanding is this would greatly increase the sensitivity of the system to op-amp input offset voltage, in this case anyway I only have a single 2.5V supply to work with. \$\endgroup\$
    – Hugoagogo
    Jul 15 at 10:45
  • \$\begingroup\$ Why is the opamp's offset so critical, if you are anyway adding an offset with the pot? The opamp you chose has an extremely stable offset, much better than the potentiometer can give you. \$\endgroup\$
    – polwel
    Jul 16 at 10:38
  • \$\begingroup\$ @polwell it matters because you will note my output voltage isn't measured with respect to GND but with respect to the midpoint reference, meaning the input offset does matter and if the pot drifts a little it shouldn't affect the output much since the output is relative to it. \$\endgroup\$
    – Hugoagogo
    Jul 16 at 12:11
  • \$\begingroup\$ @Hugoagogo - I have not tested my configuration. However, if I am not mistaken, if the attenuator uses the op amp like the proposed scheme, it will add noise since it is in the loop (even if the gain is very low) ... The offset can still be compensated ... "without additional noise" since, anyway, you need it. Noise ... is a difficult problem. So to be tested ... \$\endgroup\$
    – Antonio51
    Jul 16 at 16:03
2
+50
\$\begingroup\$

Let's consider the basis of your circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

\$V_o = -R_f/R_i V_s + (1+R_f/R_i)V_r - V_r = -R_f/R_i V_s + R_f/R_i V_r \$

Note that Vr is not suppressed by the CMRR of the op amp, but simply by the factor Rf/Ri. So for your values, a 1V change in Vr should lead to 3/10000 Vr = 0.3mV change in the output. This is roughly what you measure.

As far as the non-linearities are concerned, or the changes in Vr sensitivity due to output loading, I can't see causes for them from either the schematic or datasheet, but there are some possible issues with prototyping/testing this that I'd raise:

  1. you are measuring the output relative to Vr - the wiper on a 100R pot. How are you doing this? Do you have a differential probe or have you connected your scope ground to the pot wiper? If the latter, what other mains connected equipment are in the setup? I only ask as Vo contains signals from Vr as well as Vs, and if you aren't careful there could be ground current issues.
  2. Are you sure there are no supply ripple issues - you are talking of around a mA of signal current and worrying about fractions of a mV in the output. Try running the reference voltage from a battery, and if you are already, from a separate battery.
  3. Have you made sure that the input signal current shares no common path with the reference voltage wiring. Ideally the return for the input signal current would be to the junction of the decoupling capacitors on the op amp + and - rails.

Sorry if you have already considered all of these, but they are worth raising.

Edit - added after discussion:

Given that the linearity seems to improve with increasing frequency, this is also suggestive of an issue with bypassing.

If you think about the signal currents for a moment, when the signal is positive, the current into Ri and Rf is being sunk by the op amp, and so returns via the op amp negative supply pin, and hopefully the bypass cap. Similarly, when the signal is negative, current flowing out of Ri and Rf is sourced by the op amp, and ultimately from the positive supply pin and it's bypass cap. So the op amp acts like a rectifier with the signal current coming from alternate supply pins each half cycle.

The ripple on the bypass caps is a form of rectified signal. I suspect that some of this is leaking into the signal path, possibly via Vr. Have you bypassed Vr to only one supply rail? Adding some half-wave rectified signal could explain your problem.

This is sort of like crossover distortion, you can reduce / remove it by loading the output so that the output is always sourcing / sinking current and so all the ripple current comes from the positive / negative supply bypass cap. This is probably why the linearity improves when you load the output. With enough loading all the current comes from one bypass cap so the current drawn from the op amp isn't rectified and so there is no non-linear signal to cause your non-linearity. The undesired coupling to the power supplies is still there, it's just that the coupled signal is linear.

Edit #2: Re your comment: Also noting that the op-amp is running from a single 2.5V supply with a bypass cap very close to the op-amp between the supply rails This is probably your problem - you haven't provided a path for the signal current to get back to the source. You need substantial bypassing from each op amp supply pin to the ground of the signal source. There is of the order of a mA of signal current, and unless you provide a low impedance path from the op amp supply pins to the ground of the signal source, it is probably meandering it's way back through various ground leads. Worse still, half-wave rectified versions of it are probably getting lost differently! This is why I said originally to think very carefully about the return path for the signal currents.

Edit #3:

I've tried to illustrate the return currents on this schematic:

schematic

simulate this circuit

I don't know if I have your bypassing arrangement correct.

You can see (hopefully) that in this circuit that you are relying on the bypass capacitor Cbp to reduce the modulation of V+ by the signal current when Vs < Vr. Any modulation on V+ will modulate Vr. If the signal voltage (Vs) swings either side of Vr then the modulation on V+ becomes non-linear. Increasing Vr until it is past the peak of the signal will stop the non-linear feedback (only the upper diode will conduct), but the feedback will will still be there - changing the output levels. Similarly for adding a pull-down or pull-up resistor to the output - this can stop the non-linear effects by ensuring only one of the virtual diodes conducts.

I don't have your circuit in front of me to test out, but this is a feasible explanation of your problems. It is consistent with the variation with setting of Vr, variation with output loading and the reduced effect as you increase frequency. Of course it may not be this - but a good design would eliminate this as a possibility. Try increasing Cbp or add extra filtering to the Vr line. Ideally I'd also prefer to see you lower the impedance of Vr, especially since you are feeding it off to the oscilloscope.

\$\endgroup\$
8
  • \$\begingroup\$ Hi Tesla, took me a bit but I agree and can see whats going on with the offset even though the values are a little off what I measured. In answer to your questions 1) Measurements are being done with a scope with Isolated channels (RTH1004) 2) As best as I can measure I don't have any meaningful supply ripple. 3) I don't think I have any interaction between the current paths, the closest one would be 0V which is a solid ground-plane. \$\endgroup\$
    – Hugoagogo
    Jul 20 at 0:09
  • \$\begingroup\$ What do you see if you disconnect your signal from the 10k and just connect it to the groundplane via another 10k, with the original 10k connected to the groundplane? This should produce similar currents, hopefully without a hint of the signal on the output. What sort of bypassing is in place? You are using 50Hz signals, these aren't synchronous with the mains are they? Try changing the frequency. (clutching at straws!) \$\endgroup\$
    – Tesla23
    Jul 20 at 0:36
  • \$\begingroup\$ I would also try lowering the impedance of the reference voltage, ideally buffer it with another op amp if feasible, preferably using an RC filter to remove any signal ripple. \$\endgroup\$
    – Tesla23
    Jul 20 at 0:42
  • \$\begingroup\$ I will have to try these when I am in at the office latter this week and have parts on hand to make mods. My signal is not synchronous with mains. Just going by eye if I play with the frequency the linearity gets worse at lower frequencies and better at higher frequencies. \$\endgroup\$
    – Hugoagogo
    Jul 20 at 1:10
  • 1
    \$\begingroup\$ Thanks for your help Telsa, I have been given the move along signal from my boss since adding the pulldown gets us going. I am still not sure on the bypassing especially since in my example graph Vs is only +-0.8V i.e always less than Vr. Either way adding caps between VR and each rail had no noticeable impact. I am going to mark this as accepted and award the bounty as it certainly helped a lot and I appreciate the time and effort you have spent here trying to help me out. \$\endgroup\$
    – Hugoagogo
    Jul 21 at 4:05
0
\$\begingroup\$

OPamps are not good (linear) near V+ or V- - even rail-to-rail ones. Change offset to (V+ - V-)/2 and you will be in linear region.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ An opamp doesn't need to be linear as long as it has enough gain. The feedback will linearize the behavior (again, provided that there is enough gain). What you mean is that if you take the inputs outside the common mode range then the gain will collapse and that will affect performance. What is hapening in OP's situation depends on the opamp for which I did not see a datasheet yet. \$\endgroup\$ Jul 15 at 9:29
  • 1
    \$\begingroup\$ @Bimpelrekkie OP has problem with nonlinearity in 0V ... 500uV region, with V- connected to 0V. It just can't work in this region (OPA330 has typicaly 30mV voltage swing from rail - yes, i know OP is talking about OP330 not OPA330). \$\endgroup\$
    – ufok
    Jul 15 at 10:01
  • \$\begingroup\$ Isn't the non-inverting input tied to 1.2V? Also the output hovers around that value (orange trace in the scope screenshot). \$\endgroup\$
    – polwel
    Jul 15 at 15:19
  • \$\begingroup\$ Yep, non-inverting is mid supply and can be adjusted with r5 I expected things to work pretty well with it mid supply at 1.25v but for some reason it doesn't and works better when closer to the positive supply rail at 2v \$\endgroup\$
    – Hugoagogo
    Jul 15 at 22:49
  • \$\begingroup\$ Yep, ufok is right! Explaining whole thing in a few words. :) \$\endgroup\$
    – jay
    Jul 20 at 17:43
0
\$\begingroup\$

-. "Virtual ground" must be established in order to apply the sophisticated theory of operation.
-. There is no physical connection between two input pins.
-. What makes the virtual is the OPA output fed back to the input, driven to balance two input signals.

Hugo, search "Open-loop output impedance" in the datasheet, which is 2k ohm for OPA330. It is not a static value, I think. Though, it is a good reference.
Thus, when the OPA is in it's maximum effort to pull the Vi- input pin down while the signal source is at 10V, the output can reach only to (10V * 2K) / (10K + 2K) = 1.6V. Meantime, output can only swing about 100mV near the rail. Besides, there is a possibility the equivalent output impedance grows near the rail.The same principle applies when the output has to swing up hard, when the reference is set high.

Now, you can tell "Aha!", I guess. The solutions you have found were:
a) Shift the reference. This puts the "balancing point" of input pins inside the "circuit output" range.
b) Pull down the output. This bleeds the current from the signal source (10V), and shifts the output lower.

c)"Close to negative" is self explained now, along with the output pull down.
d) OPA ouput is Vo = Vr - (Vi - Vr) x ((R2 + R3) / (R1 + R2 + R3)). Vo depends on Vr directly. Adjusting it in mV using a single pot is very delicate. Instead, set the range of the adjustment using 3 resistors in series, pot in the center. So, pot swings only in +/- some mV range.

\$\endgroup\$
4
  • \$\begingroup\$ Hi Jay, how does the openloop output impedance fit in with the figure 5 output swing diagram. If the true closed loop output resistance was 2k then I would expect on the graph that at 1mA it wouldn't be able to drive any closer to the rail than 2v. \$\endgroup\$
    – Hugoagogo
    Jul 20 at 23:06
  • \$\begingroup\$ Further noting that the output impedance is specified at 350kHz, way above the case we are considering here that is practically DC. \$\endgroup\$
    – Hugoagogo
    Jul 21 at 0:00
  • \$\begingroup\$ Hi Hugo, Yes, I agree with you. Figure 5 and 2k do not calculate to equal. Output impedance depends on the OPA internal output configuration. Source and sink are often different as in the fig 5. What I think is the impedance (of 2k) is not static, but a good reference value. Meantime, test condition 350Khz is the GBW, too, Well, however it is, OPAs have output impedance. I am curious and would try measurement of OPA330 on my bench when chance comes, using a voltage follower circuit. Hmm.. why would they drive it to GBW to measure DC impedance (k ohms)? For the choppers inside? \$\endgroup\$
    – jay
    Jul 21 at 3:53
  • \$\begingroup\$ RN the only significant load (other than the pull-down) is the feed back network. To test this hypothesis, OP could try to increase the feedback resistors (by 10x for instance). The Opamp is CMOS, and the frequency is low, so it shouldn't have any negative effects. \$\endgroup\$
    – polwel
    Jul 21 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.