# Frequency Modulation (FM) and Demodulation Using DSP Techniques

Frequency Modulation (FM) is as old as the history of wireless communications itself. The past few decades saw the rise of digital signal processing in all spheres of life that pervaded even the implementation of analog modulation schemes. Today many of the FM systems are built using discrete-time techniques instead of the conventional circuitry as described below.

## Frequency Modulation

In digital communications, data is sent through altering a characteristic of an electromagnetic wave such as amplitude, frequency or phase in discrete steps (e.g., $M$ number of levels). Such systems are known as Amplitude Shift Keying (ASK), Frequency Shift Keying (FSK) and Phase Shift Keying (PSK), respectively. Analog modulation schemes, on the other hand, vary the desired parameter in a continuous fashion according to the message signal.

Frequency Modulated (FM) systems trade off bandwidth with power, i.e., they exhibit good noise performance at a cost of high bandwidth. This is why they are used in FM audio broadcasting and specialized point-to-point communication systems. We now turn towards how an FM modulator is implemented through DSP techniques.

### Message Signal

The starting point is the familiar relation between the frequency $f$ and instantaneous phase $\theta(t) = 2\pi f t$ in a sinusoid. The frequency is defined as the rate of change of phase.
$f = \frac{1}{2\pi}\frac{d \theta(t)}{dt}$

This frequency needs not be constant at all times and can be represented as $f(t)$. As the frequency changes, the relation still holds true. In our scenario, the message signal, denoted by $x(t)$, can modulate the frequency variations in a carrier sinusoid. Therefore,
$x(t) = \frac{1}{2\pi}\frac{d \theta(t)}{dt}$

To find the phase $\theta(t)$ from here, we need to integrate both sides of the above equation starting with zero initial conditions at time $0$.
\label{equation-fm-phase}
\theta(t) = 2\pi \int_{0}^t x(\tau) d\tau

If the carrier wave is represented as
$y(t) = A_c \sin (2\pi f_c t),$

then the wave form for an FM signal is given by introducing the time-varying phase into the above expression.
\begin{aligned} y(t) &= A_c \sin \big[2\pi f_c t + \theta(t)\big]\nonumber \\ &= A_c \sin \left[2\pi f_c t + 2\pi k_f \int_{0}^t x(\tau) d\tau\right] \end{aligned} \label{equation-fm-modulation}

where the phase $\theta$ has been replaced from Eq (\ref{equation-fm-phase}) that is multiplied with a new factor $k_f$, the frequency deviation.

### Frequency Deviation

To understand what the frequency deviation means, consider the instantaneous phase expression in Eq (\ref{equation-fm-modulation}).
\label{equation-fm-carrier-phase}
\theta_c(t) = 2\pi f_c t + 2\pi k_f \int_{0}^t x(\tau) d\tau

The instantaneous frequency is thus given by
$f(t) = \frac{1}{2\pi}\frac{d \theta_c(t)}{dt} = f_c + k_f x(t)$

This equation shows that the instantaneous frequency varies according to the message signal scaled by the frequency deviation. The maximum deviation of this frequency occurs for the maximum value of $|x(t)|$. Denoting this value by $A_m$, we get the peak frequency deviation.
$f_{\text{max}} = f_c + k_f A_m$

Peak frequency deviation represents how far the modulated signal frequency can stretch in either direction as compared to the carrier frequency. Note that it depends on the frequency deviation as well as the peak amplitude of the input signal.

### Discrete-Time Implementation

The modulation phase in Eq (\ref{equation-fm-phase}) is a continuous-time description of the modulation process. For a discrete-time implementation, we need to sample this signal after including the frequency deviation $k_f$.
\begin{aligned} \theta(nT_s) &= 2\pi k_f \int_{0}^{nT_s} x(\tau) d\tau \\ &= 2\pi k_f \int_{0}^{(n-1)T_s} x(\tau) d\tau + 2\pi k_f \int_{(n-1)T_s}^{nT_s} x(\tau) d\tau \\ \\ &=\theta[(n-1)T_s] + 2\pi k_f T_s x[(n-1)T_s] \end{aligned} \label{equation-fm-phase-baseband}

where the continuous-time integral has been replaced with the backward difference version of a discrete-time integrator. A block diagram of a discrete-time FM modulator is now drawn in the figure below where $D$ denotes a unit time delay commonly written as $z^{-1}$. The diagram includes the complete instantaneous phase in the carrier signal, see Eq (\ref{equation-fm-carrier-phase}). The Look-Up Table (LUT) stores the values of cosine and sine functions. The complete setup forms a Numerically Controlled Oscillator (NCO) for FM signal generation. The NCO combined with a Digital to Analog Converter (DAC) turns into a Direct Digital Synthesizer (DDS) implmentation.

An example FM signal with a noisy message signal of frequency 1 Khz, frequency deviation 2.5 kHz and a carrier frequency of 5 kHz is plotted in the figure below. Observe the frequency variations in the modulated signal according to the message signal.

Next, we turn our attention towards the modulation index.

### Modulation Index

Consider a sinusoidal message signal written as
$x(t) = A_m \cos \left(2\pi f_m t \right)$

Plugging this expression into Eq (\ref{equation-fm-modulation}), we get
\begin{aligned} y(t) &= A_c \sin \left[2\pi f_c t + 2\pi k_f \frac{A_m}{2\pi f_m} \sin \left(2\pi f_m t \right)\right] \\\\ &= A_c \sin \Big[2\pi f_c t + \beta \sin \left(2\pi f_m t \right)\Big] \end{aligned}

In the above expression, the parameter $\beta$ is the FM modulation index defined as
$\beta = \frac{k_f A_m}{f_m}$

If it is scaled by the maximum value in the message signal $A_m$, the modulation index can be interpreted as the normalized frequency deviation, where this normalization is with respect to the maximum frequency in the message signal. This is where the ideas of narrowband FM and wideband FM arise where a small modulation index $\beta << 1$ indicates narrowband FM while a large $\beta$ represents wideband FM.

For a non-sinusoidal signal, the FM modulation index is written as
$\beta = \frac{k_f A_m}{B}$

where $B$ is the bandwidth of the message signal $x(t)$ and $A_m$ is its maximum value in absolute sense.

### FM Bandwidth

FM signals are non-linear and hence there is no straightforward way to derive the occupied bandwidth. As an approximation, Carson’s rule gives the effective bandwidth of an FM signal that is determined on the basis of $98\%$ bandwidth occupancy.
$B_{\text{FM}} = 2(\beta+1)B$

where $B$ is the message signal bandwidth. The spectra of the message signal, integration of the message signal and the modulated signal are plotted in the figure below.

For example, in commercial FM broadcasts, the audio signal has a maximum frequency of approximately $f_m=15$ kHz while the peak frequency deviation is $75$ kHz. From Carson’s rule, the bandwidth can be approximated as
$B_{\text{FM}} = 2\left(\frac{75}{15}+1\right)15 = 180 ~\text{kHz}$

If an AM system was used to transmit the same information, the bandwidth required would only be twice the audio signal bandwidth, or $30$ kHz. While worse than Amplitude Modulated (AM) systems in terms of bandwidth, FM signals enjoy certain advantages for which bandwidth is a worthwhile price to pay.

1. Noise in communication systems impact the amplitude of a wireless signal differently as compared to its frequency. While amplitude variations from noise appear in the demodulated signal in AM systems, white noise is distributed uniformly in frequency and exhibits no such variations in frequency. Therefore, FM signals are inherently immune to random noise and offer better signal fidelity suited to high-quality broadcasting systems.
2. Since the variations in the message are encoded into signal frequency but not the amplitude, the modulation signal has a constant envelope that can be transmitted with efficient non-linear amplifiers.

## FM Demodulation

To focus on the signal processing operations, let us remove the carrier term by multiplying $y[n]$ with $e^{-j2\pi f_c nT_s}$ and focus on the discrete-time phase from Eq (\ref{equation-fm-phase-baseband}).
\label{equation-fm-demodulation}
e^{j\theta(nT_s)} = e^{j \left\{\theta[(n-1)T_s] + 2\pi k_f T_s x[(n-1)T_s]\right\}}

Clearly, if the angle of this signal is computed and passed through a differentiator, we get the message signal scaled by the factor $2\pi k_f T_s$. A very important step to remember is to first unwrap the phase obtained so that the differentiator can compute the correct values.

Another practical demodulation technique is shown in the block diagram below where $D$ denotes a unit time delay, commonly shown as $z^{-1}$.

What happens when the above signal is multiplied with a delayed and conjugated version of itself? Since a conjugate operation reverses the phase sign, we have
$v[n] = e^{j\theta(nT_s)}\cdot e^{-j\theta[(n-1)T_s]} = e^{j\left\{\theta(nT_s) – \theta[(n-1)T_s]\right\}}$

We deduce that conjugate multiplication computes the difference between phases. Using Eq (\ref{equation-fm-demodulation}) in the above expression and taking the angle, we can write
$\measuredangle v[n] = 2\pi k_f T_s \cdot \underbrace{x[(n-1)T_s]}_{\text{Message Signal}}$

which is our desired message signal delayed by one time unit and scaled by $2\pi k_f T_s$ as shown in the figure below.

Again, it is of utmost importance to unwrap the phase after extraction to get a valid result.