Introduction: FM Radio Receiver on Intel Edison
This is a DIY article on how to build a FM Radio Receiver (Supports AM too) using a Software Defined Radio and an Intel Edison.
FM broadcasting has been a medium of entertainment, education, news and emergency communication all over the world for a long time now.
Throughout the world, the FM broadcast band falls within the VHF part of the radio spectrum. Usually 87.5 to 108.0 MHz is used.
Using a RTL SDR and a processing device like an Edison or a normal PC (the latter would not be a portable option though) we can configure the SDR to function as a FM Receiver.
To know more in simple terms as to how SDR's work, check out the introduction on this Flight tracker article built using the same SDR.
https://www.instructables.com/id/ADS-B-Real-Time-Fl...
Step 1: Components Being Used in This Project
- Intel Edison running Yocto 3.0
( https://software.intel.com/en-us/iot/hardware/edi... ) - NooElec NESDR Mini 2 SDR & DVB-T USB Stick (RTL2832 + R820T2) with Antenna
- Portable 12V Lead Acid Battery
- Arduino Breakout Board for Intel Edison
- A USB hub to extend the USB support of Edison to multiple devices
- Enter external USB Sound card (http://www.amazon.in/Enter-External-USB-Sound-card...
- A speaker or a pair of earphones
Step 2: Connecting the SDR to Intel Edison
Since it uses an USB interface it can be directly interfaced with Edison that offers out of the box USB capabilities. Once we connect it to the Edison we will have to configure it to run as a device that can act as an FM receiver
- Connect the SDR and the external sound card to the USB hub which is connected to the Intel Edison through the USB port
- Ensure that the microswitch is towards the USB port as this is the mode that allows to power the USB device connected to the interface
- Connect the USB cable between the PC and Edison to the outermost micro USB port. We will use this to establish the serial connection needed for programming.
- Also, the Edison would need to be powered with a 12V adapter to meet the power requirements of the SDR.
- Setup a terminal session using Putty with the appropriate Serial Line and 115200 baud rate
- Connect to Wi-Fi using
$ configure_edison --wifi
Step 3: Configuring the SDR to Act As an FM Receiver
In order to configure the SDR to act as an FM Receiver
Create a script file in your Project directory using
vi fm_configuration.sh
Code the following into the script file
#!/bin/bash abort() { echo >&2 echo "Error Encountered" >&2 exit 1 } trap 'abort' 0 set -e echo "-----------------------------------------------------------------" echo "Configuration started ......" echo "Run this once and delete it later" echo "Watch the progress bar......" echo "src all <a href="http://iotdk.intel.com/repos/1.1/iotdk/all" "=""> http://iotdk.intel.com/repos/1.1/iotdk/all" </a> > /etc/opkg/base-feeds.conf echo "src x86 <a href="http://iotdk.intel.com/repos/1.1/iotdk/x86" "=""> http://iotdk.intel.com/repos/1.1/iotdk/all" </a> >> /etc/opkg/base-feeds.conf echo "src i586 <a href="http://iotdk.intel.com/repos/1.1/iotdk/i586" "=""> http://iotdk.intel.com/repos/1.1/iotdk/all" </a> >> /etc/opkg/base-feeds.conf echo "Progress |#### |" sleep 1 opkg update opkg install git opkg install --force-downgrade libusb-1.0-dev echo "Progress |######## |" sleep 2 #Source compilation mkdir -p /rtlsdr cd /rtlsdr git clone <a href="https://github.com/steve-m/librtlsdr"> http://iotdk.intel.com/repos/1.1/iotdk/all" </a> #Steve's repository for code to turn the SDR into an FM receiver cd librtlsdr echo "Progress |############## |" sleep 2 autoreconf -i echo "Progress |################### |" sleep 2 ./configure make echo "Progress |####################################### |" sleep 2 make install echo "Progress |############################################## |" sleep 2 make install-udev-rules echo "/usr/local/lib" > /etc/ld.so.conf ldconfig echo "pcm.!default sysdefault:Device" > ~/.asoundrc #Set Enter USB to AUX device as default audio out. # In some cases this might be required to be changed to Headset echo "Progress |######################################################|" sleep 2 ####################################################################### trap : 0 echo >&2 ' Configuration Done ' echo "Complete."
Now, run this script using
sh fm_configuration.sh
This script needs to be run only once. To obtain the needed repositories. You may delete the script after running it once. It need not be executed every time.
You may want to go through the script and change the Device name based on the sound card you are using in the line
pcm.!default sysdefault:Device" > ~/.asoundrcTo get your device name use the following command to find your audio device
$aplay -Ll
Step 4: Starting the FM Receiver
Now that the SDR has been configured to work as a FM Receiver (SDR can be used in several other configurations to tap into different spectra).
Create another script which needs to be run every time you want to start the receiver
vi fm_run.sh
Code the following into the script file
#!/bin/bash if [ $# -eq 0 ] then echo "" echo "Specify the frequency as an argument in MHz." exit 1 fi rtl_fm -f $1e6 -M wbfm -s 200000 -r 48000 - | aplay -r 48k -f S16_LE
Close the vi editor using Esc + :wq to save and quit from the editor
Step 5: Let's Tune Into Some FM Channel!
For the last step, in order to tune into a specific FM channel specify the frequency as an argument in Mhz while running the script. The syntax being
#sh fm_run.sh <freq in Mhz> sh fm_run.sh 91.1
You should now be able to listen to broadcasts from that FM channel. To terminate use Ctrl+C or Ctrl+Z
There you have it. An FM Receiver using RTL SDR and an Intel Edison.
The links to the github repos that have the code used in this article