Wien bridge oscillator theory - Page 1
Forum section: electronics / projects

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 04:48:31 pm
content: I have been trying to understand the theory behind the Wien bridge oscillator as shown in the picture of the circuit I attached. I have also attached the simulated output of the oscillator. I have also done the math by hand and plotted the amplitude and phase in the frequency domain (not shown). I also understand the reason behind choosing the component values for a desired output.However, I am having two problems at the moment.1. I have built a similar circuit and tried probing the output, but I can't get it to begin oscillating. (Note: I have initialized a capacitor voltage in the simulation). I assume some charge is stored on the capacitor in reality and it's enough to begin oscillating.2. I don't understand AT ALL why the output is sinusoidal. I have tried searching the web for a good explanation for why it is so, but can't find any. Any help would be appreciated.

author: Andy Watson
author_rank: Super Contributor
timestamp: October 10, 2013, 05:20:29 pm
content: There is a complete loop. Any loop in which more signal is fed-back, at 0 or 360 degrees phase will be unstable. You say you've done the maths, you should have found the magic value of 3 figures largely in the equations, i.e. the R-C network has an attenuation of 3. This loss is balanced by the gain set by R4 and R3. Anything less than 3 and the oscillation dies away; more than 3 and the oscillation will build until it is limited by some other means, i.e the signal saturates. If you tweak the gain a little bit you should see it oscillate - but you'll be lucky if it stays sinusoidal for very long. Real Wien bridge oscillators have some means of stabilising the loop gain at exactly three.Any periodic waveform can be broken down into sinewaves. To generate the harmonics requires more energy input (as you will find out if you crank-up the gain). By configuring the system to have an exact gain of 3 you are optimising the conditions for selecting the lowest frequency sinewave.

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 05:27:36 pm
content: Quote from: Andy Watson on October 10, 2013, 05:20:29 pmI found that Vo/Vi = 1/3 and that is why the gain due to the purely resistive feedback has to be at least 3 in order to oscillate. When I built it, I used 2.2k and 1k as feedback resistors so my gain was set at approximately 3.2 to ensure oscillation, however, my output was sitting at 200mV w/out oscillating.Quote from: Andy Watson on October 10, 2013, 05:20:29 pmFirst part makes sense...Fourier analysis.Does a higher frequency harmonic require more energy to oscillate than the fundamental?

author: Andy Watson
author_rank: Super Contributor
timestamp: October 10, 2013, 05:41:23 pm
content: Quote from: tree on October 10, 2013, 05:27:36 pmShould have worked. Perhaps the losses in the op-amp and bridge circuit are more than the simple analysis allows for. By making the gain significantly more then 3 (like 10) you should be able to force it to oscillate - but it won't be a sinewave.QuoteYep! Law of nature - to make anything move quicker requires more energy. Although we're talking about signal level here, you should find that if you move the frequency up, the attenuation of the R-C bridge network increases. Which explains why increasing the gains allows more harmonics into the waveform and it will start to look like a squarewave (Fourier 'n' all that).

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 05:52:30 pm
content: Everything you have stated makes perfect sense.I still don't feel confident in my understanding of the oscillatory nature of the circuit. Why does it oscillate anyway? I feel as though it shouldn't oscillate.

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 06:11:58 pm
content: I chose R = 1M and C = 10n and got a 15.9Hz resonant frequency. See attached plot.We can see that at the resonant frequency, the output follows the input (no phase)If we increase the gain via the feedback resistors, attenuation must decrease (not negotiable since the inputs to the op amp must be equal, considering ideal conditions). According to that plot, in order to meet the condition for an increase in attenuation, the frequency must be either greater OR less than 15.9Hz. In which direction will the frequency shift if the gain is increased from the ideal gain of 3? Is it because of the non-zero phase at those other frequencies, that when the gain is increased the output becomes less and less pure sinusoidal? If so, what is the relationship there?

author: Andy Watson
author_rank: Super Contributor
timestamp: October 10, 2013, 07:16:55 pm
content: I'm not sure. Zero phase (or 360) is an important criterion of oscillation. Moving away from zero phase effectively reduces the loop gain (by the cosine of the phase - I think?) Increasing the gain in some other part of the circuit might permit oscillation at non-zero phase, to clarify, that's the phase of the R-C network. Based on the previous energy argument, I'm going to say that the frequency will go down rather than up.Thinking about this a little more: If you increase the gain considerably you will turn it into to a relaxation oscillator - the frequency will be determined largely by the time constant of R2+R1 and C1//C2 and ratio of R3/R4. Following through the operation of this configuration will indicate why the circuit oscillates - then add on the refinement of the gain and bridge conditions to select-out the sinewave.

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 07:44:27 pm
content: When you are talking about energy and frequency are you referring to the concept of photon energy where the energy of a photon increases as the frequency increases?

author: Andy Watson
author_rank: Super Contributor
timestamp: October 10, 2013, 07:55:16 pm
content: Quote from: tree on October 10, 2013, 07:44:27 pmI wasn't, but it's still true isn't it? Xray photons are more energetic than visible light and they are higher frequency. Or take a lump of lead and swing it - if you want to swing it faster, at a higher frequency, you will have to put more energy in. It's just a general property of nature, and the reason that the frequency response of all systems tends to zero as the frequency increases.

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 08:12:44 pm
content: Quote from: Andy Watson on October 10, 2013, 07:55:16 pmWhat does that mean?I simulated the circuit with a gain higher than 3, and the frequency decreased (even though it was very close to a square wave). You claimed that the frequency would decrease based on the energy argument you presented. I am still confused for two reasons:1. Why doesn't the output look sinusoidal when the gain via the resistors increases, why is it sinusoidal?2. You claimed that energy/gain/frequency are functions of each other. Can you clarify what you mean?

author: Andy Watson
author_rank: Super Contributor
timestamp: October 10, 2013, 09:47:37 pm
content: Quote from: tree on October 10, 2013, 08:12:44 pmTake a sinewave and drive it into a series combination of a resistor and a capacitor. Measure the output across the capacitor. As you increase the frequency, the response of this network, i.e. output relative to input, will decrease. Ultimately, at infinity frequency the output would be zero.But you'll not find an infinite frequency oscillator because all real systems have the equivalent of series resistance and capacitance to ground. The resistor dissipates energy on each cycle, therefore, to get infinite frequency would require infinite energy. The same is true for any real system (electrical, mechanical, whatever,...). The response always tends to zero as the frequency increases.Quote1. The magic value of 3 comes from the R-C bridge network. To compensate for this loss, the "amplifier" is given a gain of three. If you were to break into the amplifier-R-C loop you would find that the overall loop gain would be unity. Anything less and the oscillations die away anything more and the oscillations build up until the signal saturates, i.e. the circuit becomes non-linear, and therefore non-sinusoidal. While in its linear region, you can consider the R-C network is attached to a perfect amplifier with a gain of 3, then solve the differential equations for the Rs and Cs.2. I think I've explained the energy-frequency thing above. I think I may have been a bit confusing when talking about gain (that's the problem with multiple loops!) I was thinking about it this way: The overall gain of the loop varies, downward, for a frequency shift in either direction (due to the R-C network). Due to the energy considerations, it's "easier" for the amplifier if the frequency shifts down rather than up. Although, I 'm willing to listen to any more solid arguments

author: tree
author_rank: Regular Contributor
timestamp: October 10, 2013, 11:04:21 pm
content: Quote from: Andy Watson on October 10, 2013, 09:47:37 pmI thought you were making a general statement as well as considering ideal conditions, i.e. where a capacitor is a PURE capacitor, when you said that the frequency response of all systems tends to zero as the frequency increases. I should have asked you to clarify, sorry!Quote from: Andy Watson on October 10, 2013, 09:47:37 pmWhy did you mention harmonics in one of your previous posts? How do those come into play when the gain is higher than 3?One of the biggest issues I'm having is understanding the sinusoidal nature of the oscillator when the gain is 3. I asked this already, but here goes again, why is it sinusoidal? Where does that behavior come from?Quote from: Andy Watson on October 10, 2013, 09:47:37 pmWhat do you mean by "easier"? Why is it "easier"?

author: quantumvolt
author_rank: Frequent Contributor
timestamp: October 11, 2013, 12:06:28 am
content: Quote from: tree on October 10, 2013, 11:04:21 pmThe answer is like "Why is 2 + 2 = 4". The condition of nature and mankind's mind.The derivative of Sin() is Cos(). And the derivative of Cos() is -Sin(). So by differentiating Sin() two times you are back to the function itself with a "-" sign in front. Add some constants and an equation of the second order derivative of Sin() and Sin() itself will add to zero.When in physics modelling resonant circuits like the Wien oscillator, you end up with a Second Order Differential Equation. The Sin() function is the solution to the equation as mentioned over.That is why it oscillates freely in a sinusoidal way - and not triangular or square ...Please readhttp://en.wikipedia.org/wiki/Harmonic_oscillatorfirst and the you can study the topic further. Thousands of pages on the web.

author: tree
author_rank: Regular Contributor
timestamp: October 11, 2013, 12:11:27 am
content: Quote from: quantumvolt on October 11, 2013, 12:06:28 amLOL. My gosh, I am embarrassed no.wI've already solved 2nd order harmonic oscillator DEs. I just hadn't set up an equation for this circuit and went straight to a transfer function rather than transient response.Thank you, by the way.

author: quantumvolt
author_rank: Frequent Contributor
timestamp: October 11, 2013, 12:33:27 am
content: I edited my post before I saw your post. I had mixed up the signs (I was posting in between my children's Ben 10 and Barbie YT movies). But it is all to be found in any good tutorial on harmonic oscillators.Anyway - study physical oscillators, masses, damping etc... and you will understand why electronic abrupt changing signals are not natural. Nature is "heavy" and likes smooth changes.

author: tree
author_rank: Regular Contributor
timestamp: October 11, 2013, 01:32:05 am
content: I need help figuring out the differential equation now. Ahh!

author: tree
author_rank: Regular Contributor
timestamp: October 11, 2013, 07:37:26 pm
content: I went through this a couple of times and still haven't arrived at a right answer.I attached my differential equation, some initial conditions and the plot of the solution. However, the solution EXPLODES. Now I'm stuck. By the way, I used the component values from the original circuit from my first post.

author: AG6QR
author_rank: Frequent Contributor
timestamp: October 11, 2013, 08:21:27 pm
content: Quote from: tree on October 11, 2013, 07:37:26 pmYou've discovered the beauty of Bill Hewlett's use of the incandescent lamp in the feedback loop. Those resistances aren't constant. Nowadays, some other component with a positive temperature coefficient may be used instead of a lamp, but the idea is that, the greater the power going through the lamp, the greater the resistance. And as the resistance increases, feedback decreases to lower the output power of the amp, which lowers the heating, and lowers the resistance. This process eventually stabilizes the feedback loop so that the overall loop gain is exactly 1, and you get a nice sine wave output.I'm not sure I'm reading your schematic and equations right, but I believe the PTC element is R4, and it should self-heat until its resistance reaches precisely R3/2Modelling that self-heating resistance element accurately is more calculus than I care to do.

author: tree
author_rank: Regular Contributor
timestamp: October 11, 2013, 08:40:51 pm
content: Quote from: AG6QR on October 11, 2013, 08:21:27 pmYes, R4 is the PTC element/lamp.All of the circuits I've seen show a lamp part of the feedback loop. Why do you think the transient response of the simulation in LTspice seems to work with the resistors?

author: AG6QR
author_rank: Frequent Contributor
timestamp: October 11, 2013, 09:06:29 pm
content: Quote from: tree on October 11, 2013, 08:40:51 pmI don't know enough about the inner workings of LTspice, nor do I know exactly how you were plotting the solution to your differential equation. So I can't say exactly what was going on in either of the computer simulations.What I do know is that the Wien bridge output amplitude isn't stable without that PTC/lamp in the feedback loop. Or more precisely, it's metastable, and extremely sensitive to the precise values of all the other components in the bridge. Since you'll always have imperfect components in the bridge, you need that thermal feedback to adjust the resistor to exactly the right value, at least in a real world circuit.My wild guess is that your LTspice model was modelling all the other bridge components with their ideal correct values, with no errors like you'd see in the real world. That might allow you to get away with a fixed resistor for R4, and still have good behavior. Maybe you could try tweaking some of the component values by very small amounts and see if things still look good.And I'll take another wild guess that the package you used to solve the differential equation had some very slight numerical roundoff error somewhere in a calculation. That's often the nature of finite precision floating point arithemetic.

author: tree
author_rank: Regular Contributor
timestamp: October 11, 2013, 09:16:13 pm
content: Quote from: AG6QR on October 11, 2013, 09:06:29 pmI used Mathcad to generate the solution (numerically using the Adams-BDF algorithm) that I presented, but I also used Mathematica to solve the equation symbolically. Both solutions exploded. When Mathematica presented the symbolic solution, the frequency did not match up the expected frequency, which suggested that my equation was incorrect.LTspice was modeling the circuit using ideal components including the op amp. My equations use ideal models for all of the components as well.I guess my biggest concern at this point is if the differential equation that I set up is correct. I was hoping someone could verify that it is indeed the correct equation if using ideal components.I tried playing around with the feedback gain. I increased it to various values greater than 3 at which point the response explodes. If gain is adjusted in the other direction, the response dies away.

author: AG6QR
author_rank: Frequent Contributor
timestamp: October 11, 2013, 09:38:38 pm
content: Quote from: tree on October 11, 2013, 09:16:13 pmThat sounds exactly like what I'd expect if your model doesn't include the heating effects of the PTC/Lamp part of the circuit. So it sounds to me like you've probably modelled it "right", where "right" means "included everything except the heating effects".Both the LTSpice and Mathcad models ought to exhibit a similar sensitivity to the precise values of the feedback resistors. They should both explode when R4 stays lower than R2/2, and they should both die out when R4 stays higher than R2/2.

author: tree
author_rank: Regular Contributor
timestamp: October 11, 2013, 10:15:06 pm
content: Quote from: AG6QR on October 11, 2013, 09:38:38 pmIf you refer to my first post, I simulated the circuit with LTspice for the first 200ms. You can clearly see it oscillating with an amplitude of about 420mV despite lacking the heating effects. When I run the Mathcad simulation for the first 200ms, the response is an exponential oscillation (i.e. it's growing extremely quickly). I have a feeling that my differential equation is not correct for two reasons. The first being what I just claimed about its growth. The second being that the frequency is just off.

author: tree
author_rank: Regular Contributor
timestamp: October 12, 2013, 03:08:32 pm
content: I have attached a picture of the correct differential equation and its solution, symbolic and graphic. I have also have attached a Mathematica worksheet for those who want to play with the theoretical solution.