For my first project after getting the Raspberry Pi ($35 Linux computer) I wanted to extend on a very good blog post I read from MightyOhm about turning a cheap Wifi router into an internet radio:
http://mightyohm.com/blog/2008/10/building-a-wifi-radio-part-1-introduction/
In that article he also had a cheap Linux device (the router) and was able to stretch it to be a mucic machine. I had no previous experience with Linux, always used and programmed on Windows machines. So I wasn’t sure what to expect when my Raspberry Pi finally arrived. After some initial hickups, I was able to get the device running:

I installed MPD, MPC, and SSH on it so that it could be a headless (meaning no monitor) device. Linux has been an experience, its entirely to cryptic for my taste, too many blind alleys to get stuck down. I was able to get it to install a tiny nano Wifi and wrote a small python program that hold a list of internet radio streams (and executed MPC commands).
I control which stream the player is listening to using the Adafruit Cobbler to breakout the pins so that the python program is just listening for button presses. When the button is pressed the player moves on to the next stream in the list. I can SSH (remote command line access) into the Raspberry Pi using Putty on my PC and edit the list as much as I want remotely (I even have an SSH access as an app on my phone). Here it is in action:
These links are the documentation for how to setup and run the Raspberry Pi as a Wifi Internet Radio:
The Raspberry Pi and where to buy it
How to setup SSH on the Raspberry Pi
Edimax nano USB Wifi that worked great for me on the Raspberry Pi
Easy setup instruction for Edimax EW-7811Un Wifi
Adafruit instruction for buttons with the Pi Cobbler
Adding items to your MPC playlist – look under “installing mpd”
Streaming radio lists – the .pls have to be downloaded and opened in a text editor for the “http//” items to add to MPC
Here is the python file:
radio.py
you will need to call “sudo python radio.py” to run it (as well as have Python installed)
Here is the instructions on how I created the radio station list:
Radio Station List – includes 20 stations, just run this command “sudo mpc save mine” to save the list as the “mine” playlist used by the radio.py file
here are some of the recent hardware choices:
Here is the latest video going over all the parts I am using to make this happen. You certainly don’t need all of these to get it to work, but the upgrades do make it very interesting
















Pingback: Raspberry Pi Wifi Internet Radio Player – #piday #raspberrypi @Raspberry_Pi « adafruit industries blog
what breadboard are you using for the buttons? I looked on Adafruit but I dont see the one your using? will any board work?
Any board will work as long as you are paying attention to the traces below (because some boards have traces already). I like to use the boards from radioshack that have only pads and no traces for projects that are simple like these. I try and use the ones with the square pads and bridge them with solder to create the traces I need. For longer traces I tend to cut some legs from resistors to makes the solder stretch better. Any proto-board would work though, just go with whatever makes most sense to you.
maybe you want to try to keep your board off of carpet. Otherwise, you risk the chance of bricking your Raspberry Pi. Google ESD protection and you’ll find a plethora of information on how to safely handle electronics.
Its in a case now, I didn’t have a wired connection in my home office so I had to plug it into the router hence the uncomfortable setup here. Had the monitor and keyboard on the floor as well just to download the drivers for the Wifi.
Do You have any better instructions for adding the radio list? I just can`t get it work properly. (the file “sudo mpc mine” is a text file or python file?
Greg,
ok, id love to help!
mpc is a client that runs on the device and should be installed if you followed my directions carefully. go here for instructions on installing it:
http://miro.oorganica.com/raspberry-pi-mpd/
once it is up and working you can add playlist items to it by executing this command on the command line (all interaction with it is done through the command line):
sudo mpc add http://relay3.slayradio.org:8000/
(this will add the slayradio stream to your playlist.)
once you have added all the stations you will need to save it so that you can access it by name later. to save the playlist (after you have added all the stations you want) execute this command:
sudo mpc save mine
saves the playlist under the name “mine” (give it any name you want, i used: mine). you can then later load that saved playlist by executing this command:
sudo mpc load mine
then you can play an item from your list like this:
sudo mpc play 1
(plays the first item on the list)
look at the other mpc commands here:
http://linux.die.net/man/1/mpc
Let me know how it goes. Send me info on what you are trying and how far through the instructions you have moved. You might want to send me pics too if you are trying to put buttons on it.
Pingback: Wifi radio | Massif Software
Pingback: Raspberry Pi Wifi radio #piday #raspberrypi @Raspberry_Pi « adafruit industries blog
Found you blog from the RaspberryPi website. They mention you found “a nice little battery you can use to charge a micro USB device which he found at Radioshack (his Pi runs for a couple of hours on it)”. Can you post a link to that? Thanks!
Here is the USB battery that I use: http://www.radioshack.com/product/index.jsp?productId=13072382
Its great, it can charge a cell phone from completely dead to 100% in ~30 minutes and I use it to have a wireless battery powered RPi and as a power source for my Netduino projects as well (they take a USB power supply quite nicely!). They have a few different ones (an even a smaller one) but I like this one the best since it takes USB in and out.
Hello,
It looks from the photo that you have a bluetooth keyboard connected to the Rpi. I got one almost like that today and I can’t get it to work. Would you have any pointers for bluetooth keyboard and mouse on the Rpi? Thanks.
I don’t think that mine is bluetooth. It came with a little nano USB receiver and worked as soon as I plugged it in, no configuration necessary.
Could you post link to source of that little keyboard please.
If it plays nice with RaspberryPi & price is right I could be up for one of them.
FAVI Entertainment Wireless Keyboard (Built-in TouchPad/Laser Pointer) – Black
$28 right now
I finally got it to work. This is the keyboard I got http://www.amazon.com/Anker-OrientEX-Bluetooth-Handheld-Multi-Touchpad/dp/B005C6CVAE/ref=pd_cp_e_1 I wanted bluetooth because I also want to use it on Android.
Thanks for swift response. I’ll be checking them both out.
Sweet project BTW, guess I’ll be ordering ANOTHER Rpi.!
Hey, I found a tutorial explaining how to use Wifi through GPIO. Have you tried that? http://www.cooking-hacks.com/index.php/documentation/tutorials/wifi-module-for-raspberry-pi-roving-rn-xvee
um, I already get great wifi through the USB nano device I use, I wouldnt prefer to do it by hand. I am sure its possible but not very practical since the Wifi Nano USB module was only $9.
Great project.
I got my RPi to play wma format streams via mpd/mpc by using ffmpeg:
sudo apt-get install ffmpeg
Then changed the audio_output section in /etc/mpd.conf to use encoder “ffmpeg”:
audio_output {
type “alsa”
name “My ALSA Device”
device “hw:0,0″ # optional
format “44100:16:2″ # optional
mixer_device “default” # optional
mixer_control “PCM” # optional
mixer_index “0″ # optional
encoder “ffmpeg”
}
Restart mpd and then add the URL to mpc as usual:
mpc add [URL]
mpc play
Pingback: Guest blog #2: Near field communication by Donatien Garnier | Massif Software
Pingback: ทำ Wi-Fi Internet Radio ด้วย Raspberry Pi | Raspberry Pi Thailand
Pingback: » Linuxaria – Everything about GNU/Linux and Open source Raspberry Pi what is the secret of his success and what are its potential
Pingback: Eine eigene Cloud auf Himbeerbasis « Hatori Kibble
Pingback: Credit-Card Size Computer for $35 « California Online High School
Pingback: raspberry wifi internet radio | Jakob'll Fix It!
Very nice work!
But still wondering how you managed to execute the python-script on startup…?!
Thanks in advance and best regards.
I found this: http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-run-a-command-at-every-boot-521372/
and put the radio.py in the /etc/rc.local file and it runs on it boot. Means all I have to do is plug it in and 1 minute later its all up and running. I’m not a linux guy, I just keep googling until I found something that worked. Comment if that works for you.
Thx for your quick reply.
Tried your mentioned solution but getting this error-log:
decoder_thread: curl failed: Couldn’t resolve host
When executing
mpc play
It works…?!
I think what you are missing is the list item indicator. The full command should be something like this:
mpc play 1
The couldn’t resolve host usually means that it couldn’t find the address you provided. Either that or you don’t have a music station list, make sure you re-read all the steps and have everything.
Pingback: Turn a Raspberry Pi Into an AirPlay Receiver for Streaming Music in Your Living Room
Pingback: Turn A Raspberry Pi Into An AirPlay Receiver For Streaming Music | Lifehacker Australia
Pingback: Turn a Raspberry Pi Into an AirPlay Receiver for Streaming Music in … | Acoustic Environments
Pingback: Framboise sonore | Carnet
Hi
I wanted to report the solution to my described problem:
For I am using an external USB-soundcard I commented “snd_bcm2835″ in /etc/modules and modified “mpd.conf” as pulse-audio-output instead of ALSA.
Now everything works fine.
Best regards
excellent!
can you give everyone more details? the usage of the USB soundcard is a great way to up the sound quality. Which one are you using and can you post the edits you did to mpd.config?
I got this site from my pal who informed me regarding this site and at the
moment this time I am browsing this web page and reading very
informative articles or reviews at this place.
I like it when people get together and share ideas. Great
blog, keep it up!
As a site owner. Do you truly feel like owning a web-site or blog site is profitable?
Also how can you get visitors to visit your website or blog?
I do not do this site for profit (I make no money from it). The reason I post here is to document the projects I am working on to help others that may be working on similar projects or technologies. Hopefully my notes or diagrams will help them get past any roadblocks that they may be hitting, or inspire them to try new ideas. I get visitors by posting my projects to G+ communities and in my own circles of people who also work on Arduino or Raspberry Pi types of projects.
I really like your article. I just bought my first Raspberry Pi and I’m trying to play mms://eemsscan.dyndns.org:1877. This doesn’t work. The error message is: ERROR: problems decoding *mms://eemsscan.dyndns.org:1877/* When I try mms://196.35.64.36/highveld_22/ all works fine. What am I doing wrong? Can you help me out?
I think that URL is just wrong, where did you get it?
I got it from this page http://members.home.nl/aef/Tablet.html
It works fine on my pc running Windows 7. Could the problem be that it is a WMA-file? (I’m not sure it is a WMA-file though.)
Yeah, I am not sure of the different kinds of streams that MPD can play, all the ones that I used were all streams that could be used over HTTP, I didnt do anything that was using MMS. Take a look at my notes on getting streams from Shoutcast.com and there are more notes down in the comments.
Will any bluetooth speaker work with this setup?
This is directly connected to the speaker, not using bluetooth (I know you can but ran out of USB slots) its just directly connected with a headphone type of cable to the Supertooth input.