Pi Zero with PhatDAC

Raspberry Pi Zero with PhatDAC streaming player (SqueezeLite)

While most modern sound devices have a streaming client built in (AirPlay or DLNA), there’s no point in replacing perfectly good kit if such an option is missing. I have two Denon hifis that sound excellent, but are limited to CDs and radio (though the later model does have a USB input for iPods, I’ll never buy an Apple product if I have another choice). Fortunately, each of them has aux, which means that I can add a streaming player using a Raspberry Pi.

The on-board sound of a Raspberry Pi is not very good (I tried it first). However, there are various cheap add-on boards that resolve this issue, and for this article I’m building a stream player using a Raspberry Pi Zero and a Pimoroni PhatDAC. This allows me to connect to the aux on the older Denon hifi (the later model supports SPDIF, so I’ll be using a HifiBerry DigiPro for that, which will be covered in another post).

Setting up the hardware

I bought a Raspberry Pi with the GPIO pins already soldered, so installing the PhatDAC was as simple as connecting the two together.

Setting up the Raspberry Pi Zero

As usual, the Raspberry Imager is the easiest way to do this, and in this case I installed Raspbian OS (Debian Bullseye version). Once done, the card slots into the Pi and it can be powered on. Everything else is done using PuTTY.

Once logged in, I always start with:
sudo apt update
sudo apt upgrade
sudo reboot

Configure PhatDAC

After that, it’s time to configure the PhatDAC. I simmply followed the instruction here for automatic setup, so all I needed to run was:

curl https://get.pimoroni.com/phatdac | bash

Install Squeezelite

Installing SqueezeLite was done with:

mkdir squeezelite
cd squeezelite
wget https://kumisystems.dl.sourceforge.net/project/lmsclients/squeezelite/linux/squeezelite-1.9.9.1401-armhf.tar.gz
tar -xzf squeezelite-1.9.9.1401-armhf.tar.gz
sudo mv squeezelite /usr/bin/squeezelite

Note that version numbers could change, but were correct at time of writing this post.

The final step is to configure SqueezeLite to run as a service. To do this, we first need to know which sound device to target. We can get this using:

squeezelite -l

Then, to install as a service:

sudo nano /etc/systemd/system/squeezelite.service

The above file was configured as follows:
[Unit]
Description=Squeezelite
After=network.target
[Service]
ExecStart=/usr/bin/squeezelite -o hw:CARD=sndrpihifiberry,DEV=0 -n pizeroplayer -s 192.168.0.254
[Install]
WantedBy=multi-user.target

And to configure the service to start at boot:
sudo systemctl enable squeezelite.service

Conclusion

Once the above is complete, the player can be connected to any suitable hifi (or other sound device) and streamed to from LMS (I either use the web UI from a computer, or Squeezer from my phone).

The sound quality is excellent, and as far as I can tell this is one of the cheapest ways of building a streaming player (certainly cheaper than any off-the-shelf product I could find).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.