Lukas Mönch blog

How I turned my old Stereo Amp To A Smart Spotify and AirPlay Player

Smart everything is the new Standard for all kinds of devices, even in the good old HiFi amplifier segment. New amps have fancy connectivity like WiFi, Soptify and AirPlay support built-in. But why buy a whole new Amp if your good old HiFi stereo still works just fine?

In this project I want to use a Raspberry Pi as a smart Audio source that can stream Spotify and audio from iOS devices via AirPlay. In addition to that the Pi should be able to change the input channel on the stereo amp via infraread when audio is playing. The Amplifier should be turned on automatically by toggling a smart wall plug as well.

For this project I used the following components:

1. Preperation

First of all, some components have to be assembeled. Solder a header to the Raspberry Pi and the prototyping board. Solder the stacking header to the HiFiBeerry board.

Use a tool like Etcher to flash the ‘Lite’-version of the Raspbian OS on the SD card.

Next, we need to setup the WiFi-Connection and enable SSH access, so we can reach the Raspberry once it is powered up. To do this, mount the SD Card on your computer and add the following files to the boot/ partition:

Add the file wpa_supplicant.conf with the following contents and change the country, ssid and psk (WiFi Password) variables accordingly. This assumes your Access Point uses WPA-PSK-Encryption. :

country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1
network={
     ssid="WiFi SSID"
     scan_ssid=1
     psk="WiFi Password"
     key_mgmt=WPA-PSK
}

Second, add an empty file named SSH to the root partition.

Now insert the microSD card into the Pi, find the Pi’s IP Adress in your Access Point admin panel and ssh into the system using Putty for Windows or the command ssh pi@ip-of-your-pi on mac and linux.

2. Software: raspotify and shairport sync

For spotify playback we use the raspotify library. This allows us to control music via a Spotify mobile or desktop app using the Spotify Connect feature. The shairport-sync library is used as a AirPlay reciever.

To install raspotify, simply run this command on your pi:

curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

For shairport-sync, follow this guide to download, install and build the package.