# RC oscillator with op amps

I am a physics student at a university and because of the pandemic, I and my classmates have to simulate our electronics lab exercises in Micro-Cap (version 12). We've got schematics like in this picture.

Our goal is to find the right resistance of potentiometer RP, so that the voltage in point B will oscillate. However, it looks like the voltage in the point B is independent of the resistance of RP. It oscillates with a resistance of 1 ohm as well as with a resistance of 58 kohm.

P.S.

I have little experience with oscillators and op amps.

Many of you pointed out that V4 and V5 should not be sources and that I confused them with meters. This is the symbol used in the original schematics in places of V4 and V5:

### Update

I edited my schematic: removed the voltage sources and connected the X2 op-amp in inverting input. Here is an image:

Also, I tried to set an initial voltage on C1 capacitor to 1 V (link to manual). Here is how my transient analysis looks like:

I used these settings:

The maximum resistance of the potentiometer RP is 200 kΩ and the wiper is in the 50% position.

### Update

Now it works! Here is my final schematic:

• The phase shift oscillator above uses three RC stages so that there is a way to get 180 degrees out of them, as two wouldn't be able to make it. These RC stages attenuate (reduce) their input signal so that there's only a small bit left on the right side from the input at the left. The goal of this exercise is to find out how much gain the OPAMP must supply in order to make up for the losses in the 3 RC stages. If you are seeing oscillation taking place, then you want to reduce the gain until it stops, then increase the gain until it starts. Find the "sweet spot" where this happens.
– jonk
Commented Apr 7, 2021 at 19:24
• You may see various examples here and see the required gain calculated here for similar arrangements.
– jonk
Commented Apr 7, 2021 at 19:26
• Point B is directly connected to the voltage source V4 so the voltage at point B will be equal to V4. If V4 is oscillating then Point B will always be oscillating. You must be missing something in the circuit. Commented Apr 7, 2021 at 19:29
• V4 and V5 don't belong there. Take them out and try again, or justify why you put them in. Commented Apr 7, 2021 at 19:40
• "Many of you pointed..." I'm sure many of us have tortured students just by inventing puzzles like this and have seen the most common rookie mistakes. If you claim V4 and V5 should be sine voltage sources someone should kick you back to the rails. Hopefully you can tomorrow laugh yourself your rookie mistake.
– user136077
Commented Apr 7, 2021 at 20:13

The voltage of point B is fed by voltage source V4. Nothing else in the circuit affects it, V4 outputs what you have written it to output. The circuit is not an oscillator.

I do not know all versions of Micro-Cap. You may have a possibility to insert an internal series resistance to V4, but I guess it's now = zero ohms. Those versions of Micro-Cap that I have tried no invisible internal series resistance can be inserted to voltage sources.

ADD: There's comments where the questioner say that V4 and V5 are sine voltage sources. To make the circuit to have a possibility to be an oscillator those voltage sources should be simply wiped off because they rigidly output certain predefined voltages. The lecturer in the school may have drawn there in the places of V4 and V5 voltage meters to show that those voltages should be inspected in transient analysis.

Another good idea to check the oscillation possibilities is to keep V5, remove the wire between R3 and X1 and check with AC analysis is there a frequency where the amps+the RC network together cause exact 0 or 360 degrees phase shift and amplify more than attenuate. V4 should be removed also in this case.

• I am using Micro-Cap 12 Commented Apr 7, 2021 at 19:21
• if I remove V4 and V5 completely, there is constant 0V in point B Commented Apr 7, 2021 at 19:42
• Run transient analysis WITHOUT searching at first the operating point. The oscillation should build up gradually from noise. The opamp noise may be left out of the model, but you can give a kickstart by charging one volt initial DC to one of the capacitors as a state variable. Have big enough Rp to make the amps amplify more than the RC network attenuates at the frequency where the RC network causes phase inversion. Otherwise no oscillation will happen.
– user136077
Commented Apr 7, 2021 at 20:07
• Can you please look at my update? Commented Apr 7, 2021 at 22:24
• @Velitar Ouch! you have removed V4, but not by wiping it off, you inserted a wire in the same place. Then you removed the ground from the bottom ends of R1, R2 and R3. The phase shift functionality is totally disabled. Fix it.
– user136077
Commented Apr 7, 2021 at 22:37

What you have is called a phase-shift oscillator. There are many web sites with the design information, in both linear and matrix algebra.

What are V4 and V5? If they are measurement points, fine. But if they are voltage sources, the standard circuit and design methods will not work.

Search for phase shift oscillator schematic. Each of the images has a site attached, so it should be easy to find one with an explanation geared for your level of understanding.

• I agree, I think Velitar assumes V4 / V5 is something it's not. Commented Apr 7, 2021 at 19:11
• from schematics I got from my teacher it looks like V4 and V5 are sine wave source Commented Apr 7, 2021 at 19:18
• @Velitar unfortunately it doesn't make much sense connecting voltage sources to the output of one op. amp (make it useless) or to the input of the other (making the preceding circuit useless). Maybe your teacher mixed the symbols. Commented Apr 7, 2021 at 19:27
• @vangelo if I remove V4 and V5 completely, there is constant 0V in point B Commented Apr 7, 2021 at 19:43
• Some simulation programs have a difficult time with oscillator circuits, because with ideal components there is no noise to start oscillation. Commented Apr 7, 2021 at 19:53

It looks like your intent is to measure the voltage at V4 and V5. But instead of putting a probe there you put voltage sources.

I am not specifically familiar with Micro-Cap but you probably need to put a voltage source on VC and VE so that the op-amps have power.

As for the correct potentiometer value...

• The op-amps (without the pot) are configured for a constant gain of -1, which is a phase shift of 180 degrees. At the oscillation frequency the phase shift in the network of R1, C1, R2, C2, R3, C3 will be add another 180 degrees to make 360 degrees around the whole loop.
• You can therefore determine the oscillation frequency by finding the frequency for which the RC network has 180 degrees of phase shift.
• Once you have found the oscillation frequency you can determine the value of the RC network transfer function (H) at that frequency.
• The op amp gain (G) is -(RB + RP) / RA.
• You need the magnitude of the overall gain around the loop to be > 1 in order for the oscillator to work. Put mathematically G * H > 1.

So basically find the transfer function of the RC network. Find the point where the phase shift is 180 degrees. Finally solve for the value of RP that gives G * H = 1, and that is the minimum value of RP.

• Please see the last question edit (marked as EDIT). Also, there are sources connected to VE and VC, they are just not shown in the schematic. Commented Apr 7, 2021 at 19:56

I'll not comment further on the issue regarding the two sinusoidal voltage sources and the fact that the circuit below uses a single inverting amplifier (the one in your circuit is a non-inverting amplifier and the first is a buffer).

You may need to "jump-start" the simulation with some energy, otherwise it may just react to some "numerical garbage" and settle to 0V in all nodes.

A transient analysis of this circuit:

will not oscillate in LTSpice:

But if C1 is set to an initial condition of 1V:

There probably is a way to do the same with the simulator you are using.

• Thanks, this is very helpful because now I know how it should look like. Also, can you please look at the update? Commented Apr 7, 2021 at 22:26
• Couldn't the non-oscillation be due to some non-linear effect (e.g., leakage currents or input diodes in the op amp model)? Perhaps it is actually (very marginally) stable for low signals? After all, a true sinusoidal oscillation usually require some sort of non-linearity (otherwise the amplitude would grow without bounds). What if the corresponding initial conditions are only a few orders of magnitude above the 50 µV offset voltage or 250 pA bias current? Commented Apr 8, 2021 at 10:03

if I remove V4 and V5 completely, there is constant 0V in point B.

You may have run into a limitation of the simulator.

At t=0 or start, many simulators simply find the "DC operating point" to preset all nodes to their DC voltages. This is fine for most circuits, but it can present a problem for simulated oscillators. In the real world, nodes would never exactly be any specific voltage, or stay there for a long time, because tiny bits of noise permeate everything. But here in the simulator, nodes are set to precise values and there is no noise. This can "lock" an oscillator because this noise (or at least some difference in node voltages) may be required to have any changing signal to begin with, then amplify, and ultimately oscillate.

If you can insert an "initial condition" on one of those nodes (such as B) of something other than its DC operating point (say 2 V instead of 0 V), that might be enough to get the oscillation going. I'm not sure how that is done in Micro-Cap; check the help.

As the RC HPF phase shift of 3x 60 degree= 180 degree phase shifters is RC= 100ns =T for the 3rd stage, in order to satisfy the Barkhausen Criteria threshold of instability (oscillation) the positive feedback for a sine wave must be Av=1 @ 360 deg.

## Tricky Tacky Details

However you will notice that each stage is not independent but “apparently” (pun intended) has either an load or source impedance that is not 0 like the 1st stage comes from 0 Ohms. So the phase shift is not exactly = 3x RC but slightly higher. (If R was 1,10,100x and C= 1,0.1,0.01x then it would almost be isolated but with same RC=T. Nevertheless an approximation will do using a pot to expect >6dB per stage and not quite -60 deg per stage ( and thus more gain compensation)

Nevertheless intuitively you know at 45 deg the attenuation of an RC =T network is when | Xc(f)| = R and -6 dB and to get 60 deg, a higher frequency. Is required with more attenuation which you can solve with trig.

Thus as all good 1st yr Physics students shud know in lab work, how close does your computed values match your result with the tolerance stack up of your components in order to validate your theory. Getting it to work is not enough. You must learn to analyze all the sources of error.

There is an expression for “goodness” on the error in order to validate your theory of prediction and apparent loading is a predictable error. (Besides the brain farts)

This is more important than the low Q phase shift Oscillator design.

Q is ratio of the fo/ BW - 3dB of this low Q (high phase noise, an fo tolerance).

These have nothing to do with Op Amp experience using any general purpose part, however high speed ones used for low frequency with a gain >= 1e6 may have a tendency to oscillate at their own max frequency from parasitics with the added positive feedback and another zero at Av=1 internally at GBW/1.

So in future if you see any unstable ringing from step response, look for parasitic coupling to positive feedback or mismatched driver to cable impedance.

One final thing is as the Op Amp hits saturation the gain goes from 1e5 (ish) to zero , yes that’s “0”, so limiting will not change with a small change in input (gain=0). But before this cliff, the gain will reduce enough to soft limit the loop gain with the correct value of pot to affect the total harmonic distortion value or THD and yield a decent sine wave. But in future don’t use this design, there are better ones.