For those who don’t know, the Raspberry Pi can transmit an FM signal directly. It’s a surprisingly powerful signal, too, and it’s very easy to do.
Following the guide on the Imperial College Robotics Society (ICRS) wiki, it took me less than 5 minutes to get the entire thing operational.
Step 1 – Download/Extract the Sample Code(GPL)
I am hosting a copy of their code located here. (this archive contains the source and binary).
tar -zxvf Pifm.tar.gz
Step 2 – Attach the Antennae
Find an 8 inch piece of plain wire, and attach it to the GPIO4 port on your Pi. Technically the is step is optional, but my transmission range went from 200ft to 8 inches without it. Use the picture below as a reference.
Step 3 – Run the Code
Usage: sudo ./pifm wavfile.wav [freq] [sample rate]
The second command line argument is the frequency to transmit on, as a number in Mhz. For example, this will transmit on 100.1 FM
sudo ./pifm sound.wav 100.1
You can use whatever frequency you’d like (88->108).
That’s it! Here is a video of mine working.
How It Works
According to the ICRS, it uses the hardware on the raspberry pi that is actually meant to generate spread-spectrum clock signals on the GPIO pins to output FM Radio energy.
For more information, and a link to the actual C code, visit the ICRS wiki. I’m also happy to answer any questions you have regarding my setup. Thanks!