How to build an AirPlay receiver with Raspberry Pi Zero

AirPlay Raspberry Pi receiver

AirPlay is great for wirelessly piping music through your home, but even basic AirPlay speakers come with a hefty price tag attached. You may already have a perfectly serviceable stereo system in place, so why spend a fortune on new speakers when you can put together your own wireless AirPlay receiver for under £50/$70 with the Raspberry Pi?

AirPlay Raspberry Pi receiver

AirPlay is great for wirelessly piping music through your home, but even basic AirPlay speakers come with a hefty price tag attached. You may already have a perfectly serviceable stereo system in place, so why spend a fortune on new speakers when you can put together your own wireless AirPlay receiver for under £50/$70 with the Raspberry Pi?

This project was inspired by a desire to make full use of a 25-year-old Pioneer stereo system that sounds as good as the day we bought it. We hoped the receiver would make good use of this stereo’s stunning sound, but even we couldn’t have foreseen just how spectacular the results would be.

The components used in this project will cost you about £50/$70, and some soldering is involved. The good news is that it’ll give you a full-blown music receiver that can do much more than simply act as an AirPlay receiver, though that’s the sole focus of this tutorial.

Your AirPlay receiver will consist of a number of components, and you’re free to trade up or down as you see fit. We picked the Raspberry Pi Zero because it costs about a fiver, but you can easily adapt this project to any Raspberry Pi model – doing so may cost more, but you’ll avoid the need to do any soldering and you’ll even have the option of turning your AirPlay receiver into a standalone system – all you need to do is provide speakers.

If you’re thinking of buying another Raspberry Pi model, watch our video below to see if the Raspberry Pi 3 could replace your current PC.

YouTube : https://www.youtube.com/watch?v=ZYPATphfGY4

To follow our project exactly, you’ll need the following items – feel free to shop around for better deals, but these are the items and sellers we used during this project. You’ll need a Raspberry Pi Zero (£4.20/$5), of course, for which you’ll want to add: the Essential Raspberry Pi Zero Kit (£6/$10), which contains necessary adaptors and a GPIO header; a USB Wi-Fi dongle (£6/$10); and a Raspberry Pi Zero power adapter (£6/$10), all of which you can get from The Pi Hut (or Ada Fruit in the US).

You’ll also need the Pi-DAC Zero (£15/$25) which offers twin phono outputs to hook up the Raspberry Pi Zero to your stereo sound system.

There’s also a Pi-DAC Zero Headphones add-on (£15/$25), if you want a private experience.

Best case scenario

You’ll want a case for your Raspberry Pi Zero; we used a Pibow Zero case. We hope IQaudIO will, in time, produce a dedicated case to house the Raspberry Pi Zero and its audio cards. For now, the Pibow Zero case keeps your Raspberry Pi Zero snug while allowing the IQaudIO card to sit on top of it.

Finally, you’ll need a Class 10 MicroSD card. It only needs to be 1GB in size, although if you plan to store music on the Raspberry Pi Zero itself, you’ll want it to be a much larger capacity – 16GB at minimum. Also you need a phono cable (about £3/$5) to connect to your hi-fi.

The cost of these parts, excluding postage and the optional headphones add-on, comes to about £49/$70.

Physical construction

The biggest task you’ll face with the Raspberry Pi Zero is having to solder on a GPIO header, which is required to connect the DAC. If this is your first project of this kind, check your local hardware store for a soldering iron, a stand, suitable solder and a tub of flux.

Make sure the Raspberry Pi Zero is the right way up and insert the male header into the correct holes at the back of the board, with the shortest pins facing down. If you turn the Raspberry Pi Zero over, you should see the pins protrude just above the board, which is where you’ll solder them into place.

Use a suitable object – such as the female GPIO header – to prop up the circuit board while you apply the solder. If you’ve never done anything like this before, check out this video of someone soldering a GPIO header onto a Raspberry Pi Zero, which we strongly recommend you watch.

Place the soldering iron in the stand, dampen the little cloth on the stand, then switch on the iron and wait for it to heat up. While waiting, dip the end of the solder wire into the flux to help prevent it sticking. When the iron is hot enough, dip its tip into the flux.

Now place the tip against one of the corner pins. Introduce the solder to it and wait for a bit to melt off and fix the pin in place. Repeat for the pin in the opposite corner. At this point, switch off the iron and wait a few seconds for the Raspberry Pi Zero to cool down.

Pick it up and turn it over to verify the solder has taken and the pins remain straight. Flip the Raspberry Pi Zero over again, and solder the other 38 pins. As you gain confidence, you’ll find you can quickly move from one pin to the next. Remember to clean the soldering iron tip on the damp pad every now and then, and keep adding flux to prevent sticking.

Final steps

One of the frustrating things about the Pibow case we’ve used is that it seals off the MicroSD card slot, so the storage card needs to be inserted before you can put it in the case.

Follow the first three steps of the walkthrough on the next page to prepare your MicroSD card with Pi MusicBox, the software we’re using here. At the time of writing, the latest version (0.6) is incompatible with the Raspberry Pi Zero, but we found a specially modified build that works perfectly, which is the version you’ll download in step one – or you can visit Pi MusicBox’s site to see if a newer official version that works with the Raspberry Pi Zero is ready.

Once your MicroSD card is ready, insert it into the Raspberry Pi Zero, attach the Wi-Fi adaptor and switch on the Pi Zero. You’ll notice you don’t need a keyboard or monitor – Pi MusicBox is designed to work headless, allowing you to access and administer it remotely using any web browser.

Direct your Mac or PC’s web browser to musicbox.local to do that. After verifying that everything’s working correctly, click System and choose Shutdown to power off the Raspberry Pi Zero. Disconnect all cables, leave the MicroSD card in place, and then assemble the Pibow case.

Once that’s done, plug the Pi-DAC Zero into the Pi Zero’s GPIO header. It should fit snugly and securely. You can now power the Raspberry Pi Zero back on and follow the final two walkthrough steps to finish basic configuration. Connect the Pi-DAC Zero to your stereo, set the correct input, then test the connection using your Mac, iPhone or iPad.

When selecting an AirPlay device, you should see MusicBox is listed as an available target on your network. Select it and enjoy your music full blast through your stereo.

How to set up Pi MusicBox
1. Create a bootable image

Download the archive containing a Pi Zero-compatible version of Pi MusicBox and extract the IMG file from it. Next, get Pi Filler and then open this app and point it at the image you just extracted to create a bootable MicroSD card.

2. Locate configuration file

Once your bootable MicroSD card is ready, eject and then reinsert the card. Open the card in Finder, go to the config folder on it. Hold Ctrl and click the file named settings.ini, then choose Open With > Other. Select TextEdit and click Open to edit the file in plain text mode.

3. Add Wi-Fi details

Locate the [network] section and add your wireless network’s SSID to the line that begins ‘wifi_network = ‘. Type the password required to access the network to the right of the line that begins with ‘wifi_password = ‘. Save the file, eject the card and you’re good to go.

4. Boot and access

Insert the card into your Raspbery Pi Zero and switch on the computer. A flashing green light should indicate it’s booting correctly. Wait a few minutes, then open Safari on your Mac and enter musicbox.local in its Smart Search field. You should see a page like the one below.

5. Change audio output

In Pi MusicBox’s administration page, choose Settings, then expand Audio, click the HDMI pop-up menu and choose ‘IQ Audio DAC’. Flick the ‘Downsample USB’ switch to the Off position. Expand the MusicBox section and flick ‘AirPlay Streaming’ to the On position.

6. Test connection

Scroll down to the bottom of the page and click ‘Update settings (reboot)’. Wait while your Raspberry Pi Zero reboots, then connect the Pi-DAC Zero to your stereo system’s auxiliary input and try to stream using AirPlay from your Mac or iOS device to Pi MusicBox.

Enjoyed this article? Get more tutorials, guides, and tips on how to get the most from your Apple devices inside MacFormat. Take advantage of an exclusive offer in our sampler today.

Leave a Reply

Your email address will not be published. Required fields are marked *