MATLAB Examples

QPSK Transmitter with ADALM-PLUTO Radio

This example shows how to use the ADALM-PLUTO Radio System objects to implement a QPSK transmitter. The ADALM-PLUTO radio in this system will keep transmitting indexed "Hello world" messages at its specified center frequency. You can demodulate the transmitted message using the QPSK Receiver with ADALM-PLUTO Radio example. This example assumes that two ADALM-PLUTO radios are attached to your computer.

Contents

Implementations

This example describes the MATLAB® implementation of a QPSK transmitter with ADALM-PLUTO radio. There is another implementation of this example that uses Simulink®.

MATLAB script using System objects: plutoradioQPSKTransmitterExample.m.

Simulink implementation using blocks: plutoradioQPSKTransmitterSimulinkExample.slx.

You can also explore a no-radio QPSK Transmitter and Receiver example that models a general wireless communication system using an AWGN channel and simulated channel impairments at commQPSKTransmitterReceiver.m.

Introduction

This example has the following motivation:

  • To implement a real QPSK-based transmission-reception environment in MATLAB using ADALM-PLUTO Radio System objects.
  • To illustrate the use of key Communications System Toolbox™ System objects for QPSK system design.

In this example, the transmitter generates a message using ASCII characters, converts the characters to bits, and prepends a Barker code for receiver frame synchronization. This data is then modulated using QPSK and filtered with a square root raised cosine filter. The filtered QPSK symbols can be transmitted over the air using the ADALM-PLUTO Transmitter System object and the ADALM-PLUTO radio.

Initialization

The plutoradioqpsktransmitter_init.m script initializes the simulation parameters and generates the structure prmQPSKTransmitter.

% Transmitter parameter structure
prmQPSKTransmitter = plutoradioqpsktransmitter_init;
% Specify Radio ID
prmQPSKTransmitter.Address = 'usb:1'

Code Architecture

The function runPlutoradioQPSKTransmitter implements the QPSK transmitter using two System objects, QPSKTransmitter and comm.SDRTxPluto.

QPSK Transmitter

The transmitter includes the Bit Generation, QPSK Modulator and Raised Cosine Transmit Filter objects. The Bit Generation object generates the data frames. Each frame contains 200 bits. The first 26 bits are header bits, a 13-bit Barker code that has been oversampled by two. The Barker code is sent on both in-phase and quadrature components of the QPSK modulated symbols. This is achieved by repeating the Barker code bits twice before modulating them with the QPSK modulator.

The remaining bits are the payload. The first 105 bits of the payload correspond to the ASCII representation of 'Hello world ###', where '###' is an incrementing sequence of '001', '002', '003',..., '100'. The remaining payload bits are random bits. The payload is scrambled to guarantee a balanced distribution of zeros and ones for the timing recovery operation in the receiver object. The scrambled bits are modulated by the QPSK Modulator (with Gray mapping). The Raised Cosine Transmit Filter upsamples the modulated symbols by four, and has a roll-off factor of 0.5. The output rate of the Raised Cosine Filter is set to be 100e3 samples per second with a symbol rate of 25e3 symbols per second.

Pluto Transmitter

The host computer communicates with the ADALM-PLUTO radio using the ADALM-PLUTO Transmitter System object. The CenterFrequency and Gain arguments are set by the parameter variable prmQPSKTransmitter.

Execution

Connect two ADALM-PLUTO Radios to the computer. Start the transmitter script in one MATLAB session and then run the QPSK Receiver with ADALM-PLUTO Radio example in another MATLAB session.

runPlutoradioQPSKTransmitter(prmQPSKTransmitter);

If the message is not properly decoded by the receiver object, you can vary the gain of the source signals in the ADALM-PLUTO Transmitter and ADALM-PLUTO Receiver System objects by changing the SimParams.PlutoGain value in the transmitter initialization file and in the receiver initialization file.

Also, a large relative frequency offset between the transmit and receive radios can prevent the receiver functions from properly decoding the message. If that happens, you can determine the offset by running the Frequency Offset Calibration (Tx) with ADALM-PLUTO Radio and the Frequency Offset Calibration (Rx) with ADALM-PLUTO Radio models, then applying that offset to the center frequency of the ADALM-PLUTO Receiver System object.

Appendix

This example uses the following script and helper functions: