The Instruct-able


The Micro Pirate Radio Station is a open source project implemented using the Raspberry Pi (RPI).  The original hack is attributed to Oliver Mattos and Oscar Weigl, who over a few hours at the Code Club pihack, were able to transform the RPI into a surprisingly strong FM transmitter.  The hack uses the hardware on the RPI that is actually meant to generate spread-spectrum clock signals on the GPIO pins to output FM Radio energy.  Pretty incredible to say the least.

What makes this hack even more interesting is that the only extra piece of hardware needed is a piece of wire to plug into the GPIO pin 4.  This, in addition to some simple coding, is all you need to have your own Micro Pirate Radio Station. The process itself isn’t overly complicated at all, and even the most amateur hackers can learn to program their own transmitter. Note, however, that the RPI’s broadcast frequency can range between 1Mhz and 250Mhz, which may interfere with government bands.  As such, I advise that you limit your transmissions to the standard FM band of 87.5MHz–107.9MHz, and always choose a frequency that’s not already in use, to avoid interference with licensed broadcasters.

In order to improve the original hack (which is a few years old, and has been modified several times), I decided to broaden the scope of the audio sources to be broadcast.  That is, the original hack is meant to broadcast a single .wav file (Star Wars theme) saved on the memory card inserted in the RPI, which is sufficient as a proof of concept or for testing purposes, but it’s too restrictive for a true pirate radio station.

In order to achieve my objective, I followed the guidelines by Tony Tascioglu, but had to modify the code as detailed below.  Furthermore, I used an analog RCA switch to provide the broadcaster with various audio sources.  My original intent was to connect the RPI to a DJ Music Mixer, but unfortunately for the time being, mine is back at school.  Nevertheless, by using the RCA switch, I was able to select audio sources in real-time. It isn’t the same as creating a live mix on a DJ controller, but it’s close enough nevertheless.


The components and materials needed to create your own Micro Pirate Radio Station can all be purchased at  The complete list with prices and relevant links to Amazon were provided earlier on this blog.  As a summary, the list includes:


  • Raspberry Pi 3 Complete Starter Kit
  • Jumper Wires

If Needed:

  •  USB Keyboard
  •  USB Mouse
  •  HDMI to VGA Cable (to connect to a VGA Monitor)
  •  Flash Memory Card Reader


  •  USB Audio Interface for RCA Input
  •  Multiple RCA Input Switch
  •  RCA-male to 3.5mm-female cable adapter



  1. Get the necessary files on the Raspberry Pi:
    • On your desktop, go to and download the zip file
    • Copy the downloaded zip file ( onto a flash card/thumb drive or email it to you
    • On the RPI, insert the flash card/thumb drive or open the email with the attachment, and extract the zip file to a new folder, FMTransmitter, on the RPI file directory
    • Move all files inside the folder “fm_transmitter-master” outside that folder, but inside “FMTransmitter”, and then, delete the emptied “fm_transmitter-master” folder


  1. “Compile” the newly created files:
    • Open up the LXTerminal on the RPI
    • Type: sudo apt-get install make gcc g++
    • Type: cd FMTransmiter
    • Type: make


  1. Test your FM Transmitter by broadcasting a sample music track:
    • Plug a female jumper cable to GPIO pin 4 (I extended the antenna by adding a second jumper cable to the end of the first one)FC9060185D2C4B949B9D51E57A12B4D4.jpg
    • Type: sudo ./fm_transmitter -f 88.7 -r star_wars.wav (you can use any other unused FM frequency)
    • Tune into frequency 88.7 on your FM receiver


  1. Connect and configure the USB audio interface:
    • Plug the USB audio interface into the RPI
    • Open up the LXTerminal on the RPI
    • Type: sudo alsamixer (This will run the AlsaMixer application in a LXTerminal window)C52B9F1F88F8409491F36232CDC7629F.jpg
    • This shows the on-board audio device’s playback control (note that the chip is called “Broadcom Mixer”). Press “F6” and you should see a small pop-up “window” with all the available sound cards listed.alsa2.jpg
    • The item “0 bcm2835 ALSA” is the on-board audio device, and the item “1 C-Media USB Audio Device” is the USB audio device (yours might have a different name). Use the arrow keys to select the external sound card on item 1, and press Enteralsa3.jpg
    • This shows the playback controls for the USB audio device. Use the right and left arrow keys to select the control you wish to adjust and then use the up and down arrow keys to adjust the level.  Adjust the playback level near its maximum level (i.e. 90)
    • Pres Esc to exit the AlsaMixer application


  1. Connect external audio source and broadcast its output:
    • Using the RCA-male to 3.5mm-female cable adapter, connect an external audio source, such as a smartphone, mp3 player, computer (or if you want to go retro, a Walkman or record player) to the USB audio interface previously connected to the RPI.
    • Open up the LXTerminal on the RPI
    • Type: cd FMTransmitter
    • Type: arecord -fS16_LE -r 22050 -Dplughw:1,0 – | sudo ./fm_transmitter -f 88.7 – (this line of code tells the RPI to record audio coming from soundcard “1” as 16-bit data at 22,050 sampling rate, and, then, to playback such recording through frequency 88.7 Mhz)
    • YOUR MICRO PIRATE RADIO STATION IS LIVE…!!! You are now broadcasting your music within a 100-meter radius


  1. Optional Step: Add an audio mixer for a real-time DJ music set (or, alternatively, use an RCA switch to manually change audio sources)
    • Plug RCA audio output from audio mixer into the USB audio interface connected to the RPI, or
    • Plug an RCA switch into the USB audio interface, and, connect up to three different audio sources into the RCA switch (using the RCA-male to 3.5mm-female cable adapter if needed).



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s