Round about two years ago, I started to play around with Shairport on Raspberry. Over the time the solution become a great part to listen podcasts and Music in the house. Unfortunately, a Raspberry and an attached speaker wasn't looking nice. Stumbling over the IKEA hack web page the idea was born to put the Raspberry in one of the IKEA bamboo boxes I had at home.
Assembling the hardware
Setting up the software
In the end the result will look like this.
The project did not focus to high end HIFI and therefore I did not spend any time calculating a perfect speaker. The equipment for the speaker is very cheap to keep the budget at a lower level.
Assembling the hardware
What did I use
All together I spend less than 60 or 70 Euros - well for this price you will find wireless speakers with Bluetooth... probably also with better audio quality. But of course you will not find a Airplay compatible speaker nor have the fun of tinkering the things.
The amp uses 12V, so the box will run on 12V power source. The source of the Raspberry Pi is 5V. To convert the 12V input voltage I removed all plastic parts and from the USB charger and soldered some wires on it.
Before assembling the raspberry and the speaker into the IKEA box, I soldered the resistors and the potentiometer to a stereo to mono converter. The layout should be as in this diagram:
After finalizing the electrical work, I need to macgyver the box. Honestly I think that I am not very skilled for wood work but luckily all of this would be covered in the IKEA Box and by a piece of fabric :) I finished the assembling after I completed the software configuration because until the completion of the network configuration a keyboard and display was necessary.
Setting up the software
As in the most of my project i have chosen Raspbian as operation system. It's a Raspberry specific Port of the always stable Debian. What we need more?
Download the latest version of Raspbian Jessie from the
Raspberry Pi project site. In a first step I removed all the unnecessary packages:
sudo apt-get purge console-setup desktop.* desktop-base dillo gnome.* gsfonts gtk.* gvfs.* libgtk.* libqt.* libxcb.* libxfont.* libxt.* lightdm lxde.* lxpanel omxplayer openbox penguinspuzzle python-tk python3-tk shared-mime-info tcl.* x11.* xarchiver xauth xdg-.* xkb-data xinit xserver.* wolfram
Afterwards the network configuration. First the WIFI passphrase will be stored as hash value in the conf file:
sudo wpa_passphrase mywifi mypass>> /etc/wpa_supplicant/wpa_supplicant.conf
In
the next step the WIFI adapter wlan0 will be configured as DHCP, which
means that the Raspberry will get it's IP address from the router the
config file should look like this:
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "ssid"
wpa-psk "password"
The network configuration is complete and the interface can be restarted:
sudo ifdown wlan0 && sudo ifup wlan0
After a few seconds we check if the wifi interface has been connected to the Router and obtained a IP address:
sudo ifconfig
Next step was to update and upgrade the OS:
sudo
apt-get -y update && sudo apt-get -y upgrade
After the successfull update a new firmware has been installed:
sudo rpi-update
Okay the OS is up to date, now we can install some necessary packages for Shairport:
apt-get install autoconf libtool libdaemon-dev libasound2-dev libpopt-dev
avahi-daemon libavahi-client-dev
git
The next step is to clone the Shairport sources from git
git clone https://github.com/mikebrady/shairport-sync.git
When it is done we change the directory
cd shairport-sync
an build the config files for the installation of Shairport
autoreconf –i –f
followed by a configure command with following options:
./configure --with-alsa --with-avahi --with-ssl=openssl
in the next step Shairport will be compiled from the cloned source
make
and finaly installed.
make install
For Raspian Jessie is a start up script nessesary, to ensure that Shairport will come up on boot. Create a new file with the following command
nano /etc/systemd/system/shairport-sync.service
and paste this contend (change the bold part for YOUR Shairport name):
[Unit]
Description=Shairport AirTunes receiver
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service
[Service]
Type=simple
ExecStart=/usr/local/bin/shairport-sync -a "MyShairport"
Restart=always
[Install]
WantedBy=multi-user.target
After saving the file, the script need to be added to systemd services:
systemctl enable shairport-sync.service
Done. Shairport can be started with the command:
systemctl start shairport-sync.service
to check if the start was successful:
systemctl status shairport-sync.service
The result should ne something like this.:
shairport-sync.service - Shairport AirTunes receiver
Loaded: loaded (/etc/systemd/system/shairport-sync.service; enabled)
Active: active (running) since Sun 2015-03-01 17:33:51 UTC; 3s ago
Main PID: 3040 (shairport-sync)
CGroup: /system.slice/shairport-sync.service
ΓΆΓΆ3040 /usr/local/bin/shairport-sync -a MyShairport
Mar 01 17:33:51 spi03 systemd[1]: Started Shairport AirTunes receiver.
Mar 01 17:33:51 spi03 shairport-sync[3040]: startup
Okay now we do a reboot and check if the Raspberry will obtain a IP address and Shairport is starting. If so, after a few seconds the Shairport will be available as target in iOS.
As I mentioned before, the final assembling has been done after successful software configuration. The result is a low budget Airplay player in a nice box. :)