Raspberry Pi Airplay Tutorial

A tutorial that guides you through setting up a Raspberry Pi AirPlay receiver. It then shows you how to use a Raspberry Pi as a web server. By .

Leave a rating/review
Save for later
Share

Make your Raspberry Pi into an AirPlay receiver!

Raspberry Pi AirPlay Receiver

The Raspberry Pi is a full Linux computer that is about the size of a credit card and sells for $25–$35. It has a 700Mhz ARM CPU and 512MB of RAM. Because of its capabilities and its low price, it has become wildly popular with the hobbyist market. Some people have done ingenious things with theirs.

If you’re like me, you toyed with the idea of getting an AirPort Express in the past but the $100 price seemed a bit steep, since all you really wanted to do with it is play audio using AirPlay. Sound familiar?

Maybe you also have a new Raspberry Pi and don’t know what to do with it. Well, guess what – you can turn that baby into an AirPlay speaker. That’s right, instead of spending $100 on an AirPort Express, you can put together a cool DIY AirPlay receiver for around $45 using the Raspberry Pi. That’s what you’re going to do in this tutorial. By the end of it you’ll have your very own Raspberry Pi AirPlay receiver!

After that, you’ll look further into the usefulness of the Raspberry Pi to iOS developers. Most complex apps need some sort of backend web service and a Raspberry Pi is a perfect server for development or perhaps even a small app. You’ll install the Apache web server, MySQL database and PHP, then use them to create a web service that you can access from an iOS chat app.

Getting Started: What You’ll Need

Here are the hardware components you’ll need for this project (places to buy the equipment listed next to each component):

  • Raspberry Pi. (Buy)
  • SD Card. (Amazon) 4 GB is all you should need for this project. This is the storage for the project and will act as the hard drive for the Raspberry Pi.
  • Ethernet cable/jack. The Raspberry Pi doesn’t have WiFi built in so we’ll use the wired connection
  • OS X or Linux computer on which you have sudo rights. You’ll need a computer to load the OS onto the SD Card and to SSH into the Raspberry Pi.
  • Memory card reader. The one built into your computer will work fine if it has one. You need this to load the OS onto the memory card.
  • iPhone or iPad. You going to use this to airplay audio from and to run the demo app
  • Micro-USB cable. (Buy) To power the Raspberry Pi.
  • Set of speakers with a mini audio cable.(This is just to normal analog audio connecter) So you can hear the AirPlayed audio

You’re going to download and run Shairport, a project that emulates the proprietary Apple AirPort protocol with software so that Raspberry Pi will appear as an AirPort receiver on your network. The AirPlay protocol isn’t something that Apple publishes publicly but somebody reverse engineered it and created an executable that will appear as an AirPlay receiver. You can check out the open source project here.

A Brief Introduction to the Raspberry Pi

RaspiModelB

The Raspberry Pi is quite a little device. Although not the first of its kind, it has exploded in popularity because it has combined very capable, full feature computer hardware in a tiny form factor at a unbelievable price ($25-35). It has a 700Mhz ARM CPU with 512 MB of RAM with all the standard connectors that you would expect to come on a computer like an analog audio out port, 2 USB ports, wired ethernet, and analog RCA and digital HDMI video out for connecting a monitor. In addition to that, it has a bank of GPIO (General Purpose Input/Output) pins for connecting to hardware. These can be used for anything from simply controlling a LED to a motor to reading from any number of different kinds of sensors.

There is also a SD Card reader onboard. There is no onboard memory on the Raspberry Pi so all files are kept on a SD Card. Think of it exactly like the hard drive in your computer.

The final component of interest onboard is the micro-USB port. This is not used for data or connecting to your computer but rather as the power for the Raspberry Pi. The Raspberry Pi used very little power and 5V that USB provides is enough to power it as long as you aren’t using any addition devices plugged into the Pi that use a lot of power.

Here is a quick start guide to help you get started if need to help hooking it up and powering it on.

Loading the Operating System

Every computer needs an operating system (OS). Your Mac runs Mac OS X and your iPhone, iPad, etc run iOS. The OS handles all the interfacing to the hardware so that “apps” can just do what they need to do.

A Raspberry Pi can run many different OSs, but the one you’re going to use here is Raspbian. Raspbian is a version of the Debian Linux distribution dedicated to running on a Raspberry Pi. Therefore it’s perfect for this tutorial!

To get your Raspberry Pi up and running with Raspbian, you’ll first need to download and install it. This is done by downloading something called an “image”. An image is simply a snapshot of a pre-installed copy of Raspbian, ready to copy over onto your memory card to run on your Raspberry Pi.

Downloading the Image

Go to http://www.raspberrypi.org/downloads and look down the page for the Raw Images section. Under the Raspbian sub-section, download the image either as the direct ZIP or using the torrent. The torrent is downloaded using the bit torrent protocol. If you don’t know what that is just download the image directly.

Screen Shot 2013-09-29 at 2.47.24 PM

The zip file contains a disk image (a .img file) of the entire installed operating system. Download and extract the image from the zip anywhere you have access to it. Then you are just going to copy the data in the disk image on the SD card (in the next section).

The default root (administrator) username and password are:

Username: pi    Password: raspberry

Make a note of these, because they’ll come into play later.