Main Content

QPSK Transmitter with ADALM-PLUTO Radio

This example shows how to design a QPSK transmitter using an ADALM-PLUTO radio. The QPSK transmitter modulates and transmits indexed "Hello world" messages at a specified center frequency and a bit rate of 0.4 Mbps. In this example, the transmitter generates a message using ASCII characters, converts these characters to bits, and appends a Barker code at the beginning for receiver frame synchronization. This data is then QPSK modulated and filtered with a square root raised cosine filter. The filtered QPSK symbols can be transmitted over the air using the software-defined radio.

The example requires two MATLAB sessions, one for the transmitter and one for the receiver. You can demodulate the transmitted message using the QPSK Receiver with ADALM-PLUTO Radio example.


This example has the following motivation:

  • To implement a real world QPSK transmitter using using ADALM-PLUTO Radio System objects.

  • To illustrate the use of key Communications Toolbox™ System objects for QPSK system design.

Initialize Transmitter Parameters

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

% Transmitter parameter structure
prmQPSKTransmitter = plutoradioqpsktransmitter_init;
% Specify Radio ID
prmQPSKTransmitter.Address = 'usb:0'
prmQPSKTransmitter = struct with fields:
                          Rsym: 200000
               ModulationOrder: 4
                 Interpolation: 2
                    Decimation: 1
                          Tsym: 5.0000e-06
                            Fs: 400000
                    BarkerCode: [1 1 1 1 1 -1 -1 1 1 -1 1 -1 1]
                  BarkerLength: 13
                  HeaderLength: 26
                       Message: 'Hello world'
                 MessageLength: 16
               NumberOfMessage: 100
                 PayloadLength: 11200
                     FrameSize: 5613
                     FrameTime: 0.0281
                 RolloffFactor: 0.5000
                 ScramblerBase: 2
           ScramblerPolynomial: [1 1 1 0 1]
    ScramblerInitialConditions: [0 0 0 0]
        RaisedCosineFilterSpan: 10
                   MessageBits: [11200×1 double]
          PlutoCenterFrequency: 915000000
                     PlutoGain: 0
       PlutoFrontEndSampleRate: 400000
              PlutoFrameLength: 11226
                      StopTime: 1000
                       Address: 'usb:0'

Code Architecture

The function runPlutoradioQPSKTransmitter implements the QPSK transmitter System object, QPSKTransmitter, and ADALM-PLUTO radio System object, comm.SDRTxPluto.

QPSK Transmitter

The QPSKTransmitter includes a bit generator, QPSK modulator and raised cosine transmit filter System objects. The bit generator object generates the data frames, starting with a Barker code. The QPSK transmitter sends the Barker code with both the in-phase and quadrature components of the QPSK modulated symbols by repeating the Barker code bits twice and then modulating them with the QPSK modulator.

The payload, consisting of the remaining bits, includes 100 'Hello world ###' messages. Here, '###' represents a binary sequence incrementing from '000' to '099'. You can adjust the number of messages in the transmitter initialization file. Corresponding adjustments are necessary in the receiver initialization file to ensure proper decoding.

For timing recovery, the system scrambles the payload to ensure an even distribution of zeros and ones. The QPSK modulator uses Gray coding and then modulates the scrambled bits. The raised cosine transmit filter system object upsamples the modulated symbols by a factor of two and applies a roll-off factor of 0.5. Finally, the raised cosine filter output rate is set to 0.4 M samples per second with a symbol rate of 0.2 M symbols per second.

Transmit the QPSK signal

Run the example to start transmitting the QPSK signal.

Transmission has started
## Establishing connection to hardware. This process can take several seconds.
Transmission has ended

If the message is not properly decoded by the receiver object, you can vary the gain of the source signals in the comm.SDRTxPluto and comm.SDRRxPluto 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 models in Frequency Offset Calibration with ADALM-PLUTO Radio in Simulink example then applying that offset to the center frequency of the comm.SDRRxPluto System object.

Supporting Functions

This example uses the following script and helper functions: