Opamp output becomes messy after 3rd stage - Page 1
Forum section: electronics / beginners

author: maelh
author_rank: Regular Contributor
timestamp: December 14, 2022, 05:18:25 pm
content: Hi,In simulation I built a circuit that works fine with AD8056 opamps for amplifying a 10MHz sine wave (ASK modulated, or in other words, switched off and on in regular intervals). The amplification happens in 4 stages.Breadboards are not suitable for high frequencies like 10MHz or at least introduce some distortion, yet I could build 2 stages with only minor distortion (which is nice since this makes testing much easier).But after the 3rd stage the result is complete chaos, I am not sure if this comes from stray capacitances/inductances (from the breadboard and wires on the breadborad), that couple in noise, or if opamps start to oscillate or something different.Notes on the design for each stage: the capacitor in the negative feedback loop is to filter out DC offsets, and the gain is set to 11 (instead of 10) since that allows to use a 1k resistor.Before I build the circuit on a perfboard, is there something else than the breadboard (too long connection leads, parasitic capacitances/inductances from the breadboard) that could be causing this issue?Is it necessary to adapt the design (without changing it completely)?(The working LTSpice circuit is in the attachment. Rename "ad8056.txt" to "ad8056.cir" and put it in the same folder as the .asc file)

author: BillyO
author_rank: Super Contributor
timestamp: December 14, 2022, 05:48:35 pm
content: I could be wrong, but I don't think those capacitors (where they are) are going to get rid of DC offset and may just be responsible to the instability. Why not just AC couple each stage?

author: maelh
author_rank: Regular Contributor
timestamp: December 14, 2022, 06:06:24 pm
content: The solution with the caps in the feedback loop is fromhttps://electronics.stackexchange.com/a/191677The idea is to set the DC gain to 1, which works in the real circuit and the simulated one (it will not get rid of an initial DC offset, just not amplify it further).I admit I don't fully understand how the DC gain setting works, though.

author: wasedadoc
author_rank: Super Contributor
timestamp: December 14, 2022, 06:08:22 pm
content: Quote from: BillyO on December 14, 2022, 05:48:35 pmThe capacitors do not eliminate the dc offsets but they do make the dc gain of each stage become 1 instead of 11. So the final output contains only the sum of the 4 offsets instead of the sum of 11x11x11x11 of the first, 11x11x11 of the second, 11x11 of the third and 11 times the fourth..

author: Kleinstein
author_rank: Super Contributor
timestamp: December 14, 2022, 06:12:53 pm
content: With more stages the overall gain goes up. This increases the chances that some unwanted feedback (e.g. via the supply, magnetic, capacitive) can cause oscillation.The amplifiers are quite fast and need some care with the layout.At least the decoupling should be sparate for the op-amps (e.g. 1 or 2 capacitors per OP-amp) and the input stage may want extra supply filtering.

author: bdunham7
author_rank: Super Contributor
timestamp: December 14, 2022, 06:15:25 pm
content: You might try loading each output with 100R to ground.

author: Ian.M
author_rank: Super Contributor
timestamp: December 14, 2022, 06:22:48 pm
content: 83dB of gain and only 72dB of typ. PSRR on a breadboard?That's ground plane, and individual screening cans for the first stage or two territory, probably with separate local regulators supplying the first (and possibly second) power to reduce unwanted feedback.However, lets at least see a photo of this abomination so we can see if there's any hope for layout improvement!

author: maelh
author_rank: Regular Contributor
timestamp: December 14, 2022, 06:29:21 pm
content: I made further tests. The capacitors do add some noise, but removing them doesn't fix it. The leads also pick up frequencies from neighboring parts of the circuit as can be noted when moving them around/out of the way.But the major issue seems to be the transition from one AD8056 to the next (each package has two opamps in it).Besides the individual voltage regulators and cans (good suggestions), what can I do to connect the two AD8056 "ideally"?Is it "just" a question of proper layout, or more?

author: maelh
author_rank: Regular Contributor
timestamp: December 14, 2022, 06:31:59 pm
content: Quote from: Ian.M on December 14, 2022, 06:22:48 pmI think you missed the point of using a breadboard (or another simple method to build a circuit) for experimentation.I want to avoid soldering before it's necessary.

author: james_s
author_rank: Super Contributor
timestamp: December 14, 2022, 06:47:25 pm
content: Quote from: maelh on December 14, 2022, 06:31:59 pmBreadboards are great, but you're working with RF here, that isn't really what breadboards are for and I'm not surprised you're having problems. You've tested a 2 stages on a breadboard and that worked, so the next logical step is to try a different construction method. Soldering stuff together on a bare copperclad PCB ground plane is one of my favorite techniques for high frequency stuff.

author: TimFox
author_rank: Super Contributor
timestamp: December 14, 2022, 06:48:25 pm
content: If I understand the source file correctly, the modulating square wave and the modulated sine wave arecoherentandcommensurate.That will produce an output waveform with a DC (mean level) component, and your circuit does have some gain at DC.Capacitors between the amplifiers (conventional AC coupling) removes any DC component from later stages.

author: Kleinstein
author_rank: Super Contributor
timestamp: December 14, 2022, 07:15:24 pm
content: Not really specific to the current setup, but fast OP-amps ususually not't like capacitive load. The bread boards often have quite some capacitance. Also just directly probing the output can become an issue. Some 100 ohm in series to the output is a good idea.Even if using a breadboard, one could still consider soldering a capacitor for decoupling directly to the supply pins. I have than with some of the OP07 / LM324 for breadboard use (not really needed with these slow ones but it still helps) - as a side effect this reminds you where the supplies are.

author: BillyO
author_rank: Super Contributor
timestamp: December 14, 2022, 07:25:40 pm
content: Quote from: wasedadoc on December 14, 2022, 06:08:22 pmRight, but AC coupling each stage will eliminate the accumulative DC offset. I'm just concerned that, in such a high gain circuit and especially in a breadboard, those caps will just pick up more noise to be amplified. It looks like he tried removing them and it did not help, so that disproves my theory anyway.

author: maelh
author_rank: Regular Contributor
timestamp: December 14, 2022, 07:28:27 pm
content: Ok I made further tests, with shorter leads cut to size, smaller breadboard, no DC gain controlling caps. Power supply caps where already used before (and I made sure they are all from the same batch, just to be sure).After the first stage the 10MHz signal is very clean and not distorted, adding a second stage adds some distortion. When adding a resistor from the opamp outputs to ground, as suggested it reduced distortion, and it's still a pretty clean 10MHz wave.The 3rd stage adds stronger distortion again. But much better than before. Adding a 100 Ohm resistor from the 3rd opamp output to ground actually makes the result more noisy.Unfortunately I don't have 5V voltage regulators available to test if this makes a difference.

author: maelh
author_rank: Regular Contributor
timestamp: December 14, 2022, 07:29:48 pm
content: Quote from: james_s on December 14, 2022, 06:47:25 pmThat's what I am planning, just wondering if the currently shown circuit is likely to work before I build it.Would a perfboard work as well for this frequency (since it's not very high yet)?

author: wasedadoc
author_rank: Super Contributor
timestamp: December 14, 2022, 07:46:11 pm
content: Quote from: TimFox on December 14, 2022, 06:48:25 pmNo, as I already wrote above, each stage has unity gain at DC.

author: Ian.M
author_rank: Super Contributor
timestamp: December 14, 2022, 08:07:38 pm
content: Quote from: maelh on December 14, 2022, 06:31:59 pmThere's a considerable difference between a good breadboard layout and a bad one. As you got two stages working on breadboard, I was simply interested to see if your layout was appropriate for HF (or at least as good as one can get for HF on a breadboard), and whether there was anything easy that could be done before going to soldered construction of whatever sort.Quote from: maelh on December 14, 2022, 07:28:27 pmSo you cleaned up the layout anyway.I'm assuming you knew the original was too *FUGLY* to show us!One of the EEE special cases of Murphy's law usually bites your @rse when dealing with RF breadboarding: "Amplifiers oscillate. Oscillators don't."We get fairly ridiculous breadboarding RF stuff here. You may have missed this:https://www.eevblog.com/forum/projects/challenge-thread-the-fastest-breadboard-oscillator-on-the-mudball/as it was before you joined.

author: bdunham7
author_rank: Super Contributor
timestamp: December 14, 2022, 08:20:44 pm
content: Quote from: maelh on December 14, 2022, 07:28:27 pmThat's a sign that your layout is an issue. How are you connecting those resistors to the ground and how much resistance is there in the ground circuit? Three stages means a gain of over 1300X, so I would expect it to be touchy.

author: Infraviolet
author_rank: Super Contributor
timestamp: December 14, 2022, 11:26:23 pm
content: Just throwing an idea in to here, may be totally wrong, but...Could using a low-pass filter help? Set the cut-off frequency to several, maybe 10, times the highest frequency you actually care about. That could kill off any really fast signals, so you'd only need to worry about oscillations at the frequencies you care about and wouldn't be troubled by feedback of far higher ones?

author: maelh
author_rank: Regular Contributor
timestamp: December 15, 2022, 01:08:04 am
content: Further tests show: when carefully laying out the cables (of the scope and the signal generator and putting them in a certain position) it is possible to get a pretty nice looking 10MHz sine wave, even after the third stage.It also seems that generating the 500Hz synch signal on the 2nd signal generator channel was interferring with the scope display a little, if not much. Using a 10MHz signal improved it slightly (that and moving the cable far from the other BNC cable from the signal gen, i.e., the first channel with tha modulated 10MHz sine wave). It sounds trivial, but it wasn't as obvious, since the cables were already quite a bit apart.A major factor was simply the very high gain (and the signal generator not being able to create a low enough output). But with 1mVpp the sine wave remains undistorted (with only a bit of lower frequency noise superimposed). This works also with the DC negative feedback caps.But the interesting part is, that the strong noise also appears when no signal at all is output from the signal generator. So the opams do indeed oscillate and become unstable, independently of the input.So I guess experimenting with the layout, shielding, and limiting the gain for too powerful signals would be what matters most. I haven't yet measured the power rails, but I suppose trying to stabilize them more would help as well.I have yet to validate that the gain really matches that of the simulation.But now it seems to be working reasonably well on the breadboard as well for 3 stages, and the sinewave remains undistorted (even if it has a bit of superimposed low frequency noise, which is not a problem for my application).

author: maelh
author_rank: Regular Contributor
timestamp: December 15, 2022, 01:16:45 am
content: Quote from: Ian.M on December 14, 2022, 08:07:38 pmThat was not the reason. It was and is actually quite ordered, but your general reaction dismissing the breadboard at all wasn't encouragingQuoteI hear that is true for "ideal" builds as well, so fingers crossed it won't happen with the perfboard versionQuoteI'll have a look, thanks!

author: maelh
author_rank: Regular Contributor
timestamp: December 15, 2022, 01:19:41 am
content: Quote from: Infraviolet on December 14, 2022, 11:26:23 pmI considered doing that, but then adding caps always seems to have a larger influence on the overall circuit. It seems difficult to predict how all of it interacts.

author: David Hess
author_rank: Super Contributor
timestamp: December 15, 2022, 07:48:06 am
content: High gain amplifiers need careful layout to maximize input to output isolation and may also need isolation of the power connections between stages.Linear Technology application note 65has a discussion of a similar 4 stage 10MHz multistage baseband amplifier starting on page 63.

author: maelh
author_rank: Regular Contributor
timestamp: December 15, 2022, 10:08:16 am
content: Quote from: bdunham7 on December 14, 2022, 06:15:25 pmCould you explain why that would work (curious in general, I experimented already as mentioned above, but interested in the theory)? Is it because it limits the gain? Or because it affects the output/input impedance? A bit more details would be appreciated

author: Doctorandus_P
author_rank: Super Contributor
timestamp: December 15, 2022, 05:39:52 pm
content: Opamps don't like capacitive loads on their outputs (and breadboard contacts are quite capacitive).If you put 100 Ohm between the output and GND, then the opamps always have a fairly stiff resistivity load and this swamps the capacitive load. It also works to put a 100Ohm resistor in series with the output.If you use a 100 Ohm resistor to couple the output of an opamp to the input of the next opamp, then you already halve the capacitive load on the opamp output. Better would be to lift the output from the breadboard and air wire the resistors.I suspect that the decoupling on the breadboard is simply inadequate, and when you have too many stages: 11*11*11 = 1331 then the output of the last opamp couples back to the input of the first opamp. You could try using two separate breadboards. Put only two stages on the first breadboard, and then the 3rd stage on another breadboard. Also, use separate wires directly from the power supply for each breadboard and even better, add some inductors or ferrite beads in those wires to filter out HF stuff.Breadboards are nice to have, but they have their limits.I used to build circuits with an ATMEGA8 on a breadboard (before "arduino" existed) and with a crystal directly into the breadboard. Every now and then the uC stopped responding and quite a while later I could correlate this with changes on the logic level on PD5. It turned out that capacitive coupling was enough to upset the crystal oscillator every now and then. My solution was to cut off the thin part of the pins for the crystal, solder on 2 pins of a molested IC socket to those pins and put the crystal in those sockets. The contraptions was completed by soldering the capacitors for the crystal directly between the GND pin and the pins for the crystal too. With that modification the lockups went away and I could happily experiment further on my breadboards.

author: maelh
author_rank: Regular Contributor
timestamp: December 16, 2022, 01:38:36 am
content: I made some further experiments, and it turns out the major thing that confused me was how an additional stage distorts not only this additional stage's output, but also the output/inputs of the previous stages.So once the opamps rail limits were reached in the 3rd stage, the 2nd and 1st stage output that was a pretty nice sine wave before (besides some lower frequency noise superimposed that makes it "wobble" a bit) are distorted as well, even the original signal input in front of the first opamp gets distorted.I have yet to test if the distortion backpropagates over the power rails or if it is due to the input/outputs themselves or possibly through the breadboard picking up generally.But the conclusion is, measuring the same point in a circuit (output of 2nd stage) can have a drastically different result once the 3rd stage is connected, just because the 3rd stage cannot realize the gain of 11 (or 10) due to hitting its rails limit,notbecause the output of the 2nd stage is loaded too much by the 3rd stage.

author: BillyO
author_rank: Super Contributor
timestamp: December 16, 2022, 02:15:37 am
content: This is a bit confusing. Perhaps your power supply is very much lacking in both voltage and current capability.

author: maelh
author_rank: Regular Contributor
timestamp: December 16, 2022, 02:35:33 am
content: Quote from: BillyO on December 16, 2022, 02:15:37 amMaybe I didn't explain myself well. The power supply will provide +5V and -5V and enough current as required by the opamps. What I meant is that the amplification is so strong that when the input signal is 10mVpp it can exceed the limits and the 3rd opamp will clip since it hits the rails: 10mV*11*11*11 = 13.310 mVpp = 13.31 Vpp. But opamp only gets 10Vpp (and could handle at most 12Vpp as per the datasheet).And that distortion is not only visible in the output of the 3rd opamp but also all the way down the signal line in previous stages.(If anybody is wondering, I usually will have very low input voltages, hence the strong amplification. It would probably need some AGC later on to prevent clipping, but I wanted to keep it simple first and understand what happens here.)

author: maelh
author_rank: Regular Contributor
timestamp: December 16, 2022, 02:46:17 am
content: Quote from: Doctorandus_P on December 15, 2022, 05:39:52 pmSorry if this is trivial, but isn't the capacitor "canceling" out the parallel resistor with HF?And if the resistor is in series, it will slow down the charging of a capacitive load. So is it really that a capacitive load would cause a strong AC current which is limited by the resistor? Finally is there some rule on how you came to the conclusion to use 100 Ohm specifically?QuoteI thought this was because of the 100Ohm resistor in the negative feedback loop, but it wouldnt form a voltage divider with a resistor on the opamp output, so I am a bit confused.Sorry for the many questions.Quote from: Doctorandus_P on December 15, 2022, 05:39:52 pmCouple capacitively through the breadboard contacts? Would it still happen when using "air" wires?Quote from: Doctorandus_P on December 15, 2022, 05:39:52 pmGood idea, I'll have to see if I have some that are suitable for the 10MHz range.

author: BillyO
author_rank: Super Contributor
timestamp: December 16, 2022, 05:37:23 am
content: Quote from: maelh on December 16, 2022, 02:35:33 amOkay, thanks for the clarification. I was not as confused as I thought.So, obviously the supply voltage is way too low for the "expected" gain over the input. You should have allowed for this .. really. Next, if the other stages are being affected by the clipping of the 3rd stage, then the current of the supply isNOTsufficient to deal with the load. I do not know if this is due to the supply appliance itself or the wiring from the supply appliance to the op-amps, but something is being strangled if there is feedback due to rail clipping. Perhaps we need a good, clear, in focus photo(s) of your set-up to provide real help here. Whenever breadboards get involved trouble follows.I have (almost) given up on breadboards. PCBs are so cheap these days I resort to just using (at least) a couple of iterations of PCB to get things right. First, they eliminate a bunch of erroneous crap related to breadboards, 2nd, if laid out the first time with modifications in mind they can be remarkably easy to modify for final layout. Unless your boards are huge, two iterations will cost only about $15. Three iterations about $21. Shipping in. Vs hours of mucking around with fatally flawed breadboad layouts.Breadboards need to be laid on the pile of"CRAP"in the history room.

author: maelh
author_rank: Regular Contributor
timestamp: December 16, 2022, 06:27:55 pm
content: I will try to build it now as soldered circuit and figure things out along the way. The breadboard is just too sensitive to minor changes which makes the opamps go into oscillation even without any input signal. Especially the feedback resistors seem to be prone to trigger this (accidental touches/minor movements). Once it started it's hard to make it stop again, even when switching the power off, maybe some charged capacitances of parts being too physically close to each other.Edit: Actually the feedback resistors were just shorting out briefly, which made it look like the noise problem was solved, but it just reduced the gain temporarily

author: EPAIII
author_rank: Super Contributor
timestamp: December 17, 2022, 07:17:12 am
content: The 1uF capacitors as shown in the original diagram remove the DC reference point from the inverting inputs. That means that the only DC reference is at the non-inverting input of the first stage. So, with 11X gain in each stage, even a small DC offset at that input will be amplified by 11x11x11x11 times (14641 times). A 0.01 V offset will become 146 Volts. I'm surprised you even see noise at the output. I would expect either +5V or -5V or a 10Vpp square wave.Those inverting inputs need a DC reference point. TAKE THOSE CAPACITORS OUT! And connect the 100 Ohm resistors to a ground point which is half way between your + and - supply Voltages.Then, I believe you should have some resistance between the output of one stage and the non inverting input of the next stage. With the 1K and 100 Ohm divider on the inverting input, something between 100 and 1K Ohms should be the range. The data sheet for that op amp may have some suggestions/equations for this.You can AC couple the stages if you wish or if that's needed to to keep the output close to centered on ground.Edit: After looking at the data sheet, I noticed that it does not call them op amps. Instead they are called Voltage Feedback Amplifiers. So at least some op amp design rules may not apply.Another thing that I saw was what appears to be the use of multiple filter capacitors at both the +Vs and -Vs power inputs. One diagram shows three capacitors on each (4.7, 0.01, and 0.001 uF) and another shows two (10 and 0.1 uF) on each power input. I would assume that should be done for each IC package you use. Looks to me that the boys and gals who designed this chip ran into some of the problems you are seeing. If you are not following this filtering scheme, I would add it.

author: Ian.M
author_rank: Super Contributor
timestamp: December 17, 2022, 10:21:57 am
content: Quote from: EPAIII on December 17, 2022, 07:17:12 amErrrr..... *NO*.Does a unit gain OPAMP buffer need a resistor to ground on its inverting input? No, because its connected to its output.With the capacitors effectively eliminating the lower resistor of the feedback divider at DC, the presence of a resistor on the feedback path makes no difference to the gain at DC, its unity. It does however slightly affect the offset voltage as the -IN bias current must flow through it. Worst case the total offset over four stages will be under 25mv, and I'd expect a typical offset an order of magnitude smaller.Quote from: EPAIII on December 17, 2022, 07:17:12 amLooks like an OPAMP, quacks like an OPAMP, smells like an OPAMP, is in Analog Devices' "Video Operational Amplifiers (Op Amps)"product selector.1K resistors between stages may make the situation worse as the resistor and its parasitics will combine with stray capacitance to form a filter that is likely to make it impossible to predict the total gain @10MHz. Of course the O.P's breadboard wiring's inductance may already form such a filter, probably causing HF peaking and instability. Its suck it and see territory, and if I was inclined to try adding inter-stage resistors, I'd start *MUCH* lower, e.g. 27 ohms. See datasheet fig.41.Quote from: EPAIII on December 17, 2022, 07:17:12 amYes, that's a strong hint that good layout and good decoupling is essential. The test jig circuits are drawn with the three decoupling caps and the power feed to the power pin star connected to emphasise how close to the pin they need to be.@maelh: You thought *I* was anti-breadboard?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: December 17, 2022, 10:41:01 am
content: Quote from: EPAIII on December 17, 2022, 07:17:12 amJeez man, relax, go yell somewhere else.As you may have read earlier, when two stages are built "it works".It is true that opamp inputs always need a DC path, but the DC currents are small, and I mean very small. (nano or pico amperes) and in this circuit they have a DC path from the output of the opamp.This way of AC coupling is very common to eliminate the amplification of DC offsets (But it can't remove the offsets, it just does not amplify them). This method is used extensively all over the place. See for example the datasheet of audio amplifiers such as the TDA2030 and any other application where a high amplification is needed such as PIR sensors.To Maelh:That your circuit goes haywire mostly as the last output stage turns into saturation is an indication to me that there is feedback though the power rails. Also, feedback combined with phase shifts equals instability and oscillations. And if you amplify 1000x then a feedback of 1/1000 of the output already equals a closed loop gain of 1 and thus oscillation. Wires always have some resistance, and therefore, a current though a wire always causes a voltage drop. One common method to mitigate this is to use star grounding. This means you designate a single point as a "clean gnd", and then route an individual gnd wire from that point to wherever you need a gnd reference in your circuit. Remember: voltage measurements are always relative. You need two wires on your DMM to measure a voltage (differential).I'm also curious about your breadboard. Can you post a picture of it?When using resistors in a breadboard, you should always cut the leads of resistor fairly short (about 10 to 15mm). Never use resistors directly if you've pulled them out of the paper tape. Always cut of the ends. When you pull resistors out of the paper tape, some glue residue will stick to the wire, and when you insert that in your breadboard it will accumulate over time and make your breadboard unreliable.You can also make an approximation of a star ground on your breadboard by placing your wires carefully.

author: Calvin
author_rank: Regular Contributor
timestamp: December 17, 2022, 01:18:36 pm
content: Hi,why not use inverting stages throughout?Can also be DC-blocked with series Caps.Should at least get rid of those commonmode distortions of noninverting stages.regardsCalvin