# Why is this op-amp circuit oscillating?

The 40 dB gain op-amp circuit below oscillates (rail to rail) at around 140 kHz when there is no signal generator driving Vin. With a signal generator driving Vin at 10 mVpp it's fine with signals 15 kHz up to 100 kHz (range of interest). Even at an input of 140 kHz (the oscillation frequency) it's well behaved, albeit gain has dropped off as expected, but it doesn't oscillate rail to rail, just a nice clean sine.

The op-amp is an MCP6294 (10 MHz). See below the open loop gain/phase curve from the datasheet which I've annotated to check stability criteria. Where loop gain = unity @ 100 kHz, the phase shift is -90 so it should be stable by a good margin.

The scope trace is also below. Magenta is point A (Vin), yellow is point B (op-amp +), blue is point C (Vout). All traces AC coupled. Pt A & pt B are identical as expected.

My initial thoughts were that maybe Vin is sort of 'floating' with the 1 MΩ to ground being a large resistance, hence why the problem only occurs without the signal generator attached. But I don't think this is the case, e.g. it has only 10 kΩ from its + input to the divider at point D, so it has a fairly low resistance DC path to 0 V/Vcc regardless of the signal generator being connected or not.

I also measured point D (not shown in the trace below). It was nicely stable at Vcc/2 and showed no oscillation. So the oscillation on the + input is all across R6. This also puzzles me as I can't reconcile the current that must be flowing through R6 as the voltage across it oscillates with the tiny input (pA level) bias currents of the op-amp.

I tried some experiments to simplify the circuit to try and narrow things down. I first removed R4 and C2. This made no difference; points B & C were the same as before. Then I removed the load C1 and R1, and connected the scope directly to the op-amp output. Again no change, exactly the same oscillation.

Any ideas much appreciated!

PS I'm a beginner to this so welcome any feedback if I'm making some rookie mistakes. Trying to research as much as I can to teach myself (reading the Art of Electronics and web) but I'm pretty stuck on what's happening here. Any other good references appreciated. Note: C5 = 0.1 μF  • How's the behaviour in terms of simulation? Can you share the simulation file? Can you try adding a small resistor between your op-amp output and the load? Jan 1 at 21:37
• The MCP6294 is a quad op amp. The other three op amps must be properly configured. What we call tied-off. The out and -input connected together and the +input tied to ground. Jan 2 at 2:02
• The capacitor C5 in the LTspice diagram has no value. Is this capacitor connected in your circuit? Jan 2 at 2:04
• Add a small cap of 100 pF across R5. Its value is rather large which allows stray capacitive feedback to become prevalent at high frequencies. Jan 2 at 10:48
• nice scope for a rookie Jan 2 at 11:04

First priority: is the circuit as described? What is the layout?

Second priority: does the explanation actually reproduce the problem?

Third priority: propose a solution; does it actually solve the problem, without causing other issues?

## Experimental

Let's reproduce the problem, and then explain it. While I can't be sure this is using the same layout, it seems a likely cause, but more on that in a moment.

First, let's simplify the circuit. R4, C2, C1 and R1 can be removed entirely, having no effect on the circuit, or at the oscillating frequency. (Some argument can be made for C1+R1, depending on the amp's output impedance at high frequencies; but likely it's still a negligible effect.) R6 and C3 can be removed, since R2 || R3 has almost identical Thevenin resistance and the lowpass is unimportant at this frequency. (Presumably this is intended to reduce Vcc noise coupling into Vin? With this much gain, that probably is worthwhile.) Also C4's value is fairly unimportant, but we can come back to that if we need to.

This leaves us with this circuit: simulate this circuit – Schematic created using CircuitLab

I'm also using TLV2372 because it's what I have to hand. This is 3MHz GBW instead of 10, so everything should be about equal when Fosc = 41.5kHz.

Powered up at 5V (with a 1uF electrolytic bypass, and the other half strapped to GND), the output is a stable 2.5V as expected.

Can we make it oscillate? Without rearranging too many connections, we can probably make a multivibrator by adding a capacitor from VO to -IN. Let's see how that looks: simulate this circuit

This gives the waveform: Ch1 is +IN (AC coupled), Ch3 is VO (DC coupled).

That doesn't look very close, though. Let's see what happens as C2 is reduced:

33pF: 10pF: Note the Ch1 scale is now much finer. Frequency is higher than predicted, and the waveform still doesn't look right, so it's not clear if there are other differences, in circuit, layout, or the op-amp (though the latter seems likely).

I don't have smaller values, so let's try a different tack. And now I need to show the layout myself: Notice the blue jumpers connecting empty positions by VO to +IN. Solderless breadboards are notoriously capacitive, about 4pF between adjacent strips. Evidently this should add about 8pF. With your 10MHz op-amp, perhaps one slot pair would be enough.

The waveform is suspiciously similar: Notice the double-humped sort-of-triangular waveform at the input, and its relative phase. We now see that it's not so much a humped triangle, but a pulse-then-return-to-zero waveform that just doesn't spend much time returning to zero!

## Solution

Simple: don't do that! Mind the capacitance of the breadboard. Don't mix inputs and outputs, especially over multiple parallel positions. Move it to perfboard or copper clad (deadbug or Manhattan style), or make a PCB. Anything to counter the capacitance will do; a few pF in parallel with R1 basically balances the capacitive divider thus formed.

This effect might even be a little helpful, if you're going for optimal bandwidth: some peaking should be possible. I think a shunt capacitor on -IN would be the preferable way to do that, but whatever works; mind that you can easily take peaking too far and end up with an oscillator (like this!), and GBW isn't always the most stable characteristic so you might not get great repeatability this way. This also increases the noise level around cutoff (because, quite literally, the noise gain is being increased there).

If you need bandwidth, the easy way is to simply get a better amp. Also consider decompensated types, which are NOT unity-gain stable but offer proportionally higher GBW. Or if you have a free half, just cascade both at Av = 10 each.

Or if gain and distortion aren't very picky, you might even use a discrete circuit; a couple BJTs will achieve around this gain well enough. But the op-amp is probably the simplest (and maybe even cheapest).

## Other

What didn't work:

• Splitting the feedback resistor (R1 / original R5) in half and loading that with capacitance (so, 47k + C shunt to GND + 47k); this only oscillated with a quite large value (22nF+) and at quite low frequency (<1kHz). This more than rules out "stray capacitance due to its large value" as an explanation.
• Loading -IN with capacitance. Even with 47nF shunting to GND, the loop remained stable (peaked, yes, but not unstable). This more than rules out stray capacitance here as an explanation.
• Likewise, loading between inputs with capacitance. This does produce oscillation, but only with rather large values: 4.7nF in my test, and then at quite a low frequency (7.1kHz). (The value is proportional to C1.)
• Swapping inputs. The output simply latches in one state, for most obvious miswirings; the motivation here is, a traditional multivibrator circuit has positive (static) feedback, and negative feedback which dominates at low frequencies (typically an R-R divider (plus biasing) from VO to +IN, and an R-C divider from VO to -IN). The problem is the coupling cap, which breaks DC feedback so it just charges full and the inputs never cross again (stays latched).
• thanks so much for such a thorough and detailed explanation and your experiments. Lots for me to learn here. I just measured the capacitance of my breadboard with one of those component analyzers, no idea how accurate it is but it came back with 3.4 pF. I will try to improve layout with all this in mind. I'm guessing the reason it goes away when a connect my signal generator is that it provides a low impedance path to ground (50 ohm) so the voltage can't build on the +ve input. Is that right? Jan 3 at 18:08
• To follow up previous comment, I examined my layout closely. Referring to my original schematic in the question the node at junction R6, C2 +IN (point B) was brought together on the breadboard on the row directly adjacent to the row with the op amp output pin in it. Moving these connections just one row further away and the oscillations stopped. A valuable lesson learned. Jan 3 at 18:54
• @mountainmad All correct. Another tip: ground the slot inbetween so it's not simply two capacitors in series between OUT and +IN. A little more capacitance on +IN doesn't seem to be a problem, but the shielding helps further. Jan 3 at 20:11

What’s happening here is that the amp is normally kept stable using negative feedback (some of the output signal is fed into the inverting input of the op-amp). However, as the frequency goes up, the phase lag of the op-amp becomes significant, and this is exacerbated by C4 which will tend to make the feedback lag further. Once the phase lag exceeds 90 degrees it’s no longer negative but positive, so the op-amp will become unstable.

• You might find that a small amount of feedback into the positive input will help, thus should be done with a reasonably large resistor and a small series capacitor to give a time constant that’s around the self-resonant frequency (140kHz is around 7us per cycle so an RC if 2us is a good place to start).
– Frog
Jan 1 at 21:20
• The overall effect should be that the phase of the feedback more or less tracks the phase delay of the amplifier, so the gain is constant across the usable frequency range.
– Frog
Jan 1 at 21:22
• thanks for the answer, as you suggest the feedback loop with C4 could add more lag and increase chance to oscillate but then I don't understand why, when I connect a source signal, it all works perfectly including at the frequency of the oscillations I get when no signal connected Jan 2 at 19:50
• I’m speculating but I suppose that the op-amp is trying to achieve two different things - on the one hand it will tend to amplify very small signals (noise really) at 140kHz to generate the unwanted instability, but it’s also a stable amplifier at lower frequencies. I’m guess that the lower frequency behaviour will dominate if it’s of sufficient amplitude, but the higher frequency behaviour will dominate if the low frequency input is small or zero.
– Frog
Jan 2 at 20:20
• Thinking of it another way, the oscillations occur when the amp switches rapidly between ‘push’ and ‘pull’ modes, but with a low frequency input it remains in either push or pull most of the time. I hope that helps a little.
– Frog
Jan 2 at 20:20

The input has a signal on it that shows the effects of output clipping. Where does the positive feedback come from? The rows of contacts and wires all over the place on a solderless breadboard causing high frequency capacitor coupling from the output to the input!

• This coupling gets a chance because the input impedance from R4 is too high. See my answer Jan 2 at 11:18
• R6 resistance is 100 times less than R1 and is in parallel. Stray capacitance on breadboards guarantee to have a high gain non-inverting oscillation. Jan 2 at 18:14
• @Audioguru I think you meant R6(10K) is 100 times less than R4 (1M). However as I noted in my experiments I tried completely removing R4 and C2 - the behavior is identical, it still oscillates Jan 2 at 18:40
• @Audioguru by making R4 smaller, you will kill the signal received from the stray capacitance of the long wires hanging on the input pin Vin. Jan 3 at 10:11

If you use a large feedback resistor R5, this combines with the opamp input capacitance and stray capacitance to form a lowpass. As a result, the negative feedback becomes increasingly weak at high frequencies, although the opamp still has gain at those frequencies.

The result is an oscillation due to essential lack of stabilizing feedback.

A small capacitor across R5 solves this. 100 pF is a starting point because it is a lot higher than the potential stray capacitances, so that high frequency feedback is almost unattenuated. It will also reduce the gain bandwidth of the amplifier, however. So you can experiment with smaller values such as 10 pF if you need a large bandwidth.

• I think the real answer is more interesting than this (seems to be bad layout), but the stabilization is correct. Jan 3 at 3:02
• Thanks tobalt. I'll work first on layout per Tim Williams answer, but its useful to understand this stabilization approach too. Jan 3 at 18:14

The op-amp has GBW of 10MHz. You want to use it up to 200kHz or so. Note that "range of interest" is not quite what you need. You want the response to start rolling off somewhere, and that better be somewhere you have control over, and not merely dependent on the process spread of the FAB where the chips were made.

10MHz/200kHz = 50x gain. You are using it at gain 100. The op-amp has no GBW left to perform its job. For this application, I wouldn't go far beyond gain of 15 or so. In fact, I'd just split the gain across two stages equally - 20dB each for simplicity. You then get a 2nd order filter for free, and a 4th order filter with a bit of design work.

Both stages can be stabilized further by placing a small capacitor across R5 - a couple pF. That should leave plenty of gain margin in both stages. There'll be no oscillation then. Since both stages are voltage followers at DC, the stacking up of offsets of two stages is not a problem. The 2nd (output) stage may need a bit more compensation in the feedback loop if there's enough parasitic capacitive load.

Unused stages must be configured within normal operating range - typically configured as voltage followers. The input must be within the common mode spec. Since this op-amp's common mode extends 0.3V beyond the supplies, it's OK to tie the two unused op-amps' inputs to pin 11. If the board has no ground plane, then the inputs should go to pin 11, and not merely tie to some nearby GND trace.

the oscillation has a period of 6 microseconds. That's not very high frequency. I would suspect a feedback over the power supply and the voltage divider with that 100 uF cap for the plus input.

Such voltage divider is a poor man's substitute for a symmetric power supply. Ideally you would have a dual power supply for plus/minus 5 V. But a better solution does not have to be expensive. Use a "real" voltage supply IC for creating the +2.5 V. Or, use a "voltage reference" IC for 2.4 V. e.g. https://www.conrad.nl/nl/p/stmicroelectronics-tl431acz-pmic-voltage-reference-shunt-instelbaar-to-92-3-155635.html for EUR 0.21 including VAT. This way, any ripple on the +5 V rail, caused by the (varying) load of the op amp, has MUCH less effect on the reference voltage at the positive input of the op amp.

You report an oscillation of 140 kHz. How does this match with a period of 3 divisions of 2 microseconds?

Then, you report oscillation only if no signal generator is hooked up at the input. Have you tried to see what happens if you short the input with a simple 600 ohm (or just 1k) resistor? It might be a clue that you suffer from parasitic coupling between the output and the input wiring, where 1M makes a too sensitive input. Signal generators may have a standard 50 Ohm output impedance, intended for coax with a characteristic impedance of 50 Ohm, and a 50 Ohm load, to avoid reflections. So why 1 M Ohm?

To get a lower input impedance, around 50 ohm, R6 and R4 in parallel should result in 50 ohm, so both are now way too large. R6 is large to not load the mid-voltage source, so R4 needs to be 50 ohm. The C2 input cap may be made larger, depending on your input frequency range.

Good Luck!

• Of course the output and its in-phase clipping distortion is capacitively fed to the input because it is built with a mess of wires on a breadboard. Jan 2 at 15:44
• @Roland thanks for the helpful suggestions. On the frequency I read it off the scope (top right) which estimates it off the trigger 138.9 kHz. I did try shorting the inputs to 0V as you suggested, in fact 22k kills the oscillation. The 1M I've ruled out - I have removed it (R4) and C2 and the circuit still oscillates exactly as before. The signal generator is 50 ohm by default, my intention was the input impedance of the circuit was 10K (which I thought I had). I'll spend some more time looking at the mid Vcc Vref point to see if I can spot any issues there. Thanks again Jan 2 at 18:47
• @mountainmad I changed to 50 ohm in my answer. From your comment I understand that making R4 smaller fixes your oscillation problem. I recommend 50 ohm, but feel free to use a larger value, as long as reflections do not pose a problem, just 1M is too large. In fact, 1M is only too large if you don't want oscillations when no input is connected. The voltage ref ic is just an optimization, hence optional, as you asked for any ideas and feedback. Feel free to upvote and/or accept useful answers/comments Jan 3 at 10:04