Wein Bridge undamped with higher freq? - Page 1
Forum section: electronics / projects

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: November 19, 2018, 03:45:46 am
content: Hi all. This project is getting a little long in the tooth, to be frank and I'm running out of things to try. I'm trying to make a good audio oscillator around the Wien-Bridge concept. It's giving me some trouble with stability of amplitude. The damping of the amplitude control is a function of oscillation frequency. It goes completely undampened when the oscillation frequency is about two and a half orders of magnitude above the natural frequency of the gain control. I have attached some scope shots to show what I mean. I've also attached a schematic and a MathCad paper showing a theoretical discussion of the circuit.But where does it say that the damping of the control loop is a function of the frequency of operation? The time constant of the AGC is around 200 mS but the freq. of oscillation is around 750 Hz when it can't settle. The damping gets better at LOWER frequencies, too. Why? The difference between the shot with sustained amplitude oscillation (1st scope shot) and that where damping happens (2nd scope shot) is only about 10%. At lower oscillation frequencies it is well behaved and will settle in less than a second, even if distortion is non-optimal. At higher frequencies it's just hopeless.BTW: The current-dependant resistor I used (called U2, LDR_hommade on the schem) is home-made with a photo-resistor and a small incandescent lamp stuffed into a small aluminum tube. Its driven by an op-amp/transistor buffer after a full-wave rectifier and filter. (see schematic)I wanted this thing to be well behaved all the way across the audio band. It WILL oscillate at any frequency I want from .1 Hz to >50 KHz but not with the amplitude governor that I have. If I chop out the AGC and just manipulate the gain resistors of U3B with a decade box then I get no instability at any frequency (4th scope shot). In fact, it will oscillate with distortion products at least 90 dB down; so far down that my poor HP 1741A cant see it (5th scope shot). That's why I put in the notch filter, so I can attenuate the fundamental and crank the input gain of the SA to bring the distortion products into view. The notch filter works to make a 30-40 dB deep notch only but it will get better eventually.Anyway does anybody know why the damping should be a function of the frequency of oscillation?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 19, 2018, 07:12:57 pm
content: Possible reasons:- Is the op-amp behaving "ideal" over this range? That is, have you designed the oscillator such that an op-amp gain of 10 or 100 or 1000 or etc. (as the case may be, and at different frequencies) is stable?- Are those actually  switches, or a solid-state mux or mDAC or anything? Is the wiring short and away from other things? (I wouldn't expect problems with most things, except mDACs / "digital pots" which can be very messy due to internal capacitances on the divider.)- Does the control loop time constant track with the frequency range? Offhand, I would guess the dominant pole is roughly a constant fraction of the oscillation frequency, which means a fixed compensator can only be correct at one setting. Of note: you have a dominant pole in the control loop (a solid RC after the precision rectifier), then a pole-zero (big cap + variable resistor). But that ceases to look like any ESR at higher frequencies, where the first RC dominates, and that's probably killing you in terms of phase margin (assuming everything else is well-behaved).- Have you evaluated the control, in terms of its linearity? CdS photocells are notoriously messy in terms of frequency response; the output-side V(I) linearity seems to be pretty good, but the photo-to-R response is weird (multiple time constants, or diffusion behavior?).Tim

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: November 21, 2018, 05:50:55 am
content: Quote from: T3sl4co1l on November 19, 2018, 07:12:57 pmYes, the op-amp is very stable at all frequencies of oscillation.Quote from: T3sl4co1l on November 19, 2018, 07:12:57 pmYup, actual "mechanical" switches (see pic w/ circles)Quote from: T3sl4co1l on November 19, 2018, 07:12:57 pmIt looks like it does. As the frequency of the oscillator is tuned down, the time constant of the control loop gets longer until it settles.Quote from: T3sl4co1l on November 19, 2018, 07:12:57 pmYeah, but that pole-zero is exactly whats supposed to make the loop stable.You know, a while back I had a simpler circuit, much a la Jim Wilson (His circuit is below, too.) with just an opamp and a single diode and a ref voltage and I didn't see any of this craziness. The distortion was a little worse at low frequencies and I thought that was due to it being only a half-wave rectifier so I thought I could get another octave of low distortion operation at the bottom end with a FW rectifier. Oh, well - I'll rip it out and go back to my previous circuit.Quote from: T3sl4co1l on November 19, 2018, 07:12:57 pmYeah, I did when there was an LED in the tube with the CdS cell. It is now CdS and incandescent light bulb. The LED current to R characteristic is pretty non-linear but I didn't think it would be significant since the time control constants would be so long.

author: Kleinstein
author_rank: Super Contributor
timestamp: November 21, 2018, 06:58:23 am
content: The nonlinear LED to R can be a real problem, as it changes the loop gain for the control loop.If the pot for the frequency adjustment is not perfect, it may need a considerable change in LDR resistance, possibly leading to the unstable range.One could see this by looking at the lamp / LED current as a function of the set frequency.A way around could be a second coarse, switched control, so that the LDR one does a fine adjustment.Another way would be to somewhat lineariz it, even if only crude.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 21, 2018, 09:07:52 am
content: Quote from: basinstreetdesign on November 21, 2018, 05:50:55 amI mean... the amp, in and of itself, is doing what it's doing, sure, but specifically the one(s) doing the oscillator: is the, for example, control output (the voltage sent to the bulb) about constant over all frequencies? Or does it have to do a "lot of work" (voltage changes significantly) over the range?The point is, the oscillator only oscillates when its loop gain is more than one; and the controller attempts to regulate that to exactly one (with an integral term, so that the amplitude is pulled to a known, steady level, not just held constant at whatever it happens to land on).This is probably going ever deeper into control theory that needs to be explained...- In a perfectly linear system, an oscillator, with unity loop gain, does the exact same thing every cycle. What that thing is (its amplitude, and phase with respect to some absolute time reference), depends on the initial conditions.- An integrating controller acts upon the integral of the error input. A proportional controller acts, well, proportionally (with no time dependency).- If we combine the two, then we are controlling oscillator amplitude up and down, to track the reference value. Consequently (assuming error goes to zero at \$t \rightarrow \infty\$), the control output will be such that the oscillator gain is exactly unity (and the oscillator output is constant), but ALSO that the oscillator output reached a known amplitude on its way there.- A real oscillator ain't never gonna have exactly unity gain, no matter how well you balance it (without a controller). Nor is it going to be perfectly linear. It is necessary to make light of these quirks, because it's easy to do the analysis*, and easy to spot special cases like unity gain giving constant amplitude. But the real world is a messy, chaotic (literally) place, and we must also understand how an (essentially) toy model differs from it.*Well, relatively speaking. The reason they teach LTI systems in undergrad is because it's tractable (the core problem is solving roots of polynomials). But you need to know differential equations to know that. So, yeah.So, anyway, the problem is twofold:1. As the control "effort" increases, it's indicative of the oscillator not being very stable, in the sense of its gain vs. frequency response. Ideally you want this flat, so the controller only has the slightest of effort required to do its job.2. If the "effort" required is greater than the (linear) range of the controller, the controller will saturate (or begin to), and error increases arbitrarily -- it loses control.3. At the same time, the more "effort" required, the more likely there are nonlinearities and time dependencies sneaking in from all those nonideal properties of the components. This isn't necessarily a bad thing, but it makes it that much harder to apply linear control theory.QuoteNononono, that's the loop, that's... well, I should've said thecontroller, not the loop.The loop is the product* of the controller AND the oscillator. If the oscillator changes, so too does the loop. That can leave the controller behind, and the system goes unstable. Probably it's necessary to vary the controller's time constant to track the oscillator, so the loop remains stable.*Not really, but sort of. It's the feedback equation, H = G / (1 + G*P), where H is the overall (ref to output) gain, G is the controller gain, and P is the "plant" (the thing being controlled, including its feedback/sense gain). All variables are, in general, functions, e.g., G(s) = 1/(s(s+a)) or something like that, where s is the Laplace domain frequency variable. The gain, and time constant (a), are controlled by the compensation components around the error amplifier (at least, for the easiest and most common example).Tim

author: xavier60
author_rank: Super Contributor
timestamp: November 21, 2018, 12:06:54 pm
content: I think the rectifier output should be compared to a reference.I can't figure out how the rectifier works. Are both half cycles the same size?

author: rhb
author_rank: Super Contributor
timestamp: November 23, 2018, 03:32:59 pm
content: If you've not read it already, read "Max Wein, Mr. Hewlett and a Rainy Sunday Afternoon" by Jim Williams.

author: bsfeechannel
author_rank: Super Contributor
timestamp: November 24, 2018, 04:42:24 am
content: Quote from: basinstreetdesign on November 19, 2018, 03:45:46 amI feel your pain. I also built a Wien bridge oscillator and it took me weeks to finally get it to work properly. But the reward is worth the pain. Below you'll find my version.The components marked with a single asterisk were adjusted to work with the JFET. They determine the range of the resistance that the opamp needs to have the proper positive gain. The JFET had to be 245C. 245A or B did not work quite well.The capacitor and the resistor marked with two asterisks are there to reduce second order harmonic. The JFET channel resistance is sensitive to VDS. So you compensate this effect by feeding the variations of VDSback to the gate. I got pretty good results. A very clean sine wave.The 100µF capacitor (marked with three asterisks) works reasonably well for all ranges. I say reasonably, because, specially for low frequencies, the amplitude takes a little (1 second) to stabilize.I took these and other ideas from HP209A. There, the AGC feedback loop changes with the range. I will probably implement this on the next upgrade of my project.Hope that helps.

author: xavier60
author_rank: Super Contributor
timestamp: November 24, 2018, 04:55:04 am
content: The tracking of the dual 10k Pot can affect amplitude stability. With some dual Pots, it's possible to open them and move one rotor with respect to the other to improve tracking.