Skip to main content

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
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 "". And run it.

sudo python

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!


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 a nixie clock

As a present I decided to build a nixie tube clock. It was essential to ditch my close-enough attitude and make it look as good as possible. For me the simplest way to complete this idea was to use a microcontroller. I am not cool enough to build a clock out of discrete logic, maybe in the future.

I had couple of nixie tubes lying around, I ordered some more to have a total of six. So the clock consist of an Arduino Nano, RTC DS3231, nixie tubes - IN-14 and a power supply. From the start I knew the biggest challenge is building the enclosure. I learned that the easiest way to drive these nixie tubes is with a driver called - К155ИД1.

It’s a binary to decimal decoder and it works quite elegantly. Depending on the binary input it enables the right output.

It does all the heavy lifting. And then I used three shift registers to drive all the drivers.

In addition I bought a nixie tube power supply that supplies the 170v I need. I could have used 220v wall power but I do not trust myself enou…

My take on the PA0RDT Mini Whip antenna.

I like shortwave radio because you can receive signals from all over the world, also there are all kinds of mysterious signals to explore.

In the grand scheme - the lower the frequency, the bigger antenna you would need. Well, there are all kinds of antenna designs but I like to think like that way. For example, I have a 27 MHz dipole on my roof that is around 5.3 meters long. If I wanted to listen to lower frequencies ~ around 3 MHz, for optimal performance I would need around 50 meter antenna, so using dipole for lower frequencies is not very space efficient, especially if you do not have any room.

So I decided to build the Mini Whip antenna. It is popular, simple to build and on paper receives frequencies from 10 kHz to 30 MHz, and also it is super tiny.

There are some variations between different designs, but the basic idea is the same.

The schematic I followed.

During my tests it performed well, I was able to receive DCF77 signal for the first time. All other bands seemed to work as w…

RFID experiments

Radio-frequency identification (RFID) is a way to use electromagnetic fields to send and receive data wirelessly. The system consists of two parts: reader and a tag.  Tags can be passive or active. I think the most popular are passive tags. Meaning, there are no batteries needed, the power comes from the reader. The reader constantly sends out an interrogation signal and when a tag absorbs the energy and powers up, it radiates back information from the embedded chip.

Then it divides further - different frequencies, generations, encryptions etc.

Also one popular part is NFC (Near Field Communication) which has better security and other improvements. Latest phones usually come with NFC read/write capabilities built in.  So you can pay with your phone or touch phones together to share information. A lot of possibilities.

RFID/NFC is quite popular in our commercial world.

Anti-theft – stores use it to stop people stealing stuff.
Tracking people - putting tags inside shoes to track people, some…