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.
Requirements
- 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.csv
Let’s walk through this command. The soapy_power
command is the program being called. the -g 0
option sets the gain to 0 dB. The -r 125M
option sets the receiver sample rate to 125 MSPS. The -f 2.4G
option tunes the radio to 2.4 GHz frequency. We set the FFT size to be 8192 samples using the -b 8192
and average 100 windows using the -n 100
option. Finally, the output file is defined by the -O data.csv
option. 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
from matplotlib import pyplot as plt
with open('data.csv', 'r') as csvfile:
data_str = csvfile.read() # Read the data
data = data_str.split(',') # Use comma as the delimiter
timestamp = data[0] + data[1] # Timestamp as YYYY-MM-DD hhh:mmm:ss
f0 = float(data[2]) # Start Frequency
f1 = float(data[3]) # Stop Frequency
df = float(data[4]) # Frequency Spacing
sig = np.array(data[6:], dtype=float) # Signal data
freq = np.arange(f0, f1, df) / 1e9 # Frequency Array
# Plot the data
plt.plot(freq, sig)
plt.xlim([freq[0], freq[-1]])
plt.ylabel('PSD (dB)')
plt.xlabel('Freq (GHz)')
plt.show()
Resulting Power Spectral Density Plot
Visit our documentation page here for the full tutorial including installation instructions.