Main Content

Alamouti Coding Based MIMO Receiver using USRP Radio

This example demonstrates the implementation of a 2x2 multiple input multiple output (MIMO) receiver based on Alamouti space-time Block Coding (STBC) using a USRP™ radio.The MIMO receiver processes the received signal and decodes the QPSK-modulated payload that the Alamouti Coding Based MIMO Transmitter using USRP Radio example sends using Alamouti STBC . You can also validate the performance of the 2x2 MIMO receiver in terms of bit error rate (BER).

Required Hardware and Software

To run this example, you require one of the following hardware:

The example requires two MATLAB™ sessions, one for the transmitter and one for the receiver. You run the Alamouti Coding Based MIMO Transmitter using USRP Radio example in one MATLAB session to transmit the signal.

Configure USRP Radio Parameters

Define the USRP radio parameters including the platform type, radio address, gain, center frequency, and sample rate. If you use two N200 or N210 radios, specify radioAddress for two radios separated by a comma. Example: "192.168.10.2,192.168.10.3"

platform                = "B210"; % Select radio for reception
radioAddress            = "30F597A"; % Serial number/IP Address of USRP radio
gain                    = 40; % Set radio gain
centerFrequency         = 3200000000; % Set RF center frequency
sampleRate              = 1000000; % Set sample rate
stopTime                = 2; % Set stop time
plotConstellation       = true;                  % Control to plot constellation
printData               = false;                  % Control to print the output decoded data

Initialize Parameters and System objects

The sdruOSTBCReceiverInit function initializes the USRP radio System object and returns the initialization parameters. Initialize the system objects required for the receiver, including the radio object, raised cosine receive filter, descrambler, Alamouti combiner, and error rate calculator.

[radio, initParams] = sdruOSTBCReceiverInit(platform, radioAddress,...
    gain, centerFrequency, sampleRate);

% Create an Alamouti combiner object to perform Alamouti decoding on input
% symbols
alamoutiDec = comm.OSTBCCombiner( ...
    NumTransmitAntennas = initParams.NTx,...
    NumReceiveAntennas  =  initParams.NRx);

% Create a descrambler object to descramble the input bits
descrambler = comm.Descrambler(...
    initParams.DescramblerBase, ...
    initParams.DescramblerPolynomial, ...
    initParams.DescramblerInitialConditions);

% Create a BER calculator system object
berCalc = comm.ErrorRate( ...
    Samples       = 'Custom', ...
    CustomSamples = initParams.SamplesToCheck);

% Create an object to plot constellation diagram
constDiagram = comm.ConstellationDiagram;

% Get Gold sequences for estimating channel
goldSeqRef = sdruOSTBCInitGoldSeq;

Capture and Process Received Signal

The receiver captures the signal until it reaches stop time, processing each frame as follows:

  • Automatic Gain Control: The AGC adjusts the received signal's power to a desired level for both antennas.

  • Filtering: The signal is passed through a raised cosine receive filter to reduce intersymbol interference (ISI).

  • Coarse Frequency Compensation: The receiver performs coarse frequency compensation to correct large frequency offsets in the received signal.

  • Symbol Synchronization: The receiver synchronizes the symbols to ensure accurate timing alignment for subsequent processing.

  • Fine Frequency Compensation: The receiver performs fine frequency compensation to correct any residual frequency offsets after coarse frequency compensation.

  • Channel Estimation: The receiver estimates the channel conditions using a reference Gold Sequence.

  • Alamouti Decoding: The Alamouti combiner combines the received signal using the estimated channel information, effectively separating the transmitted symbols.

  • Demodulation: The receiver demodulates the combined signal from Alamouti combiner to recover the transmitted bits.

  • Descrambling: The descrambler object reverses the scrambling process to retrieve the original data bits.

  • Message Recovery: The receiver reconstructs the message from the received bits, displaying the result.

  • BER Calculation: The BER calculator compares the received bits to the originally transmitted bits to calculate the bit error rate, providing a measure of the transmission quality.

currentTime = 0;
overrun = uint32(0)
overrun = uint32

0
BER = [];
USRPFrameTime = radio.SamplesPerFrame/sampleRate;

while currentTime < stopTime
    [rxSig, ~, overrun] = radio();
    
    % Frequency and timing offset correction
    [rx1, rx2] = sdruOSTBCOffsetCorrection(rxSig, initParams);

    % Calculate channel estimate
    [channelEstimate, payload] = ...
        sdruOSTBCChannelEstimation(rx1, rx2, goldSeqRef);

    if isempty(payload)
        continue;
    end

    % Alamouti combiner
    combinedData = alamoutiDec(payload, channelEstimate);

    % QPSK demod
    demodOut = pskdemod(combinedData, 4, pi/4, 'OutputType','bit');

    % Perform descrambling on payload
    rxbits = descrambler(demodOut);

    % BER calculation
    BER = berCalc(initParams.MessageBits, rxbits);

    % Plot constellation
    if plotConstellation
        constDiagram(combinedData);
    end

    % Recovering the message from the data
    if printData
        charSet = int8(bi2de(reshape(rxbits, 7, [])', 'left-msb'));
        fprintf('%s', char(charSet));
    end

    currentTime = currentTime+USRPFrameTime;
end
fprintf('Error rate is = %f.\n',BER(1));
Error rate is = 0.000000.

Finally, release the system objects to free up resources

release(radio);
release(alamoutiDec);
release(descrambler);
release(berCalc);
release(constDiagram);

Conclusion

In this example you used Communications Toolbox™ System objects to build a 2x2 MIMO Receiver using Alamouti scheme with USRP radios, which provides a foundation for further exploration and customization of wireless communication systems.

Helper Functions

The following scripts are used in this example.

  • sdruOSTBCInitGoldSeq.m

  • sdruOSTBCReceiverInit.m

  • sdruOSTBCEstimateChannel.m