Overview
This document describes how to set up a 2x2 multiple input, multiple output (MIMO) system using NI LabVIEW software and NI USRP™ (Universal Software Radio Peripheral) hardware. After a brief discussion of MIMO, the paper examines the hardware and software based on LabVIEW for a 2x2 system with Alamouti space-time block coding and maximal ratio combining (MRC).
Table of Contents
- What Is MIMO?
- Implementing a 2x2 MIMO System
- 2x2 MIMO System: Hardware Configuration
- 2x2 MIMO System: Software Configuration
- Working With the Example
- Building a 2x2 MIMO System in LabVIEW
- Preparing a Signal for Transmission
- Signal Recovery
- Results
- Additional Resources
What Is MIMO?
With MIMO, you can increase wireless system performance without increasing power consumption. It is based on the idea that when using multiple antennas, the transmitted signal progresses through different wireless channels, from the transmitter antennas to the receive antennas, to create a capacity gain by exploiting channel diversity.
To learn more about MIMO, visit http://en.wikipedia.org/wiki/Mimo.
Implementing a 2x2 MIMO System
The MIMO system described here uses Alamouti space-time block coding on the transmitter side and MRC on the receiver side. The combination of the two exploits the full diversity available to a 2x2 MIMO system.
At the transmitter, symbols are encoded with the Alamouti scheme as follows: the first two symbols (s1 and s2) are converted into a 2x2 matrix

where the rows represent the different transmit antennas and the columns represent consecutive time slots. This is repeated for every consecutive pair of transmit symbols.
View a detailed description of the decoding scheme on the receive side
2x2 MIMO System: Hardware Configuration
You need four NI USRP transceivers for a 2x2 system because individual transceivers are not capable of two simultaneous transmits or receives. The following configuration is recommended:
- One PC with a free Gigabit Ethernet port.
- One Gigabit Ethernet switch connected to the PC.
- The first transceiver connected directly to the switch via Ethernet and the second transceiver connected to the first via the MIMO cable. These two are your transmitters.
- The third transceiver connected directly to the switch via Ethernet and the fourth transceiver connected to the third via the MIMO cable. These two are your receivers.

Figure 1. The 2x2 MIMO Hardware Setup Diagram
Figure 1 shows the configuration you can use to synchronize the reference clock sources between both transmitters and the reference clock sources between both receivers. Each transceiver has one antenna connected to either port (NI recommends RX1/TX1 for simplicity). For the MIMO system to fully exploit the diversity of the separate channels, the transmitters should be at least half a wavelength of the carrier frequency used apart (the same is true for the receivers).
2x2 MIMO System: Software Configuration
This 2x2 MIMO example is a LabVIEW application that requires the following software components:
- NI LabVIEW Version 2011 (or later) system design software—Full, Professional, or Student Edition
- NI-USRP Version 1.1
- NI LabVIEW Modulation Toolkit Version 4.3.1
- 2x2 MIMO Example VIs
Working With the Example
Unzip the associated zip file to a new folder and open the file entitled 2x2QAMAlamouti.vi in LabVIEW.

Figure 2. The System Parameters Tab on the Front Panel of the 2x2QAMAlamouti.vi Example
On the front panel of the example (Figure 2), click on the System Parameters tab. The Tx Settings and Rx Settings clusters contain the parameters for the Tx and Rx pairs of NI USRP transceivers, respectively. Set the controls in these clusters and those found in the Link Parameters cluster with the following guidelines in mind:
USRP IP Address: Enter the two IP addresses associated with the NI USRP transceivers in each of the Tx and Rx pairs. Use a semicolon to separate the entries, for instance: “192.168.10.6; 192.168.10.5.”
I/Q Sampling Rate [S/sec], Symbol Rate, Tx Oversample Factor, and Rx Oversample Factor: For the I/Q Sampling Rate, enter the sample rate, in units of samples per second, for the baseband I/Q signal samples for both the Tx and Rx pairs. Enter values for the Symbol Rate, Tx Oversample Factor, and Rx Oversample Factor so that the I/Q Sampling Rate is an even multiple of the desired Symbol Rate. Enter an even-valued Oversample Factor that corresponds to the multiple. In other words, the relationship between the I/Q Sampling Rate, Symbol Rate, and Oversample Factor parameters needs to be as follows:
I/Q Sampling Rate = Symbol Rate * Oversample Factor
Carrier Frequency [Hz]: Enter a common Carrier Frequency in units of Hz for both the Tx and Rx pairs. It is your responsibility to choose a frequency that conforms to your local regulations.
Start Trigger Time cluster—whole seconds, fractional seconds: Choose a Start Trigger Time in whole and fractional seconds to ensure that your receivers start receiving just before your transmitters begin to transmit.
Per Device array: The Per Device array is an array of clusters that contains two elements. Each array element corresponds to one of the NI USRP transceivers in the Tx or Rx pair. Element 0 corresponds to the first NI USRP transceiver in the USRP IP Address and element 1 corresponds to the second NI USRP transceiver in the USRP IP Address. You need to configure the Tx and Rx pairs of the NI USRP transceivers to share a common source for their Reference Frequency and Timebase Clock. You can set one NI USRP transceiver of each pair (“primary”) to supply the other (“secondary”) through the MIMO cable connection. To set up this configuration, set the elements of the Per Device array as follows:
Per Device array element 0:
Ref Frequency Source: Internal
Timebase Clock Source: Internal
Per Device array element 1:
Ref Frequency Source: MIMO
Timebase Clock Source: MIMO
With the parameters set appropriately, you can run the VI. Doing so, the Tx pair transmits a burst that is received by the Rx pair. The resulting waveforms that exhibit a successful reconstruction are shown in Figure 3.

Figure 3. The upper large plot of this successful reconstruction of a 4QAM in your 2x2 system shows the received time-domain signal samples for the I/Q components of both receive antennas (four signals all together). The constellation plots on the bottom left show the signals received by the two Rx NI USRP transceivers. The lower right constellation shows the reconstructed constellation.
Building a 2x2 MIMO System in LabVIEW
Figure 4 shows the block diagram (the LabVIEW graphical program) that implements this example. The following sections describe some of the key areas of the application.

Figure 4. The LabVIEW block diagram for 2x2QAMAlamouti.vi is organized into three sections. The upper left section of code synthesizes a signal for transmission. The code in the middle lower portion of the diagram initiates the Tx/Rx operations with the NI USRP hardware. The upper right section of code processes the received signal and displays the received waveforms.
Preparing a Signal for Transmission
The first several steps in preparing a signal for transmission consist of calls to subVIs (subroutines) from the LabVIEW Modulation Toolkit. A call to MT Generate Bits generates a PN sequence that acts as message bits. These bits are mapped to symbols by a subsequent call to MT Map Bits to Symbols.
Then apply the Alamouti encoding scheme to the symbols (Figure 5) generated in the previous step. The result is a 2D array of symbols with two streams, one for each transmitter.

Figure 5. The block diagram for subApplyAlamoutiCode.vi, the subVI that applies the Alamouti coding, shows that the operation is straightforward in that it requires a few array manipulations to produce the desired 2D array of symbols.
After encoding the symbols, the application prepends a training symbol sequence to each stream. The training sequence is used by the receiver for synchronization and to estimate the channel.
The training sequence addition operation prepends the same sequence to each stream and arranges the data so that the sequence is transmitted by one of the two Tx NI USRP transceivers and then the other—for example, one of the two Tx NI USRP transceivers transmits the sequence while the other is silent. The other transceiver then transmits the same sequence while the other is silent.
The final step in signal synthesis prior to the transmit/receive operations involves upsampling the incoming symbol spaced samples to the rate specified in the Tx Oversample control and then applying a pulse shaping filter to the upsampled signal.
Signal Recovery
On the receiver side, the USRP Fetch Rx Data VI returns a 2D array of the received signal with each row representing a stream of received signal samples from an antenna.
For the first signal recovery step, you need to extract the received packet from the received frames of data. Use an energy detection algorithm to determine the start of the packet and discard the remaining nonpacket portion of the frame.
Next, apply a matching filter to each stream and determine the stream with the stronger signal by comparing the energy between the two rows of the 2D received array. Then apply symbol synchronization to the row with the stronger signal and apply the calculated offset to both rows.

Figure 6. The graph shows the four received waveforms—the I and Q waveforms from each of the two Rx antennas. You can see the training sequences from each of the two Tx antennas by zooming in on the initial portion of the received packet.
Frame synchronization is trickier and depends on the structure of the two training sequences on the transmitter side. In this case, both transmitters use the same training sequence but offset from one another in time, so that when they are overlapped, they appear as one continuous training sequence that is twice the length. The application exploits this for frame synchronization by searching for the portion of the received signal where the two consecutive sets of T symbols (where each training sequence is of length T) are the most highly correlated. Apply the calculated frame offset to both rows of the received 2D array.
For channel estimation, you consider four different channels. Each row of the 2D array contains two training sequences (one from each transmitter). Thus, by performing your channel estimation on each training sequence in each row, you determine four channel estimates.
These estimates are important for the next step, during which you convert your 2D array of symbols into the proper 1D array of symbols by decoding the Alamouti coding scheme and then performing MRC. You can implement these last two steps with two separate operations or, as with this application, using a single matrix multiplication. The single matrix multiplication approach generalizes more easily to larger MIMO systems. For details on how to perform these last decoding steps, refer to one of the many online references.
Results
Figure 3 shows the two Rx signal constellations from a test run of the 2x2 MIMO system running on four NI USRP transceivers. On the far right is the final signal constellation after performing Alamouti decoding, MRC, and channel equalization. This image shows that it works properly.
Additional Resources
View VIs associated with this tutorial
Reader Comments | Submit a comment »
Hi,
I was setup MIMO2x2 system like in
example, with 4 NI USRP 2920 devices,
2 MIMO cables and one switch. VI that i
use is the same as yours, but simulation
isn't work because some error.
error is: The reference clock PLL did not
lock within aloted time.
How to fix this problem?
Thanks
-
Nenad Stojkovic,Faculty of Electrical Engineering.
nele11121987@hotmail.com
- Sep 19, 2012
channel estimation
Are there any channel estimation
techniques that could be incorporated into
the model
-
Gerardo Moreno,Aalto University.
gerardo.moreno-crespo@aalto.fi
- Jun 01, 2012
Decoder inneed
hi, Could you share the function diagram of
Alamouti Decoder, Please?
-
salnouman@yahoo.com
- May 10, 2012
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
