Keying Lab

Computer Systems Modelling · Example 5.3 · Interactive lab

Keying: sending bits on a carrier

A transmitter sends information by changing the phasor c ejωt from one symbol to the next. Changing c is amplitude shift keying, changing ω is frequency shift keying, and changing the phase is phase shift keying. Type a bit string, pick a scheme, and then add noise to see why we cannot send ever more bits per symbol.

How it works and what to try

How it works: Type a bit string and pick ASK, FSK, BPSK, QPSK, 8-PSK or 16-PSK. The page draws the transmitted waveform with the bits above each symbol, the rotating phasor being sent, and what the receiver sees after multiplying by its local oscillator: a constellation of points with decision boundaries, labelled with a Gray code. A noise slider adds random complex error to each symbol, and the decoded bits show errors underlined. A bar chart compares symbol error rates across the PSK schemes, and Python code for encoding, adding noise and decoding updates as you go.

Try this: Compare on-off keying with BPSK at the same noise and see why BPSK makes fewer errors. Switch to QPSK to send two bits per symbol. Raise the noise slowly and watch 16-PSK fail long before BPSK, which is why we cannot keep adding bits per symbol.

Example numbers refer to Chapter 5 of S. Keshav, Mathematical Foundations of Computer Networking, Addison-Wesley, 2012.

Keying scheme

Binary phase shift keying

Send 0 as c ejωt and 1 as −c ejωt, which is 180 degrees out of phase with the receiver’s local oscillator.

3
0.00
0 (clean)0.8 (very noisy)

Each received symbol is the sent phasor plus a random complex error whose real and imaginary parts have standard deviation σ. The symbol magnitude is 1.

bits per symbol
—
symbols sent
—
The transmitted signalone symbol per time unit; the bits each symbol carries are written above it
sentreceived, with noisecurrent time
The phasor being sent

The signal on the wire is the projection of this rotating phasor on the real axis.

What the receiver sees

The receiver multiplies by its own local oscillator, which turns at the same rate, so each symbol becomes a fixed point. Dots are your symbols as received; faint dots are 1,000 random symbols through the same noise.

Bits decoded by the receivererrors are underlined
t = 0.00
Why not 65,536 phases?symbol error rate at the current noise, from 4,000 random symbols per scheme

Each extra bit per symbol doubles the number of phases, so the phases sit closer together and a smaller error pushes a symbol across a decision boundary. Raise the noise slowly and watch 16-PSK fail long before BPSK does. This is the limit described at the end of Example 5.3.

Python · building the symbols and the signal

    
Python · adding noise and decoding

    

What to notice

In ASK and BPSK the information is in where the phasor points relative to the receiver’s oscillator, so in the right-hand panel each symbol is a single point. QPSK uses four points and so carries two bits per symbol. The labels on the points use a Gray code, in which neighbouring phases differ in one bit, so that the most likely error costs only one bit.

For FSK the right-hand panel instead plots how much of the received symbol lies at each of the two frequencies. A 0 sits on one axis and a 1 on the other, and the receiver picks whichever is larger.

With no noise every scheme decodes perfectly. As noise grows, schemes whose points are closer together make mistakes first. At the same noise and the same symbol magnitude, on-off keying has its two points only 1 apart, while BPSK has them 2 apart, which is why BPSK is more robust.