Categories
Linux

Building a FM Radio Transmitter with Raspberry Pi

DISCLAIMER: Building FM transmitters and transmitting on FM frequency requires government permissions in many countries/regions. I am posting this for educational purposes and I strongly recommend not to use this for any other purposes. I shall not be liable for any use of the contents of this post.


I have owned a Raspberry Pi for a while now but haven’t really done anything significant with it other than installing a LAMP server and running some random Python codes on it. Today, while reading Rasp Pi related articles on the internet, I came across a reddit thread where a guy posted about his home made raspberry pi based FM transmitter which he used to relay random messages from inside his car to the surprise of other people on the street. I’m sure he had so much fun doing that though that was illegal! 😀

It was such an inspiration for me, specially because I needed no extra hardware! The Pi hardware itself is capable of transmitting in really short range (~10cm). I started googling on how I can do the same and soon I found enough resources. In fact I found the source code and a precompiled binary to do this. I couldn’t wait to test! I plugged in my Pi and transferred the source code to the device and turned the radio on with the provided sample clip. Then browsed for the default station on my android phone. Voila, it was working!

It is really really simple!

# Grab the application package – Download.

# Turn on and SSH into your Raspberry Pi. Unzip the package and transfer the directory to the Pi.

# cd into the directory and run:

Please note that you need root access for the transmitter to work. So make sure you used “sudo”. You can replace the sound.wav with any file that is 16 bit 44.1kHz Mono format.

By default the transmitter will transmit on FM 103.3 MHz frequency. You can pass the frequency as an additional parameter to the application. Eg.

The transmitter range can be extended up to ~100m by connecting wires to the GPIO pins. I’m going to try that tomorrow and see how it goes.

The application package also contains a python module that provides an API to programmatically run sounds.

So what’s next? I’m going to look for a decent sound conversion tool to convert my mp3s into mono wav. And I might write a small program to rotate the tracks on it.