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.
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: QPSKTransmitterWithADALMPLUTORadioExample.
Simulink implementation using blocks: QPSKTransmitterWithADALMPLUTORadioSimulinkExample.
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 QPSKTransmitterAndReceiverExample.m.
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 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.
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'
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:1'
The function runPlutoradioQPSKTransmitter implements the QPSK transmitter System object, QPSKReceiver, and ADALM-PLUTO radio System object, comm.SDRTxPluto.
The transmitter includes the Bit Generation, QPSK Modulator and Raised Cosine Transmit Filter objects. The Bit Generation object generates the data frames. 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 payload contains 100 'Hello world ###' messages, where '###' is an increasing sequence of '000', '001', ... '099' in binary forms. The number of messages is tunable via the initialization file, namely transmitter initialization file. Please make corresponding changes in the receiver initialization file, receiver initialization file. The payload is then 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 two, and has roll-off factor of 0.5. The output rate of the Raised Cosine Filter is set to be 400k samples per second with a symbol rate of 200k symbols per second. Please match the symbol rate of the transmitter model and the receiver model correspondingly.
The host computer communicates with the ADALM-PLUTO radio using the ADALM-PLUTO transmitter System object. The CenterFrequency, Gain, and InterpolationFactor arguments are set by the parameter variable prmQPSKTransmitter.
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.
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 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.
This example uses the following script and helper functions: