OpAmp Oscillation

Started by KimJongFun, December 09, 2017, 09:22:06 AM

Previous topic - Next topic

KimJongFun

Hey,

I finished building my second pedal and I suspect that the op amp is oscillating.

Today I changed some capacitor's value to lower down the high frequencies, hopping it would work, but it didn't help or very little.
Yesterday I tested to touch the legs of the first op amp (so in parallel with C10) with the only small capacitor value I had at home... which was 0.056u, which is way too high but it removed all the hiss and screaming, so I was hopping that a 1n in that spot would do the job (I chose 1n because a higher value would cut too much high frequencies, I don't want to change the responce too much).
I plugged my pedal into my scarlett 2i2 (I don't have an amplifier) and I can still hear the pedal screaming like crazy.

The schematic:


Unlike what I expected, because there is nothing behind it, another high pitch noise appears when the Master Volume pot is at 9 o'clock and beyond.

All the ceramic capacitors are NP0, the exception are the bypass caps which are X7R (the only reason why I chose X7R over NP0 for the power supply part and bypass capacitors is because they are cheaper).

I'm also wondering if the problem isn't coming from the layout of the board itself or not, so here it is:


anotherjim

Is the unused half of IC1 responsible? It looks like you've tied it up safely, but pin5 is at 0v. That's ok if the TLC2272 is happy with pins at the -v supply. It's CMOS, so it probably should be ok, but the safe choice is to tie pin5 to Vref (your VA).  A smart move then is to use the output of that op-amp (since its wired as a unity buffer) to supply VA to the rest of the circuit.

Maybe there should be a DC blocking cap between Q2 and IC1a pin3.

Lower VA voltage divider resistors could help. I'd never use less than 10k for those, I don't know why so many designs try to use higher - unless it's buffered by an op-amp as I suggested above. VA needs to be a low impedance or signal gets on VA which, as it feeds op-amp + inputs causes positive feedback = oscillation.

R.G.

Oscillation can be a difficult thing to understand sufficiently to track down and eliminate.

First, you should understand that in any amplifier circuit, if you increase the gain enough, it WILL oscillate. At some large gain, there is enough feedback through the tiny resistors and capacitances to make it oscillate.

You have a VERY high gain circuit there. You also have a single-ended power supply, which makes it prone to oscillation if the grounding paths are not very well thought out - that layout thing you're (correctly!) worried about.

The real advantage you're having here is that the oscillation is in the audio range, so at least you know it's happening. If it was ultrasonic or RF, you could not hear it, only that the circuit didn't pass audio.

I have a few suggestions. First - do you have access to a good oscilloscope? Sometimes you need this to figure out what is oscillating.

Next, I think you have a minor circuit flaw. and perhaps the entire reason it's oscillating. The collector of Q2 does not have a capacitor between it and the input of the first opamp. So it is directly affecting your Va reference supply. I think you should put a capacitor there to avoid having the second transistor change Va.

Third, divide and conquer. Temporarily disconnect R23 from the output of IC2A and connect it instead to Va. Did that help?
If not, leave that disconnected, then temporarily disconnect the output of IC1A from C12. Did that help?
Both of these actions are disconnecting some amount of the total gain in the forward amplification path.

There are other things that can be done to diagnose the issue, but these are the first steps in finding out which stages contribute most to the problem.

Just saw AJ's post. He's right. Those are some of those other things I mentioned. I'd include in that set adding a ceramic cap to ground paralleling the 10uF cap bypassing the Va chain.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

KimJongFun

#3
The schematic shows the lastest modifications of the circuit.

Before posting I tested the pedal, I had oscillations, I didn't use an osciloscope back then (I don't own one) so I tried to connect (or just touching to make contact) various capacitors in parallel with other parts of the circuit so after those little experiments, I added a capacitor to Q2 (100pf like Q1).
Then a capacitor to IC3B (1nf) and there was still oscilation.
Then I changed the capacitor in IC1A, and I still have oscillations, so I posted this thread.

Now I agree that the gain is a little bit too high and I will lower it down, because there is almost no change at the end of gain control (I will try an 8k resistor instead of 4.7k from the op amp feedback to ground).

Yes I do have an access to a good osciloscope.

And I will try the other suggestions.

KimJongFun

#4
update:
I cutted the leg of ic1b and I got rid of one of the high pitch noises that used to appear when the gain knob was increased, so indeed, wiring like I did was a stupid idea (I drew the schematic in may or june when I barely knew anything about op amps...).
But there is still one.
I have no noise when the eq section is set at noon, gain and master set at max, but noise appears when the eq is boosted (mostly high frequencies knobs), the noise appears earlier if all the controls are boosted.
If all the eq knobs are set to max, there is no noise when the gain knob is set bellow 12oclock.

Is there any problem with the board's layout? Because I didn't make it... I will probably make the next one but I want to know what problem it has.

Edit: 10k instead of 39k in the voltage divider made absolutely no difference.
According to lt spice a dc blocking cap after Q2 would make no difference, so a part from removing the active EQ part from the circuit do you have other suggestions?

KimJongFun

I found a fix, not too sure about the values, but it completly removed the high pitch noise at extreme settings:

The ltspice circuit is stable and does not oscillate, so it's hard to find values that will remove that high pitch without affecting the tone too much, I should ouput an audio signal and have a listen to see if it even matter here.
I can feel something is different but I wonder if it's not something else I changed... because I made two boards, one that was broken and I was too lazy to fix back then and a newer one, that a friend borrowed me, I made the changes on the broken board that I fixed and it doesn't feel the same plus I can't remember the changes I did and not did.

This plus the modifications made previously made the pedal silent and stable at extreme settings.

So thanks I guess? Even though I found the solution while googling "how to prevent op amp oscillation" ...
I don't have the link anymore but the article called that part a "snubber" and the issue was "capacitance load" something like that.
I will update this post if I find the article back.

R.G.

This is a subtle issue with nearly all opamps. A capacitive load on their output will push them toward oscillation. This was not too severe with the earliest opamps, as they were not super high open loop gain, and had lower internal frequency responses. But today's opamps are closer to "perfect" in the theoretical sense, and this pushes them toward higher sensitivity to capacitive loading. Internal frequency compensation for stability has become something the beginner just assumes is there, but it produces a fixed response to frequency internally that also adds to the sensitivity to external capacitive load.

Many opamps note this in their datasheets by stating the maximum capacitive loading, or the maximum capacitive load as a follower, which is the condition that is most sensitive to it. Circuit simulators vary in how accurately they model ICs in general, and advanced opamps in particular. SPICE simulators are only as good as the models they have to work with. High frequency response of complex opamps may be wildly different from the actual chip, or pretty good. It's not clear until you can actually test the real, physical circuit. As an apocryphal professor once noted, the real universe is only a special case - albeit an important one.

The cure is easy - insert a small resistance in series with the opamp's output before the capacitive load. If that fixes it, it was capacitive loading.

And always, always, always add good power supply bypassing caps physically near the chip's power terminals. Otherwise, the power supply can be the phase shift and feedback element that gets Nyquist oscillation going.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

KimJongFun

Quote from: R.G. on December 22, 2017, 07:30:14 PM
The cure is easy - insert a small resistance in series with the opamp's output before the capacitive load. If that fixes it, it was capacitive loading.

And always, always, always add good power supply bypassing caps physically near the chip's power terminals. Otherwise, the power supply can be the phase shift and feedback element that gets Nyquist oscillation going.

There is a 1k resistor at the op amp's output, I guess that the capacitive load could have been the guitar cable.
One way to simulate the value I needed was to use the output volume pot, but adding a 80 to 90k resistor on the ouput wasn't really appealing to me.

I've seen lower resistor value in other designs, such as 470, I chose 1k because I had a lot of them and it wouldn't lower the volume too much with the 100k master volume pot.

I had two type of noise in my circuit, one quiet which was there all the time and a really high pitch one that only happened at extreme settings.
The quiet one happened because the other half of IC1 was to ground, but cutting the legs of the unused part wasn't enough, the pypass cap of IC3 wasn't large enough.
Then the high pitch noise was removed once the really high frequencies were removed and the "snubber" added at IC3b's output.
The snubber alone did nothing, so did the low pass filter in IC3B's feedback loop.

I tried different bypass caps and only a really big one could remove the noise (470uF)
Cutting the really high frequencies (by adding a 1nF cap in the feedback loop of IC3B and increasing the value of the cap in IC1A from 100p to 1nF) helped, the bypass cap could have been lowered a little (I can't remember the values, I tested quickly and continued my researches) but it wasn't enough to remove everything.
Adding that resistor and cap to ground removed the noise almost completly and the bypass cap's value was reduced significantly (2.2u and I haven't tested lower values, but the 0.1uF was not enough).