I wanted to replace my old bathroom radio with a more contemporary device by building a network-enabled speaker. Because I'm a user of several iDevices, the idea of making the speaker AirPlay-compatible became the basis of my further work.
After some googling I discovered James Laird's amazing shairport client for Linux. The initial installation on the RasPi worked like a charm, so I decided to take the project one step further by making it wireless. With a little help from Google again and some twiddling I finally got it to work and started writing this Instructable.
Have fun reading how it all went down and maybe build your own version of the raspbAIRy.
Step 1: Parts & Tools
220V AC to 5V DC power supply
White LED, 5mm
3,5 mm audio socket and cable
Cable with power plug
600 x 200 mm artificial leather
Screwdriver and screws
Soldering iron and solder
Other typical workshop equipment
Step 2: Electronics
- Stereo to Mono
- Input Switch
- Mono Amp and speaker
- Power Supply
Step 3: Installation
- Raspbian 'wheezy'
The following steps require some basic command line skills but if you stick to the linked tutorials you should be good.
- Install some packages and their dependencies, that shairport uses, via apt-get
- Get shairport and the perl module Net::sdp via git
- Install shairport as a service and make it run at startup
- Here is what I did (commands in italic):
- Updated apt-get
- $ sudo apt-get update
- Installed vim (personal preference)
- $ sudo apt-get install vim
- List USB devices to get infos on wifi dongle
- $ lsusb
- Installed Ralink-Firmware
- $ sudo apt-get install firmware-ralink
- Modified the interfaces config
- $ sudo vim /etc/network/interfaces
- auto lo
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
- $ sudo reboot
- Checked that wifi is running
- $ ifconfig -a
- Installed all dependencies for shairport
- $ sudo apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils
- Installed Net::SDP for iOS6 support
- $ git clone https://github.com/njh/perl-net-sdp.git perl-net-sdp
- $ cd perl-net-sdp
- $ perl Build.PL
- $ sudo ./Build
- $ sudo ./Build test
- $ sudo ./Build install
- $ cd ..
- Got shairport from git
- $ sudo git clone https://github.com/albertz/shairport.git shairport
- Changed to shairport directory and compiled
- $ cd shairport/
- $ sudo make
- $ sudo make install
- Copied the init sample to startup folder and set rights
- $ sudo cp shairport.init.sample /etc/init.d/shairport
- $ cd /etc/init.d
- $ sudo chmod a+x shairport
- $ sudo update-rc.d shairport defaults
- Changed name of shairport client
- $ sudo vim shairport
- changed the following lines:
DAEMON_ARGS="-w $PIDFILE -a raspbAIRy"
- Set audio output to line
- $ amixer cset numid=3 1
- Started shairport
- $ sudo /etc/init.d/shairport start
Step 4: Case
- The case is a simple 200 x 200 x 210mm cube-shaped box made of 5mm MDF, with the side parts being mitered with a 45° angle.
- On the front I made cutouts for the speaker, the volume knob and the power LED. It was covered with light-grey speaker cloth and clipped on with wooden dowels.
- The back shows holes for the power chord, power switch, audio jack and input switch and is held in place by wood screws.
Step 5: Wiring
- All of the audio wiring was done according to Step 2. The RaspberryPi got its own 5V DC power supply with a soldered-on MicroUSB connector.
Step 6: Final closeups
Step 7: Modifications and future plans
- Switching from Raspbian to ArchLinux to decrease boot time from ~35 to 6 seconds
- Adding an audio output socket and switch
- Adding bluetooth support for non-Airplay devices