Saturday, July 5, 2014

How to setup AirPlay Audio via Raspberry PI 2014 Edition (Part 1)

In this first part of the two part blog post, I am going to cover doing the initial setup of the Raspberry PI. The second part of the post covers setup of shairport (for AirPlay Audio).


Understanding Why?
You may want to do this if you use iTunes or an iOS device and want to be able to stream audio to a stereo that has a "Line-In" capability. AirPlay stereo devices as well as AirPort devices can be costly.

What to Get (all items I bought from MicroCenter):
·      Hardware:
o   Required:
§  Raspberry PI Model B ($29.99 – on Sale)
§  SD Card 6GB minimum (8GB Samsung Class 6 SDHC $5.99)
§  Micro USB cable for power or Micro USB AC adapter ($6.99)
§  HDMI cable and Monitor or TV (for initial installation only)
§  USB Keyboard (for initial installation only)
§  3.5mm Audio cable that can go to the stereo of your choice
o   Optional:
§  Case ($8.99)
§  Wireless Adapter (TP-Link TL-WN722N $14.99)
·      Software
o   SD Formatter (For Mac or Windows)
o   NOOBS 1.3 (From Raspberry PI website, Offline installation unless you have Ethernet)
o   Shairport + Related Libraries (We will walk through installation of this later)

So you’re looking at a maximum cost of $66.95 (plus tax), which is still cheaper than an AppleTV, and we have flexibility of putting other software onto the device itself.

Notes for Wireless adapter:
I tried to use a different wireless adapter at first (Asus USB-N10), but there was no external antenna and had issues flooding my network with noise. Choose your wireless adapter wisely as it must be compatible (or have a driver) for Raspbian OS.

Step 1: Format SD Card and Copy OS Installation

1)   Insert the SD card into the computer.
·      Note: If you have an SDXC or SDHC memory card is used on a non-compliant SD card slot, you may have issues using SD Formatter properly.

2)   Download and start the SD Formatter application (from
3)   Choose your SD card with the Overwrite Format option (you can also customize the name if you want).

4)   Download the NOOBS installer (from
5)   Copy files from the downloaded NOOBS zip file directly to the SD card and you should see a file structure like this: 
6)   Eject the SD card from the computer when copying is complete.

Step 2: OS Installation

1)   Plug the following into PI:
a.     SD Card
b.     HDMI cable into the PI as well as into the monitor or TV,
c.      USB keyboard
d.     Micro USB Power
e.     Wireless Adapter (if needed)
·      Note: As soon as power is plugged-in, the PI should turn on.
2)   After booting, the NOOBS installer should show a screen to choose which OS to install. Choose Raspbian (which is a Debian port).
3)   The installer will prompt you with a warning stating that all data on the SD card will be overwritten. Choose Yes.
4)   Now it’s time to wait. Installation doesn’t take too long though just go and grab a cup of coffee.

5)   Upon completion of the installation, you will be notified. After clicking OK, the PI will reboot.

6)   The PI will reboot and after a couple of seconds.

Step 3: OS Configuration

1)   Upon first boot, raspi-config should run on its own (or you can run it via ‘sudo raspi-config’). There are a couple commands we want to run. First, we want to change the user password (the default username is pi). You can change it to anything (just make sure to remember it as you will have to use this password to login to the PI later).
2)   You can also choose an advanced option such as changing the hostname (I named my PI Airplay-LivingRoom), but for now, we will just choose to expand the filesystem (which will get rid of the original OS installation files that are not needed).
3)   After this is complete, choose Finish and you will be at the command prompt.

Step 4: Wireless Configuration

·      Note: if you are using Ethernet only, then you can skip this step.
1)   From the command prompt, type ‘ifconfig’ and Enter. This will show you a list of network adapters the PI detects. If your wireless adapter is plugged-in and supported by Raspbian, it should show up as ‘wlan0’. If you don’t have this behavior, you need to take additional steps not covered in this guide.
2)   We are going to now edit the network interface file to setup the wireless SSID and password for connecting to your home network. Run ‘sudo vi /etc/networks/interfaces’ (or using your other favorite text editor such as nano). Have the text look like the image below:
3)   On the lines wpa-ssid and wpa-psk, enter your SSID and WPA/WPA2 password. After saving the file and quitting the editor, run ‘sudo reboot’ to reboot the PI.
4)   After rebooting, login and try to ping a known website such as
5)   Once these steps are followed and you have network access, you can now SSH into your PI instead of using a keyboard and Monitor/TV.

Make sure to check out Part 2 to see how to setup shairport for AirPlay audio.

No comments:

Post a Comment


Ryan Kuhn