Tired of listening to the chatter of DJs and want to broadcast your own radio station? Do you need a quick and easy solution to stream MP3 or internet radio to your archaic car stereo?

Once again, this Raspberry Pi comes to your rescue with its previously unknown FM broadcasting capability.

Before proceeding, please understand that this is a proof of concept design. If you are not licensed, you must not broadcast on the FM band and you do so at your own risk.

What You’ll Need for Your Pi FM Project

Start by downloading the PiFM image, which you will need to flash onto your SD card. You can use the PirateRadio.py script if you like by installing it into your existing Raspbian installation. but this tutorial focuses on the PiFM image.


You will also need a jumper wire, a soldering iron and solder and a length of 2mm wire cut to 20-30cm. I used an old hanger left over from the HDTV digital antenna project. but you can buy 2 mm wire in rolls in electronic stores; some may even cut it for you. While you’re at it, buy some heat shrink tubing that’s the right size to put on the jumper.

You may also need some Sugru or similar putty. to secure the antenna, or possibly the glue gun. When everything is assembled, it’s time to assemble the project.

Finally, you will need a Linux computer other than your Raspberry Pi.

But first, an important question…

How does a small computer become a radio transmitter?

In order not to interfere with other devices, the Raspberry Pi uses a technique known as spread spectrum. This reduces the impact of the processor on nearby equipment (by spreading EMI over a wider bandwidth to reduce interference), but the side effect of this is a GPIO array that can be used to broadcast on the FM band!

You can use this broadcast power by connecting an antenna to pin 4.

Now, as you know, we are not lawyers. We . So before proceeding, be aware that in the vast majority of countries, broadcasting on the FM band without a license is illegal and can lead to problems with fines and jail time.

Building your own antenna

aya-did-pifm solder

The most difficult aspect of this project is assembling the antenna, but if you have the right equipment, you should be able to do it in about 10 minutes. With the jumper notched about 10mm of the stripped wire above the connector, continue soldering it with the 2mm wire.


When the solder has solidified, put 50mm heat shrink tubing over the joint and the top of the joint jumper and heat it for a few minutes with a hair dryer until the joint is insulated and the tube is a snug fit.

When you’re done, you can connect this to pin 4 on the GPIO.

Looking for GPIO 4

If you haven’t used GPIO pins before, you probably won’t know where pin 4 is. On both the 26-pin and 40-pin version of the Raspberry Pi GPO, GPIO 4 is the fourth pin on the innermost row of the array, as shown here:


For best results, connect your antenna to this pin (connecting to other pins will also broadcast on FM, but the signal will not be as strong).

GPIO pinout, from RaspberryPi.org
GPIO pinout, from RaspberryPi.org

Playlist preparation

The next step is to prepare the MP3 files. Copy them from your desktop computer to your SD card by placing them in the partition / Pirate Radio cards. You probably won’t be able to do this on Windows, so take this opportunity to install Linux on your computer as a dual boot. You can also transfer files to a live Linux environment from USB if your computer has enough free USB or SD card slots.

Then go to file pirateradio.config and open it in a text editor. It offers a set of options such as frequency, random play, repeat_all and stereo_playback. These last three can be toggled by switching the default true to False .


As for the frequency setting, you need to make sure you set it to a value that can be detected using a standard FM radio. For example, in the UK the frequency range is 87.5 to 108 FM, so you won’t set 85 or 110 as the radio won’t be able to tune in.

It’s a good idea to scan the FM band on your FM radio to find a free spot. Hardship on a busy frequency is highly unreasonable (see above).

Save the pirateradio.config file when you’re done and close the text editor.

Download for broadcast!

Save the MP3 files to the desired folder and safely remove the SD card. extract from your computer, plug it into your Raspberry Pi and turn it on. At the same time, take your FM radio and tune it to the frequency specified in the configuration file.

In a few seconds you will hear the first track, and your radio station will be on the air!

You can get an idea of ​​range by taking your FM radio outside with you and seeing how far away you are from your Raspberry Pi when the signal drops out. The limit is around 50-100 feet, although turning off the stereo_playback option to broadcast in mono rather than stereo will increase the range.


The range can also be increased by placing the Raspberry Pi in an elevated position, or by using copper wire rather than aluminum (as I did). You can get results by making the whole kit easy to carry around, perhaps by putting it in a jar or something similar. I powered six AA batteries, but any compatible external power source will work.

But really, what can you use it for?

Broadcast licensing rules will likely preclude the widest use of this project, but that shouldn’t stop you from trying it out. For starters, you can use it to show any soldering interest you have (check out our soldering tips to get started) and get an idea of ​​how adding a piece of wire can turn a computer into a radio station.

Meanwhile, if you are a teacher or involved in a school radio project, this is a great project for students to help them better understand computer technology and radio.

Finally, in this project, there are opportunities for citizens of repressive regimes to use this project to communicate with resistance movements.

Need help with your PiFM project? Outdoor life not quite right? Tell us about it in the comments.

Похожие записи