By the end of this post you will be confident in building a Raspberry Pi streaming audio music player that plugs in to any speaker and is controlled by your smartphone to play internet radio stations, Spotify, last.fm, or locally stored music, or act as an Airplay speaker for your iTunes library or apps like Pandora.
I recently put one together and it's been working great. The hardware components are simple to put together; they mostly just snap into place. Here's what I used for mine:
- Raspberry Pi B+ ($29.49 at the time of this writing)
- A MIcro USB power supply ($7.99)
- A WI-FI adapter ($9.99)
- A case for the media server ($6.98)
Grand Total $54.45
Ok, I lied just a little. You will also need an SD card to store the Raspberry Pi operating system and a card reader to write the OS image from your computer. If you don't own these things already, here are some that will work just fine:
- SanDisk 8GB Micro SD Card ($7.62) OR Kingston 8GB Micro SD ($3.58)
- SanDisk Card Reader ($4.40) OR IOGEAR Card Reader ($4.99)
- Flash drive (For local media storage- completely optional!)
Once you have all of the parts, put the Raspberry Pi board into the case and screw the case on. Be sure to ground yourself first to avoid a static charge which could harm this sensitive hardware. Simply plug the WI-FI adapter into one of the USB ports and the player is put together! When put together it will look something like this:
Set the player aside for now while you prepare the OS image to be installed. For my build I chose to use Rune Audio, which includes a custom built OS based on Arch Linux and an Open Source player and user interface for controlling your audio player. You can download the disk image here or check the download page for possible future updates. (Several other choices also exist, including Pi MusicBox and Ras Plex.)
When the download is complete (it's roughly 1GB) you need to unzip it. Fire up a terminal and unzip the file:
If you're using Windows you can use a program like 7-Zip to unzip the file.
Plug the Micro SD card into the card reader and plug the card reader into your computer, and you're ready to flash the OS onto the SD card.
Rune Audio provides separate instructions for flashing the SD card for Windows, Mac, and Linux. They can be found here:
On my mac this involved running one command to find out which device the SD card was mapped to:
Judging by the 8GB size of the SD card I found the device name, which should be something like
/dev/diskX. Then it was simply a matter of writing the image to this disk:
dd if=/path/to/unzipped/runeaudio/diskimage.img of=/dev/diskX
In the above example you'll want to replace
/dev/diskX with the actual device path for your SD card. Be sure to triple check this device path as choosing a different drive could completely mangle another one of your disks.
I wasn't keeping track of exact time but this operation took around 20-30 minutes to complete. Once it's done you can unplug the SD card reader and pop the SD card into the Raspberry Pi. It took me a minute to find where this should be plugged in to:
This should click into place when you push it in. You may need the round side of a paperclip or other small object to help.
The Raspberry Pi has no power button, so plugging/unplugging the micro USB power supply turns the device on and off. Once plugged in the device takes about 10-20 seconds to boot up. If you have an HDMI monitor you can plug it in to watch the boot sequence but this is not necessary.
To initialize WI-FI settings I found it easiest to first plug an ethernet cable directly from my router into the Raspberry pi. When the device comes on you can access the media server settings by going to http://runeaudio or http://runeaudio.local on OSX or Linux.
If for some reason those addresses don't work, you'll have to log in to your router's admin console and find the IP address for the device from your DHCP client list. Then you may use this address instead; it should be something like http://192.168.x.xxx.
Navigate to the network page under the Menu at the top right of the screen and set up the password for your WI-FI network for the
As soon as this is done your audio player is ready to go wireless. Put it in its permanent home, plug in the speakers and you can begin configuring your audio sources at the same URL.
Most of the configuration is pretty self-explanatory but I did find one thing a bit tricky when setting up internet radio stations. Most of these stations are distributed via a
.m3u file. The URL to the
.m3u file will not work by itself. Instead, open the
.m3u file in a text editor and find the URL in it (usually the second line) and use this URL in the RuneUI. You can find tons of internet radio stations here or by visiting your favorite radio station website.
$ cat test.m3u #EXTM3U http://test.streamguys.net <--- GRAB THIS URL
With this URL you can set up a new MyWebradio on the Library screen
Also, be sure to set an airplay name for your media player so that you can stream from iTunes or apps like Pandora.
If you have an iPhone, Apple's "Remote" app in the app store is great for controlling iTunes on your computer.
Lastly, to control your media player from your smartphone, just go to the above mentioned local URL on your smartphone and play music from any of your sources. Bookmark this page or set a homescreen bookmark for it to access it more quickly on your smartphone.