Author Topic: RC oscillator  (Read 1962 times)

0 Members and 1 Guest are viewing this topic.

Offline syTopic starter

  • Contributor
  • Posts: 45
  • Country: au
RC oscillator
« on: June 12, 2024, 12:42:32 pm »
Hello,
I am having a play around with opamps and trying to create an RC oscillator using a single supply rail (0-5V).
The goal is to get oscillations happening at about 400kHz centered around 2.5V.
I am just trying to get oscillations happening at the moment, without worrying about the particular frequency it's at, however, the output of U2 seems to just sit at a constant value of 2.5V.
Can someone help me point out what I am doing wrong here?
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2067
  • Country: is
Re: RC oscillator
« Reply #1 on: June 12, 2024, 01:30:31 pm »
A couple of observations, R3, 4,and 5 are too low in value and kill the loop. Raise them to about 10k. Eliminate R6 and R7 and connect the inverting input directly to the last R/C stage. 400KHz in this style of oscillator will drift in frequency all over the place with temperature and VCC voltage drift. I didn't look up the specs on your opamp but you will need a minimum GBP of 4MHz or better to sustain oscillation at 400KHz. You would be far better off with a single I.C. designed for the job of oscillator and perhaps going to a single L/C resonant circuit. You can then drive a good buffer opamp and create the offset in the final buffer. Even the cross-coupled digital I.C. oscillators based on 7404 and such work poorly at this frequency range. There are some I.C. oscillators that use only one capacitor and one resistor but again, they tend to drift like crazy.
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6809
  • Country: ro
Re: RC oscillator
« Reply #2 on: June 12, 2024, 02:15:20 pm »
The second opamp has to have enough amplification (about x30) to compensate for the attenuation introduced by the 3 RC cells.  Yours has amplification x1.  Make R7 33k or smaller, and it might start.  Make it 22k to start faster.

C1 is not needed in simulation, but in practice might be useful.  In practice, you may also want to add a 100nF+10uF in parallel with the 5V power supply, too.


Offline syTopic starter

  • Contributor
  • Posts: 45
  • Country: au
Re: RC oscillator
« Reply #3 on: June 12, 2024, 03:06:14 pm »
The second opamp has to have enough amplification (about x30) to compensate for the attenuation introduced by the 3 RC cells.  Yours has amplification x1.  Make R7 33k or smaller, and it might start.  Make it 22k to start faster.

C1 is not needed in simulation, but in practice might be useful.  In practice, you may also want to add a 100nF+10uF in parallel with the 5V power supply, too.

Thanks RoGeorge, I totally forgot about correcting for the gain. Good news I can see the circuit oscillating now!

May I also ask how you got 20-30x attenuation on the three RC cells?

When I tried to solve for the attenuation, for one cell, I had |A|=RwC/sqrt((RwC)^2 + 1) with w=1/[RCsqrt(6)], R=10k, C=100nF.
Then for three cells, |A|^3 is about 0.054. So I would need a gain of 1/0.054=18.5 times. Is this the right way to go about it?

A couple of observations, R3, 4,and 5 are too low in value and kill the loop. Raise them to about 10k. Eliminate R6 and R7 and connect the inverting input directly to the last R/C stage. 400KHz in this style of oscillator will drift in frequency all over the place with temperature and VCC voltage drift. I didn't look up the specs on your opamp but you will need a minimum GBP of 4MHz or better to sustain oscillation at 400KHz. You would be far better off with a single I.C. designed for the job of oscillator and perhaps going to a single L/C resonant circuit. You can then drive a good buffer opamp and create the offset in the final buffer. Even the cross-coupled digital I.C. oscillators based on 7404 and such work poorly at this frequency range. There are some I.C. oscillators that use only one capacitor and one resistor but again, they tend to drift like crazy.

Thanks for the suggestions CaptDon. I tried as your suggestion and it worked well too although I don't quite understand why it works.

How does this circuit achieve oscillation without the 1Meg resistors?
I tried to place them there for a unity inverting gain so there would be zero phase shift

Also, how do we determine that the resistor values are too low, and hence, kill the "loop"?



« Last Edit: June 12, 2024, 03:07:55 pm by sy »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1603
Re: RC oscillator
« Reply #4 on: June 12, 2024, 05:13:57 pm »
The second opamp has to have enough amplification (about x30) to compensate for the attenuation introduced by the 3 RC cells.  Yours has amplification x1.  Make R7 33k or smaller, and it might start.  Make it 22k to start faster.

C1 is not needed in simulation, but in practice might be useful.  In practice, you may also want to add a 100nF+10uF in parallel with the 5V power supply, too.

Thanks RoGeorge, I totally forgot about correcting for the gain. Good news I can see the circuit oscillating now!

May I also ask how you got 20-30x attenuation on the three RC cells?

When I tried to solve for the attenuation, for one cell, I had |A|=RwC/sqrt((RwC)^2 + 1) with w=1/[RCsqrt(6)], R=10k, C=100nF.
Then for three cells, |A|^3 is about 0.054. So I would need a gain of 1/0.054=18.5 times. Is this the right way to go about it?

A couple of observations, R3, 4,and 5 are too low in value and kill the loop. Raise them to about 10k. Eliminate R6 and R7 and connect the inverting input directly to the last R/C stage. 400KHz in this style of oscillator will drift in frequency all over the place with temperature and VCC voltage drift. I didn't look up the specs on your opamp but you will need a minimum GBP of 4MHz or better to sustain oscillation at 400KHz. You would be far better off with a single I.C. designed for the job of oscillator and perhaps going to a single L/C resonant circuit. You can then drive a good buffer opamp and create the offset in the final buffer. Even the cross-coupled digital I.C. oscillators based on 7404 and such work poorly at this frequency range. There are some I.C. oscillators that use only one capacitor and one resistor but again, they tend to drift like crazy.

Thanks for the suggestions CaptDon. I tried as your suggestion and it worked well too although I don't quite understand why it works.

How does this circuit achieve oscillation without the 1Meg resistors?
I tried to place them there for a unity inverting gain so there would be zero phase shift

Also, how do we determine that the resistor values are too low, and hence, kill the "loop"?

Hi,

One way is to analyze the three RC sections to obtain the transfer function T(s) then set s=j*w and you'll have T(jw), then set the imaginary part of T(jw) equal to zero and solve for w which we can call w0, then insert w0 into T(jw) for w to find the attenuation G which is the amplitude with an input of 1 volt.  The required gain of the circuit is then 1/G.  This comes out to -29 so apparently you did not do the analysis correctly, try it again.

You then solve T(jw) for the phase angle ph using w0 again.  Verify that the phase angle is 180 degrees which helps to ensure you got the right w0.

The analysis is a little simpler even though it's a three stage network.  That's because all the R's are the same and all the C's are the same.

The above is the theoretically exact analysis.

You could also do a numerical analysis by first finding the transfer function T(jw), then solve for the phase angle ph(jw), then plot the amplitude of that versus 'w', notice what value of 'w' causes a 180 degree phase shift and that's your w0.  You can then insert that w0 back into T(jw) and solve for the amplitude, then take the inverse of that and that's the required gain of the original circuit.
You can set R=1 and C=1 when you do the numerical analysis, then scale them later.
See attachment.  Note that if you have any other resistance associated with R5 you have to figure that as being in parallel to R5.  Your first circuit had two 1M resistors in series and connected to a zero impedance source, so that would mean R5 would have a 2M resistor in parallel with it (2M comes from R6+R7).

You can also do this with a program if you write your own programs in Basic, Pascal, C, C++, etc.

« Last Edit: June 12, 2024, 05:33:12 pm by MrAl »
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6809
  • Country: ro
Re: RC oscillator
« Reply #5 on: June 12, 2024, 07:48:31 pm »
The second opamp has to have enough amplification (about x30) to compensate for the attenuation introduced by the 3 RC cells.  Yours has amplification x1.  Make R7 33k or smaller, and it might start.  Make it 22k to start faster.

C1 is not needed in simulation, but in practice might be useful.  In practice, you may also want to add a 100nF+10uF in parallel with the 5V power supply, too.

May I also ask how you got 20-30x attenuation on the three RC cells?

I didn't say 20-30 attenuation, I said about 30x (it's slightly less, about 29, but 30 or bigger gain will work, with gain 20 it will not oscillate).  I've remembered the value 30 by heart, from last time when I've read about phase-shift oscillators.  The analytic expression might be more complicated, because the cells do influence each other.

However, what is easy to remember it's the value ~30, and that 30 is independent of the R,C, or F values.  Though, the number of RC cells does matter.  For example, >30 gain is needed for 3 identical RC phase-shit cells, while for 4 cells the needed gain has to be >19.

Just as MrAI said before, you can let LTspice compute the exact numerical values.

The attached example measures the attenuation introduced by 3 or by 4 identical RC cells (either 3, or 4, or more RC cells will oscillate when the phase shift becomes -180 and the opamp's gain is bigger than the attenuation introduced by the cascaded RC cells).  Press CTRL+L to bring the LOG, or click in the plot area, then from menu View -> SPICE Error Log, to see the measurements:

g3: mag(V(in))/mag(V(out3))=(29.2765,0°) at 654.566 Hz
g4: mag(V(in))/mag(V(out4))=(18.5201,0°) at 1340.66 Hz
« Last Edit: June 12, 2024, 08:08:41 pm by RoGeorge »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #6 on: June 12, 2024, 08:56:35 pm »
The OP07 is completely unsuited to this. It has far too lower GBWP and slew rate for 400kHz and isn't designed to work off a 5V supply.

Use a faster op-amp, which is also suitable for 5V operation such as the TL972.
« Last Edit: June 13, 2024, 07:40:09 am by Zero999 »
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 8139
  • Country: ca
    • LinkedIn
Re: RC oscillator
« Reply #7 on: June 13, 2024, 09:16:23 am »
I would have done this with a 74HC14.  If I needed a near sine wave output, I would have RC filtered the 74HC14's output.
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1603
Re: RC oscillator
« Reply #8 on: June 13, 2024, 12:33:31 pm »
Hello again,

Because all the C's are the same and all the R's are the same the transfer function comes out rather simple:
Vout/Vin=(s^3*C^3*R^3)/(s^3*C^3*R^3+6*s^2*C^2*R^2+5*s*C*R+1)

and with s=j*w the right side becomes:
-(j*w^3*C^3*R^3)/(-j*w^3*C^3*R^3-6*w^2*C^2*R^2+5*j*w*C*R+1)

Solving this for the oscillation frequency 'w' the result is:
w=1/(sqrt(6)*R*C)

then substituting that into the transfer function we always get:
-1/29

which is the attenuation factor.

I should have mentioned though that if a square wave is acceptable there are simpler oscillators that are very stable.
« Last Edit: June 14, 2024, 08:17:17 am by MrAl »
 
The following users thanked this post: Zero999

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #9 on: June 13, 2024, 09:26:12 pm »
Go for a Wien bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wien bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.



f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.



It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.
« Last Edit: June 21, 2024, 06:59:00 pm by Zero999 »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1603
Re: RC oscillator
« Reply #10 on: June 14, 2024, 08:30:55 am »
Go for a Wein bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wein bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #11 on: June 14, 2024, 12:21:24 pm »
Go for a Wien  bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wien bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
I think it's running out of gain, rather than the slew rate.

The TL071 has a slew rate of 13V/μs, yet my circuit only has an output voltage of 600mV peak (1.2V peak-to-peak), which was deliberately chosen, because the supply voltage is only 5V, which I know is marginal.

Using the  TL072 (I normally use single op-amps for breadboarding, unless I need more than one) with both amplifiers, set to √3, in series might work, but suspect the group delay is also responsible for the distortion, as well as the lower than the expected frequency output, so it maybe not.

I don't have a faster op-amp in a through hole package to test at the moment (I'm not messing around with an adaptor board), but I expect it will work properly with a TL972.
« Last Edit: June 21, 2024, 07:05:16 pm by Zero999 »
 

Offline Picuino

  • Super Contributor
  • ***
  • Posts: 1033
  • Country: es
    • Picuino web
Re: RC oscillator
« Reply #12 on: June 14, 2024, 02:23:16 pm »
At that relatively high frequency wouldn't it be simpler to make a transistor LC oscillator?

https://en.wikipedia.org/wiki/Colpitts_oscillator
 



Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #15 on: June 14, 2024, 09:25:54 pm »
Well the thread title says RC oscillator. Discrete is a possibility, but there are op-amps which will work at this frequency.

Here's photograph of the breadboard layout.
2289625-0

I raided the miscellaneous op-amp bin at work and borrowed an AD817, which I plugged into the circuit and it works. This time the frequency is a bit higher than expected, which I put down to the capacitors and resistors being on the low end of their specifications.
« Last Edit: June 14, 2024, 09:36:27 pm by Zero999 »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1603
Re: RC oscillator
« Reply #16 on: June 15, 2024, 02:15:52 am »
Go for a Wein bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wein bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
I think it's running out of gain, rather than the slew rate.

The TL071 has a slew rate of 13V/μs, yet my circuit only has an output voltage of 600mV peak (1.2V peak-to-peak), which was deliberately chosen, because the supply voltage is only 5V, which I know is marginal.

Using the  TL072 (I normally use single op-amps for breadboarding, unless I need more than one) with both amplifiers, set to √3, in series might work, but suspect the group delay is also responsible for the distortion, as well as the lower than the expected frequency output, so it maybe not.

I don't have a faster op-amp in a through hole package to test at the moment (I'm not messing around with an adaptor board), but I expect it will work properly with a TL972.

13v/us sounds good for now.   You could check at what frequency the circuit starts to act up by starting at a lower frequency, even as low as 40kHz.  As you go up, you can find the point where it stops working the way you expect it too then figure out why.
Sometimes a 5v power supply is not enough, you can check that also.
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6809
  • Country: ro
Re: RC oscillator
« Reply #17 on: June 15, 2024, 06:44:37 am »
A phase-shift osc should work just fine even with the most simple voltage amplifier, a CE BJT (common emitter bipolar junction transistor), but I didn't try:


Image from https://en.wikipedia.org/wiki/Phase-shift_oscillator

Any other voltage amplifier should work too, a FET, an opamp, etc. as long as it has enough amplification and the phase shift doesn't have any "humps" (or in other words, the Barkhausen oscillation condition has to be met at a single frequency only, or else it will oscillate at more than one frequency at the same time, and the output waveform will be a combination of all the oscillations, so not sinusoidal any more).
« Last Edit: June 15, 2024, 06:49:32 am by RoGeorge »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #18 on: June 15, 2024, 11:57:37 am »
Go for a Wein bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wein bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
I think it's running out of gain, rather than the slew rate.

The TL071 has a slew rate of 13V/μs, yet my circuit only has an output voltage of 600mV peak (1.2V peak-to-peak), which was deliberately chosen, because the supply voltage is only 5V, which I know is marginal.

Using the  TL072 (I normally use single op-amps for breadboarding, unless I need more than one) with both amplifiers, set to √3, in series might work, but suspect the group delay is also responsible for the distortion, as well as the lower than the expected frequency output, so it maybe not.

I don't have a faster op-amp in a through hole package to test at the moment (I'm not messing around with an adaptor board), but I expect it will work properly with a TL972.

13v/us sounds good for now.   You could check at what frequency the circuit starts to act up by starting at a lower frequency, even as low as 40kHz.  As you go up, you can find the point where it stops working the way you expect it too then figure out why.
Sometimes a 5v power supply is not enough, you can check that also.
Changing the supply voltage to 12V made no difference.

I also tried the TL081, which should be the same as the TL071 in terms of AC characteristics, and there was no oscillation whatsoever.

I didn't try different frequencies to see what point it stopped working, became distorted, or fell below the theoretical frequency, but I recently built a 50kHz Wien bridge oscillator with the TL071, which worked perfectly.
https://www.eevblog.com/forum/projects/want-to-hear-the-bat-flying-in-my-front-yard/msg5518471/#msg5518471

I suspect it'll stop working somewhere around 100kHz.

I tried simulating it in LTSpice. I had difficulty finding a model for an incandescent lamp. The one I found on the LTSpice Google Group needed to be tweaked before it worked. I changed the time constant TAU from 22m to 10u. With ideal components, it should oscillate around 390kHz. The output voltage is still much higher, than the practical circuit, because the model doesn't match the real incandescent lamp.
https://groups.google.com/g/sci.electronics.cad/c/I9QfewHAaSI

2289951-0
* Wein Bridge osc lamp 400k.asc (2.35 kB - downloaded 11 times.)

A phase-shift osc should work just fine even with the most simple voltage amplifier, a CE BJT (common emitter bipolar junction transistor), but I didn't try:


Image from https://en.wikipedia.org/wiki/Phase-shift_oscillator

Any other voltage amplifier should work too, a FET, an opamp, etc. as long as it has enough amplification and the phase shift doesn't have any "humps" (or in other words, the Barkhausen oscillation condition has to be met at a single frequency only, or else it will oscillate at more than one frequency at the same time, and the output waveform will be a combination of all the oscillations, so not sinusoidal any more).
400kHz would be a struggle for a single transistor phase shift oscillator. The Miller effect means the impedance of the RC network needs to be very low. I think more than one transistor is required to build a reliable phase shift oscillator at this frequency.
« Last Edit: June 21, 2024, 07:01:11 pm by Zero999 »
 

Offline mawyatt

  • Super Contributor
  • ***
  • Posts: 3920
  • Country: us
Re: RC oscillator
« Reply #19 on: June 15, 2024, 04:40:14 pm »
If one doesn't explicitly require an RC oscillator the Peltz we mentioned above is quite good for a simple oscillator and produces a very good sine-wave output. We just grabbed a couple 2N3904s, a 10uH, a parallel cap and 1K emitter bias resistor, that's it!!

This will run down to ~1V DC supply, and as shown with 2V supply, the frequency is quite stable with supply voltage. The cap was tweaked (another parallel cap) to get close to 400KHz.

Best,
« Last Edit: June 15, 2024, 05:20:15 pm by mawyatt »
Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #20 on: June 16, 2024, 12:56:54 pm »
At these frequencies, an LC oscillator starts to become more practical. Much less gain is required, compared to a very lossy RC filter.

Here's a simulation of a discrete Wien bridge circuit. I didn't put any limiting in because the non-linear and slew rate limits the output, without a large amount of distortion.


I don't have my breadboard to hand at the moment, but it appears as though the original poster has lost interest anyway, so won't build it, unless someone indicates interest.

* Wein Bridge discrete 400k.asc (2.35 kB - downloaded 9 times.)

 It might work without Q1, but I didn't try. I copied the amplifier circuit from another design.

EDIT:
Here's the two transistor version.

* Wein Bridge discrete 400k.asc (2.03 kB - downloaded 10 times.)
« Last Edit: June 21, 2024, 07:01:40 pm by Zero999 »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1603
Re: RC oscillator
« Reply #21 on: June 17, 2024, 10:00:27 am »
Go for a Wein bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wein bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
I think it's running out of gain, rather than the slew rate.

The TL071 has a slew rate of 13V/μs, yet my circuit only has an output voltage of 600mV peak (1.2V peak-to-peak), which was deliberately chosen, because the supply voltage is only 5V, which I know is marginal.

Using the  TL072 (I normally use single op-amps for breadboarding, unless I need more than one) with both amplifiers, set to √3, in series might work, but suspect the group delay is also responsible for the distortion, as well as the lower than the expected frequency output, so it maybe not.

I don't have a faster op-amp in a through hole package to test at the moment (I'm not messing around with an adaptor board), but I expect it will work properly with a TL972.

13v/us sounds good for now.   You could check at what frequency the circuit starts to act up by starting at a lower frequency, even as low as 40kHz.  As you go up, you can find the point where it stops working the way you expect it too then figure out why.
Sometimes a 5v power supply is not enough, you can check that also.
Changing the supply voltage to 12V made no difference.

I also tried the TL081, which should be the same as the TL071 in terms of AC characteristics, and there was no oscillation whatsoever.

I didn't try different frequencies to see what point it stopped working, became distorted, or fell below the theoretical frequency, but I recently built a 50kHz Wein bridge oscillator with the TL071, which worked perfectly.
https://www.eevblog.com/forum/projects/want-to-hear-the-bat-flying-in-my-front-yard/msg5518471/#msg5518471

I suspect it'll stop working somewhere around 100kHz.

I tried simulating it in LTSpice. I had difficulty finding a model for an incandescent lamp. The one I found on the LTSpice Google Group needed to be tweaked before it worked. I changed the time constant TAU from 22m to 10u. With ideal components, it should oscillate around 390kHz. The output voltage is still much higher, than the practical circuit, because the model doesn't match the real incandescent lamp.
https://groups.google.com/g/sci.electronics.cad/c/I9QfewHAaSI

(Attachment Link)
(Attachment Link)

A phase-shift osc should work just fine even with the most simple voltage amplifier, a CE BJT (common emitter bipolar junction transistor), but I didn't try:


Image from https://en.wikipedia.org/wiki/Phase-shift_oscillator

Any other voltage amplifier should work too, a FET, an opamp, etc. as long as it has enough amplification and the phase shift doesn't have any "humps" (or in other words, the Barkhausen oscillation condition has to be met at a single frequency only, or else it will oscillate at more than one frequency at the same time, and the output waveform will be a combination of all the oscillations, so not sinusoidal any more).
400kHz would be a struggle for a single transistor phase shift oscillator. The Miller effect means the impedance of the RC network needs to be very low. I think more than one transistor is required to build a reliable phase shift oscillator at this frequency.

Hi,

I meant for you to check the type of IC chip being used because some op amps do not function well at 5v.  Some need at least 10v or something because the inputs do not function right unless they are at least 4v above ground and possibly 4v below +Vcc.  With a 10v supply that means you only get 2v to operate within.  Some of them were made to work with a very old standard of using plus and minus 15 volt supplies.
Just something to check for whatever IC chip you are using.

Another thing to keep in mind is if you do increase the supply voltage you probably want to make sure the output of any op amp does not increase too.  If the AC output increases also, that means the slew rate has to be higher to work at the same frequency as with the lower supply voltage.  That's only if the AC part of the response of the output increases though.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RC oscillator
« Reply #22 on: June 17, 2024, 10:22:27 pm »
Go for a Wien bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wien bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
I think it's running out of gain, rather than the slew rate.

The TL071 has a slew rate of 13V/μs, yet my circuit only has an output voltage of 600mV peak (1.2V peak-to-peak), which was deliberately chosen, because the supply voltage is only 5V, which I know is marginal.

Using the  TL072 (I normally use single op-amps for breadboarding, unless I need more than one) with both amplifiers, set to √3, in series might work, but suspect the group delay is also responsible for the distortion, as well as the lower than the expected frequency output, so it maybe not.

I don't have a faster op-amp in a through hole package to test at the moment (I'm not messing around with an adaptor board), but I expect it will work properly with a TL972.

13v/us sounds good for now.   You could check at what frequency the circuit starts to act up by starting at a lower frequency, even as low as 40kHz.  As you go up, you can find the point where it stops working the way you expect it too then figure out why.
Sometimes a 5v power supply is not enough, you can check that also.
Changing the supply voltage to 12V made no difference.

I also tried the TL081, which should be the same as the TL071 in terms of AC characteristics, and there was no oscillation whatsoever.

I didn't try different frequencies to see what point it stopped working, became distorted, or fell below the theoretical frequency, but I recently built a 50kHz Wien bridge oscillator with the TL071, which worked perfectly.
https://www.eevblog.com/forum/projects/want-to-hear-the-bat-flying-in-my-front-yard/msg5518471/#msg5518471

I suspect it'll stop working somewhere around 100kHz.

I tried simulating it in LTSpice. I had difficulty finding a model for an incandescent lamp. The one I found on the LTSpice Google Group needed to be tweaked before it worked. I changed the time constant TAU from 22m to 10u. With ideal components, it should oscillate around 390kHz. The output voltage is still much higher, than the practical circuit, because the model doesn't match the real incandescent lamp.
https://groups.google.com/g/sci.electronics.cad/c/I9QfewHAaSI

(Attachment Link)
(Attachment Link)

A phase-shift osc should work just fine even with the most simple voltage amplifier, a CE BJT (common emitter bipolar junction transistor), but I didn't try:


Image from https://en.wikipedia.org/wiki/Phase-shift_oscillator

Any other voltage amplifier should work too, a FET, an opamp, etc. as long as it has enough amplification and the phase shift doesn't have any "humps" (or in other words, the Barkhausen oscillation condition has to be met at a single frequency only, or else it will oscillate at more than one frequency at the same time, and the output waveform will be a combination of all the oscillations, so not sinusoidal any more).
400kHz would be a struggle for a single transistor phase shift oscillator. The Miller effect means the impedance of the RC network needs to be very low. I think more than one transistor is required to build a reliable phase shift oscillator at this frequency.

Hi,

I meant for you to check the type of IC chip being used because some op amps do not function well at 5v.  Some need at least 10v or something because the inputs do not function right unless they are at least 4v above ground and possibly 4v below +Vcc.  With a 10v supply that means you only get 2v to operate within.  Some of them were made to work with a very old standard of using plus and minus 15 volt supplies.
Just something to check for whatever IC chip you are using.
Yes, the TL071 isn't specified for a 5V supply, but it is with a 12V supply. The fact that absolutely nothing changed when increasing the voltage to 12V and I have built a different circuit with the same IC, which did work off 5V, indicates it wasn't that which was causing the problem.
Quote
Another thing to keep in mind is if you do increase the supply voltage you probably want to make sure the output of any op amp does not increase too.  If the AC output increases also, that means the slew rate has to be higher to work at the same frequency as with the lower supply voltage.  That's only if the AC part of the response of the output increases though.
Are you saying the slew rate of some op-amps varies with the supply voltage? The data sheet for the TL071 doesn't imply that, but if it's run at a lower voltage than it's specified to, it wouldn't surprise me, if it might be a little slower.
« Last Edit: June 21, 2024, 07:06:23 pm by Zero999 »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1603
Re: RC oscillator
« Reply #23 on: June 18, 2024, 10:00:58 am »
Go for a Wein bridge oscillator, which only requires a gain of 3.
https://en.wikipedia.org/wiki/Wien_bridge_oscillator?useskin=vector

I tried building it one a breadboard, but used the TL072. It did oscillate, but I consider it to be a failure because the frequency was well-out, at 220kHz.  I chose lo resistor values, to reduce the effect of the parasitic capacitance of the breadboard. I tried increasing the supply voltage from 5V to 12V, but it made no difference. The TL071 obviously isn't fast enough.

I used the standard Wein bridge circuit, with the classic lightbulb gain control. The only difference was I designed it for a single supply.

(Attachment Link)

f = 1/(2πRC)

R1 and R2, form a potential divider with an output impedance equivalent to their values in parallel, to the non-inverting input, so a resistance of 820/2 = 410R.
R3 = 390R.

For simplicity, consider R to be 400R, which should be near enough.

C = 1nF.

f = 1/(2π*400*10-9) = 400kHz.

Note: the C1 and C3 are connected to +V, to avoid the risk of the TL071 going into phase inversion (when the functions of the +- inputs exchange, due to the common mode range limits being exceeded). If you're using a different op-amp say one which works with its inputs down to the negative supply, you'll be better off connecting them to 0V. It makes no difference, once the circuit is running, as both rails can be considered to be ground, at AC, since the power supply should have a low impedance C4 AC couples them together, for good measure.

(Attachment Link)

It's also a little distorted, which is evident from the fact that the peaks are asymmetrical, even though the oscilloscope is set to AC coupled.

It might be better if built on a PCB, with a decent layout, but I think a faster op-amp is required.

Hello again,

Yes at 400kHz you need a fairly fast op amp.  For low distortion you need one with a slew rate of about 2.5v/us per peak volt.
So if you only need 1v peak output then you need an op amp that can do 2.5v/us, and if you need 2v peak output then you need an op amp that can do 5v/us, if you need a 5 volt peak output then you need one that can do 12.5v/us or better.
Probably go a little higher like 2.6v/us per peak output volt.
Usually when you choose it this way it will have a high bandwidth to go along with the fast slew rate, but you could check that too.
I think it's running out of gain, rather than the slew rate.

The TL071 has a slew rate of 13V/μs, yet my circuit only has an output voltage of 600mV peak (1.2V peak-to-peak), which was deliberately chosen, because the supply voltage is only 5V, which I know is marginal.

Using the  TL072 (I normally use single op-amps for breadboarding, unless I need more than one) with both amplifiers, set to √3, in series might work, but suspect the group delay is also responsible for the distortion, as well as the lower than the expected frequency output, so it maybe not.

I don't have a faster op-amp in a through hole package to test at the moment (I'm not messing around with an adaptor board), but I expect it will work properly with a TL972.

13v/us sounds good for now.   You could check at what frequency the circuit starts to act up by starting at a lower frequency, even as low as 40kHz.  As you go up, you can find the point where it stops working the way you expect it too then figure out why.
Sometimes a 5v power supply is not enough, you can check that also.
Changing the supply voltage to 12V made no difference.

I also tried the TL081, which should be the same as the TL071 in terms of AC characteristics, and there was no oscillation whatsoever.

I didn't try different frequencies to see what point it stopped working, became distorted, or fell below the theoretical frequency, but I recently built a 50kHz Wein bridge oscillator with the TL071, which worked perfectly.
https://www.eevblog.com/forum/projects/want-to-hear-the-bat-flying-in-my-front-yard/msg5518471/#msg5518471

I suspect it'll stop working somewhere around 100kHz.

I tried simulating it in LTSpice. I had difficulty finding a model for an incandescent lamp. The one I found on the LTSpice Google Group needed to be tweaked before it worked. I changed the time constant TAU from 22m to 10u. With ideal components, it should oscillate around 390kHz. The output voltage is still much higher, than the practical circuit, because the model doesn't match the real incandescent lamp.
https://groups.google.com/g/sci.electronics.cad/c/I9QfewHAaSI

(Attachment Link)
(Attachment Link)

A phase-shift osc should work just fine even with the most simple voltage amplifier, a CE BJT (common emitter bipolar junction transistor), but I didn't try:


Image from https://en.wikipedia.org/wiki/Phase-shift_oscillator

Any other voltage amplifier should work too, a FET, an opamp, etc. as long as it has enough amplification and the phase shift doesn't have any "humps" (or in other words, the Barkhausen oscillation condition has to be met at a single frequency only, or else it will oscillate at more than one frequency at the same time, and the output waveform will be a combination of all the oscillations, so not sinusoidal any more).
400kHz would be a struggle for a single transistor phase shift oscillator. The Miller effect means the impedance of the RC network needs to be very low. I think more than one transistor is required to build a reliable phase shift oscillator at this frequency.

Hi,

I meant for you to check the type of IC chip being used because some op amps do not function well at 5v.  Some need at least 10v or something because the inputs do not function right unless they are at least 4v above ground and possibly 4v below +Vcc.  With a 10v supply that means you only get 2v to operate within.  Some of them were made to work with a very old standard of using plus and minus 15 volt supplies.
Just something to check for whatever IC chip you are using.
Yes, the TL071 isn't specified for a 5V supply, but it is with a 12V supply. The fact that absolutely nothing changed when increasing the voltage to 12V and I have built a different circuit with the same IC, which did work off 5V, indicates it wasn't that which was causing the problem.
Quote
Another thing to keep in mind is if you do increase the supply voltage you probably want to make sure the output of any op amp does not increase too.  If the AC output increases also, that means the slew rate has to be higher to work at the same frequency as with the lower supply voltage.  That's only if the AC part of the response of the output increases though.
Are you saying the slew rate of some op-amps varies with the supply voltage? The data sheet for the TL071 doesn't imply that, but if it's run at a lower voltage than it's specified to, it wouldn't surprise me, if it might be a little slower.

Hi,

The slew rate can change a little but that's not what I was drawing attention to.
For most purposes we can think of the slew rate as being a constant regardless of the power supply voltage like 5v vs 12v.
What does change though is the maximum frequency, *IF* the output of the op amp goes higher than it did at 5v.  This could be the case if the circuit uses the power supply as a reference of some kind.  If the output was going from say -1v to +1v at 5v, then at 12v it was going from -2v to +2v, that's a two-fold change in peak amplitude.  If the slew rate was 1v/s when at 5v it would take 0.25 seconds to reach the peak after starting at 0v.  At +12v (in this example) it would take 0.5 seconds to reach the peak after starting at 0v.  That's twice as long, which means half the frequency.  If the output could be reduced to -1v to +1v (peaks) then it would behave the same as before the increase.

What this means is if the output does not change in amplitude, then we will not see any difference.  It's only if the output increases (or decreases) that we will see any difference in the maximum frequency.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf