← All chapters

Chapter 1 · 19 slides

From complex numbers to Fourier analysis and software-defined radio

The two tools under all signal processing: the spectrum of a signal, and the complex number that describes amplitude and phase

01

From complex numbers to Fourier analysis and software-defined radio

Opening

Speaker notes

This chapter gives two tools.

Fourier: every signal is a sum of sines, and its spectrum says which sines, how strong.

Complex numbers: one number that holds an amplitude and a phase. That is what I and Q are, and why a radio signal can be handled as numbers.

02

Every signal is a sum of sines

Every signal is a sum of sines
03

Three numbers describe a sine

Every signal is a sum of sines

Speaker notes

A pure sine is the simplest signal there is: A · cos(2πft + φ). Three numbers fix it completely: amplitude A, frequency f and phase φ.

Radio example: at 3.5 GHz one period lasts 0.29 ns, and the wave travels 8.6 cm (one wavelength) in that time.

Phase is the number most people skip, and the one radio depends on most: digital modulation puts information in it.

04

Every signal is a sum of sines

Every signal is a sum of sines

Speaker notes

Fourier's idea (1807): any signal can be written as a sum of sines, each with its own amplitude, frequency and phase. The list of those sines is the spectrum.

Here a square wave is built from sines at f, 3f, 5f and 7f, with amplitudes 1, 1/3, 1/5 and 1/7. Four sines already come close; more sines give sharper edges.

The lesson for radio: sharp changes need high frequencies. A signal that changes fast takes a wide band of spectrum.

05

A higher data rate needs more bandwidth

Every signal is a sum of sines

Speaker notes

Read a nearly square wave as data: every high part is a 1, every low part a 0. Top: a slow stream, data rate R. Bottom: the same pattern, twice as fast, data rate 2R.

Both are built from the same four sines, at the fundamental and the odd harmonics 3, 5 and 7 times it. Speed the wave up by two and every one of those sines moves to twice the frequency: f, 3f, 5f and 7f become 2f, 6f, 10f and 14f.

So the spectrum gets twice as wide: about 7f becomes about 14f. That is the rule: the bandwidth a signal needs grows with its data rate. Double the bits per second and you need double the bandwidth.

How many harmonics you keep is a choice: fewer gives rounder edges and less bandwidth, more gives sharper edges and more bandwidth. Radio systems filter the edges deliberately so a signal stays in its channel; the rule that bandwidth grows with the data rate stays.

06

A dot in the circle holds amplitude and phase

Every signal is a sum of sines

Speaker notes

Back to the three numbers of a sine: amplitude, frequency and phase. The dot holds two of them. Its distance from the centre is the amplitude A; its angle is the phase φ. The third number, the frequency, is not in the dot itself: it is which dot it is. One dot belongs to one frequency.

The drawing uses the same sine as before: phase 60°, so the wave is shifted by one sixth of a period against the dashed wave with phase 0.

In the circle, the horizontal axis is the cosine axis, called I, and the vertical axis the sine axis, called Q. The two coordinates of the dot, I = A·cos φ and Q = A·sin φ, are how much cosine and how much sine make up this wave.

Mathematicians write the dot as a complex number, A·e^(iφ). For the rest of this chapter all we need is: length is amplitude, angle is phase.

07

The dots are the spectrum: that is Fourier

Every signal is a sum of sines

Speaker notes

Take several dots, one per frequency: f, 2f and 3f here. Each dot is a sine with its own amplitude and phase: 0.9 at 20°, 0.5 at 120°, 0.35 at −110°.

Bottom left, the same three dots drawn as a spectrum: one bar per frequency, the height is the amplitude, the label the phase. Nothing new is added: the spectrum is just the dots, sorted by frequency.

Add the three sines and you get the waveform on the right, which looks nothing like a sine. Adding sines up is the inverse Fourier transform.

The Fourier transform goes the other way: from any waveform, it finds the amplitude and the phase for every frequency. That is the whole idea; in a computer it is done with the FFT.

What matters for us are those two numbers per frequency, not the dots as such. The amplitude per frequency is the spectrum you see on your screen, and one row of the waterfall later on. The phase per frequency is not shown on a waterfall, but the receiver needs it: digital modulation puts information in the phase, as the constellation will show.

Nothing is lost in either direction: the waveform and its amplitudes and phases are the same signal, seen two ways.

08

Two numbers, I and Q, set the radio wave

Every signal is a sum of sines

Speaker notes

Radio puts information in amplitude and phase: each symbol is one point in the I/Q plane. With 16 points (16-QAM) every symbol carries 4 bits, with 256 points 8 bits.

The transmitter turns the point into a wave: I times a cosine plus Q times a sine at the carrier frequency. The receiver does the reverse and finds the point again.

This is the reason a radio signal can travel over a network: written as I/Q samples it is just a stream of numbers, and nothing is lost when it is sampled fast enough.

09

Two ways to build an SDR receiver

Every signal is a sum of sines

Speaker notes

Both receivers deliver the same thing to the DSP: a stream of I and Q samples, a dot per sample. They differ in where the radio becomes numbers.

Quadrature sampling (top). The mixing is analog: two mixers, fed by one oscillator as a cosine (0°) and a sine (90°), bring the signal down to baseband: the cosine path gives I, the sine path Q; low-pass filters and two ADCs make I and Q. This is the SDR transmitter and receiver of the next two slides, and the classic design of many low-cost SDRs (the Tayloe or quadrature sampling detector, from 2001). Its weak point: I and Q are only as good as the matching of two analog paths, which changes with temperature and between units. Imperfect balance shows up as a mirror image of strong signals and a spur at the centre of the waterfall.

Direct sampling (bottom). One fast ADC samples the RF almost straight from the antenna, for example at 80 or 123 million samples per second for the whole of HF. The mixing to I and Q is done in numbers, in an FPGA, with a numerically controlled oscillator (NCO): its 0° and 90° are exact, so I and Q are in perfect balance. A digital filter then keeps the wanted band and lowers the sample rate (decimation). Only the front end stays analog; the preselect filter is drawn dashed because with enough oversampling it is optional.

The trend, in John VE6EY's words, is the ADC moving ever closer to the antenna, towards the ideal of "just a chip connected to an antenna".

Source and drawing: John VE6EY, "SDR Receiver Architecture – Approaching Ideal", Making It Up (play.fallows.ca), 3 October 2017. The Perseus (80 MHz ADC) and the Flex 6300 (123 MHz ADC) are his examples of direct sampling.

10

An SDR transmitter: I·cos plus Q·sin

Every signal is a sum of sines

Speaker notes

Four symbols, each a point with I = +1 or −1 and Q = +1 or −1 (QPSK). The SDR's software produces these I and Q samples.

The two DACs turn the samples into two voltages; their filters smooth the steps. The I voltage is multiplied by the carrier cosine, cos 2πft; the Q voltage by the same carrier 90° later, sin 2πft.

The sum, I·cos 2πft + Q·sin 2πft, is one wave at the carrier frequency. Its amplitude is √(I² + Q²) and its phase is the angle of the point (I, Q): each symbol simply sets where the wave stands in its cycle. Look at the dashed symbol boundaries in the RF out: the wave jumps to a new phase there.

The drawing uses 3 carrier periods per symbol to keep it readable; on the air a carrier makes millions of periods per symbol.

11

An SDR receiver: multiply, filter, sample

Every signal is a sum of sines

Speaker notes

The receiver does the same steps backwards. The incoming wave goes to two mixers: one multiplies it by cos 2πft, the other by sin 2πft, from an oscillator at the same frequency.

Why that works: cos × cos = ½ + ½·cos(2 × 2πft), and sin × cos averages to zero. So the I mixer gives I/2 plus a ripple at twice the carrier frequency, and nothing of Q. The Q mixer, the other way round.

That is why the mixer outputs ("times the carrier") are not centred on zero: they swing around I/2 or Q/2, the dashed lines. For a +1 symbol the I mixer output runs from about −0.2 to +1.2 around an average of +0.5; for a −1 symbol around −0.5. This offset is not an error: it is the wanted value, and the filter keeps exactly that average and removes the ripple.

The low-pass filter removes the ripple and keeps I/2 and Q/2: the original symbol values, at half size. The ADCs sample them once per symbol, and the receiver has the points back: +1, −1, −1, +1 for I and +1, +1, −1, −1 for Q.

This only works when the receiver's oscillator matches the transmitter's in frequency and phase. If it is a little off, the recovered points slowly turn around the circle. A real receiver measures that and corrects it.

Many receivers use −sin on the Q path; the sign convention differs, the idea does not.

12

The constellation shows how good reception is

Every signal is a sum of sines

Speaker notes

Digital modulation is choosing a point. 16-QAM has 16 points, so every symbol carries 4 bits. The neighbours differ by one bit only (Gray code: the corner points are 0010 and 1010), so a small error costs one bit, not four.

Sending: for every symbol the SDR puts the chosen point on its DACs, as on the SDR transmitter slide.

Receiving: the SDR measures a point for every symbol and picks the nearest constellation point, the square it lands in. Before the points line up like this, the receiver has done everything from the earlier slides: set the gain, locked its frequency (otherwise the whole constellation keeps turning), found the moment of each symbol, and undone the phase and amplitude change of the path.

Below each constellation is the spectrum of the same signal: the band of the QAM signal and, under it, the noise floor. The two are coupled: the distance between the top of the band and the noise floor, the signal-to-noise ratio (SNR), is exactly what sets the size of the clouds. In the drawing both come from the same noise: about 22 dB SNR gives tight clouds, about 12 dB gives overlapping clouds. So on the waterfall you can already see whether a constellation will be clean: a band standing well above the floor.

Middle: a good signal gives tight clouds and every point is read right. Right: with a weak signal the clouds grow and overlap; samples that land in a neighbour's square become bit errors, which error correction can repair up to a point.

That is why the constellation is the first thing to look at for digital amateur television. DVB-S2, used on the QO-100 wideband transponder, uses QPSK (4 points) and 8PSK, 16APSK or 32APSK; DVB-T uses QPSK, 16-QAM or 64-QAM. Many DATV receivers show the constellation and the MER (modulation error ratio): how tight the clouds are, in dB. More points per symbol means more bits, but the points sit closer together and need a cleaner signal.

13

The waterfall is a Fourier transform over time

Every signal is a sum of sines

Speaker notes

The waterfall on your SDR or radio is nothing new: it is the Fourier transform from earlier in this chapter, done over and over.

1. The receiver cuts its stream of I/Q samples into short blocks, for example 2048 samples.

2. It computes the FFT of one block: one spectrum, one dot per frequency. Only the length of each dot, the strength, is kept and turned into a colour. That is one row of the waterfall.

3. It does the same for the next block, many times per second, and adds each new row under the previous one. The rows scroll down: frequency runs across, time runs down.

So you read the waterfall like this: a steady carrier is a straight vertical line, CW is a dashed line, a drifting station is a slanted line, and a wide digital or voice signal is a broad band that lasts as long as the transmission.

The block length is a trade-off. A block of length T gives frequency steps of 1/T: a long block gives fine frequency detail but reacts slowly; a short block reacts fast but blurs in frequency. Most SDR programs let you set this as the FFT size. In signal-processing terms the waterfall is a spectrogram, or short-time Fourier transform.

14

A mixer shifts a signal up or down in frequency

Every signal is a sum of sines

Speaker notes

Baseband is the information itself, around 0 Hz: the audio of a voice, or the I/Q samples coming out of the SDR's DACs. A modulated signal is the same shape, moved up to the carrier frequency fc so it can go on the air.

The mixer does the moving. It multiplies the signal by a high-frequency wave: the carrier. Multiplying by a sine shifts every frequency in the signal by the carrier frequency, so the whole shape lands around fc: exactly the SDR transmitter from earlier.

The receiver does it again: multiply by the carrier once more and the shape comes back down to 0 Hz. A plain mixer also makes a copy at the sum frequency, 2·fc; a low-pass filter removes it. That is the SDR receiver from earlier.

The same trick moves a signal anywhere, not only to and from 0 Hz: mix with fc and a signal at f shows up at f + fc and at f − fc. A superheterodyne receiver uses it to bring every station to the same intermediate frequency (IF); a QO-100 station uses it to bring 2.4 GHz to and from what the SDR handles directly.

With an I/Q mixer, the cosine and sine pair of the SDR, the shift goes in one direction only, without the mirror copy. That is why SDRs work with I and Q.

15

Introduction to SDR principles

Introduction to SDR principles
16

A good SDR starts with a clean oscillator

Introduction to SDR principles

Speaker notes

The mixer slide showed that every SDR moves the signal by multiplying it with an oscillator. So whatever the oscillator does wrong ends up in the signal.

Stability: a plain crystal drifts with temperature, typically by several ppm. 1 ppm of the QO-100 downlink at 10.489 GHz is 10.5 kHz: the whole waterfall slides away and narrow signals walk off the screen. A temperature-compensated oscillator (TCXO), an oven-controlled one (OCXO), or locking to GPS keeps it in place.

Purity: an oscillator also jitters a little in phase, phase noise. In the spectrum that shows as shoulders on both sides of every strong signal. Mixing copies those shoulders onto every station, so a strong station next door spreads its skirts over a weak one. Steep, narrow shoulders mean a clean waterfall and weak signals that stay visible: that is what you pay for in a better SDR.

For digital modes it matters too: phase noise makes the constellation points smear around the circle, which lowers the MER.

The drawing is an illustration of the effect, not a measured SDR.

17

The sample rate sets how wide your SDR sees

Introduction to SDR principles

Speaker notes

The bandwidth of an SDR is how much spectrum it sees at once. The oscillator sets the centre, fc; the mixer brings it to 0 Hz; the filter and the ADCs take the band around it.

With I and Q, a sample rate of fs samples per second covers fs hertz: from −fs/2 to +fs/2 around the centre. That is why I and Q matter: the dot per sample tells signals above and below the centre apart. With real samples only, fs samples per second would cover just fs/2.

Example: an SDR at 2.4 million samples per second shows 2.4 MHz of waterfall. With a 2048-point FFT, each bin is 2.4 MHz / 2048 = 1.2 kHz wide. To see narrower detail: a longer FFT, or a lower sample rate around the signal you want, which is what decimation in the direct-sampling SDR does.

The usable width is a little less than fs: the filters need some room at the edges.

18

More bits: weak signals next to strong ones

Introduction to SDR principles

Speaker notes

The ADC turns every sample into a number with a fixed number of bits. 8 bits give 256 levels, 12 bits 4096, 16 bits 65 536. The rounding to the nearest level is an error that looks like noise: quantisation noise.

Every extra bit halves the steps and lowers that noise by about 6 dB. For a full-scale sine: dynamic range ≈ 6.02 × bits + 1.76 dB, so about 50 dB for 8 bits, 74 dB for 12 bits and 98 dB for 16 bits.

Dynamic range is the distance between the strongest signal the ADC can take without clipping and the noise floor. A strong local station sets the top; anything weaker than the floor disappears. In the drawing a station 65 dB weaker is lost with 8 bits and visible with 12 or 16.

The FFT helps: spreading the noise over many bins lowers the floor per bin (processing gain), so a waterfall shows signals somewhat below these numbers. And an ADC is rarely as good as its bit count: real converters lose a few bits to their own noise and distortion.

Examples: the RTL-SDR has an 8-bit ADC; many better SDRs use 12, 14 or 16 bits.

19

Every signal is sines, every sine a point

Closing