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

D13 · Lesson 7 · Software radio

Assembling the software radio from front-end gain to decoded text, planning the analog gain so the ADC is neither overloaded nor buried in its own noise, then tuning, filtering, demodulating FM and decoding an audio-tone packet with a CRC, all in code

The last step joins the pieces: the analog front end sets the level at the ADC, and the code does the rest. The station you want carries a packet the way amateur radio's APRS does: as audio tones, D12's 1200 and 2200 Hz FSK, sent over an ordinary narrowband FM transmitter. Your receiver has to tune to it in a recording that also holds two other stations, one much stronger, demodulate the FM to get the audio, and decode the packet from the audio, finding it at an unknown time and checking its CRC.

  • The front end's level plan: an antenna signal passes an LNA, a mixer and an IF amplifier on its way to a 12-bit ADC whose full scale is 0 dBm.
  • The ADC's own noise sits 6.02 × 12 + 1.76 = 74 dB below full scale across 48 kHz; in a 4.8 kHz channel, filtering lowers it a further 10 dB. The readouts show the headroom left before clipping and how far the signal sits above the ADC's noise.
  • Too little gain buries a weak station in ADC noise; too much lets a strong neighbor clip the ADC, which wrecks every station at once. Find the gain that suits signals from −110 to −40 dBm.

Predict

A 12-bit ADC digitizes 48 kHz of spectrum, and the receiver keeps a 4.8 kHz channel. How far below full scale is the ADC's quantization noise within that channel?

Name it

Gain planning

The analog gain before the ADC should put the strongest expected signal a few dB below full scale and the weakest wanted one comfortably above the ADC's noise in the channel:

SNRADC=6.02N+1.76dB,in the channel: +10log10⁡fs/2B

The dynamic range between clipping and that floor is what lets a weak station be decoded next to a strong one. Real receivers add automatic gain control to slide the window with conditions.

The receiver chain

  1. Channelize: tune the station to 0 Hz, low-pass filter to ±4.8 kHz and decimate from 96 to 9.6 kHz (lesson 5).
  2. Demodulate: the discriminator turns the FM into audio (lesson 6).
  3. Decode: the audio carries 1200 baud FSK at 8 samples per bit, so D12's correlators recover the bits; the receiver tries each of 8 sampling offsets, searches for sync words one after another, reads each candidate frame and keeps the first whose CRC checks.

Why search for more than one sync word

Before the packet, the channel carries noise, and a random stretch of bits matches the sync word within one error about once every 3900 bits (D12). A receiver that gave up after the first match would sometimes miss a perfectly good packet behind a false one. Moving on to the next candidate costs little, and the CRC rejects the false ones.

Worked example

With 20 dB of LNA gain, what's the window of antenna levels the front end can handle?

Show the solution
  1. Gain to the ADC. The other stages add −7+20−2=11dB so with the LNA's 20 dB the ADC sees S + 31 dBm.
  2. The window. Clipping starts at S = −31 dBm, and the ADC's channel noise (−84 dBm at the ADC) is reached at S = −115 dBm: −31−(−115)=84dB
  3. A weak station. A −110 dBm station then sits only 5 dB above the ADC noise, so the gain should be raised until the analog front end's own noise sits above the ADC's and sets the floor.
  4. The cost of more gain. More LNA gain helps the weak station but brings clipping down to −41 dBm.

Answer antenna levels from −115 dBm to −31 dBm, an 84 dB window.

Worked example

How long does the lab's longest message, "CQ from the software radio" (26 characters), take on the air?

Show the solution
  1. Frame length. D12's frame is 8×26+80=288bits
  2. Airtime at 1200 baud. t=2881200s=0.24s
  3. The lead-in. The lab's recordings start up to 0.094 s (9000 samples at 96 kHz) earlier with unmodulated carrier, where the receiver's bits are just noise and the occasional false sync match.

Answer 0.24 s, after up to 0.094 s of unmodulated carrier in the lab's recordings.

Check

Build the whole receiver: tune the station, demodulate its FM and decode the packet from its audio.

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

Check

What SNR does an ideal 10-bit ADC give for a full-scale sine across its whole band?

Check

A receiver samples at 240 kHz and keeps a 4.8 kHz-wide channel. How much does filtering lower the ADC's noise in the channel?

Check

In the level plan above, the LNA has 20 dB of gain and the ADC clips at 0 dBm. At what antenna level does clipping begin?

Check

An AFSK packet at 1200 baud (Bell 202: 1200 and 2200 Hz tones) is sampled at 24 kHz and has 100 bits.

(a)

How many samples cover each bit?

(b)

How long does the packet last?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

Check

How many cycles of a 2100 Hz tone fit in one 1200-baud bit?

Explain why

Why does a software radio filter and decimate before it demodulates?

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.