A great way to use the Raspberry Pi is to use it for an audio receiver. Setup with your Stereo will allow a whole new world of possibilities. Using Spotify Connect (Premium required) you can stream in music all day without needing audio pushed from another device. With Bluetooth connectivity, you can connect your smart devices like Alexa, Google Home, or Mycroft. And with Apple Airplay and UPnP you pretty much have all the bases covered for listening to anything through your stereo.

If your using a Raspberry Pi 3 or older, you will need a Bluetooth dongle. The Raspberry Pi 3 does have integrated Bluetooth, but there is a known issue where WiFi and Bluetooth usage at the same time causes interference. Bluetooth dongles like this are cheap and work well.

This guide will show you how to configure usage with a DAC as the Raspberry Pi doesn’t have the cleanest audio output. This is optional however, you don’t need to configure it if you don’t have one. I am using a Cambridge Audio DacMagic, but there are certainly cheaper alternatives that work great as well.

Lets install Raspian Lite

Lets grab the latest release version of Raspian Lite from here.

https://www.raspberrypi.org/downloads/raspbian/

Once downloaded, write the image to your SD card. If your new to writing images, there is a great cross-platform program called Etcher you can use to write to the SD card. It can be found here.

https://etcher.io/

Once your have written to the SD card, lets insert and start our Raspberry Pi.

Configure Raspian Lite

On first boot, we will need to do some initial configuration on the Raspberry Pi. First we need to log into the system with the following.

User: pi

Pass: raspberry

This will log us in with the default user/pass. Now at the command prompt, enter the following.

sudo raspi-config

Change your default password. (You may want to set your keyboard layout first under localization options)

Configure your network options.

Configure your Localization settings.

Under Interfacing Options, set SSH to be active.

Once complete, select Finish to reboot the system.

Once restarted, lets now login to our Raspberry Pi again using SSH or the console again with

User: pi

Pass: (new password)

Now lets see if there are any updates for Raspian using the following commands.

sudo apt-get update sudo apt-get upgrade -y sudo apt-get dist-upgrade -y sudo reboot

If your using a Bluetooth Dongle

Lets disable the onboard Bluetooth so we don’t run into any conflicts.

sudo nano /boot/config.txt

Now scroll to the bottom of the file, and add the following to the end of the file.

# Disable onboard Bluetooth dtoverlay=pi3-disable-bt

Press Ctrl+x, press y to save the changes, and enter to exit the editor.

Now at the prompt, enter the following command.

sudo systemctl disable hciuart.service

Lets Configure the Raspberry Pi to use our DAC

If your using a USB DAC, we will need to configure the Raspberry Pi to use the USB connection by default when rebooted. To do this, we need to reconfigure the order it uses for audio devices. Lets create a new config file with the following command.

sudo nano /etc/modprobe.d/alsa-base.conf

Now in the new window, lets name and reorder our audio devices. Enter the following in our new file.

# sets the index value of the cards but doesn't reorder. options snd_usb_audio index=0 options snd_bcm2835 index=1 # does the reordering. options snd slots=snd_usb_audio,snd_bcm2835

Press Ctrl+x, press y to save the changes, and enter to exit the editor. Now, on reboot, our Raspberry Pi should default to the usb audio device. Lets give a quick reboot to save our new configuration files.

sudo reboot

Now lets setup our Audio Hub

First, lets name our Raspberry Pi to something meaningful for us to connect to. I am going to use the name Stereo. This will be the name that shows up when you are searching for the Raspberry Pi to connect to.

sudo raspi-config nonint do_hostname stereo sudo hostnamectl set-hostname --pretty &quot;Stereo&quot;

GitHub user nicokaiser has done a great job of creating a great set of scripts that automates much of the setup for us.

sudo apt-get install git -y git clone https://github.com/nicokaiser/rpi-audio-receiver.git cd rpi-audio-receiver

Lets setup the Bluetooth receiver. This will make the raspberry pi discoverable any time there isn’t an active connection and allow A2DP streaming.

sudo ./install-bluetooth.sh

Next lets setup our shairport receiver. This will allow audio input using Apples Airplay protocols.

sudo ./install-shairport.sh

Next lets set up Spotify Connect. This will allow you to use the Raspberry Pi as a Spotify Connect Device.

sudo ./install-spotify.sh

Lastly, lets configure UPnP so that UPnP devices can also use our new audio hub.

sudo ./install-upnp.sh

Some final configuration

Now lets adjust our output volume with the following command.

sudo alsamixer

Turn your default volume level up to anywhere from 85% to 100% and press ESC. Now we need to store this volume level for any time we reboot.

sudo alsactl store

Next, lets start up our Bluetooth. Enter the following commands.

sudo bluetoothctl power on discoverable on exit

Lets give our system one final reboot to make sure everything is live.

sudo reboot

All finished!

After our Raspberry Pi reboots, we should be able to have it stream in Spotify using Spotify Connect, pair it using Bluetooth, or stream directly to it via Apple AirPlay or UPnP! Thanks again to nicokaiser for taking the headache out of configuring everything separately.

If you found this guide helpful please leave me some encouragement below! If your really happy, you can always gift me a coffee, I can never say no to coffee!

I have also by request added a bitcoin donation address. If you want to show your appreciation I would be grateful, but under no means do you need to feel obligated. This is a fun hobby for me. 🙂

BTC: 1GzagpXcAkELhU5emJFMLZpp7J5ayf cNQF

And for those that have, thank you for enabling my coffee addiction! You all know who you are!