---
title: Sinusoidal oscillators
heading: Feedback that's positive at exactly one frequency
eyebrow: C6 · Lesson 49 · Sinusoidal oscillators
xp: 40
---

::: hook
Lesson 48's relaxation oscillators make square and triangle waves by snapping between two states. A sine wave needs a gentler approach: a frequency-selective network in a feedback loop arranged so that at exactly one frequency the signal comes back around the loop in phase and at the same size. Then the loop sustains that one sine, whatever started it. The trick is getting the loop gain to be exactly one: a bit less and the oscillation dies, a bit more and it grows until something clips. Real oscillators start with a little extra gain and let a gentle nonlinearity trim it.
:::

::: play
- A Wien-bridge oscillator: an op amp with gain $1 + R_F/R_G$ and an RC network (10 kΩ, 15.9 nF) feeding back to its non-inverting input. A 10 mV step at the start gives it a kick.
- With $R_F$ = 23 kΩ the gain is 3.3, a little more than the 3 the network needs, so the sine at 1 kHz grows until the op amp's output limits.
- Lower $R_F$ below 20 kΩ: the loop gain drops below one and the oscillation dies away. Raise it far above: it clips into a square-ish wave.
:::
:::

```sim circuit
VK k 0 step 0.01                    @ 0,5 down 2
RG n k 10k                          @ 0,3 down 2
RF out n 23k                        @ 0,1 right 4
U1 p n out VSAT=5 GBW=10M           @ 1,3 flip
R1 out a 10k                        @ 4,3 down 2
C1 a p 15.9n                        @ 4,5 left 3
R2 p 0 10k                          @ 1,5 down 3
C2 p 0 15.9n                        @ 2,5 down 3
slider: RF 18k..40k
scope: v(out)
time: 0..20m s
```

::: predict
## A Wien network of 10 kΩ and 15.9 nF feeds back to a non-inverting amplifier. At what frequency does it oscillate, and what gain does the amplifier need?

- [ ] 1 kHz, gain 1
- [x] 1 kHz, gain 3
- [ ] 6.3 kHz, gain 3
- [ ] 159 Hz, gain 29

::: reveal
1 kHz, gain 3. At $f_0 = \frac{1}{2\pi RC}$ = 1.0 kHz the Wien network's phase shift is zero and it passes exactly one third of the signal, so the amplifier must make up a factor of 3: $R_F = 2R_G$.
:::
:::

::: nameit
## The Barkhausen condition

An amplifier A with a frequency-selective feedback network β sustains a sine at the frequency where

$$A\beta = 1 \quad\text{(magnitude 1, phase 0° or 360°)}$$

With $|A\beta|$ slightly above 1 the oscillation grows; below 1 it decays. A practical oscillator starts with a little too much gain, and some nonlinearity (the op amp's output limits, diodes across $R_F$, a lamp or a thermistor whose resistance rises with amplitude) reduces it to exactly 1 at a steady amplitude. The gentler the limiting, the purer the sine.

## RC oscillators

**Wien bridge:** a series RC and a parallel RC as a divider:

$$f_0 = \frac{1}{2\pi RC} \qquad \beta(f_0) = \frac13 \qquad A = 1 + \frac{R_F}{R_G} = 3$$

**Phase shift:** three RC sections around an inverting amplifier; each contributes 60° at

$$f_0 = \frac{1}{2\pi\sqrt6\,RC}$$

where the network attenuates by 29, so the amplifier needs a gain of −29.

## LC and crystal oscillators

Above a few hundred kilohertz, LC tanks take over. A **Colpitts** oscillator uses a capacitive divider ($C_1$, $C_2$) across an inductor:

$$f_0 = \frac{1}{2\pi\sqrt{LC_s}} \qquad C_s = \frac{C_1C_2}{C_1 + C_2}$$

and the transistor needs a gain of at least $C_2/C_1$ to make up the divider's loss. A **Hartley** taps the inductor instead: $f_0 = \frac{1}{2\pi\sqrt{(L_1 + L_2)C}}$. A **crystal** replaces the tank with a quartz resonator whose Q of 10⁴ to 10⁶ pins the frequency to parts per million.
:::

::: example
## Design a Wien-bridge oscillator for 1 kHz with 10 kΩ resistors, and choose its gain resistors.

::: solution
1. **Capacitors.**
   $$\begin{aligned} C &= \frac{1}{2\pi \times 10\ \text{k} \times 1\ \text{kHz}} \\ &= 15.9\ \text{nF} \end{aligned}$$
2. **Gain resistors.** The amplifier needs exactly 3, so $R_F = 2R_G$: 20 kΩ with 10 kΩ.
3. **Starting and settling.** Nudge $R_F$ up a little (as in the sim, 23 kΩ) so it starts reliably, with diodes or a lamp to settle the amplitude.

**Answer:** C = 15.9 nF, with $R_F$ = 20 kΩ (nudged up to about 23 kΩ) and $R_G$ = 10 kΩ.
:::
:::

::: example
## A Colpitts oscillator has L = 10 µH and $C_1 = C_2$ = 1 nF. What is its frequency and the gain it needs?

::: solution
1. **Series capacitance.** $C_1$ and $C_2$ in series give $C_s$ = 0.5 nF.
2. **Frequency.**
   $$\begin{aligned} f_0 &= \frac{1}{2\pi\sqrt{10\ \mu\text{H} \times 0.5\ \text{nF}}} \\ &= 2.25\ \text{MHz} \end{aligned}$$
3. **Gain.** It needs a gain of at least $C_2/C_1 = 1$ from the transistor.

**Answer:** it oscillates at 2.25 MHz and needs a gain of at least 1.
:::
:::

::: example
## Design an RC phase-shift oscillator for 1 kHz with three 10 kΩ, C sections. What capacitors, and what gain does the amplifier need?

::: solution
1. **Capacitors.** $f_0 = \frac{1}{2\pi\sqrt6\,RC}$, so
   $$\begin{aligned} C &= \frac{1}{2\pi\sqrt6 \times 10\ \text{k}\Omega \times 1\ \text{kHz}} \\ &= 6.50\ \text{nF} \end{aligned}$$
2. **Gain.** At that frequency the three sections shift the phase 180° and attenuate by 29, so the inverting amplifier must have a gain of at least 29.
3. **Compare the Wien bridge.** It needs only 3; the phase-shift oscillator's high gain makes its amplitude harder to control.

**Answer:** 6.50 nF capacitors, and an inverting gain of at least 29.
:::
:::

::: check
given: R = 1 | 10 | 47; C = 1 | 10 | 100
answer: 1/(2*pi*R*1000*C*1e-9)
unit: Hz
tolerance: 0.5%

## A Wien-bridge oscillator uses R = {R} kΩ and C = {C} nF. At what frequency does it oscillate?

::: right
Right. $\frac{1}{2\pi RC}$ = {answer}.
:::

::: misses
- [1/(2*pi*sqrt(6)*R*1000*C*1e-9)] That's the phase-shift oscillator.
- [any] Not yet. $f_0 = 1/(2\pi RC)$.
:::
:::

::: check
given: RG = 1 | 4.7 | 10
answer: 2*RG
unit: kΩ
tolerance: 0.5%

## A Wien-bridge oscillator's gain resistor $R_G$ is {RG} kΩ. What $R_F$ gives exactly the gain it needs?

::: right
Right. $1 + R_F/R_G = 3$, so $R_F$ = {answer}.
:::

::: misses
- [3*RG] The gain is $1 + R_F/R_G$, so $R_F/R_G$ = 2.
- [any] Not yet. The network passes one third.
:::
:::

::: check
given: R = 4.7 | 10; C = 10 | 47
answer: 1/(2*pi*sqrt(6)*R*1000*C*1e-9)
unit: Hz
tolerance: 0.5%

## A three-section RC phase-shift oscillator uses R = {R} kΩ and C = {C} nF. At what frequency does it oscillate?

::: right
Right. $\frac{1}{2\pi\sqrt6RC}$ = {answer}.
:::

::: misses
- [1/(2*pi*R*1000*C*1e-9)] Three sections reach 180° at $\frac{1}{2\pi\sqrt6RC}$, not $\frac{1}{2\pi RC}$.
- [any] Not yet. Each section shifts 60° there.
:::
:::

::: check
given: L = 1 | 10 | 100; C1 = 0.1 | 1; C2 = 0.47 | 2.2
answer: 1/(2*pi*sqrt(L*1e-6*C1*C2/(C1 + C2)*1e-9))/1e6
unit: MHz
tolerance: 0.5%

## A Colpitts oscillator has L = {L} µH, $C_1$ = {C1} nF and $C_2$ = {C2} nF. What is its frequency?

::: right
Right. With $C_s = C_1C_2/(C_1 + C_2)$: {answer}.
:::

::: misses
- [1/(2*pi*sqrt(L*1e-6*(C1 + C2)*1e-9))/1e6] The two capacitors are in series around the tank.
- [any] Not yet. $f_0 = 1/(2\pi\sqrt{LC_s})$.
:::
:::

::: check
given: C1 = 0.1 | 1; C2 = 0.47 | 4.7
answer: C2/C1
tolerance: 0.5%

## What minimum transistor gain does a Colpitts oscillator with $C_1$ = {C1} nF and $C_2$ = {C2} nF need?

::: right
Right. $C_2/C_1$ = {answer}.
:::

::: misses
- [C1/C2] The capacitive divider feeds back $C_1/C_2$; the gain must make that up.
- [any] Not yet. The divider's loss must be recovered.
:::
:::

::: check
given: L1 = 1 | 10; L2 = 2 | 20; C = 0.1 | 1
answer: 1/(2*pi*sqrt((L1 + L2)*1e-6*C*1e-9))/1e6
unit: MHz
tolerance: 0.5%

## A Hartley oscillator has $L_1$ = {L1} µH and $L_2$ = {L2} µH tapped across a {C} nF capacitor. What is its frequency?

::: right
Right. $\frac{1}{2\pi\sqrt{(L_1 + L_2)C}}$ = {answer}.
:::

::: misses
- [any] Not yet. The tapped inductor's total is $L_1 + L_2$.
:::
:::

::: check
kind: parts
given: f = 0.1 | 1 | 10; R = 4.7 | 10 | 22

## An RC phase-shift oscillator uses three {R} kΩ, C sections for {f} kHz.

::: part
answer: 1/(2*pi*sqrt(6)*R*1000*f*1000)*1e9
unit: nF
tolerance: 0.5%

### What capacitance?

::: misses
- [1/(2*pi*R*1000*f*1000)*1e9] The three sections put $f_0$ at $\frac{1}{2\pi\sqrt6RC}$.
- [any] $C = \frac{1}{2\pi\sqrt6Rf_0}$.
:::
:::

::: part
answer: 29
tolerance: 0.5%

### What gain must the amplifier at least have?

::: misses
- [3] That's the Wien bridge's.
- [any] The network attenuates by 29 at $f_0$.
:::
:::
:::

::: check
kind: derivation
vars: R = 1000..100000, C = 0.000000001..0.000001, L = 0.000001..0.001, a = 0.0000000001..0.00000001, b = 0.0000000001..0.00000001

## A Wien bridge uses R and C; a Colpitts uses L with capacitors a and b.

::: step
answer: 1/(2*pi*R*C)

### What's the Wien bridge's frequency?
:::

::: step
answer: 1/(2*pi*sqrt(L*a*b/(a + b)))

### What's the Colpitts' frequency?
:::

::: step
answer: b/a

### What gain does the Colpitts need, with $C_1$ = a and $C_2$ = b?
:::

::: right
Right. The capacitive divider sets the feedback fraction.
:::
:::

::: explain
## Why does a practical oscillator need slightly more than the minimum loop gain, and something nonlinear?

::: model
With a loop gain of exactly one, a sine neither grows nor decays, but no real component holds its value exactly, and the oscillation must start from nothing, from noise or a supply switching on. So the designer gives the loop a little more gain than needed, making any small disturbance at the right frequency grow. Left alone it would grow until the amplifier clips, distorting the sine. A gentle nonlinearity, such as diodes that lower the gain at large amplitudes or a lamp whose resistance rises as it warms, brings the effective loop gain down to exactly one at a chosen amplitude, where the sine settles.
:::
:::

::: practice

::: check
given: f = 100 | 1000 | 10000
answer: 1/(2*pi*10*1000*f)*1e9
unit: nF
tolerance: 0.5%

## What capacitor makes a Wien-bridge oscillator with 10 kΩ resistors run at {f} Hz?

::: misses
- [any] $C = 1/(2\pi Rf_0)$.
:::
:::

::: check
given: C1 = 1 | 4.7; C2 = 1 | 10
answer: C1*C2/(C1 + C2)
unit: nF
tolerance: 0.5%

## What is the series combination of {C1} nF and {C2} nF?

::: misses
- [any] Product over sum.
:::
:::

::: check
given: f0 = 1 | 10; k = 2 | 4
answer: f0/sqrt(k)
unit: MHz
tolerance: 0.5%

## An LC oscillator runs at {f0} MHz. Its capacitance is multiplied by {k}. Where does it run now?

::: misses
- [any] $f \propto 1/\sqrt{C}$.
:::
:::
:::
