not a pure sine wave with wien bridge oscillator

Thread Starter

digitsboy

Joined Dec 29, 2016
48
Hello,
i am trying to design a wien bridge oscillator at 20khz and limited it to 2 Vpp.
I don't understand why i get such a bad wave form out of the circuit and i am stuck. i tried to change values but that didn't help. I thought out of lecture i designed a correct circuit...
could someone help me further?

thanks a lot
design.png
 
Last edited:

crutschow

Joined Mar 14, 2008
34,285
You need an AGC (automatic gain control) circuit to limit the oscillator excursion to within the amps linear limits.
This is discussed starting at page 10 of this reference.
Clipping the output voltage, as you are doing, causes the waveform to be more of a square-wave than sinusoidal.
 

Thread Starter

digitsboy

Joined Dec 29, 2016
48
is there no easier way to get the sine wave better? because i saw there was a lot of harmonic distortion so maybe that gives the bad signal. i tried to add a low pass filter but that didn't help a lot.
 

Jony130

Joined Feb 17, 2009
5,487
Well the old lm741 is to slow for this job (F = 23.6kHz) try change the op amp type. And THD value that you're aiming for?
 

MrAl

Joined Jun 17, 2014
11,389
Hi,

It would be good if we could see the output waveform.

Diodes are typically used as AGC in these circuits, but the trick is to keep the resistor-based gain as low as possible (lower maybe R1) so the diodes dont actually have to do much. The more the diodes have to do to limit the gain, the more distortion. As others have said the op amp is probably not the right choice either unless you want a very low output voltage like maybe 1 vac peak.
Also, the diodes look like they are connected so that they clip too much. Typically there would be some decent resistance in series with the diodes to make the clipping less extreme.
If we could see the output waveform that would help too.
 
Last edited:

Jony130

Joined Feb 17, 2009
5,487
Well, the first think what you should do is to learn how to use a circuit simulation. Your output is distorted because your simulation time step is to small. Try 1μs first.
 

MrAl

Joined Jun 17, 2014
11,389
Also try this version for a automatic gain circuit
Hi there Jony,

That looks much, much, much better :)

In theory the feedback is about 1/3 so ideally we want a gain of 3 but with component variations and other variations the gain might have to be adjusted dynamically to be higher than 3, and with 22k and 10k we get a gain just over 3 and with 18k and 10k we get a gain just under 3, so the ideal diode series resistance would be 180k, but 150k should do just as well while leaving a little dynamic internal diode resistance to increase that number slightly.

So "hoot hoot" and +1 Like for that circuit mod :)
 

Thread Starter

digitsboy

Joined Dec 29, 2016
48
wow the result is great. So if i understand it right, the AGC to keep the amplification constant. so the signal is too low it increases the gain etc.
But i can't get it out of the circuit, the working?


ps. the harmonic oscillation is still high but i think i can increase it with a low pass filter
 

Thread Starter

digitsboy

Joined Dec 29, 2016
48
wow the result is great. So if i understand it right, the AGC to keep the amplification constant. so the signal is too low it increases the gain etc.
But i can't get it out of the circuit, the working?


ps. the harmonic oscillation is still high but i think i can increase it with a low pass filter
sorry harmonic distortion was not a case it is very low. i did something wrong in my circuit:). But it's nice but i still don't understand the principle of the working of the AGC
 

crutschow

Joined Mar 14, 2008
34,285
For minimum distortion you need to avoid any form of clipping of the waveform to control the amplitude.
You need a AGC circuit that controls the feedback gain.
The vacuum tube, wein-bridge sinewave oscillator the HP started their business with used a small incandescent bulb as a nonlinear feedback element to control the feedback gain and give very low distortion.
A sold-state version of that is here:
upload_2016-12-30_19-38-44.png
(from the TI reference I mentioned in post #2).
 

MrAl

Joined Jun 17, 2014
11,389
sorry harmonic distortion was not a case it is very low. i did something wrong in my circuit:). But it's nice but i still don't understand the principle of the working of the AGC
Hi,

The working principle is actually simple. The op amp provides a gain, the two RC networks loose gain. To maintain perfect oscillation, we need a gain of 1 around the loop with a phase shift of 0 (see Barkhausen et al.). If we have less than a gain of 1 then the oscillation stops, and if we have more than a gain of 1 the oscillation amplitude increases so much that it clips badly or saturates resulting in poor or no oscillations.
One of the problems is that it is impossible to set this condition by hand, it must be done dynamically by the circuit itself. That's because the gain setting is ever so critical so once we have it adjusted, it changes a few seconds later or even sooner. If the circuit does it, then it can constantly adjust it to maintain the correct amplification and thus maintain oscillations.

The diodes have a non linear resistance so if the output increases too much they reduce the gain by conducting making the negative feedback resistor look smaller (and thus less gain) and if the output decreases too much they stop conducting and allow the higher gain.
The problem with diodes is that they are non linear in the electrical sense only (they act only on current and voltage and very little on anything else) and have no memory, so they must act on each and every cycle. This means that they must clip at least a little in order to maintain the correct gain, and that means we'll see a little odd harmonic distortion. This can be kept down by choosing the resistor values carefully and using temperature stable resistors, but the 'old' way of doing it was to use an electrical device that has a more linear property and also has the property of memory so that it can 'remember' the last setting and thus does not have to change for each and every cycle. This device was typically a light bulb, which for short time spans is linear and also has thermal memory which helps to keep it's resistance constant and at the right value over several cycles. This means we may see only a small amount of clipping due to very small changes in resistance from cycle to cycle, but much less than with diodes. Getting the operating point right is also a little bit of a challenge too though, and has to be right for each type of bulb.

The good thing about using diodes is that they are easy to work with and if done right they dont have to clip too much. The nice thing about a sine wave is that the amplitude is reduced more when we remove an area near the peak than when we remove an area near the mid section, so little clipping can do the job. If you need an ultra clean sine then you may want to look into more linear methods, but the diodes will work in most cases. You can also try a small capacitor across the diodes to help act as pseudo memory, as long as it does not cause other problems like low frequency sub oscillation modulation.

We can assess the distortion caused by the diodes knowing the circuit values, but it will take some Fourier analysis and estimation of the degree of clipping needed by a given setup. Of course a circuit simulator will show how much distortion we might expect too, such as the Linear Tech's free Spice simulator.
 
Last edited:

Thread Starter

digitsboy

Joined Dec 29, 2016
48
sorry for my late reply, thanks a lot!! I understand it and i am going to build it tomorrow.
Also i am going to try to make the amplitude of the sine wave variable. I think the best way is by adding a non inverting amplifier with a potentiometer to the output of the oscillator.
 

crutschow

Joined Mar 14, 2008
34,285
You need a higher frequency and slew rate op amp than the 741 for that frequency oscillation, along with the other changes, if you haven't done that already.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,285
Here is the LTspice simulation of the circuit with a faster op amp and using a JFET as a variable resistor to provide the AGC function.
I increased the value of the bridge resistors to avoid overloading the op amp output.

upload_2017-1-2_9-15-51.png
 

Attachments

MrAl

Joined Jun 17, 2014
11,389
Here is the LTspice simulation of the circuit with a faster op amp and using a JFET as a variable resistor to provide the AGC function.
I increased the value of the bridge resistors to avoid overloading the op amp output.

View attachment 117910
Hi,

Doesnt that depend on how much output amplitude he wants/needs ?

For example, for a 1vac peak (2vac peak to peak) i calculate the min slew rate to be 0.126v/us and the LM358 is 0.5v/us and the 741 is probably around that too (but you could check that).
So that means a LM358 should work at least up to 2vac peak (4vac peak to peak) maybe higher.
I guess if you want to do a simulation with the LM358 or the 741 we could see what it looks like.
 

crutschow

Joined Mar 14, 2008
34,285
Doesnt that depend on how much output amplitude he wants/needs ?
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.
For example, for a 1vac peak (2vac peak to peak) i calculate the min slew rate to be 0.126v/us and the LM358 is 0.5v/us and the 741 is probably around that too (but you could check that).
So that means a LM358 should work at least up to 2vac peak (4vac peak to peak) maybe higher.
I guess if you want to do a simulation with the LM358 or the 741 we could see what it looks like.
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.

upload_2017-1-2_23-2-19.png upload_2017-1-2_23-12-15.png
 
Top