Raspberry Pi FM trasmitter

So I was browsing reddit and came across THIS.

It was so cool, I had to try this out. So I took my Raspberry Pi and hooked it up. When it booted up I was able to run the following commands over SSH.

mkdir radio
cd raadio
wget http://omattos.com/pifm.tar.gz
tar –xvf pifm.tar.gz

And that’s it. Now you need to connect a wire to Pi’s 4 GPIO pin. I just connected a random wire. For maximum performance use 20cm wire or dedicated antenna.

To test it out I typed:

sudo ./pifm sound.wav 100

Tuned my radio to 100 MHz and tadaa – Star Wars theme was rolling in.

When the file ends or you cancel it, it stops but the modulation stays on. To get rid of it you need to restart your Pi or run this script I made.

stop For example save it as "stop.py". And run it.

sudo python stop.py

And it should stop.

As you can see the 100 stands for the frequency. For more flags read THIS. Now it even supports stereo.

You can replace the "sound.wav" with other music file. PiFm currently only supports 16 bit 22050Hz mono .wav files. To do this you need to put your file into the pifm directory or type in the full directory where the file is located.

If you want to transmit .mp3 files you need to install a package.

I tried this out and it worked great!

If you want to transmit your voice live you need to use USB webcam or microphone because Raspberry does not have a dedicated mic input.

I have a Logitech webcam with mic and used this command to pipe my mic output to PiFm

Worked great!

Now when that was done I wanted to push Pi into its limits and see how far it would transmit.

With the wire it was simple : it basically covered entire house.

Put what happens if I use a bigger antenna? Let’s find out!


So the HAM shack is in the attic so I climbed there, hooked everything up and port forwarded Pi’s SSH.

I quickly made this ghetto adapter.


Before I went away I snapped a picture because it looked cool:


I grabbed a IC-T8E and started pedaling. I turned the radio on. Took out my phone and SSH'd into the Raspberry that was sitting in the attic. Inserted the commands and boom IT WORKS!

[youtube http://www.youtube.com/watch?v=z7yesNNWZJQ?rel=0]

When I arrived I climbed on my roof and tried again. Still worked with the stock antenna. It was low on signal but I was still able to listen it. The range was whopping 2km. That blew my mind. Probably I was violating like thousands of FCC and TJA rules when I transmitted in the FM frequencies – I have nothing else to say then “Sorry”.

The next day I drove on the top of the trash mountain and started the experiment again. The stock antenna did not pick up anything but when I tried with my Yagi antenna it worked. I did not test it much because it was freezing there. Before I left I snapped a pic:


Anyway without any amplification the Raspberry Pi transmitter is pretty powerful with a good antenna. That ended my experiment.

I’m looking forward to send other modulations than WFM. AM would be super cool. That means I can record what my doorbell button sends out – record that with my SDR and then whenever I need replay that and my door would ring. Think about the possibilities!


  1. How to connect the antenna to the raspberry pi ?

  2. I did it very crudely. I connected it to GPIO 4 and ground to ground.


Post a Comment

Popular posts from this blog

My take on the PA0RDT Mini Whip antenna.

My take on a nixie clock

RFID experiments