TExcelTAD
Home › Analog Electronics: Diodes, Transistors & Op-Amps › Oscillators: Barkhausen, Wien Bridge and Phase Shift

Oscillators: Barkhausen, Wien Bridge and Phase Shift

Every amplifier in this course so far was designed not to oscillate: Stability and Frequency Compensation was about keeping the loop away from −1-1. An oscillator does the opposite on purpose. It is an amplifier whose output is fed back to its input through a network that selects one frequency, with just enough gain that the signal at that frequency sustains itself. Audio test generators, the reference tone in a sensor bridge and the excitation for an LVDT are all built this way. This lesson covers the condition for oscillation, the two classic RC oscillators (Wien bridge and phase shift), and the part that textbooks rush and real designs live or die by: controlling the amplitude.

The loop picture

A beta(j omega) + vout + beta vout no input loop gain L(j omega) = A beta(j omega)

Cut the loop anywhere, inject a sinusoid, and follow it round: it comes back multiplied by the loop gain L(jω)=A β(jω)L(j\omega) = A\,\beta(j\omega). With positive feedback the returned signal adds to what is there, so a sinusoid sustains itself at a frequency ω0\omega_0 where

A β(jω0)=1⟺∣Aβ(jω0)∣=1  and  ∠Aβ(jω0)=0∘ (or 360∘)A\,\beta(j\omega_0) = 1 \quad\Longleftrightarrow\quad \lvert A\beta(j\omega_0) \rvert = 1 \ \text{ and } \ \angle A\beta(j\omega_0) = 0^\circ\ (\text{or } 360^\circ)

This is the Barkhausen criterion. It is the same condition as the closed-loop pole sitting exactly on the jωj\omega axis (Transfer Functions, Poles, Zeros and Stability): with ∣L∣\lvert L \rvert slightly above 1 the poles move into the right half-plane and the amplitude grows as eσte^{\sigma t}; slightly below 1 it dies away.

Necessary, not sufficient. Barkhausen describes the steady state. A practical oscillator also needs:

  1. Start-up gain margin. Component tolerances and temperature move ∣L∣\lvert L \rvert by a few percent, so design for ∣L∣≈1.1\lvert L \rvert \approx 1.1 to 1.51.5 at switch-on. Exactly 1 on paper means "may not start" on the bench.
  2. An amplitude-limiting mechanism that pulls the effective loop gain back to exactly 1 at some amplitude. Without one, the signal grows until the op-amp clips at its rails, and the "sine" becomes a flattened wave with several percent distortion.
  3. A single frequency where the phase condition holds with ∣L∣≥1\lvert L \rvert \ge 1. If the loop also satisfies it elsewhere (a parasitic pole in the amplifier, for example), the circuit may lock onto the wrong one.

Noise is the "input": thermal noise (Noise in Analog Circuits) and the switch-on transient contain every frequency, and the loop amplifies the one it selects.

The Wien-bridge oscillator

The Wien network is a series RC followed by a parallel RC. At low frequency the series capacitor blocks; at high frequency the shunt capacitor shorts the output. In between, at ω0=1/(RC)\omega_0 = 1/(RC), its output is in phase with its input and exactly one third as large:

β(jω)=VpVout=13+j(ωRC−1ωRC),f0=12πRC,β(jω0)=13\beta(j\omega) = \frac{V_p}{V_\text{out}} = \frac{1}{3 + j\left(\omega R C - \dfrac{1}{\omega R C}\right)}, \qquad f_0 = \frac{1}{2\pi R C}, \qquad \beta(j\omega_0) = \frac{1}{3}

So a non-inverting amplifier (The Ideal Op-Amp) with gain A=1+Rf/Rg=3A = 1 + R_f/R_g = 3 satisfies Barkhausen, and the Wien network drives its ++ input.

+ - R 10 kOhm C 16 nF C 16 nF R 10 kOhm p Rf1 18 kOhm Rf2 10 kOhm D1 D2 Rg 10 kOhm out

Amplitude control

Gain exactly 3 cannot be built, so the circuit above sets the small-signal gain above 3 and lets a nonlinearity pull it down as the amplitude grows:

  • Diodes across part of RfR_f (shown). At small amplitude the diodes are off and A=1+(18+10)/10=3.8A = 1 + (18 + 10)/10 = 3.8: the oscillation starts. As the swing grows, the voltage across Rf2R_{f2} approaches a diode drop and the diodes conduct for part of each cycle, shunting Rf2R_{f2}. The gain averaged over a cycle falls towards 1+18/10=2.81 + 18/10 = 2.8, and the amplitude settles where it is exactly 3. Cheap and robust; distortion of about 1 to 3 %, because the gain changes within each cycle.
  • A thermistor or a small lamp. A lamp in place of RgR_g (or an NTC thermistor in place of RfR_f) changes resistance with the rms current, averaged over many cycles, so the gain is constant within a cycle. Hewlett's HP 200A (1939), the first commercial Wien audio oscillator, used a lamp this way and was specified below about 1 % distortion; careful modern lamp- or AGC-stabilised designs reach 0.01 % or less. The price is slow settling ("bounce") after a frequency change.
  • A JFET or an automatic gain control loop. Rectify the output, compare it with a reference, and use the error to set a JFET's channel resistance in the gain network (MOSFET and JFET). The amplitude becomes as accurate as the reference.

The RC phase-shift oscillator

Three RC sections in a ladder give 180∘180^\circ of phase shift at one frequency; an inverting amplifier adds the other 180∘180^\circ. For three equal sections of series CC and shunt RR, driven from a low impedance and lightly loaded,

f0=12π6 RC,β(jω0)=−129⇒A=−29f_0 = \frac{1}{2\pi\sqrt{6}\,R C}, \qquad \beta(j\omega_0) = -\frac{1}{29} \quad\Rightarrow\quad A = -29

The large attenuation (each section loads the one before it) means a high amplifier gain and more sensitivity to tolerances, so the phase-shift oscillator is used where cost matters more than purity, for example a simple tone or a lamp-flasher-style test signal.

Worked example

Given: a Wien-bridge oscillator with R=10 kΩR = 10\ \text{k}\Omega, C=16 nFC = 16\ \text{nF}, Rg=10 kΩR_g = 10\ \text{k}\Omega, Rf1=18 kΩR_{f1} = 18\ \text{k}\Omega, Rf2=10 kΩR_{f2} = 10\ \text{k}\Omega bridged by two antiparallel silicon diodes; op-amp on ±12 V\pm 12\ \text{V}.

Find: the frequency, the start-up loop gain, and the loop gain once the diodes conduct fully.

Solve:

f0=12π⋅10 kΩ⋅16 nF=994.7 HzLstart=βA=13(1+28 kΩ10 kΩ)=3.83=1.27Ldiodes on→13(1+18 kΩ10 kΩ)=2.83=0.93\begin{aligned} f_0 &= \frac{1}{2\pi \cdot 10\ \text{k}\Omega \cdot 16\ \text{nF}} = 994.7\ \text{Hz} \\ L_\text{start} &= \beta A = \frac{1}{3} \left(1 + \frac{28\ \text{k}\Omega}{10\ \text{k}\Omega}\right) = \frac{3.8}{3} = 1.27 \\ L_\text{diodes on} &\to \frac{1}{3} \left(1 + \frac{18\ \text{k}\Omega}{10\ \text{k}\Omega}\right) = \frac{2.8}{3} = 0.93 \end{aligned}

Check: the start-up gain is 27 % above 1, enough margin for 5 % parts; the fully limited gain is below 1, so an amplitude exists in between where the average is exactly 1. The two values bracket 1, which is the design rule for any limiting scheme.

In Python: the two feedback networks

python · try it yourself
import numpy as np
from scipy.optimize import brentq

R, C = 10e3, 16e-9
f0 = 1 / (2 * np.pi * R * C)

def wien_beta(f):
    x = 2 * np.pi * f * R * C
    return 1 / (3 + 1j * (x - 1 / x))

print(f"Wien: f0 = {f0:.1f} Hz")
for f in [0.5 * f0, f0, 2 * f0]:
    b = wien_beta(f)
    print(f"  f = {f:7.1f} Hz  |beta| = {abs(b):.4f}  phase = {np.degrees(np.angle(b)):6.1f} deg")

# Phase-shift ladder: three C-series / R-shunt sections, ideal source in, open circuit out
def ladder(f):
    Zc = 1 / (2j * np.pi * f * C)
    M = np.eye(2, dtype=complex)
    for _ in range(3):
        M = M @ np.array([[1, Zc], [0, 1]]) @ np.array([[1, 0], [1 / R, 1]])
    return 1 / M[0, 0]          # Vout/Vin with the output open

f180 = brentq(lambda f: ladder(f).imag, 100, 2000)
print(f"Phase shift: f180 = {f180:.1f} Hz (formula {1 / (2 * np.pi * np.sqrt(6) * R * C):.1f} Hz)")
print(f"  ladder gain = {ladder(f180).real:.5f}  ->  amplifier gain needed = {-1 / ladder(f180).real:.2f}")
Wien: f0 = 994.7 Hz
  f =   497.4 Hz  |beta| = 0.2981  phase =   26.6 deg
  f =   994.7 Hz  |beta| = 0.3333  phase =    0.0 deg
  f =  1989.4 Hz  |beta| = 0.2981  phase =  -26.6 deg
Phase shift: f180 = 406.1 Hz (formula 406.1 Hz)
  ladder gain = -0.03448  ->  amplifier gain needed = 29.00

The ladder is built from ABCD matrices, and brentq finds the frequency where its gain is purely real (negative). Both textbook numbers, 1/291/29 and f0=1/(2π6RC)f_0 = 1/(2\pi\sqrt{6}RC), come out of the numerics. The Wien phase is only ±26.6∘\pm 26.6^\circ an octave away, so the network is not very selective: the amplitude limiter, not the network, sets the distortion.

Interactive: the Wien network alone

This lab is the Wien network driven by a 1 V1\ \text{V} source standing in for the op-amp output (the op-amp itself is not in the netlist: the loop is open). Sweep the frequency and watch V(p)V(p) peak and pass through 0∘0^\circ.

0.00.10.20.31001k10kf (Hz)|V| (V)|V(p)|phasors at f = 995.0 Hz (magnitude @ phase)V(out)1.00 V @ 0.0 degV(a)745 mV @ -26.6 degV(p)333 mV @ 0.0 degI(V1)47.1 uA @ -135.0 degI(R1)47.1 uA @ 45.0 degI(C1)47.1 uA @ 45.0 degI(R2)33.3 uA @ 0.0 degI(C2)33.3 uA @ 90.0 deg

At 995 Hz995\ \text{Hz} the lab shows V(p)=333.3 mVV(p) = 333.3\ \text{mV} at 0.0∘0.0^\circ: β=1/3\beta = 1/3. Move R2R_2 away from 10 kΩ10\ \text{k}\Omega and the peak value and the zero-phase frequency both shift: with unequal parts the required gain is no longer 3, which is why matched pairs (or a dual-gang potentiometer for a tunable oscillator) are used.

Cross-check with SPICE: watching it start

The op-amp is the course macro-model (a 1 mS1\ \text{mS} transconductance into 100 MΩ∥159.2 pF100\ \text{M}\Omega \parallel 159.2\ \text{pF}, so A0=105A_0 = 10^5 and GBW=1 MHz\text{GBW} = 1\ \text{MHz}), with its output limited to ±12 V\pm 12\ \text{V} by an E-source table to stand for the rails. A 10 mV10\ \text{mV} initial charge on the series capacitor plays the part of noise. meas finds the time to reach 1 V1\ \text{V}, the frequency from ten cycles, and the settled peaks.

bash · try it yourself
cat > wien.cir <<'EOF'
* Wien-bridge oscillator, R = 10k, C = 16n, diode amplitude control
.model DSIG D(Is=2.52n N=1.752 Rs=0.568 Cjo=4p M=0.4 Tt=20n BV=100 IBV=0.1u)
.subckt OA inp inn out
G1 0 n1 inp inn 1m
R1 n1 0 100meg
C1 n1 0 159.2p
E1 out 0 TABLE {v(n1)} = (-12,-12) (12,12)
.ends
X1 p n out OA
* frequency-selective (positive) feedback
R1 out a 10k
C1 a p 16n IC=0.01
R2 p 0 10k
C2 p 0 16n
* gain-setting (negative) feedback: 1 + (18k + 10k)/10k = 3.8 at small amplitude
Rg n 0 10k
Rf1 out m 18k
Rf2 m n 10k
D1 m n DSIG
D2 n m DSIG
.control
tran 2u 40m uic
meas tran tstart when v(out)=1 rise=1
meas tran t1 when v(out)=0 rise=20
meas tran t2 when v(out)=0 rise=30
let f = 10/(t2 - t1)
print f
meas tran vmax max v(out) from=30m to=40m
meas tran vmin min v(out) from=30m to=40m
.endc
.end
EOF
ngspice -b wien.cir 2>&1 | grep -E '^(f|vmax|vmin|tstart) +='
tstart              =  1.716386e-03
f = 9.878524e+02
vmax                =  9.539861e+00 at=  3.428550e-02
vmin                =  -9.539860e+00 at=  3.377950e-02

The oscillation reaches 1 V1\ \text{V} after 1.7 ms1.7\ \text{ms} and settles at ±9.54 V\pm 9.54\ \text{V}, well inside the ±12 V\pm 12\ \text{V} rails: the diodes, not clipping, set the amplitude. The frequency is 987.9 Hz987.9\ \text{Hz}, 0.7 % below the ideal 994.7 Hz994.7\ \text{Hz}, because the op-amp's finite gain-bandwidth adds a little phase lag that the network must cancel slightly below f0f_0. Change Rf1 to 15k (fully limited gain 2.5/32.5/3) and the amplitude drops; change it to 22k and the limited gain 3.2/3>13.2/3 > 1 can no longer hold the signal, which then grows into the rails.

Guided lab: build a 1 kHz Wien oscillator

Hand calculation. f0=995 Hzf_0 = 995\ \text{Hz}, start-up loop gain 1.27, limited gain 0.93.

Simulation. The Python table, the network lab and the SPICE start-up above.

What you would measure. Build it with a general-purpose op-amp on a ±12 V\pm 12\ \text{V} current-limited bench supply (limit about 50 mA50\ \text{mA} per rail), 1 % resistors, two 16 nF16\ \text{nF} film capacitors and two 1N4148-class diodes. Watch the output on a scope: it should start within a few milliseconds and settle to roughly ±8\pm 8 to ±10 V\pm 10\ \text{V} (the exact value depends on the diodes' forward voltage and temperature). Expect ff within about ±5 %\pm 5\ \% of 995 Hz995\ \text{Hz} with 5 % capacitors, ±2 %\pm 2\ \% if you measure and match them. The scope's FFT should show the third harmonic about 30 dB below the fundamental (around 3 % distortion, compare the SPICE waveform); swapping the diodes for a small lamp in place of RgR_g lowers it markedly.

Hazards and safe setup. Low voltage only; current-limit both rails and switch them on together. Never "test" an oscillator by touching high-impedance nodes: your body adds capacitance and hum, and the lesson you learn is misleading rather than dangerous. Electrolytic capacitors are unsuitable in the network (polarised, leaky, wide tolerance).

Pitfalls

  • Designing for ∣L∣=1\lvert L \rvert = 1 exactly. It will not start reliably, or it will stop when the room warms up.
  • No limiter. The amplitude grows into the rails; the result is a clipped wave with poor distortion and a frequency that drifts with the supply.
  • Ignoring the amplifier's bandwidth. At high frequencies the op-amp's own phase lag shifts f0f_0 and can stop oscillation; keep f0f_0 below about GBW/100\text{GBW}/100 for a well-behaved Wien oscillator, or check in simulation.
  • Loading the network. A low-impedance load on node pp or a heavy load on the output changes β\beta. Buffer the output if the next stage is not a high impedance.

Practice

  1. Choose CC for a 10 kHz Wien oscillator with R=4.7 kΩR = 4.7\ \text{k}\Omega.
  2. A phase-shift oscillator uses R=10 kΩR = 10\ \text{k}\Omega, C=10 nFC = 10\ \text{nF}. What frequency, and what inverting gain?
  3. Why does a lamp give lower distortion than diodes in the Wien gain network?
Answer
  1. C=1/(2π⋅10 kHz⋅4.7 kΩ)=3.39 nFC = 1/(2\pi \cdot 10\ \text{kHz} \cdot 4.7\ \text{k}\Omega) = 3.39\ \text{nF}; use 3.3 nF3.3\ \text{nF} for f0=10.3 kHzf_0 = 10.3\ \text{kHz}.
  2. f0=1/(2π6⋅10 kΩ⋅10 nF)=650 Hzf_0 = 1/(2\pi\sqrt{6} \cdot 10\ \text{k}\Omega \cdot 10\ \text{nF}) = 650\ \text{Hz}, gain −29-29 (in practice about −30-30 to −35-35 for start-up margin).
  3. The lamp's resistance follows the rms current with a thermal time constant much longer than one cycle, so the gain is constant within each cycle and the waveform is not bent; diodes change the gain during each cycle.

Test yourself

The Barkhausen criterion for a sustained oscillation at ω0\omega_0 is…

  1. ∣Aβ∣=0\lvert A\beta \rvert = 0
  2. Aβ(jω0)=1A\beta(j\omega_0) = 1: unit magnitude and zero (or 360∘360^\circ) phase
  3. Aβ(jω0)=−1A\beta(j\omega_0) = -1 with negative feedback
  4. ∣A∣=∣β∣\lvert A \rvert = \lvert \beta \rvert

A Wien network with R=10 kΩR = 10\ \text{k}\Omega and C=16 nFC = 16\ \text{nF} has, at its centre frequency, a gain of…

  1. 1/291/29 at 406 Hz406\ \text{Hz}
  2. 1/31/3 at 995 Hz995\ \text{Hz}
  3. 11 at 995 Hz995\ \text{Hz}
  4. 1/31/3 at 6.25 kHz6.25\ \text{kHz}

Why is the Wien amplifier's small-signal gain set to about 3.8 instead of exactly 3?

  1. To raise the frequency
  2. To guarantee start-up despite tolerances; a limiter then reduces the effective gain to 3
  3. Because the op-amp needs gain 3.8 to be stable
  4. To lower the distortion

A three-section RC phase-shift oscillator needs an amplifier with a gain of about…

  1. +3+3
  2. −3-3
  3. −29-29
  4. +29+29