---
title: FM demodulation and the phase-locked loop
heading: Discriminators and quadrature detectors, the phase-locked loop as a demodulator and tracking filter, first- and second-order loops, phase error, settling and noise bandwidth
eyebrow: S8 · Lesson 6 · FM demodulation and the phase-locked loop
xp: 50
---

::: hook
Recovering an FM message means measuring how fast a carrier's phase is turning. A discriminator does it by converting frequency to amplitude; a phase-locked loop does it by building a local oscillator that chases the incoming carrier and reporting how hard it had to push. The PLL turned out to be far more than an FM detector: the same loop recovers carriers for coherent demodulation, extracts symbol timing, synthesizes frequencies and cleans up jittery clocks. This lesson analyzes it as a control system, which is what it is, and finds how fast it locks, how far it lags, and how much noise it lets through.
:::

::: play
- The phase error of a PLL after a sudden step Δf in the input frequency, in units of $2\pi\Delta f/\omega_n$: a second-order loop (solid) with natural frequency $\omega_n$ and damping ζ, and a first-order loop with gain $K = \omega_n$ (dashed).
- The first-order loop settles to a permanent phase error, $2\pi\Delta f/K$. The second-order loop with an integrator drives the error back to zero after a transient.
- Lower damping gives a faster but ringing response; ζ ≈ 0.7 is the usual compromise. The peak error is $\frac{2\pi\Delta f}{\omega_n}e^{-\zeta\arccos\zeta/\sqrt{1 - \zeta^2}}$.
:::
:::

```sim plot
view: graph
x: t = 0..10
y: e = -0.4..1.1
slider: z = 0.2..0.95 = 0.707
plot: exp(-z*t)*sin(sqrt(1 - z^2)*t)/sqrt(1 - z^2) | samples: 600 | label: second-order loop
plot: 1 - exp(-t) | samples: 600 | dashed | color: ch3 | label: first-order loop
readout: peak of the second-order error = exp(-z*acos(z)/sqrt(1 - z^2))
```

::: predict
## A first-order PLL with loop gain 2π × 1000 rad/s locks to a carrier that then jumps 100 Hz. What happens to its phase error?

- [ ] It returns to zero
- [x] It settles at 0.1 rad, about 5.7°
- [ ] The loop loses lock
- [ ] It oscillates

::: reveal
A first-order loop has no integrator, so to hold the VCO 100 Hz away from its rest frequency it needs a steady control voltage, which only a steady phase error provides: $\theta_e = \Delta\omega/K = 2\pi(100)/2\pi(1000)$ = 0.1 rad. A second-order loop with an integrating filter tracks frequency steps with zero steady error, which is why practical loops are second order.
:::
:::

::: nameit
## Discriminators

Differentiating an FM signal gives $A[2\pi f_c + 2\pi k_fm(t)]\sin(\cdot)$, an AM signal whose envelope is proportional to the instantaneous frequency; an envelope detector then recovers m(t). The **quadrature detector** and the **zero-crossing** counter do the same job with simpler hardware. All of them respond to amplitude noise too, so they follow a **limiter**.

## The phase-locked loop

A phase detector compares the input with a VCO, a loop filter F(s) smooths the result, and the filter's output steers the VCO. Linearized, with phase-detector gain $K_d$ and VCO gain $K_v$ (rad/s per volt), the closed loop is

$$H(s) = \frac{KF(s)}{s + KF(s)}, \qquad K = K_dK_v$$

and the VCO control voltage is proportional to the input's frequency deviation: in lock, it is the FM demodulator's output.

- **First order** (F = 1): $H = \frac{K}{s + K}$, a frequency step Δω leaves a steady phase error Δω/K; noise bandwidth $B_L = K/4$ Hz.
- **Second order, type 2** (proportional-plus-integral filter): $H = \frac{2\zeta\omega_ns + \omega_n^2}{s^2 + 2\zeta\omega_ns + \omega_n^2}$. A frequency step leaves zero steady error, with transient $\frac{\Delta\omega}{\omega_n}\frac{e^{-\zeta\omega_nt}\sin(\omega_n\sqrt{1 - \zeta^2}t)}{\sqrt{1 - \zeta^2}}$, settling in about $4/(\zeta\omega_n)$. Noise bandwidth:

$$B_L = \frac{\omega_n}{2}\left(\zeta + \frac{1}{4\zeta}\right)\text{ Hz}$$

A narrow loop rejects noise but tracks slowly and has a small pull-in range; a wide loop does the opposite.
:::

::: example
## A second-order PLL has $\omega_n$ = 2π × 100 rad/s and ζ = 0.707. Find its noise bandwidth and its peak phase error for a 50 Hz frequency step.

::: solution
1. **Noise bandwidth.**
   $$\begin{aligned} B_L &= \frac{628.3}{2}(0.707 + 0.354) \\ &= 333\ \text{Hz} \end{aligned}$$
2. **Peak phase error.**
   $$\begin{aligned} \theta_\text{pk} &= \frac{2\pi \times 50}{628.3} \\ &\quad \times e^{-0.707\arccos(0.707)/0.707} \\ &= 0.5 \times e^{-0.785} \\ &= 0.228\ \text{rad} \\ &= 13.1° \end{aligned}$$
3. **Settling.** After the peak the error decays to zero within about
   $$\frac{4}{0.707 \times 628}\ \text{s} = 9\ \text{ms}$$

**Answer:** the noise bandwidth is 333 Hz, and the peak phase error is 0.228 rad (13.1°), gone within about 9 ms.
:::
:::

::: example
## The first-order loop with K = 2π × 1000 rad/s: what's its noise bandwidth, and what frequency step makes it lose lock?

::: solution
1. **Noise bandwidth.**
   $$\begin{aligned} B_L &= \frac{K}{4} \\ &= 1571\ \text{Hz} \end{aligned}$$
2. **Hold-in range.** With a sinusoidal phase detector, the steady error $\Delta\omega/K$ can't exceed 90° (sin θ = 1), so the largest step it can hold is
   $$\begin{aligned} \Delta\omega &= K \\ \Delta f &= 1000\ \text{Hz} \end{aligned}$$
3. **Beyond that.** The loop slips cycles and loses lock.

**Answer:** the noise bandwidth is 1571 Hz, and a frequency step of more than 1000 Hz makes the loop lose lock.
:::
:::

::: example
## A second-order PLL has $\omega_n$ = 2π × 100 rad/s. Compare its noise bandwidth at ζ = 0.5, 0.707 and 1.

::: solution
1. **The formula.** With $\omega_n/2 = 314$:
   $$B_L = \frac{\omega_n}{2}\left(\zeta + \frac{1}{4\zeta}\right)$$
2. **ζ = 0.5.**
   $$\begin{aligned} B_L &= 314(0.5 + 0.5) \\ &= 314\ \text{Hz} \end{aligned}$$
3. **ζ = 0.707.**
   $$\begin{aligned} B_L &= 314(0.707 + 0.354) \\ &= 333\ \text{Hz} \end{aligned}$$
4. **ζ = 1.**
   $$\begin{aligned} B_L &= 314(1 + 0.25) \\ &= 393\ \text{Hz} \end{aligned}$$
5. **The usual choice.** The noise bandwidth is smallest at ζ = 0.5, but ζ = 0.707 is the usual choice: only 0.26 dB more noise for a far better-damped response to frequency steps.

**Answer:** 314 Hz at ζ = 0.5, 333 Hz at 0.707 and 393 Hz at 1.
:::
:::

::: check
given: f = 20 | 100 | 400; K = 500 | 2000 | 10000
answer: f/K*360
unit: °
tolerance: 0.2

## A first-order PLL with gain K = 2π × {K} rad/s sees a {f} Hz frequency step. What's its steady phase error?

::: right
Right. $\Delta\omega/K$ = {answer}°.
:::

::: misses
- [f/K] Convert to degrees: $2\pi f/(2\pi K)$ rad is $360f/K$ degrees.
- [any] Not yet. $\theta_e = \Delta\omega/K$.
:::
:::

::: check
given: K = 500 | 2000 | 10000
answer: 2*pi*K/4
unit: Hz
tolerance: 0.5%

## What's the noise bandwidth of a first-order PLL with K = 2π × {K} rad/s?

::: right
Right. $B_L = K/4$ = {answer} Hz.
:::

::: misses
- [K/4] K is 2π × {K} rad/s; use it in rad/s.
- [any] Not yet. $B_L = K/4$ with K in rad/s.
:::
:::

::: check
given: f = 20 | 100 | 1000; z = 0.5 | 0.707 | 1
answer: 2*pi*f/2*(z + 1/(4*z))
unit: Hz
tolerance: 0.5%

## A second-order PLL has $\omega_n$ = 2π × {f} rad/s and ζ = {z}. What's its noise bandwidth?

::: right
Right. $\frac{\omega_n}{2}(\zeta + \frac{1}{4\zeta})$ = {answer} Hz.
:::

::: misses
- [f*(z + 1/(4*z))] $\omega_n$ is 2π × {f} rad/s.
- [any] Not yet. $B_L = \frac{\omega_n}{2}(\zeta + 1/4\zeta)$.
:::
:::

::: check
given: d = 10 | 50 | 200; f = 50 | 100 | 500; z = 0.4 | 0.707
answer: d/f*exp(-z*acos(z)/sqrt(1 - z^2))*180/pi
unit: °
tolerance: 0.2

## A second-order PLL ($\omega_n$ = 2π × {f} rad/s, ζ = {z}) sees a {d} Hz frequency step. What's its peak phase error?

::: right
Right. $\frac{\Delta\omega}{\omega_n}e^{-\zeta\arccos\zeta/\sqrt{1 - \zeta^2}}$ = {answer}°.
:::

::: misses
- [d/f*180/pi] That's without the transient's decay before its peak.
- [any] Not yet. Maximize the step-error transient.
:::
:::

::: check
given: f = 20 | 100 | 1000; z = 0.5 | 0.707 | 1
answer: 4/(z*2*pi*f)*1000
unit: ms
tolerance: 0.5%

## About how long does that second-order loop ($\omega_n$ = 2π × {f} rad/s, ζ = {z}) take to settle?

::: right
Right. About $4/(\zeta\omega_n)$ = {answer} ms.
:::

::: misses
- [4/(z*f)*1000] $\omega_n$ is in rad/s: include the 2π.
- [any] Not yet. The envelope $e^{-\zeta\omega_nt}$ falls to 2% after four time constants.
:::
:::

::: check
given: K = 500 | 2000 | 10000
answer: K
unit: Hz
tolerance: 0.5%

## A first-order PLL with a sinusoidal phase detector and K = 2π × {K} rad/s: how far can the input frequency move before it loses lock?

::: right
Right. The error can reach 90° at most, so $\Delta\omega \le K$: {answer} Hz.
:::

::: misses
- [K/4] That's the noise bandwidth.
- [any] Not yet. With a sinusoidal detector the restoring signal is K sin θ, which can't exceed K.
:::
:::

::: check
kind: parts
given: v = 10 | 50 | 200; d = 5 | 75; K = 1 | 10

## A PLL FM demodulator has a VCO gain of {v} kHz per volt and a first-order loop gain K = 2π × {K} kHz; the input deviates by {d} kHz.

::: part
answer: d/v
unit: V
tolerance: 0.5%

### What peak control voltage does the VCO need?

::: misses
- [any] Deviation over VCO gain.
:::
:::

::: part
answer: d/K*180/pi
unit: °
tolerance: 0.5%

### What peak phase error does the first-order loop show?

::: misses
- [any] Δω/K, in degrees.
:::
:::
:::

::: check
kind: derivation
vars: w = 10..100000, z = 0.2..2, K = 10..100000

## A second-order PLL has natural frequency w (rad/s) and damping z; a first-order PLL has gain K.

::: step
answer: w/2*(z + 1/(4*z))

### What is the second-order loop's noise bandwidth in hertz?
:::

::: step
answer: K/4

### What is the first-order loop's?
:::

::: step
answer: w/2

### What is the smallest the second-order bandwidth can be (at z = 0.5)?
:::

::: right
Right. The minimum sits at ζ = 0.5, and the curve is flat enough there that 0.707 costs little.
:::
:::

::: explain
## Why does a PLL's control voltage reproduce an FM signal's message?

::: model
When a phase-locked loop is locked, its VCO runs at exactly the same frequency as the incoming signal, apart from a small, bounded phase error: if the VCO fell behind or ran ahead, the phase error would grow and the loop would push it back. A VCO's frequency is set by its control voltage, so to follow an input whose frequency is $f_c + k_fm(t)$, the control voltage must vary in proportion to $k_fm(t)$. The loop thus produces, at the VCO's input, exactly the voltage needed to imitate the incoming frequency, which is the message itself, scaled by the VCO's gain. The loop filter's bandwidth must be wide enough to pass the message and narrow enough to reject noise.
:::
:::

::: practice

::: check
given: f = 50 | 300; K = 1000 | 5000
answer: f/K*360
unit: °
tolerance: 0.2

## First-order steady error: {f} Hz step, K = 2π × {K}?

::: misses
- [any] $360f/K$ degrees.
:::
:::

::: check
given: f = 50 | 400; z = 0.6 | 0.9
answer: 2*pi*f/2*(z + 1/(4*z))
unit: Hz
tolerance: 0.5%

## Noise bandwidth: $\omega_n$ = 2π × {f}, ζ {z}?

::: misses
- [any] $\frac{\omega_n}{2}(\zeta + 1/4\zeta)$.
:::
:::

::: check
given: d = 20 | 120; f = 80 | 300; z = 0.5 | 0.8
answer: d/f*exp(-z*acos(z)/sqrt(1 - z^2))*180/pi
unit: °
tolerance: 0.2

## Peak error: {d} Hz step, $\omega_n$ = 2π × {f}, ζ {z}?

::: misses
- [any] $\frac{\Delta\omega}{\omega_n}e^{-\zeta\arccos\zeta/\sqrt{1 - \zeta^2}}$.
:::
:::
:::
