Spectrum Monitoring Using MATLAB and USRP
Learn how to use spectrum monitoring and the preamble detection reference application to capture signals from the air using supported USRP™ hardware. You can capture baseband signals efficiently by leveraging the preamble detector reference application running on USRP FPGA. This capability offered by Wireless Testbench™ fits into a large set of use cases and applications where complete receiver design is not required, such as signal classification, spectral conformance, cognitive radio, signal intelligence, radar, and other wireless designs.
Published: 28 Feb 2022
Let's talk about one of the reference applications provided by Wireless Testbench. You can use Spectrum Monitoring and Preamble Detection Reference Application to capture signals from the air using supported USRP hardware.
Unlike capturing the raw signals and post-processing and filtering them on the host, you can capture piece find band signals efficiently by leveraging the Preamble Detector Reference Application running on USRP FPGA. This capability offered by Wireless Testbench fits into a large set of use cases and applications where complete receiver design is not required, such as signal classification, spectral conformance, cognitive radio, signal intelligence, radar, and the list is long.
This application is shipped as pre-built bitstream that is ready to run on supported USRP FPGA. The Preamble Detector consists of three major blocks that are programmable FIR filter, threshold calculator, and capture controller. Wireless Testbench offers an easy-to-use command line interface to configure these blocks and arm the Preamble Detector running on FPGA. To showcase signal detection capability, Wireless Testbench provides examples for custom and wireless LAN signal detection. We will be demonstrating wireless LAN signal detection in this video.
This diagram shows the detailed architecture of the Preamble Detector. The length of a FIR filter can vary, and depends on the search sample rate. You can set the filter tabs from MATLAB. The threshold calculation block sets the threshold for integrating the signal energy over duration equal to the filter length.
The adaptive threshold value is a linear function of signal energy, where you can set the gain and offset from MATLAB. You can also optionally provide a fixed threshold if you don't want to rely on adaptive method. The capture controller compares the FIR filter output with the threshold, and capture is triggered when a FIR filter output exceeds the threshold. The capture controller can also move the capture instant forwards and backwards in time with respect to the trigger point based on your setting of trigger offset.
This graph shows the thresholding and triggering of the signal capture. The stem plot shows the output of the FIR filter, while the plot in red shows the adaptive threshold. The capture data is enclosed in the green rectangle. In order to avoid false detection, the Preamble Detector lets you calibrate the threshold, where you can plot the FIR filter output and threshold calculator output using a single function call by pulling the data from the hardware.
This figure shows how trigger delays can be adjusted around the trigger point to capture the signal of interest. Here the data is captured nine samples before the trigger point. You can use this when you want to bring preamble, along with the data sequence, into MATLAB workspace.
Let's dive into a real-world application where you are required to detect and analyze wireless LAN signals in your environment. This diagram shows a typical setup, where several Wi-Fi access points are transmitting wireless LAN signals. You can use Preamble Detector Reference Application, running on USRP, to capture the signals and process them in MATLAB to extract the key information.
Though this example is based on wireless LAN signals, a similar approach can be used for detection of any signal present in the environment, such as 5G, LTE, satellite, and others.
Signal detection using Preamble Detector Reference Application can be split into five simple steps. Firstly, you can arm the Preamble Detector running on FPGA by configuring the known preamble sequence. The Preamble Detector will look for the sequence in the incoming waveform.
Next, you can set the frequency band and channels for the Preamble Detector to scan.
Next, you can scan the channels. And with each successful detection, the waveform will automatically be captured and pulled into MATLAB workspace from the hardware. Then you can process the signal in MATLAB.
Finally, you can retrieve the key information from the captured signal. If you have configured the Preamble Detector to capture the waveform corresponding to the beacon packets from the Wi-Fi access point, you can decode and display information, such as SSID, MAC address, SNR, channel width, frequency band, and wireless LAN standard, as shown.
Let's execute the MATLAB script to capture the wireless LAN signal and decode the beacon packets in my office environment. Initially, we provide the name of the radio connected to MATLAB. The name of the radio is specified while setting up the radio using the radio setup wizard. This radio setup is simplified, and you can refer to the product page or documentation and look for Simple Radio Setup for details.
Next, we create a Preamble Detector object with the specified radio name. Then we set up the receiver antenna and other Preamble Detector properties, such as sample rate and threshold method. Threshold method can be fixed or adaptive.
Next, we set the preamble as the first long training sequence from the legacy long training field of the wireless LAN frame. To know more about this, you can refer to the MATLAB documentation on wireless LAN on the generation of legacy long training field.
Then you set a negative trigger offset from the trigger point to capture the whole wireless LAN packet, and not just from the point of detection onwards.
Next, we tune the threshold of the Preamble Detector for the local environment. One can leverage the plot threshold function of the Preamble Detector to visualize the FIR filter output and the threshold value to tune the preamble detector parameters. As one can observe from the figure, there are no significant peaks.
Firstly, we adjust the radio gain. And you can see the peaks are evident.
Next, we adjust the threshold gain and the offset to reduce the number of trigger points shown in the figure.
Now, we have just two trigger points that correspond to the two long training sequences present in wireless LAN waveform. By zooming into the figure along X-axis, one can see that a FIR filter output is sufficiently above the threshold, and trigger points are well defined.
Next, we scan the desired wireless LAN channel to detect the access point beacons in a loop.
Finally, the key information, such as SSID, MAC address, SNR, channel width, frequency band, and wireless LAN standard can be populated.
You can refer to the product page to know more about Preamble Detector and other features offered by Wireless Testbench. You can also see documentation, the Getting Started Guide, and tutorials.