Raspberry Pi

Make your own FM Station – Turn Raspberry Pi into FM transmitter

FM radio is a good source of entertainment for most users as it allows them to listen to music, football match commentary and news. However, you won’t get an opportunity to play your favorite music on the FM station due to unavailability of any option. But surprisingly, if you have Raspberry Pi, you can turn the device into a FM transmitter that allows you the freedom to play your favorite music onto your dedicated FM channel or you can use it to communicate important messages.

In this tutorial, we will show you how you can turn your Raspberry Pi device into a powerful FM transmitter.

Turn Raspberry Pi into FM Transmitter

If you want to turn your Raspberry Pi device into FM transmitter, you will require to perform the following steps:

Step 1: Attach a cable to Raspberry Pi GPIO Pin

First, you will need to attach a connecting cable to Pin 4 of the Raspberry Pi GPIO Pinouts as shown in the image below:

Step 2: Create Directories

Then, open the Raspberry Pi terminal and create a directory to store some files. To make this happen, use the following commands to create a directory with the name “PI_FM” and navigate to the created directory:

$ mkdir PI_FM

$ cd PI_FM

Step 3: Download Built-in program

Next, you will require to clone or download the program from the GitHub repository into the “PI_FM” directory using the command:

$ sudo git clone https://github.com/markondej/fm_transmitter

Step 4: Install a Compiler

The above program downloaded in Step 2 is written in C language so you will need a compiler to execute this program. So, here we are using a g++ compiler that will execute the program using the tool called “make”. To make the whole process work, use the following command to install the compiler on Raspberry Pi.

$ sudo apt-get install gcc g++ make

The above command will install the compiler on your device.

Step 5: Compile the Program

Next, navigate to “fm_transmitter” directory using the following command:

$ cd fm_transmitter

Then use the following command to compile the C code in the current directory.

$ sudo make

This completes the setup of turning your Raspberry Pi into an FM transmitter.

Play Audio File on FM channel

Now, if you want to play an audio file on an FM channel, you will need to select the FM frequency range as well as you will need an audio file to play it on the assigned channel.

The following syntax will be used to transfer the audio to FM channel:

$ sudo ./fm_transmitter -f <frequency_range> -r <audio_file_name>

The normal FM range lies from 88MHz to 108MHz. However, you will need to ensure that no other channel is working on your current frequency otherwise you won’t be able to play the audio file. Also, the audio file must be present in the fm_transmitter directory.

In our case, we have set the frequency to 90MHz and the audio is running perfectly fine. To listen to the audio file, go to FM radio from your mobile device and set the channel to “90”, you will be able to listen to the music originating from the Raspberry Pi to the FM channel.


Through this guide you have learned how to turn Raspberry Pi into a FM transmitter, use the above given steps on your device and enjoy playing music files on a live FM channel. You can also use a microphone with your device to start streaming yourself live on the FM stations. In case, if you experience a noise, you may change the frequency range for clear audio.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.