13
\$\begingroup\$

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: enter image description here

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: enter image description here

  • 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.enter image description hereOutput 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.enter image description hereAgain 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 distortionenter image description here

Negetive Cycle : Reduced but still exist - distortionenter image description here 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)

After reading your comments and answers i tried the following:

  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:enter image description here 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.enter image description here 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!

\$\endgroup\$
13
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ Mar 12, 2018 at 10:23
  • 6
    \$\begingroup\$ 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! \$\endgroup\$ Mar 12, 2018 at 10:30
  • 3
    \$\begingroup\$ Excellent question presentation, as @MarcusMuller said. Upvoting. \$\endgroup\$
    – TonyM
    Mar 12, 2018 at 10:36
  • 4
    \$\begingroup\$ 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. \$\endgroup\$ Mar 12, 2018 at 10:37
  • 1
    \$\begingroup\$ Is your circuit built on a PCB or are you still at breadboarding stage? \$\endgroup\$ Mar 12, 2018 at 12:05

3 Answers 3

1
\$\begingroup\$

You are probably sinking too much current. Here is a section of the TI LM358 datasheet: LM358 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.

\$\endgroup\$
2
  • \$\begingroup\$ I did what you asked ... tried experiment 6 with 10k resistor, the distortions reduced but did not completely go away. \$\endgroup\$ Mar 13, 2018 at 4:00
  • \$\begingroup\$ @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? \$\endgroup\$
    – user110971
    Mar 13, 2018 at 5:01
0
\$\begingroup\$

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!".

\$\endgroup\$
2
  • 7
    \$\begingroup\$ 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.) \$\endgroup\$ Mar 12, 2018 at 12:42
  • 1
    \$\begingroup\$ @Tan: Your schematic still doesn't show any bypass caps. \$\endgroup\$ Mar 13, 2018 at 11:37
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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