DIY WiFi: OFDM-based Data Transfer Algorithm

For Lab 3 in Principles of Wireless Comms., I developed an algorithm to transmit and receive data over software-defined radios using OFDM as described in IEEE 802.11a WiFi standards. I wrote custom scripts to implement channel estimation, timing synchronization, and carrier frequency offset compensation for Tx/Rx at data rates upto 4Mbps and received a worst-case Bit-Error Rate of 0.08% in noisy real-world tests without any error correction.

WirelessComms - Copy of Flat Fading Model for Subcarriers.jpg

What is OFDM?

Orthogonal Frequency Division Multiplexing (OFDM) is a modulation technique that uses a large number of narrow-band subcarriers instead of a single wide-band subcarrier to transmit data over non-flat fading channels. OFDM is the preferred mode of modulation in WiFi and LTE standards.

OFDM requires sending data over a wide range of frequencies, i.e. the channel has a large bandwidth, as represented in Figure a. A large bandwidth of the channel implies a frequency-dependent frequency response of the channel. To assume a flat-fading model for efficient calculations, the carrier signal is divided into parallel strips of subcarriers each having equal coherence bandwidth, as shown in Figure b. This flat-fading model provides advantages like simpler implementation, robust performance, and sharply reduces the chances of frequency-selective fading.

Tx: Cyclic Convolution

The first step of OFDM involves encoding the the signal to be transmitted using the Inverse Discrete Fourier Transform (IDFT). In real-world implementations, this IDFT is performed digitally, which means that a circular convolution must be performed to move data from the frequency domain into the time domain.

However, a perfect IDFT requires infinite extension of the signal in both directions. For a symbol of length L, with M bits long impulse response, and M < L, this problem is solved by selecting the last M-1 bits of every symbol, and repeating them in front of the symbol to create an illusion of infinite symbol extension. Those M-1 bits of data are called Cyclic Prefixes (CPs); CPs help reduce the inter-symbol interference (ISI) and reduce computational runtime by quickly converting a linear convolution into cyclic convolution.

channel-estimation.png

Rx: Channel Estimation and Equalization

Channel estimation and equalization was performed using Least Squares Error (LSE) algorithm. LSE estimation involves dividing the received data of a known transmitted symbol by the corresponding received data point. The image on the right shows the linear algebra behind channel estimation for a two-antenna system. Accuracy of LSE can be improved by increasing the number of OFDM symbols being sampled and performing element-wise division to compensate for noise. For my implementation, I sampled the channel estimate over 12 symbols.

xcorr.png

Rx: Timing Synchronization

Cross-correlation of the preamble with the received signal was used to predict the beginning of the received signal. This functionality was provided by the xcorr function in MATLAB, which also returns the lags at which the index of the cross-correlation is highest.

schmidl-cox.PNG

Rx: Carrier Frequency Offset Correction

The Schmidl-Cox algorithm was used to implement Carrier Frequency Offset (CFO) correction. For a signal that has been temporally-synchronized, CFO correction using Schmidl-Cox can be implemented by summing the result of the division of the angle of subcarrier n by the angle of subcarrier n+L, where n is the index and L is the length of a symbol. Next, this sum is divided by the total number of subcarriers in a symbol, i.e. L, which gives the frequency offset f.

CFO is performed by taking the exponent of f*[k]*(-j) and multiplying it with the received, temporally-synchronized signal. Here, k is the sample number and j is the complex number iota.

Lab 3C_OFDM Transmission.jpg

Rx: Phase Offset Correction (Pilot) and Guard Bands

Phase offset compensation is needed to correct for drift in the oscillations of the Tx and Rx crystals. In WiFi systems, CFO correction is performed per packet of data while phase correction is performed per OFDM symbol.

802.11a standards use 4 pilot symbols at index locations -21, -7, 7, and 21. Our implementation divided data the 48 data subcarriers into an even split of 6, 12, 12, and 6 subcarriers, thus moving the location of pilots to -20, -7, 7, and 20 in Figure c. Additionally, 802.11a specifies guard bands equal to 11 subcarriers with 6 at the beginning and 5 end of each symbol to decrease ISI and reduce spectrum spread from adjacent subcarriers/symbols. The guard bands can seen in Figure b and Figure c.

Finally, a null is placed at the center of the symbol which corresponds to the DC subcarrier. This subcarrier is not used for carrying data because the Rx local oscillator leaks into the DC component of the OFDM symbol, rendering it useless.

Results

 

The IQ plots shown below are plotted without error correction to visualize the actual Bit Error Rate (BER) of the system. 1000 symbols were transmitted/received for each data set at 4.0 GHz using the B210 Software-Defined Radios over a noisy, real-world environment.

 
3C_Scatter_2Mbps.png
 

0.02% BER @2Mbps

3C_Scatter_4Mbps.png

0.08% BER @4Mbps

Next
Next

IoT-enabled Environment Monitoring