Classroom Glossary Public page

Lab 2: DSSS Spread-Spectrum Build

437 words

Chapter: 2 (Week 3) Duration: 3 hr Substrate: GNU Radio (software-only) Points: 8


Overview

Build a complete DSSS transmitter + receiver pair in GNU Radio using an 11-chip Barker sequence. Observe the spectrum before and after spreading. Verify despreading recovers the original data.


Background

DSSS multiplies each data bit by a high-rate pseudorandom chip sequence. The result spreads the signal across a bandwidth equal to the chip rate. The receiver multiplies by the same chip sequence and integrates over one bit period to recover each data bit.

You are implementing the 802.11b physical layer (simplified). The Barker sequence used in 802.11b DSSS:

Barker-11: [1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1]

Part 1: DSSS Transmitter Flowgraph

Build this flowgraph in GNU Radio:

[Bernoulli Binary Source] → [Pack K Bits] → [Chunks to Symbols (NRZ: 0→-1, 1→+1)]
                                                    |
                                              [Repeat] (chips_per_bit=11)
                                                    |
                                              [Multiply] ← [Vector Source] (Barker chips, repeated)
                                                    |
                                              [Root Raised Cosine Filter] (alpha=0.35)
                                                    |
                                              [Throttle] → [File Sink: dsss_tx.iq]
                                                         → [QT GUI Frequency Sink]

Parameters:

  • Sample rate: 2,200,000 (2.2 MSPS)
  • Data bit rate: 100,000 bps
  • Chip rate: 1,100,000 cps (11× data rate)
  • Samples per chip: 2 (2.2 MSPS / 1.1 Mcps)
  • RRC filter: 11 taps, sample_rate=2.2e6, symbol_rate=1.1e6, alpha=0.35, ntaps=45

Barker sequence (as Vector Source): Values [1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1] repeated. Set Vector Source repeat=True.


Part 2: Spectrum Comparison

Capture two spectral screenshots:

  1. Before spreading: Connect the data bit stream (NRZ symbols before the multiply) to a Frequency Sink via a Throttle. This shows the narrowband data spectrum (~100 kHz bandwidth).
  2. After spreading: The transmitter output spectrum. This shows the spread signal (~1.1 MHz bandwidth).

Measure the processing gain: PG (dB) = 10 × log10(chip_rate / data_rate) = 10 × log10(11) ≈ 10.4 dB.

Verify visually: the spread signal's spectral density should be approximately 10.4 dB lower than the unspread signal for the same total power.


Part 3: DSSS Receiver Flowgraph

Build the despreading receiver:

[File Source: dsss_tx.iq]  [Throttle]  [Multiply]  [Vector Source] (Barker chips)
                                                |
                                         [Moving Average] (length=22, N samples per bit = 2 samples/chip × 11 chips)
                                                |
                                         [Keep 1 in N] (N=22, phase=0)
                                                |
                                         [Binary Slicer] (threshold=0)
                                                |
                                         [Unpack K Bits]
                                                |
                                         [File Sink: dsss_rx_bits.bin]
                                         [QT GUI Time Sink]

Part 4: Verification

import numpy as np

# Load transmitted bit source (Bernoulli output, saved via File Sink before spreading)
tx_bits = np.fromfile("dsss_tx_bits.bin", dtype=np.uint8)
rx_bits = np.fromfile("dsss_rx_bits.bin", dtype=np.uint8)

# Account for filter and integration delay (few bits lost at start)
delay = 10  # adjust as needed
match = tx_bits[delay:len(rx_bits)+delay] == rx_bits
ber = 1 - match.mean()
print(f"BER: {ber:.4f}  (should be <0.01 for clean channel)")

If BER > 0.05: check chip-sequence alignment (Vector Source phase), Moving Average length, and Keep 1 in N timing.


Part 5: Jamming Resistance Demonstration (optional)

Add a narrowband jammer to the signal before despreading:

[Signal Source] (sine, 100 kHz offset from centre, amplitude 0.5) 
                                                    [Add]  [rest of receiver chain]
[File Source: dsss_tx.iq] ──────────────────────────────↗

Run the receiver with and without the jammer. Compare BER. The jammer adds narrowband noise, but the DSSS despreading correlator rejects it: its processing gain provides ~10.4 dB of jammer rejection.


Deliverables

  • GNU Radio flowgraph screenshots (TX + RX)
  • Spectrum comparison screenshots (narrowband before vs. spread after)
  • BER measurement output (Python snippet output)
  • 1-paragraph analysis: what does the processing gain of 10.4 dB mean practically? At what jammer power level (above signal) does DSSS fail to recover the data?

Grading (8 points)

Item Points
TX flowgraph screenshot with correct blocks 2
RX flowgraph screenshot with correct blocks 2
Spectrum comparison screenshots (narrowband vs. spread) 2
BER verification output (≤0.05 BER) 1
Written analysis of processing gain 1