Build an FM radio using an RTL-SDR dongle
Raspberry Pi FM Radio
For the Pi FM radio project in this article, I tried a few different arrangements, but I found that an LCD HAT (hardware attached on top) with buttons (Figure 4) worked best. However, other options such as a PiFace digital HAT (Figure 5) or a button HAT could also be used.
The LCD Python libraries will vary according to the hardware used; however, most LCD HATs are based on the Adafruit libraries [4].
The Python code for the LCD HAT (Listing 2) is based on the simple test code with some additional logic for an LCD button interface and some predefined radio frequencies. The main code loops through, looking at each of the buttons with the lcd.is_pressed()
function. The LCD.UP
and LCD.DOWN
buttons are used for volume control, and the LCD.LEFT
and LCD.RIGHT
buttons cycle through the predefined radio stations. The lcd.clear()
and lcd.message()
functions show the new radio station information on the LCD HAT. In my testing, I used a 0.25-second delay on all the button presses, although you might need to tune this value for your hardware and usage.
Listing 2
Pi FM Radio with an LCD HAT
Summary
Creating a homemade FM radio is just one of the many interesting applications for SDR utilities and the low-cost RTL-SDR dongle [5]. In the future, I would like to add a Python Tkinter or web interface to my FM radio application.
Infos
- About RTL-SDR: http://www.rtl-sdr.com/about-rtl-sdr/
- GNU Radio: https://www.gnuradio.org/
- Code for this article: ftp://ftp.linux-magazine.com/pub/listings/linux-magazine.com/206/
- Adafruit libraries: https://github.com/adafruit/Adafruit_Python_CharLCD
- See more of Pete's Projects: https://funprojects.blog
« Previous 1 2
Buy this article as PDF
(incl. VAT)