Introduction: AirPlay Speakers

I had an old Rasapberry pi model B and nothing to do with it since I have a different model, so I decided to turn it into a really simple AirPlay server that starts automatically when you plug it in. It is very cheap and convenient. It's very easy but it takes a while for some of the installations.

Step 1: Materials

You will need...
-Raspberry pi running raspbian
-power supply
-wifi adapter
-some speakers(or you can have it play through HDMI if you want)

-a couple female to female leads

Step 2: Installing the Software

You need your wifi adapter in and connected to the wifi (there are lots of tutorials online if you don't know how to do this). This step is from Jordan Burgess's AirPlay tutorial:

First, upgrade your packages by entering the following commands into LX Terminal:
sudo apt-get install update
sudo apt-get install upgrade

Next, you can set the audio output to whichever port you want. For this tutorial, we will set it to the headphone port:
sudo amixer cset numid=3 1

Now you need to get shairport. Enter the following command, (yes it is very long and it will take a while to finish so you might as well go do something else while you wait):

sudo apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl

Now you have to install Perl Net-SDP:

git clone perl-net-sdp
cd perl-net-sdp
perl Build.PL
sudo ./Build
sudo ./Build test
sudo ./Build install
cd ..

Now setup Shairport:

git clone
cd shairport

Step 3: Running Airplay

You can now run AirPlay from any LX Terminal session

If you aren't already, go to the shairport directory by entering
cd shaiport

Now run it by entering

./ -a (server name)

If you are connected to wifi, it should say something like "Established under name....."

Now, go on whatever iOS device you want, pull up AirPlay, and connect. You can now stream music wirelessly to you speakers.

Step 4: Running AirPlay at Boot

First what you have to do is make your pi login automatically at boot. Enter the following command:

sudo nano /etc/inittab

This will open a text file. Now find the line that starts with '1:2345...'
Comment it out by putting a # in front of it. Now, below it, add the line

1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1

Close it with CONTROL+X, Y, ENTER

Your pi should now no longer require a username or password.

Next we have to add an AirPlay File. Enter the following command:

sudo nano AirPlay

This will pull up a blank text editor. Enter your AirPlay commands:

cd shairport
./ -a (server name)

Now close it by doing control+X, then Y, then ENTER
Next, make that file executable. Enter:

sudo chmod +x AirPlay

Now open .bashrc by entering

sudo nano .bashrc

And add the line


Now close it by doing CONTROL+X, Y, ENTER

Now your pi should automatically start an AirPlay server when you plug it in. It will take a while to get it started, it's still running a normal boot, but now, when ever you log in, which it does automatically now, it starts an AirPlay server. All you need to do is plug it in with the wifi adapter and some speakers and you have a working AirPlay server. Enjoy!

Step 5: Extra: Notification LED

I decided to add a little LED Bulb that would go on about when the AirPlay Server goes up. There is a slight delay between when the bulb goes on and when the server goes up by about 5 seconds, but it is still kinda cool.

Take LED and connect one side to GPIO18 and the other to a Ground. To do this, You can use some Female to Female leads and connect directly to the LED. I only had male to males, but I found that if I took pliers, I could pull out the metal tip, leaving a female header that worked perfectly. It's a very tight fit though and you have to be careful not to Bend the pins, but it works really well.

Now you have to create a python script that will activate the pins. Open a new script and add the following lines of code:

import RPi.GPIO as GPIO
GPIO.setup(18, GPIO.OUT)

Now save the file as
Next reopen the AirPlay nano editor with the command

sudo nano AirPlay

And add the following at the top, before 'cd shairport'

sudo Python

Next, save and exit. Now if you reboot, the LED will go on a few seconds before the AirPlay server goes up.

The LED doesn't turn off on its own. I did this by creating a new Python script named with the following commands:

import RPi.GPIO as GPIO
GPIO.output(18, False)

Then I added it to the end off .bashrc by entering:

sudo nano .bashrc

Then adding -- sudo python -- Below the './AirPlay'

Now when the server is running, if you cancel it by doing CONTROL+C, it will stop the server and turn off the LED

Coded Creations

Participated in the
Coded Creations