EE Product News

# Analysis of a Digitally Controlled Wien Bridge Oscillator

Step-By-Step Design
Analysis of a Digitally Controlled Wien Bridge Oscillator

By Simon Bramble,
Maxim UK Applications

INTRODUCTION
Of all the low-frequency oscillator configurations, the Wien Bridge has to be the friendliest and easiest to get along with. Like a faithful dog, it behaves itself regardless of the weather, is not very temperamental and very rarely chews up newspapers. It uses standard components, gives a good sine wave and is fairly immune to the type of op amp it is designed around.

It can, however, be misunderstood, and over simplifications as to its operation can leave the designer thinking that it is not as well trained as originally thought. In pursuit of gaining an understanding of our trusty friend, it is wise to go back to basics.

1 THE CIRCUIT
The circuit of a standard Wien Bridge oscillator is shown in Figure 1. A circuit will oscillate if, at a given frequency, it has greater than unity gain and zero phase shift from input, through the device, through the feedback network and back to the input.

2. CONSIDER PHASE SHIFT
Looking at the circuit in Figure 1, R1 and C1 produce a positive phase shifted current with respect to the output voltage. When this current meets R2 and C2, these components produce a voltage that is phase shifted in a negative direction. At one frequency the phase shift caused by R1 and C1 will be offset by an equal and opposite phase shift caused by R2 and C2 and the net phase shift will be zero. The circuit is now in danger of oscillating.

For the mathematically inclined, the transfer function of the network made up by R1, C1, R2, C2 can be considered. Since the output impedance of the op amp will be low and the input impedance of the inputs very high, it is relatively straightforward to derive the transfer function of the Wien Network (the resistive divider made up of R1 and C1 on the top and R2 and C2 on the bottom). One strong cup of coffee and a rainy Sunday afternoon yields the transfer function as:

Put simply (if this is possible) the imaginary 'j' terms represent a 90° phase shift in the transfer function (either positive or negative). The real, non 'j' terms represent zero phase shift in the transfer function. As the magnitude-of the real and imaginary terms change, so does the resultant phase shift. It can be seen from Equation 1 that at:

the real terms in the denominator equate to zero, leaving only imaginary terms in the numerator and denominator. Dividing the numerator and denominator by 'jw' leaves no imaginary terms and hence no phase shift. We therefore have our condition for zero phase shift at a given frequency.

3. CONSIDER THE GAIN
Once the battle between the real and imaginary terms has ceased and the resonant frequency determined, the transfer function is:

Now, to greatly simplify things, it is wise to equate R1 to R2 and C1 to C2. It can then be seen that at resonance the transfer function from output to input is:

To meet the requirements for oscillation (zero phase shift and unity gain), the op amp circuit needs to have a gain of three to overcome the attenuation resulting from the Wien Bridge network. Looking at this another way, to keep the two inputs of the op amp at the same voltage, the resistor network from the output to the inverting input needs to provide an attenuation of three to match the attenuation of the Wien Network.

This is very convenient in theory, but near useless in practice. We can obtain resistors with accurate values but obtaining accurate capacitors is a bit more difficult. Getting capacitors with an accuracy greater than 20% starts to eat into the design budget, so it is now wise to consider the effect of different capacitor values on the performance of the circuit.

4. CONSIDER CAPACITOR VALUES
Figure 2 shows a simple spreadsheet illustrating the values of the Wien Bridge Network and their impact on the gain. Cell B7 is the transfer function represented in Equation 3, cell B12 is represented by Equation 2 (with the answer in kHz) and cell B9 is the reciprocal of cell B7. If C1 = C2 = 10 nF and R1 = R2 = 10K, the circuit will oscillate at 1.59 kHz and the gain of the op amp is 3. A practical measurement of this circuit backs up this theory.

However, the above results were achieved with ±10% tolerance capacitors. A quick inspection of a components catalog indicates very similar capacitors designed for general decoupling with a tolerance of -20%/+80%. If this is the case and C1 = 8 nF (10 nF - 20%) and C2 = 18 nF (10 nF + 80%), then the circuit will need a gain of 4.25. Inserting these components into the circuit will mean the circuit does not have the required gain (our circuit only delivers a gain of three) and the circuit will not oscillate. Alternatively, if C1 is high and C2 is low the circuit will have too much gain and the circuit will oscillate, but with significant distortion. In addition to this, once the circuit is oscillating, the frequency will be incorrect due to the wide tolerance on the capacitor values. The ideal circuit is one that is just biased to the point of oscillation. Any less gain and the circuit will stop oscillating; any more gain and it will start to distort.

5. ADD A JFET IN THE FEEDBACK NETWORK
As illustrated in Figure 3, adding a JFET in the feedback network provides a solution to this problem as it can vary the gain over a small range and ensure consistent oscillation. At startup, the FET Gate voltage is at zero, so the Drain–Source impedance is very low. This gives a gain greater than three (to get the circuit going). Once oscillations build up, the diodes rectify the negative transitions of the output, which provides a turn off voltage to the JET's gate. This reduces the gain and the circuit settles down to stable oscillation. The amplitude of the output is dependent on the voltage drop across the two diodes as well as the turn off voltage of the JFET. Unfortunately, JFETs have a large variation in gate turn-off voltage, meaning the output voltage of the circuit can vary considerably from batch to batch. Q1 was selected as it has a very low variation in gate turn off voltage, thus guaranteeing a small variation in output voltage from circuit to circuit, but this situation often does not yield the lowest distortion oscillator. The circuit could still oscillate, but with significant distortion and the FET would maintain this oscillation regardless of the distortion. The FET should therefore only be used as a 'tweak' to keep the circuit going, not to act as a blanket cover of poor circuit design.

6. INSERT A VARIABLE RESISTOR IN THE FEEDBACK PATH
Unless complex circuit design can be tolerated, the simplest way to ensure the circuit starts up and continues to oscillate without distortion (due to too much gain) is to insert a variable resistor in the feedback path. The resistor is then adjustedto the point where the circuit just starts to oscillate. This will provide a clean sine wave with the lowest distortion.

However, some engineers consider a variable resistor as a simple design solution, but a time-consuming production headache. It takes time and manpower to adjust a variable resistor and this makes the circuit difficult and hence expensive to produce.

The ideal solution is the insertion of an electronically variable resistor, or digipot. In Figure 3, replacing VR1 with a digipot provides a low cost, small, simple solution to enable the circuit to be adjusted at production to ensure minimal distortion. It can be used as a single variable resistor, or put in series or parallel with other resistors to provide either coarse or fine tuning of the gain. Once the circuit is oscillating, the JFET takes care of the fine tweaks in gain to keep the circuit going.

The circuit of Figure 3 was enhanced with the MAX5467 10K digipot. Since this part has two floating terminals, the part does not have to be ground referenced. Therefore, it can be used to adjust the frequency as well as the gain of the circuit, simply by combining it with either resistor, R1 or R2, or both. A simple digital interface means the circuit can also be manually adjusted without the need for a microcontroller.

Practical tests proved this theory correct. Two 10K digipots were inserted in series with resistors R1 and R2 and, it was observed that the frequency of operation of the circuit could be adjusted from 833 Hz to 1.6 kHz. A digipot was also inserted in place of VR1 and, as expected, the output of the circuit could be adjusted from dc to pure sine wave to distorted sine wave as the gain of the circuit changed. Figure 4 shows the final circuit with the MAX5467 digipots labelled IC2, IC3 and IC4.

Figure 6 shows a power supply for the circuit. The circuit was powered from 5V. From this a +2.5V and a -2.5V rail were derived using a BC547 transistor. The op amp and digipots were powered from these rails, while the rest of the circuit was referenced to 0V. Figure 7 shows the frequency and gain adjust circuits, respectively. IC2 and IC3 in Figure 4 shared the same digital interface and hence could be incremented and decremented simultaneously. IC4 was used to provide an independent gain adjust circuit. It does not matter which way round the digipot resistor terminals are connected.

CONCLUSION
In conclusion, the Wien Bridge oscillator is easy to understand in theory, but the practicalities of the circuit can cause the designer frustration. Insertion of a digipot in the three critical areas of the circuit ensures much more stable operation and factory/user adjustability.

Company: MAXIM INTEGRATED CIRCUITS

TAGS: Components