The Raspberry Pi is a very useful computer that can be used for many different things. The people over at Imperial College Robotics Society have a new way to use your favorite treat. They designed a program that turns the Pi into an FM radio transmitter. This instructable will show you how to make your own Pifm transmitter, installing and using the program.

Some Updates (03/11/15):

There is a new program up that I wrote where you only need the filename (NOT THE PATH). It will install everything for you, all you have to do is type in the frequency and the filename to be played (WAV or MP3, stereo or mono). github.com/CodyJHeiser/PiStation

ICRS has released another version on PiFM a while back, it allows you to play stereo sounds (mp3 files) over the radio now. You can go to this link here to check out the new information (the new code is included in my program listed above.)

More Updates (08/06/15):

The member, AndrewG29, has given me a link to GitHub that supports the Raspberry Pi 2! Through the traditional method, this doesn't work on the RPi2.

Step 1: Having the Necessary Parts

Obviously this will not work unless you have the right parts to start your Pifm radio. I will list the basic things that you need to start up your Raspberry Pi that most of you already have, but I will put it there for the people that don't.  In the second paragraph are things that you may not have that you need.

1. Raspberry Pi
2. 5 volt 1 amp (between 750 milliamps and 2 amps is what I have tried) USB power supply
3. Micro USB cable
4. At least 2 GB SD card with Raspbian on it
5. A display or ssh 

Now past the basics, you will need these items as well for it to work.

1. Ethernet cable or a wifi dongle (See step two if you don't have this)
2. Some sort of antenna
You can just use your finger but it will not work as well, you can use a Pi Cobbler with some wire sticking out of the pin like I did, it works fine, the projected range is about 10 meters, but I found it to go much longer than that.
<p>for those who have pi2 model b follow this persons vid on youtube. Works for me</p><p>https://www.youtube.com/watch?v=i5cp9R0SACg</p>
Thanks for sharing this video! I'll have to try it out sometime!
<p>You do not want to be using this as a long term, stationary FM <br>transmitter. If any of your signals interfere with air traffic control, <br>emergency services (police, ambulance), etc they will come looking for <br>your signal and ultimately you. Looking at a spectrum analyzer with a <br>frequency of 88.7MHz there are harmonics all across the VHF band. <br>Centering on 121.5MHZ, your aviation band emergency frequency, there are <br> harmonics and intermod products all through aviation VHF band <br>(118-136MHz,) and VHF navaids (108-117MHz). If you use this you will <br>splash onto these frequencies. If nobody complains, nobody will come <br>looking for the signal. If this does interfere with aircraft, I <br>guarantee you someone, (FAA in US, Industry Canada in CA) will come by <br>with a DF and find you and you can be charged. Use with caution.</p>
<p>Quite true, it generates a square wave and splatters all over the VHF and UHF bands. A frequency counter puts this at the specified freq above (100.1). Using a SDR with an antenna very close to the RPi I was able to see harmonics when the radio was active but not sending a wav file every 466Khz, granted, not a very accurate method but somewhat effective. While the radio was transmitting a Wav file I heard strong audio at 100.1, ~150, ~200, ~300(very strong), ~400(very strong), , ~600, ~700, ~900 and ~1.1Ghz. You can find some videos showing an actual spectrum analyzer how dirty this is as a FM radio. </p><p>The attached image shows some of the air band through the SDR while the Pi is not sending a wav audio. Also another image while transmitting at 100.1 showing it at 600Mhz </p><p>The output power is very low so it shouldn't be an issue, I can barely hear the radio 40ft away, just be aware of what @dleite says above.</p>
<p>Hello,</p><p>Your comment is kind of a big deal.</p><p>Any idea how to filter this to get rid of the harmonics?</p><p>Can you do an instructable on how you found these spikes? I am not familiar with software defined radio (other than in theory) and would be a great way to detect dirty transmissions from homemade equipment.</p>
<p>Not sure we'd be able to get rid of the harmonics since they are being generated by the Pi. Maybe at the output (antenna) we could add a band pass filter before the signal gets to a tunned antenna so the range for the harmonics is limitted. </p><p>I might be able to do an instructable for this but I'll need to start from scratch since I keep configuring my Pi for different projects. SDR is easy to get started with using cheap dongles; you can find them anywhere from $10 - $25. </p><p>Adafruit has instructions on building a scanner using a Pi, don't know what it would look like but it's on my to-do list. </p>
<p>Hello,</p><p>What I am asking about, is what steps were taken to view the harmonics, and if you could make an instructable for this? (call this the &quot;windsr method&quot;). If I were designing a band pass filter, I would want to use this &quot;windsr method&quot; to make sure my filter works and I am not letting splatter escape and cause trouble.</p>
haven't tested that yet, I live in a place where there should be no interference. I would like to hook this up to an rf amp and then a filter to deplete the interference. just using the raspberry pi and a length of wire shouldn't get you and farther than your house depending on where in the house the antenna is, and how long it is. I guess if I do cause harmful interference to aviation and others like that, it should be within my ham license limit. I would rather have my license stripped of me and have to re-take the test rather than be fined a couple hundred thousand dollars.
<p>Still going to want to be careful. Interference in a non ham band such as the aviation bands have nothing to do with your ham license. Also, if you are in the US, if you have your license revoked it is much more difficult than just retesting to get it back. There is legal red tape and a very good possibility of not getting it back</p>
<p>Of course, this is just an example of how it could be done and people need to use it in complience with the FAA.</p>
<p>lol why worry? This puts out such a tiny amount of power a receiver will not pick it up less than 50 feet away. No DF is sensitive enough to pick up such a tiny signal. Heck even a large electric motor puts out more noise than this!</p>
<p>There is a new program up that I wrote where you only need the filename (NOT THE PATH). It will install everything for you, all you have to do is type in the frequency and the filename to be played (WAV or MP3, stereo or mono). github.com/CodyJHeiser/PiStation</p>
<p>Glad to hear you are still working on this project! That is an excellent improvement</p>
<p>Thanks! I am working on a PiStation v3 now that would show recommended results. So if you typed in the song name wrong, instead of having to restart the program and type in the song name again it would say, did you mean 'this' song instead? But it is still in the development process! </p>
<p>Hello, who knows how it looks like on raspberry pi 3? Its working? I did this but its not working - any ideas?</p>
<p>will this work on raspberry pi 3 b? </p>
<p>Nice. I am a licensed amateur radio operator. The comments listed here demonstrate why building an FM transmitter is not trivial :( I wish it were. It makes VHF/UHF experimentation difficult.</p>
<p>I want some distance like my local area for CW weak signal transmission for nets and beacon and such. Again, not trivial :(</p>
i dont know why .....but the whole thing till downloading works but broadcasting has a problem i believe .......the things is that i have<strong> raspberry pi 2</strong> not the 1st version ....so the gpio pins and other stuff isnt going on well.<p>and also the ^cexiting command is not coming once i give the the command before that ( <strong>sudo ./pifm sound.wav 100.1) </strong></p><p><br></p><p><strong>can someone please help me out ......<br></strong></p>
<p><a href="https://github.com/ChristopheJacquet/PiFmRds" rel="nofollow">https://github.com/ChristopheJacquet/PiFmRds</a></p>
<p>please tell me maximum area covered by this project..?? reply plz.</p>
It really depends on your location and how much interference there is. If I had to pick a number I would say about 10 meters (32 feet) in open air, and about 5 meters between floors/walls. Also making a bigger antenna would make the signal better. Be sure you aren't near an airport or something similar! You are only legally allowed to transmit 200 feet (61 meters) in the US, not to sure about the UK however.
<p>any method to increase the area..?? antenna specification or software changes for larger coverage..??</p>
<p>You could try a different type of antenna (folded dipole or something similar). Use this formula to find out how long to make the wire (to maximize your distance covered); L = 93.75/f where 'L' is the length of wire to use and 'f' is the frequency, so if the frequency was 95.5, then enter L = 93.75/95.5. The number that comes out is how many meters the antenna should be, convert it to whatever unit you like to use after that. When scaling the wire up and down, do it in fourths and halves (for downscaling) and doubles, triples, quadruples, etc. (for upscaling). Make your antenna in the shape of a 'T' as well (folded dipole is what it's called).</p>
<p>ok for the dipole, but how can I connect a dipole antenna to a single pin (gpio 4)?</p>
<p>I am not 100% sure, but what I would try is connecting one to ground and one to GPIO 4. Again I'm not positive, but that's what I would try.</p>
<p>Hi, I was wondering where the antenna should be connected to the Rpi. (What Pin #) Right now I am playing the sound and have all the code working, but the radio 5 feet away won't pick it up. I finally realized it is because there is no antenna connected. Thank you!</p>
<p>Nice and useful task</p>
<p>Hi, if anyone can please answer if the following is possible. Can we get the audio output of the pi to play on the FM modulation? I mean any sound that comes out of the Pi to be transmitted on the FM pin. I want to have VLC working on the PI and I want it's output to go to the FM modulation. Is there any way to do this? (software solution would be best).</p>
I'm not quite sure I know what you mean, you want to transmit sound from a VLC player to the Raspberry Pi?
<p>VLC player is running on RPI. I want to transmit the sound produced by vlc on FM..the easiest way is to hook RPI audio out to an external FM modulator.</p><p>The end goal is to have a headless RPI that I control songs from my phone and it transmits over FM.</p><p>Is there anything like: <strong>sudo ./pifm rpi_audio_output 100.1 ?</strong></p><p><strong><br></strong></p><p><strong>PS: I tried to do it like in the tutorial with sound.wav. It does not work I cant find it on my randio....I used a 30cm ribboncable as the antena and nothing...tried with a long cable...still nothing...I have a RPI2 model B</strong></p>
<p>PiFm isn't currently compatible with the Pi2 as far as I can tell. I got this working great tonight though:</p><p>https://github.com/markondej/fm_transmitter</p>
<p>I have raspberry Pi 2, and i couldn't figure out how to work on your way so please any tutorial will be much appreciated</p>
<p>Ah yes I missed that part about the Pi2. So that program is working on the Pi2?</p>
Yep, literally got it set up yesterday, works a charm.
<p>Awesome, I will put it at the top and credit you. Thanks for sharing this!</p>
<p>Oh okay I see what you mean. I haven't tried this but here are some of my recommendations, get a USB cable and use it to somehow (sorry I would have to look into how to do that) connect your Raspberry Pi to your computer/phone(headphone jack) or other interface device, then control it using the microphone command (it should be in one of the steps). Another option would be to search online for someway to trasnfer sound over LAN to the RPI. Haven't looked into either. I would be interested if you find anything on this subject!</p>
Will it work with the Raspberry Pi2B?
<p>One person reported it having issues on the Pi2. Technically it should work, but you might have to take a look at the pins and test each pin (it might not be 4 on the Pi2 like it is on the regular one) But I would just play around with it. If you have anymore questions feel free to ask me! Thanks, Cody.</p>
Hey Cody,<br><br>Thanks for your reply. I will test this in a couple of weeks and I'll let you know! Thanks for this article, very informative and well written.<br><br>Greetings from Belgium!
<p><a href="http://www.instructables.com/member/dewintermaarten/" rel="nofollow"></a><a href="http://www.instructables.com/member/dewintermaarten/" rel="nofollow">dewintermaarten</a> are you able to sort out the problem actually i also want to make it could you please guide me i am having B2</p>
<p>Awesome, have fun! Please do let me know! I recommend (while the program is running) trying different wires besides GPIO 4. That's what I was trying to say above but it wasn't very clear, haha!</p>
Odd one , this works on the original pi B but not on the B+ any thoughts why this might be ???
I personally don't have the B+ yet, but correct me if I'm wrong, the B+ has more headers on it (pins). So maybe try different pins for the antenna, if thats what you mean by it doesn't work. A good, safer and faster way that I do (proceed at your own risk), is lay my finger across the pins and put it next to a radio (very close to it). My finger is just conductive enough to broadcast the sound, but not enough to cause any disturbances with the Pi. Please contact me again and let me know how it goes!
Hi sorry need to retract my statement I have the b+ and it work's great but on the pi2 very odd. there has been GPIO issues with the pi 2 hope fully we can get this running .
Awesome, and good luck! Let me know how it turns out!
<p>hey has anyone solved the GPIO problem on B2</p>
<p>Any chance you could bring it to work now? I own a 2B and I'd like to know if it works.</p>
<p>It works but I could not add more songs.</p>
<p>I had a similar problem, in that I could not ssh into my Raspberry Pi because I could not get the IP address right at all. I would recommend using Dropbox to create a file, and upload your songs to that file. Then click share to get a link used to access that folder. Go to your Raspberry Pi, and in the command line type 'wget www.dropbox.com/(rest of link)' and hit enter. This should hopefully download the files to your Raspberry Pi, ready for you to use them. Hope this helps!</p>

About This Instructable




Bio: Love to see what makes things tick! email me at: CodyJHeiser@gmail.com
More by Cody Heiser:Raspberry Pi Radio TransmitterVNC Server Set upForwarding IP Ports to Your Computer
Add instructable to: