Power Spectrum Measurement
If you are looking for a very simple way to acquire the power spectral density of a received signal with the AIR-T, you may like the Soapy Power Project. The resulting spectrum output may be used for monitoring interference, acquiring signals for deep learning, or for examining a test signal. Soapy Power is a part of the larger SoapySDR ecosystem that has built-in support on the AIR-T. In this post, we will walk you through the installation of Soapy Power on the AIR-T and provide a brief demo to help get you started.
- Artificial Intelligence Radio Transceiver (AIR-T)
- AirStack 2.0.0+
Take a Spectrum Using the AIR-T
Using Soapy Power, it is very easy to acquire a spectrum snapshot and record to a csv file. Sample rate, center frequency, and processing parameters can all be controlled via command-line arguments as you will see in the below example.
$ soapy_power -g 0 -r 125M -f 2.4G -b 8192 -O data.csvLet's walk through this command. The
soapy_powercommand is the program being called. the
-g 0option sets the gain to 0 dB. The
-r 125Moption sets the receiver sample rate to 125 MSPS. The
-f 2.4Goption tunes the radio to 2.4 GHz frequency. We set the FFT size to be 8192 samples using the
-b 8192and average 100 windows using the
-n 100option. Finally, the output file is defined by the
-O data.csvoption. Following the execution of the above command, a file is recorded with the spectrum data.
To visualize the data, we will use Python's
matplotlib package with the following script:
import numpy as np</code> <code>from matplotlib import pyplot as plt</code> <code>with open('data.csv', 'r') as csvfile:</code> <code> data_str = csvfile.read() # Read the data</code> <code>data = data_str.split(',') # Use comma as the delimiter</code> <code>timestamp = data + data # Timestamp as YYYY-MM-DD hhh:mmm:ss</code> <code>f0 = float(data) # Start Frequency</code> <code>f1 = float(data) # Stop Frequency</code> <code>df = float(data) # Frequency Spacing</code> <code>sig = np.array(data[6:], dtype=float) # Signal data</code> <code>freq = np.arange(f0, f1, df) / 1e9 # Frequency Array</code> <code># Plot the data</code> <code>plt.plot(freq, sig)</code> <code>plt.xlim([freq, freq[-1]])</code> <code>plt.ylabel('PSD (dB)')</code> <code>plt.xlabel('Freq (GHz)')</code> <code>plt.show()
Resulting Power Spectral Density Plot