The motivation for this project was to create an AM/FM tuner based on Software Define Radio (SDR) technology.
BENEFITS:
1) Demodulating an FM signal well in analog circuitry is difficult, and the finely-tuned circuitry can drift over time. In the digital domain, the demodulation equation can be implemented in a mathematically precise manner (lower distortion) and will not drift over time.
2) It is desirable to have the width of the Intermediate Frequency (IF) filter precisely capture the FM signal, while rejecting the out-of-band noise. This is particularly important with the wide-spread adoption of Digital Audio Broadcasting (DAB) that add unwanted signals just outside of the main FM audio signal. This tuner implements an IF filter with adjustable bandwidth.
GOALS:
1) High-quality audio
2) Stand-alone FM/AM tuner
3) Graphical display of the signals as they move through the tuner system, and then the demodulator.
- RF spectrum viewer allows for optimizing the antenna. You can see the station signal strength vs. RF noise
- Waterfall graph of the post-IF filter signal used to adjust the IF filter bandwidth for optimal demodulation
- Graph of post-demodulated baseband FM signal shows how the broadcaster created the FM signal (L+R, Pilot signal, L-R, and the Radio Data System (RDS) spectrum)
- L/R audio scope shows L vs R audio, to see the relative audio phase
HARDWARE:
The main components are:
- RSP1B SDR from SDRplay
- Raspberry Pi 5
- Custom PC board to accept potentiometer and switch inputs, provide an ADC for the potentiometers, provide and I2C EEPROM for the memory buttons, and physically host/interface the high-quality stereo ADC.
- Pi-DAC+ from IQaudIO
- 5-inch HDMI AMOLED touchscreen from Waveshare (#19299)
GNU RADIO
The RSP1B SDR connects to a Raspberry Pi 5. The gnuradio-companion software takes the RF data from the SDR, and processes it in various ways: filtering, down-sampling, AM and FM demodulation.
It was fairly straightforward to create a gnuradio-companion "graphical flowgraph" to create the AMFM radio, that is, to create the signal processing blocks that take the SDR's data and processes that data to implement the FM and AM radio. This file is called "AMFM_radio_v11.grc" on github.
The flowgraph also creates the graphic outputs such as the spectrum waveforms, the spectrum waterfall, and the L/R audio scope.
SDR CONTROLLED BY THE FRONT PANEL KNOBS / SWITCHES:
Most SDR software (used to control the SDR for tuning) is based on a GUI. But I wanted a radio that used actual knobs, on a front panel. How to do that?
First, the knobs/potentiometers create an analog voltage. Then an I2C ADC on a custom interface board converts those values to a number that the Raspberry Pi can read.
Then, a python program interprets the setting of the front-panel control knobs, decides what variable to change in the gnuradio flowgraph that implements the radio functions.
The python program then sends that message to the gnuradio flowgraph to modify the variable, thus modifying the radio's behavior.
LINKING PYTHON TO THE GNURADIO FLOWGRAPH:
The gnuradio provides a functional block called "XMLRPC server." This block enables all variables in the radio flowgraph to be controlled via XMLRPC through the IP address and port set in the block parameters.
The python program creates the link to the flowgraph with the line:
xmlrpc_control_client = ServerProxy('http://'+'localhost'+':8080')
Variables in the radio's flowgraph can then be set with a simple call:
xmlrpc_control_client.set_volume(newVolume)
This is how the python program reads the front-panel controls, and then adjusts the radio functions (volume, IF bandwidth, etc...) appropriately.
FILES:
All software files including the gnuradio-companion flowgraph, and the python program that controls it, can be found at:
https://github.com/delhatch/AMFM_SDR
Also, the PCB fabrication files for the interface board can be found there.
Please use Raspbery pi 2040 pico not esp ;)