Member-only story

Python Radio 13: Software Defined Radio

Simon Quellen Field
Radio Hackers
Published in
6 min readAug 31, 2024

--

Python listens to the radio.

Photo by the author

If you do an Internet search for “SDR receiver price” you will find a large number of items for sale, from about $15 to $300. For our purposes (since we want to receive low frequencies as well as those above 30 MHz) we want receivers that can reach at least as low as 100 kilohertz. I have seen one for $18 that gets as low as 10 kilohertz.

What makes these devices special is the software on your computer that controls them and decodes the signals.

Another search, “SDR radio software” gets you a large number of software packages, most of them free, with names like SDR#, HDSDR, SDR-RADIO.COM, SDR++, Linrad, GQRX, CubicSDR, and many more.

There is also a Python library called pyrtlsdr, installed by the command pip install — upgrade pyrtlsdr[lib].

Using this library, the following program will pop up a spectrum display centered around the 7032000-hertz signal from our RP2040 CW transmitter:

from pylab import *
from rtlsdr import RtlSdr
import numpy as np
import scipy.signal as signal
import peakdetect

real_center_freq = 7.032e6
offset = 200e3
margin = 10e3

sdr = RtlSdr()
sdr.set_direct_sampling(1)
sdr.sample_rate = 225001
sdr.center_freq = real_center_freq - offset
sdr.gain = ‘auto’
num_samples = sdr.sample_rate

samples =…

--

--

Radio Hackers
Radio Hackers

Published in Radio Hackers

Exploring software-defined radio and the radio spectrum. We provide tutorials & theory articles on a wide range of Communication modes, RF protocols & real-world use cases for IOT & CyberSec. Are you a writer? Submit a tutorial or share your experiences with the community.

Simon Quellen Field
Simon Quellen Field

Written by Simon Quellen Field

Simon Quellen Field is a science writer and novelist currently experimenting with shorter works. Find his books at scitoys.com/books or his website scitoys.com.

Responses (1)