Cooking with sound

This project was to enable us to play audio content (music/podcasts/radio) from our iPhones/iPad in the kitchen. It took me under an hour to complete…

Why?

We already use the Apple Airplay facility to play audio content in our living room using iOS devices + an AppleTV connected to a sound system. We wanted to get a similar setup in our kitchen at a low cost.

Time needed

The initial work took my under an hour, but then the subsequent troubleshooting (see Issues below) took another couple of hours at least.

Kit

  • Raspberry Pi Model B
  • Wifi Dongle
  • Logitech mm50 (or similar)

This set of kit was chosen for no better reason than I had it lying around not really doing anything (my son uses the Raspberry Pi sometimes but generally uses an old laptop rather than the Pi now).

The Logitech mm50 (http://www.macworld.com/article/1046722/logitechmm50.html) is an old iPod doc with an audio line in for a 3.5mm audio jack. As far as I can see the Logitech Pure-Fi Anywhere 2 is the same basic product (http://support.logitech.com/en_us/product/pure-fi-anywhere2). You can pick either of these models up second hand on eBay for under £30 (quite possibly much less).

Software

  • Raspbian Wheezy
  • Shairport-sync (https://github.com/mikebrady/shairport-sync)

This is open source software which enables streaming of audio (not video) content using Apple’s airplay protocol. It is a fork of the original Shairport software (which is no longer in development) but has added extra functions and seems to be under active development.

The Build

(ok, calling this a ‘build’ is over selling it a bit …)

All the software side of this project was based on the instructions at http://www.redsilico.com/multiroom-audio-raspberry-pi. For my purposes I didn’t need a DAAP/iTunes server because we only wanted to play audio directly from our iOS devices, which all support AirPlay already. I also already had the Raspberry Pi setup with the Wifi dongle so I basically started from the section headed “Install AirPlay software” using the instructions for shairport-sync.

I also checked and read through the instructions for shairport-sync on the shairport-sync github page to make sure I wasn’t missing anything.

Having installed the software and got it running, I attached the Logitech speakers to the Pi and successfully played music from my phone to the Pi – the tech part was done.

The Logitech mm50 (and the Logitech Pure-Fi Anywhere series) have two little metal feet that swing out at the back to stand up the speakers. I drilled a couple of small holes in each of these, then using these holes screwed the device upside down to the underside of a kitchen cabinet (and near a power socket but away from anything that might cause problems like steam from the kettle).

Then I used a large drill bit to drill a large enough hole to fit through the wires/connectors (the power cable for the Pi and the audio cable to join the Pi to the mm50). Finally, I put the Pi in the cupboard, pushe through the power and audio connectors, plugged everything in, and that was it – all done!

 

IMG_3184

Issues

I immediately tested the setup and it worked perfectly – I was able to stream music, BBC radio iPlayer content, Podcast content from my phone to the Pi.

However when I came back the next day and tried to use it again, my phone didn’t display the Pi as an Airplay option. I found that various things seemed to make the Pi display as an Airplay option again, but it always went away when it wasn’t in use and I had to somehow ‘trigger’ it again (one odd thing was that the Pi continued to display as an Airplay source in iTunes on my Mac, even when it didn’t appear on my phone). I reported this as an issue on the shairport-sync Github site and the developer (Mike Brady – who is very responsive and helpful) responded with some hints. After doing quite a bit of Googling, digging into how so called ‘zero-conf’ works, and looking at documentation around Airplay, I finally found the issue was not with shairport-sync or any of these things, but actually the Wifi dongle I was using going into some low power mode which meant it needed a prompt to ‘wake up’ and work.

I found this issue documented with a solution at https://www.raspberrypi.org/forums/viewtopic.php?t=61665).

In brief, the solution is:

In the directory /etc/modprobe.d/ make a file called 8192cu.conf
Add the following lines to the file and save it:

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Once I’d done this a rebooted, the system worked without a problem.

IMG_3187