Digital modulation: constellations and noise
Send a known sequence using BPSK, QPSK, and 16-QAM. Compare the received constellations as you reduce the signal level.
Use a software-defined radio and a browser-based scope to view received symbols in the complex plane. Compare the spread of the symbol clusters with the error vector magnitude (EVM), estimated signal-to-noise ratio (SNR), and measured bit errors.
Set aside 60 to 120 minutes for this experiment on COSMOS.
To reproduce this experiment on COSMOS, you will need an account, and you will need to have joined a project. You should have already uploaded your SSH keys to your profile. Finally, you must have reserved time on the sb5 or sb7 sandbox at COSMOS, and you must run this experiment during your reserved time. If you need help getting set up, see Hello, COSMOS.
- Skip to Results
- Skip to Run my experiment
- Skip to Lab report
Background
A digital modulation scheme maps groups of bits to a finite set of complex signal values, or "signal levels." This experiment uses three schemes with increasing numbers of signal levels:
- BPSK (2-PSK): 1 bit per symbol; two constellation points at opposite sides of the complex plane.
- QPSK (4-PSK): 2 bits per symbol; four constellation points.
- 16-QAM: 4 bits per symbol; sixteen constellation points.
We call this set of points the constellation.
The receiver does not know exactly which point was transmitted; it only sees the received value. In the absence of noise, the received value lands exactly on one of the constellation points. In the presence of noise, it lands near the constellation point, and we can see the points as clouds on the constellation diagram.
The number of signal levels has a cost, however: as the number of levels increases, the points from adjacent symbols get closer together, and it takes less noise to make the receiver confuse one symbol for another. So higher-order modulation delivers more data per symbol, but is more vulnerable to noise.
The scope measures error vector magnitude (EVM) against the ideal point for each symbol in the known transmitted frame. It takes the root mean square (RMS) of those distances on a unit-average-power constellation. For an ideal additive white Gaussian noise channel, you can use EVM to estimate the SNR:
where EVM is expressed as a percentage.
Use the estimated SNR to predict the bit error rate (BER) for a modulation scheme, then compare that prediction with the error rate in the known frame. The scope estimates SNR from error power per symbol. If a BER formula takes the ratio of energy per bit to noise spectral density, divide the linear symbol SNR by the number of bits per symbol before using that formula.
Results
At high SNR, the received symbols (blue dots) cluster around the ideal points (red crosses). The scope shows two clusters for BPSK, four for QPSK, and sixteen for 16-QAM.



As we reduce the signal level, the clouds become wider, the measured EVM increases, and the measured error rate rises.
The SNR at which errors start is different for each modulation. We expect to see that BPSK is the most robust (needs the lowest SNR), QPSK is next, and 16-QAM is the least robust.
Run my experiment
To run this experiment, you need a reservation on a sandbox. You will have to make your reservation in advance. The experiment works on either the sb5 sandbox (USB USRP B210) or the sb7 sandbox (Ethernet USRP N210 with SBX daughterboards); the instructions below give both where they differ.
Set up testbed
At your reserved time, open a terminal and log in to the console of the testbed that you have reserved:
If you are using sb5, run
# runs on your workstation
ssh YOUR_USERNAME@sb5.cosmos-lab.orgIf you are using sb7, run
# runs on your workstation
ssh YOUR_USERNAME@sb7.cosmos-lab.orgThen, you must load a disk image onto the testbed nodes. From the testbed console, run:
# runs on the sb5 or sb7 console
omf tell offs -t node1-1,node1-2
omf load -i baseline-sdr.ndz -t node1-1,node1-2This disk image has the GNU Radio software suite, the USRP/UHD drivers, and the SoapySDR abstraction layer (including the SoapySDR UHD support module) pre-installed.
This process can take 5-10 minutes. Don't interrupt it in middle - you'll just have to start again, and it will only take longer.
If it's been successful, then once the process finishes running completely you should see output similar to:
----------------------------- Imaging Process Done 2 nodes successfully imaged - Topology saved in '/tmp/omf-load-XXXX-topo-success.rb' -----------------------------
Sometimes, transient errors can cause the process to fail - if you haven't successfully imaged 2 nodes, wait a few minutes and try again.
Then, turn on your nodes with the following command:
# runs on the sb5 or sb7 console
omf tell on -t node1-1,node1-2Wait a few minutes for your testbed nodes to turn on, then continue with the experiment.
Get the lab files
From the testbed console, open a shell on the receiver node:
# runs on the sb5 or sb7 console
ssh root@node1-1In a second terminal, open a shell on the transmitter node:
# runs on the sb5 or sb7 console
ssh root@node1-2Run the clone command in each node shell:
# runs on node1-1 and on node1-2
git clone https://github.com/teaching-on-testbeds/digital-modulation.gitThe digital modulation lab repository contains the lab instructions, source code, and radio profiles.
On the receiver node, install Bokeh in a virtual environment. The environment keeps Bokeh separate from the GNU Radio packages supplied by the disk image:
# runs on node1-1
apt-get update
apt-get -y install python3-venv
python3 -m venv --system-site-packages /root/dm-venv
/root/dm-venv/bin/pip install bokeh==3.10.0Run the experiment
The transmitter runs on node1-2; the receiver runs on node1-1. Both must be set to the same frequency and the same number of signal levels (-p).
If you are using sb7, the N210 is an Ethernet device on the 192.168.10.x subnet, attached to the enp4s0 interface on the node. Assign the interface IP on each node, right after you log in to it:
# runs on node1-1 and on node1-2
ip addr add 192.168.10.1/24 dev enp4s0(If the address is already set, the command will report that it already exists, which is fine.)
Note: On sb7, Ubuntu's automatic updates may run in the background some time after the nodes boot, and restart the network service. That removes this address, and the transmitter or scope then fails with
No devices found. If that happens, run theip addr addcommand above again on that node, and restart the transmitter or scope.
Start the transmitter
Now, we will start the transmitter.
If you are using sb5 (B210), run
# runs on node1-2
time python3 /root/digital-modulation/src/dm_tx.py -f 2400e6 -p 2 --tx-gain 89 --amplitude 0.1 \
--args type=b200 --subdev A:AIf you are using sb7 (N210), run
# runs on node1-2
time python3 /root/digital-modulation/src/dm_tx.py -f 2400e6 -p 2 --tx-gain 0 --amplitude 0.1 \
--args addr=192.168.10.2 --subdev A:0The -p argument sets the number of signal levels (2 = BPSK, 4 = QPSK, 16 = 16-QAM), --tx-gain sets the transmit gain in dB, and --amplitude sets the digital waveform amplitude. In this experiment, you will keep the transmit gain fixed (89 dB on sb5, 0 dB on sb7) and change only --amplitude, using the sequence of values given below.
Choose a receiver workflow
The scope opens the USRP on the receiver node. UHD allows only one receiver process to use that radio at a time. The browser itself does not access the radio. It displays measurements produced by the scope process.
Live browser scope
We will visualize the live constellation using a "scope"! Start the scope on the receiver node:
If you are using sb5 (B210), run
# runs on node1-1
cd /root/digital-modulation/src
/root/dm-venv/bin/bokeh serve dm_scope.py --port 5006 --allow-websocket-origin=localhost:15006 \
--args --freq 2400e6If you are using sb7 (N210), run
# runs on node1-1
cd /root/digital-modulation/src
/root/dm-venv/bin/bokeh serve dm_scope.py --port 5006 --allow-websocket-origin=localhost:15006 \
--args --freq 2400e6 \
--args addr=192.168.10.2 --subdev A:0 --gain 0Keep that terminal running. From your laptop, open a second terminal and create an SSH tunnel to the receiver node.
If you are using sb5, run
# runs on your workstation
ssh -N -J YOUR_USERNAME@sb5.cosmos-lab.org \
-L 15006:127.0.0.1:5006 root@node1-1If you are using sb7, run
# runs on your workstation
ssh -N -J YOUR_USERNAME@sb7.cosmos-lab.org \
-L 15006:127.0.0.1:5006 root@node1-1Open http://localhost:15006/dm_scope in your browser. Select the same modulation as the transmitter (initially, BPSK) so that the scope knows what the "ideal" constellation should be. The scope synchronizes to the repeated known frame and displays the constellation, EVM, SNR, bit errors, and CFO.
Vary the modulation, vary the signal level, and repeat
Run the amplitude sweep for BPSK (-p 2), QPSK (-p 4), and 16-QAM (-p 16). Stop and restart the transmitter between runs.
Leave the scope running. Each time you change the modulation, select the same one in the scope.
If you are using sb5, keep --tx-gain 89, and for each modulation, run the transmitter with each of these amplitudes, in this order:
--amplitude 0.1 --amplitude 0.05 --amplitude 0.02 --amplitude 0.01 --amplitude 0.005 --amplitude 0.002
Each time, stop and restart the transmitter, wait a few seconds for the scope to update, and take a screenshot. For example, the third BPSK run is:
# runs on node1-2
time python3 /root/digital-modulation/src/dm_tx.py -f 2400e6 -p 2 --tx-gain 89 --amplitude 0.02 \
--args type=b200 --subdev A:AOn sb5, this sequence takes the SNR from about 20 dB (tight clouds, no bit errors) down to about -4 dB, where the clouds have merged together and many bits are wrong.
If you are using sb7, keep --tx-gain 0 (and the scope's RX gain at 0), and for each modulation, run the transmitter with each of these amplitudes, in this order:
--amplitude 0.1 --amplitude 0.05 --amplitude 0.03 --amplitude 0.02
Each time, stop and restart the transmitter, wait a few seconds for the scope to update, and take a screenshot. For example, the third BPSK run is:
# runs on node1-2
time python3 /root/digital-modulation/src/dm_tx.py -f 2400e6 -p 2 --tx-gain 0 --amplitude 0.03 \
--args addr=192.168.10.2 --subdev A:0On sb7, the two radios are so strongly coupled that even with both gains at 0, the signal is very strong, so this sequence covers a smaller range: it takes the SNR from about 20 dB down to about 7 dB. That is enough to see 16-QAM (and, at the end, QPSK) make bit errors, but BPSK stays error-free throughout. (Don't go below --amplitude 0.02: at lower amplitudes, the receiver loses track of the signal altogether, rather than seeing it get noisier. See the Notes section below.)
Notes
Other impairments
In this experiment, we lower the SNR, and the only effect we want to see is noise: round clouds, centered on the ideal points, that grow as the SNR falls. Real radios have other impairments too, and each one distorts the constellation in its own way:
- Carrier frequency offset (CFO): the transmitter and receiver oscillators are at slightly different frequencies, so the received constellation keeps rotating. Left uncorrected, the clusters smear into rings. The scope measures and removes the CFO, but the CFO removal may not be perfect.
- Phase noise: the oscillator phase jitters a little, so each cluster is smeared along an arc around the center, more for points farther from the center.
- DC offset and carrier leakage: a constant is added to every received sample (from the receiver itself, or from the transmitter's carrier leaking through), so the whole constellation is shifted off center. The scope removes this offset before it measures the EVM, but some may persist.
- IQ imbalance: the I and Q branches have slightly different gains, or are not exactly 90 degrees apart, so the constellation is stretched or squashed in one direction, or skewed (a square 16-QAM grid becomes a rectangle or a parallelogram).
- Nonlinearity: if the signal is too strong for the transmitter's amplifier (or the receiver), the largest samples are compressed. The outer points of 16-QAM get pulled inward, and clusters get stretched. This is why the amplitude sequences above start at 0.1, not higher.
When the signal is very weak, these impairments can matter more than the noise. For example, the carrier leakage does not get smaller when you lower --amplitude, so at very low amplitudes it can be stronger than the signal itself; then, the receiver may shift the constellation, lose track of the signal, or show points scattered everywhere, rather than a larger cloud.
Lab report
Organize your screenshots in a table of constellation diagrams:
- one column each for BPSK, QPSK, and 16-QAM
- one row for each amplitude, from highest to lowest
For each row, record the TX gain and amplitude. For each screenshot, record the EVM, SNR, bit errors, and carrier frequency offset (CFO) shown by the scope.
Explain why the clouds expand as the signal level falls. Compare the robustness of BPSK, QPSK, and 16-QAM. Explain why reducing --amplitude changes the visible SNR.