RF Spectrum Sweep
Identifying RF Channels to monitor can be a time consuming effort. Using a standard non PC radio receiver can take a long time to identify a transmitting channel. Using RTL_Power and SDR FFT Spectrum Logging provided here (http://kmkeen.com/rtl-power/), makes the effort less challenging. RTL_Power will sweep through a range of radio frequencies at given steps and log the RF power levels detected by the USB SDR receiver. It does this over and over at set intervals to create a log of values over time. When a transmitting station does finally go hot, the process will detect that and log the values it registers. In addition to text logging, there is a python script that will take the log file and generate an easy to view RF Power Waterfall Spectrogram. This can aid in identifying the precise RF channels to monitor. Here is the syntax for each function.
command line example of sweep - "rtl_power -f 160M:170M:2k -i 10 logfile.csv" "rtl_power" is the command "-f 160M:17M0:2k" is the frequency range to start (160 Mhz) and stop at (170 Mhz), along with the stepping frequency (2 Khz) "-i 10" is the interval at which to execute and log a sweep (10 seconds) "logfile.csv" is the log file to write the results to for later analysis Python Script to generate spectrogram of sweep data - "python heatmap.py logfile.csv spectrogram.png"
In this example, I’ll be sweeping a range of RF that is between 155 and 175 Mhz. I’ll be stepping through this range at 1.5 Khz every 3 seconds. I’m fairly confident I’ll get a station in this.
rtl_power -f 155M:175M:1.5k -i 3 "/home/local/Desktop/RF Spectrum Sweep/RTL-Power_155-175.csv"
I stop the process after it runs for an hour and then take the results and generate my spectrogram.
python "/home/local/Desktop/RF Spectrum Sweep/heatmap.py" "/home/local/Desktop/RF Spectrum Sweep/RTL-Power_155-175.csv" "/home/local/Desktop/RF Spectrum Sweep/RTL-Power_155-175.png"
It looks like we have something at 161.1515 Mhz. So now I’ll run my RTL_FM command to record the RF signals from this channel and squelch out silence.
rtl_fm -M fm -f 161.1515M -l 200 -s 22k "/home/local/Desktop/RF Spectrum Sweep/RTL-Power_Scanner_161.1515.raw"
I ran this for several hours then exited it using [Ctrl] + [C]. Next I converted the raw data into a wav file using SoX and removed the silent gaps when squelch was active, which was most of the time.
sox -t raw -r 22k -e s -b 16 -c 1 "/home/local/Desktop/RF Spectrum Sweep/RTL-Power_Scanner_161.1515.raw" "/home/local/Desktop/RF Spectrum Sweep/RTL-Power_Scanner_161.1515.wav" silence 1 0.2 0.5% -1 0.2 0.5%
The result was a four minute audio clip that I can listen to to sum up what was transmitted. Turns out I was picking up radio talk from the Innerbay rail system.
Since I have a decent spectrogram of other transmitting stations, I can use RTL_FM to sweep through a list of channels and play them live when one breaks squelch.
rtl_fm -M fm -f 167703400 -f 167453900 -f 167702900 -l 200 -s 22k - | play -r 22k -t raw -e s -b 16 -c 1 -V1 -
I could also record when any of them go hot. After running the record for a period of time, I can then convert that to a nice condensed audio clip. This is useful if I’m traveling but don’t want to miss what was transmitted locally.
rtl_fm -M fm -f 167703400 -f 167453900 -f 167702900 -l 200 -s 22k "/home/local/Desktop/RF Spectrum Sweep/Ballard_Scanner.raw" sox -t raw -r 22k -e s -b 16 -c 1 "/home/local/Desktop/RF Spectrum Sweep/Ballard_Scanner.raw" "/home/local/Desktop/RF Spectrum Sweep/Ballard_Scanner.wav" silence 1 0.2 0.5% -1 0.2 0.5%
I hope you have enjoyed how to use SDR to sweep a range of RF transmissions to identify active channels. I’m grateful to Kyle Keen for putting the python script online for all to use. This makes the process of identifying channels much easier. Having a simple and inexpensive way to listen to open transmissions is a great way to get a better understanding of how radios work.