D135 of 14
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

D13 · Lesson 5 · Software radio

How a software radio digitizes a wide slice of spectrum as complex I/Q samples, why complex samples tell positive from negative frequencies, tuning a station by multiplying with a complex exponential, a windowed-sinc channel filter, and decimating to a lower rate without letting the neighbors fold in

A software-defined radio does almost everything in code. Its hardware is a tuner that shifts a band of spectrum down near zero and an ADC pair that samples it as I and Q, the real and imaginary parts of a complex signal. Everything after that, choosing a station, filtering out the neighbors, demodulating and decoding, is arithmetic on those samples. This project builds a receiver that picks one narrowband FM station out of a 96 kHz-wide recording and decodes a data packet from it.

  • Three FM stations in a slice of spectrum, 15 kHz apart, the one at 45 kHz four times as strong as the one at 30 kHz you want. The dashed markers show a ±4.8 kHz channel around the tuning frequency f0.
  • Tune to each station. The channel filter will pass what's between the markers and throw away the rest.
  • Notice how much energy sits just outside the channel: the filter's skirts have to fall fast, or a strong neighbor leaks in.

Predict

The recording is sampled at 96 kHz. You keep every 10th sample to get 9.6 kHz, without filtering first. Where does a strong station 20 kHz above the wanted one end up?

Name it

Complex baseband

With I and Q samples, x[n]=I[n]+jQ[n], a component at frequency f is ej2πfn/fs, and f can be negative: a 96 kHz complex stream covers −48 to +48 kHz with no mirror images. A real ADC alone would confuse f with −f.

Tuning

Multiplying by e−j2πf0n/fs shifts every frequency down by f0, so the wanted station moves to 0 Hz.

The channel filter

A windowed-sinc low-pass with N taps, cutoff fc and a Hamming window:

h[k]=2fcfssinc⁡(2fcfs(k−N−12))w[k]

normalized to unit gain at 0 Hz. Its response is 6 dB down at fc, the transition takes about 3.3fs/N, and the stopband sits about 53 dB down for the Hamming window (S7). With 129 taps at 96 kHz the transition is about 2.5 kHz wide.

Decimation

After filtering, keeping every D-th sample gives a rate fs/D without aliasing, since nothing remains above fs/2D. Each factor of 10 also cuts the computation for every later stage by 10, and the filtering lowers the noise in the channel: the noise that was spread over 96 kHz is now confined to 9.6 kHz.

Worked example

Design the channel filter for a ±4.8 kHz channel at 96 kHz with a Hamming window. How many taps for a 2.5 kHz transition, and how does it do?

Show the solution
  1. Estimate the length. N≈3.3×960002500≈127
  2. Pick an odd length with some margin. The estimate is only a guide, so go one odd length past it to 129 taps. An odd length keeps the delay a whole number of samples (64).
  3. Measured response. The lab's filter measures 4kHz:−0.6dB4.8kHz:−6.0dB6kHz:−47dB9.6kHz:−68.5dB with no sidelobe above −55 dB beyond 7 kHz or above −63 dB beyond 20 kHz.
  4. A strong neighbor. A neighbor four times (12 dB) stronger 20 kHz away comes through at least 63−12=51dB below the wanted signal, under 0.3%.

Answer 129 taps, which pass 4 kHz at −0.6 dB and keep a neighbor 20 kHz away at least 51 dB below the wanted signal.

Worked example

A station sits at −25 kHz in the recording, and you tune to +10 kHz. Where does it land, and what happens after the filter and decimation by 10?

Show the solution
  1. Tune. Tuning to +10 kHz shifts the station to −25−10=−35kHz far into the stopband, where it's more than 80 dB down.
  2. Decimate to 9.6 kHz. What's left of it would alias to −35+4×9.6=3.4kHz
  3. Is it a problem? At that level it's harmless.

Answer it lands at −35 kHz, more than 80 dB down, and after decimation its remains alias to 3.4 kHz, too weak to matter.

Check

Tune a station to 0 Hz, filter its channel and decimate to 9.6 kHz.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

A signal 25 kHz from the tuned frequency survives into a decimated stream at 9.6 kHz. Where does it alias to, in absolute frequency from 0?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

About how many taps does a Hamming-windowed sinc filter need for a 1000 Hz transition at 96000 samples per second?

Check

A 240 kHz stream is filtered and decimated by 4. What's the new sample rate?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

A software radio samples complex I/Q at 2.4 MS/s, tuned to 100.9 MHz.

(a)

At what baseband frequency does a station at 100.3 MHz appear? (Negative if below the tuning.)

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

How much bandwidth do the complex samples cover in total?

Check

A software radio decimates 2048 kS/s down to 48 kS/s for one channel. What decimation factor is that?

Explain why

Why must a receiver filter before it decimates?

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.