Another Raspberry Pi project: how to turn RPi into an FM transmitter?
Imperial College Robotics Society released this Python code that streams a simple (44.1 KHz, mono, 16 bit) audio WAV file into FM.
How to prepare this recipe:
- download the code: you’ll find either a Python module and an executable file
- you’ll need a wire that’s at least 20 cm, less than a foot,
- connect the wire to GPIO4 (check the right pin on this page or look at the image below)
- turn on a radio tuned in at 100.00 Mhz in FM
- issue this command: sudo ./pifm sound.wav 100.0
- listen to the music (maybe check the radio tuning…)
With a 20 cm wire, transmission signal will be weak if the radio is not in the nearby, let’s say one meter radius.
Check with other frequencies too: just change the figure in the command line (e.g.: sudo ./pifm sound.wav 95.5 for 95.5 MHz) but don’t expect it to be too accurate!
Note: when connecting the wire do it very carefully: check the right pin, check that the wire doesn’t short-contact any other GPIO pin, and do it with the RPi switched off!
I posted a sample on Vine about this: