not a pure sine wave with wien bridge oscillator

MrAl

Joined Jun 17, 2014
11,496
Yes, it certainly does.
Since the op is using ±15V supplies I assumed he was looking for a output in the 10V peak range, but that's just a guess.
Here are simulations for both a 741 and 324 (LM358) with a peak output of about 4V and 2V.
At 4Vpk the 741 output looks more like a triangle-wave, indicating it has a poorer slew-rate than the 324/358.
At 2Vpk they both look like sinewaves.

View attachment 117939 View attachment 117940
Hi,

Oh yes, very nice.

I suspect the difference is due to a slight difference in the models only because they both have a spec of 0.5v/us on the slew rate. However, i dont like either waveform at 4vac peak. What helps evaluate this a little more is to use a sine source of the same frequency on the same graph of about the same amplitude so we can immediately see the graphical difference between the output and a real clean sine wave. Doesnt help to get a number on the distortion, but gives us some idea how different the output is from a pure sine wave. And yes i agree that if he wants to get up to 10vac peak then a higher slew rate op amp would be needed, say at least 2.5v/us or probably better 5v/us.

Just as a note to others, the required slew rate in volts per second is simply 'w*Vpeak', where w=2*pi*f. and can be higher than that but not lower so slew>=2*pi*f*Vpeak. [Edited and corrected after the next post after this one]

Thanks for doing the simulations.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,496
You forgot the voltage.
It's w=2*pi*f*Vp where Vp is the peak voltage of the sinewave.

Hi,

Oh yes thanks for catching that. There was also another typo w>=2*pi*f (ha ha) which should have been slew>=2*pi*f*Vpeak. Both have now been corrected, thanks.
 

crutschow

Joined Mar 14, 2008
34,465
What helps evaluate this a little more is to use a sine source of the same frequency on the same graph of about the same amplitude so we can immediately see the graphical difference between the output and a real clean sine wave.
Here's the simulation of both at 20kHz with the gain, and thus output amplitude increasing with time.

The outputs look similar up to about 3V peak at which point they both start looking like triangular waves, with the 741 degrading faster.

upload_2017-1-3_10-34-18.png
 

Thread Starter

digitsboy

Joined Dec 29, 2016
48
thank you all for help but i am thinking of using the more easy circuit of @Jony130
this one:AGC.png

i only want to know is how to calculate the max output voltage, i tried it but i failed haha.
 

crutschow

Joined Mar 14, 2008
34,465
i only want to know is how to calculate the max output voltage, i tried it but i failed haha.
Don't know that there's an easy way to calculate the exact output voltage for that circuit since it's non-linear.
You select R2 no larger than required for a good oscillation and then select R5 to give a soft clamp with the peak somewhere between 0.5V and 0.8V.
Here's a simulation with varying values of the R2 gain resistor.

upload_2017-1-3_16-34-13.png
 

Attachments

crutschow

Joined Mar 14, 2008
34,465
i don't like measuring the value i want to calculate it. but it's hard i think with a wien bridge oscillator
Yes, it's always good to be able calculate the values for circuit components but the nonlinear behavior of the diodes in that oscillator makes that somewhat difficult.
 

MrAl

Joined Jun 17, 2014
11,496
thank you all for help but i am thinking of using the more easy circuit of @Jony130
this one:View attachment 117981

i only want to know is how to calculate the max output voltage, i tried it but i failed haha.
Hi,

The strangest thing about this kind of circuit is that in (perfect) theory it is not really an oscillator until we supply at least a tiny bit of energy into the circuit loop. If the components were all ideal, the oscillation would never start because you can see that both of the op amp inputs go to ground through resistors so to start both inputs are zero, and with two zero voltage and current inputs no gain no matter how high will produce an output. This isnt that hard to understand and is the same for any oscillator.

The thing that sets an oscillator off is an injection of energy somewhere that comes in the form of either a step or a ramp, and when we move to the non ideal case we get that from the output of the op amp. The problem with this circuit as is however is that it's hard to figure out what the op amp will output with two inputs near zero because the response is not that simple in that condition and depends on both the input offset and the gain and the response of the op amp itself. This means that every package may produce a different output because the output at startup will probably be a ramp and it's hard to say when it will start to oscillate with a ramp when we dont know the actual ramp size or rate of increase. This is equivalent to a function like:
Vout(s)=Vin(s)*F(s)
where we dont know what Vin(s) really is, and so we cant predict the output very well mathematically.

To remedy the situation a little it should help to purposely inject more energy into the circuit that will swamp the effects of the input offset. This, at least in theory, should make the output more predictable.

Since the non inverting terminal has a frequency determining resistor connected to it we probably dont want to change that input, but the inverting terminal resistors only affect the gain, so with a small bias potential applied to the inverting terminal we can force a step change to help get things going, and with more predictability because the effect should swamp the unknown effects such that we may be able to calculate the output amplitude. We'll still have to deal with the unknown gain of the op amp itself at startup though, which may mean we either have to adjust this by hand or make another improvement to the circuit.

So a first try is to connect a large value resistor from the positive +15v supply to the inverting input, and calculate the output based on that input step, then see if it matches the simulation. The large value should be high enough so that it does not force too much DC offset but still provides for more predictability than before. If this doesnt work then we might have to change the circuit a little more to provide a short input pulse that goes away after the circuit starts up.

Note this concept is not that different than when we have an ideal cap in parallel to an ideal inductor, which would form an ideal oscillator if we had a way to inject a small amount of energy for a short time, but with no such energy injection the circuit never oscillates at all, and with an unknown amount of energy injection we can not predict the amplitude of the oscillations. It's only when we know the amount we can then calculate the amplitude.
 
Last edited:

Jony130

Joined Feb 17, 2009
5,488
i only want to know is how to calculate the max output voltage, i tried it but i failed haha.
What amplitude do you need? Also the calculation do not have much sense because you need to know diode Rd resistance.
View attachment 117981
For this circuit the voltage across R1 is 1/3*Vout so, the remaining part of 2/3Vout must drop across R2||(R5+Rd)
Steady-state oscillation will be if the gain is equal to 3V/V so R2||(R5+Rd) = 2R1 = 20kΩ
For R2 = 22kΩ what resistance in parallel with R2 = 22kΩ would make 20kΩ? Answer = 220kΩ
Therefore, the combination of the diode Rd resistance plus R5 = 150kΩ resistance must look like 220kΩ.
We need Rd = 70kΩ
From LTspice

a.png

I can find Rd ≈ 70kΩ for Vd ≈ 343mV ---->Id = Vd/Rd ≈ 4.9μA

From there I can easily find Vout.

VR5 = 150kΩ*4.9μA = 735mV -----> 2/3Vout = 735mV + 343mV ≈ 1V

Therefore Vout ≈ 1.5V

But LTspice shows Vout ≈ 2Vpeak ( Vd ≈ 356mV; Id ≈ 6.47μA ). So I do not know where I made a mistake.

The large the R5 resistance the higher the Vout voltage and THD is lower.

I also build this circuit on the breadboard and here you have the results:

R1 = 10kΩ, R2 = 22kΩ, R5 = 150kΩ, D1 = D2 = 1N1448, TL071
NewFile40.png

As you can see Vout is around 2.1Vpeak. Somehow this result matches to the result from LTspice.

If I change R5 to 100kΩ the Vout drop to 1.1Vpeak

NewFile41.png

And finally if I change the diode to BAT48 the amplitude drop to 0.7Vpeak.
NewFile43.png
 

MrAl

Joined Jun 17, 2014
11,496
Hi Jony and the others here,


We dont really need to know the diode resistance to calculate the theoretical output amplitude, we can just assume the optimum gain is dynamically chosen to provide a perfectly stable output, and provide a means for a known amount of energy injection.
Also, we can not find the output amplitude knowing just the gain because any output amplitude satisfies the loop.

Doing the former above we get:
Vout(t)=-Eoffset*(6*sin(w*t)+2)

where w=1/T and T represents 'tau' which is the RC time constant R3*C1 and it is assumed the other R and C are the same.

What this shows us is that the input offset (offset relative to the inverting terminal) produces the output, and because of the offset there should be some DC offset at the output which of course is 2 times the input offset hence the constant '2' in there.

This is pure theory where the op amp has infinite gain at the chosen frequency, and the output ramps up very very quickly so that it looks more like a step than a ramp.

To see this work and to see how it compares to the simulation, we could use a small voltage source connected in series with R2, so instead of connecting R2 to ground we connect a voltage source to ground and then the positive terminal to R2. The theoretical output will follow that equation then.
Note that if the slew rate of the op amp is slow it may not reach that full voltage because the output will ramp instead of shoot up quickly and that reduces the energy somewhat. Would be interesting to see how it compares with a simulation.
 
Last edited:

Thread Starter

digitsboy

Joined Dec 29, 2016
48
I had an 8 vpp output but i added a voltage divider after it so it is 1 vpp now and after that I added a non inverting amplifier to vary between 1 and 5 vpp.

is there also a way to vary between 0 and 5 vpp?
 

MrAl

Joined Jun 17, 2014
11,496
I had an 8 vpp output but i added a voltage divider after it so it is 1 vpp now and after that I added a non inverting amplifier to vary between 1 and 5 vpp.

is there also a way to vary between 0 and 5 vpp?
Hi,

That's interesting because you are getting 8vpp which is 4v peak, which would imply that there is about 0.667v input offset, but of course that is not the normal running input offset so we would have to study the start up conditions of the op amp a little more to be able to tell what is causing that much output. The energy is obviously coming from the op amp output circuit, but how the op amp starts up determines what the output will be at the moment of turn on and for the first few moments just after turn on. Each op amp package could produce a different result, and each op amp type could be very different. You might want to look into this because the output could be lower with a different op amp. There is also a chance that the op amp starts up with the output either very high or very low, which means a lot of energy injection at start up.

As to your question of variable output, you should be able to do that with a potentiometer. The pot would be fed from the output of the oscillator and the arm of the pot would go to the next stage (your output op amp). It's a simple circuit. One end of the pot to the oscillator output, the other end of the pot to ground, and the arm of the pot to the next stage op amp.
If you already have a circuit set up for that maybe you could show it here and we can take a look. Should not be hard to get it working the way you want it to work.
 

MrAl

Joined Jun 17, 2014
11,496
Hello again,

I am seeing slightly different behavior with the non ideal circuit than with the ideal circuit.

With the ideal circuit the only amplitude determining factor is the op amp input offset.
With the non ideal circuit though the amplitude is first determined by the op amp input offset and then later by the diode clipping action.
This is interesting because that means we can modify the feedback network to get a certain voltage output knowing the voltage drop of one diode.

In the non ideal case only the first several oscillation cycles follow the Voffset*(6*sin(wt)+2) theoretical rule, but then after that the diode clipping action and the resistances in the feedback determine the output amplitude. For example with 0.002v input offset the first output wave is about 0.012v peak after also considering the DC offset.
For the non ideal case example, the way i have my circuit set up (slightly different than shown here) i can get 1vac peak output, 1.5vac peak output, etc., just by changing the value of one resistor. To be more practical however i would probably set the output to maybe 5vac peak and then use a pot on the output as per my last post, followed by a unity gain buffer.
 

Thread Starter

digitsboy

Joined Dec 29, 2016
48
As to your question of variable output, you should be able to do that with a potentiometer. The pot would be fed from the output of the oscillator and the arm of the pot would go to the next stage (your output op amp). It's a simple circuit. One end of the pot to the oscillator output, the other end of the pot to ground, and the arm of the pot to the next stage op amp.
i have a nice 8vpp output, i used an voltage divider to get it to 5vpp and after the voltage divider i used a potentiometer with one side to connected to the voltage divider and one side to the ground. the middle one is the new output. But the strange thing is, it is not getting to 0 V and not to 5V max in the simulations??

how is that possible?

and with 18k and 10k we get a gain just under 3, so the ideal diode series resistance would be 180k
and my final question, then i completely understand everything:)
18k and 10k gives a gain of 2.8 but how do you come to the 180k?
 
Last edited:

MrAl

Joined Jun 17, 2014
11,496
i have a nice 8vpp output, i used an voltage divider to get it to 5vpp and after the voltage divider i used a potentiometer with one side to connected to the voltage divider and one side to the ground. the middle one is the new output. But the strange thing is, it is not getting to 0 V and not to 5V max in the simulations??

how is that possible?


and my final question, then i completely understand everything:)
18k and 10k gives a gain of 2.8 but how do you come to the 180k?
Hi,

First, the 180k was calculated based on a 20k feedback value to begin with, but with 22k to begin with we end up with 99k because 99k in parallel with 22k is 18k which is 2k less than 20k, and with 22k we have 2k more than 20k, so with an ideal diode we have a gain range that is roughly equally low as it is high meaning the circuit should be able to 'find' the right gain dynamically. We can also figure in the diode drop to make this estimate more accurate which will tend to change the value of the series resistance (for example 77k).

An 8vpp signal swings 4v above zero and 4v below zero, so for the pot, if it is connected to the output with no other resistors and no load, the output should be adjustable from 4v peak down to 0v peak which is 8vpp down to 0vpp. If you dont get that then either something is not connected right, the pot is not working properly, there is a load resistance that is too small connected to the arm, or there is an output offset. If you have an output offset you should see it go down to zero when you adjust the pot down to a low value, but when you adjust the pot upward you will see a wave that is not symmetrical about zero so it may go higher than lower (for example +5v down to -3v instead of +4v down to -4v). You can check for this, and also maybe draw a little circuit showing how you have the pot connected exactly. Also, check the pot with a meter to make sure it works and it is about the right value. A pot that is too high in value or too low in value would cause problems too depending on how you intend to load the arm.
 
Last edited:
Top