Raspberry PI as a FM transmitter

less than 1 minute read


A few weeks ago I found this tutorial on make magazine Turning the Raspberry Pi Into an FM Transmitter by Code Club pihack.

It uses the hardware on the raspberry pi that is actually meant to generate spread-spectrum clock signals on the GPIO pins to output FM Radio energy. This means that all you need to do to turn the Raspberry-Pi into a (ridiculously powerful) FM Transmitter is to plug in a wire as the antenna (as little as 20cm will do) into GPIO pin 4 and run the code posted below.


  1. SFTP the pifm.c and sound.wav files on to your Raspberry PI.
    • You will need to enable SHH to SFTP a file on your Raspberry PI
  2. From the SHH terminal window, compile the pifm.c for your distro of linux. By default gcc will produce a a.out file as the compiled program.
    gcc -lm -std=c99 pifm.c
  3. Run the output. You must run the application as an administrator (sudo) because this application uses direct memory management to access the GPIO pins.
    sudo ./a.out sound.wav

Leave a comment