# op-amp oscillators weird output

I am trying to build a sine wave oscillator using opamp, but i am getting weird output. Need help getting pure sine wave output.

Circuit Schematic:

Circuit Description:

The circuit is similar to regular 3 stage buffered RC phase shift oscillator (inspired from here). Op-amp U2B is added so that U1A amplifier resistor (R1, R2 & R3) have values in ten's of kilo-ohms (not 100's of Kohm). Oscillator Output is observed at U2B pin 7 (OUT). Two independent power supplies are connected as shown in schematic to get +15V / 0V / -15V.

R3 is used to vary amplifier gain. R4 & R5 are used to vary oscillator frequency. Target Output Frequency is 400Hz.

Problem:

• Top Waveform : IC U2B pin 5 (Non-inverting Input) w.r.t. GND
• Bottom Waveform : IC U2B pin 7 (Output) w.r.t. GND

The negative cycle of sine wave at U2B pin 7 (output) (Bottom Waveform) is distorted. This distortion is some kind of ripple/voltage oscilations. What is cause this? & How do I get rid of it?

So far I have tried:

1. My first guess was that there is a problem in -15V power supply. So I interchanged the power supplies, but the distortion still remained in the negative cycle. (I expect if there was a problem with the power supply the distortion should have been in the positive cycle after interchanging the power supply)
2. Changed IC U2 (LM358 Dual op-amp). Still the exact same distortion.
3. Changed IC U1 (LM358 Dual op-amp). Still the exact same distortion.
4. Added IC U3 as shown below.Output at U3A pin 1 (Output) is a pure sine wave like Top Waveform (in oscilloscope). So i removed amplifier connection (R1) form U2B and connected it to U3A. Then U3A's output also got distorted like Bottom Waveform (in oscilloscope) and U2B's waveform became pure sine wave.
5. Used IC U3B as shown below.Again output at U3A pin 1 (Output) gets distorted.
6. From the above schematic i removed U3B and only added a 1 Kohm load at U3A pin 1 (output), again the output is distorted but this time the distortion is lower.

The Question is a bit long, but I wanted to provide as much details as possible. I have been cracking my head over this for two days. Please help. TIA.

Edit:

1. As Bimpelrekkie suggested in the comments I added one 100nF capacitor near each IC (dual-opamp) and also two 1uF capacitor between +15V / 0v and -15V / 0V. This had no effect on the distortion. I also added 22pf capacitor across R2 & R3. This reduced the the distortion but did not eliminate it as shown bellow:

Positive Cycle : No distortion

Negetive Cycle : Reduced but still exist - distortion But this is not something I want to do as it affects the sine wave frequency.

Also something i did not mention earlier, i thought the variable resistors (preset) might be causing the problem, so shorted them ,but to no success.

EDIT 2: (Problem Solved)

1. (Experiment 7) Olin Lathrop's & analogsystemsrf's (as mentioned in analogsystemsrf's answer the problem was about stability / phase margin but the output of U2B was not close to rails(+15V or -15V), it is 2V to 3V peak to peak centered at 0V) answers hinted me to understand stability and margins(tutorials). So i tried the circuit as given below: The output was oscillating (so the distortion were oscillations as indicated by many of you guys) and it wasn't a stable DC output. So then i disconnected R13 from -15V and connected to +15V and the output was stable. So something was pushing the opamp in unstable region during the negative half cycle of the sine wave (i don't know what).

2. (Experiment 8)So I Compensated the opamp using a snubber (as shown here). The final circuit is as shown below. And BRAVO !! problem solved. The outputs are now stable (with no unwanted oscillations / distortions).

Now, Even though the problem is solved, the question now becomes..

1. Why is LM358 stable at unity gains for positive voltages and not negative?
2. Could these type of problems be avoided just by choosing a proper opamp? If yes , how do i choose a proper opamp?
3. Is stability to be accounted (mathematically) for in all opamp circuits, or could intuitively (without calculations) decide that a circuit will be stable? (How?)
4. U2B had stability issue, why didn't U1B or U2A have the same issue? (I checked the output of these opamps and found them to be stable/pure sine.)

Lastly I would like to thank each and everyone of you for helping me solve this. Thank you very much!

• I do not see any power supply decoupling capacitors in your schematics. I would recommend adding a 100 nF and/or a 1uF capacitor across the supply pins of each opamp. Commented Mar 12, 2018 at 10:23
• I don't think your question is too long! I'm thankful for all the detail you give; much better than giving too little background. Have my upvote! Commented Mar 12, 2018 at 10:30
• Excellent question presentation, as @MarcusMuller said. Upvoting. Commented Mar 12, 2018 at 10:36
• Also: at least you tried to solve it yourself. You don't want to know how many first time posters come here only complaining that it doesn't work. Also you deduced that it is the interaction between U2A and U1A. +1 for using a systematic approach in finding the problem. Commented Mar 12, 2018 at 10:37
• Is your circuit built on a PCB or are you still at breadboarding stage? Commented Mar 12, 2018 at 12:05

You are probably sinking too much current. Here is a section of the TI LM358 datasheet: Assuming you have a swing of around 10V you will get a source/sink of around 10mA.

We like to think opamp behavior is independent on the output current, but this is not always the case. When your source/sink current increase the opamp performance deteriorates. So a stable opamp at 1mA can become unstable at 10mA.

Try to repeat your scenario 6 experiment but replace the 1k resistor with a 10k resistor instead.

• I did what you asked ... tried experiment 6 with 10k resistor, the distortions reduced but did not completely go away. Commented Mar 13, 2018 at 4:00
• @TanmayPatil are the distortions present throughout the entire negative cycle of the sine wave or are they localized around the trough? What about with a 100k resistor? Commented Mar 13, 2018 at 5:01

The basic problem is that U2B is oscillating.

Note that you are using it at unity gain. It seems these amps are intended to be unity gain stable, but there will of course be less margin there than at other gains.

So now you should look around and see why this one amp is oscillating when it shouldn't be. This is probably due to coupling within the package. That should be a strong clue causing you to check the bypass caps. That's when you should have slapped yourself on the head while exclaiming "D'oh! I forgot the bypass caps!".

• Sir, at the beginning the circuit had no bypass caps (which i should have added), after i encountered the problem, i made sure to check the waveform at +ve & -ve supply pins (which were stable). After Bimpelrekkie commented about the caps, i did add them but they were not usefull (as mentioned in the edit section of the question). (I assume by Bypass Caps you mean caps between +15V / 0V / -15V.) Commented Mar 12, 2018 at 12:42
• @Tan: Your schematic still doesn't show any bypass caps. Commented Mar 13, 2018 at 11:37

Given the circuit has nothing to constrain the amplitude growth, I'm thinking the peak voltages are forcing one of the opamps into near-rail-rail operation and the phase margin drops into unstable region.