One of the best ways to improve the sound quality of your Raspberry Pi streamer is to use a DAC Hat. It would be nice if the process of adding a DAC was plug-and-play, but as of now many DAC Hats don’t work straight out of the box.
In this post we’ll go through the process to enable the Allo Boss DAC hat for your Raspberry Pi. I’m using this DAC with one one of my Headless Plexamp Endpoints.
For this post, I’m using the Allo Boss DAC 1.2, which provides excellent sound quality for my Plexamp endpoint.
If you’re using the Innomaker RPI HIFI DAC you should refer to our similar guide to Install the Innomaker DAC Hat.
What is a DAC Hat?
A DAC Hat (Digital to Audio Converter Hat) is a piece of hardware that can be used to improve the sound quality of your Raspberry Pi. It converts digital audio signals into analog audio signals, resulting in improved sound quality.
How Does a DAC Hat Work?
A DAC Hat works by connecting to your Raspberry Pi via the GPIO pins. Once connected, it will convert digital audio signals into analog audio signals, which can then be sent to speakers or headphones, allowing you to get better sound quality from your Raspberry Pi.
How to set up Allo BOSS DAC hat for your Headless Raspberry Pi
Follow this guide to improve the sound quality of your Raspberry Pi by configuring a DAC hat. With a DAC Hat, you can get considerably better sound quality from your Raspberry Pi.
Project Cost: $78 – $99
Total Time: 20 Min.
Tools and Supplies
Here is a list of tools and equipment that you should have on hand before you begin this project:
Tools
-
Terminal or another Command Line Interface tool
You’ll need to use Terminal or a similar Command Line Interface (CLI) to get access to configuration files in the Raspberry Pi. It will be helpful if you already have some experience with CLIs, but these steps should still be simple enough for someone without command line experience to follow.
Supplies
-
A Raspberry Pi 2, 3 or 4
For this tutorial I am using a Pi 4 with the included power supply. If you don’t have a Raspberry Pi handy, I would recommend buying a Raspberry Pi 4 Starter Kit from CanaKit. They offer a variety of kits, but each configuration will include everything you’ll need to get started.
In writing this tutorial I’m using a Raspberry Pi 4 with 4GB of RAM, but I’ve read user reports that a Raspberry Pi 3B+ and up should work, and reports that 2GB of RAM is sufficient if you’re building for a Plex server (for example).
-
Allo Boss 1.2 DAC HAT for Raspberry Pi
Get the Allo Boss DAC HAT Board for Raspberry Pi 2, 3, or 4. This is a great DAC option if you’re looking for the best sound out of your Raspberry Pi.
-
Power off your Raspberry Pi and attach the DAC hat
To get started, you’ll need to connect the DAC Hat to your Raspberry Pi and configure it.
Power off your Raspberry Pi, and then attach the DAC hat to the GPIO pins. Once connected, you can power the Raspberry Pi back on.
-
SSH into your Raspberry Pi
If you’re following our Complete Guide to creating a Headless Plex Server with Plexamp endpoints using a Raspberry Pi you should already be familiar with how to SSH into your Raspberry Pi, but if you need a refresh you can visit the guide How To SSH or Secure Shell into your Raspberry Pi
On your computer, launch your command-line interface app (Terminal, in my case) and enter the following command, where username is the SSH username and hostname is the hostname you created in Raspberry Pi Imager:
ssh username@hostname.local
Then hit Enter and follow the prompts as you normally would.
-
Enable the audio module for Allo Boss DAC Hat
To add the Allo Boss DAC hat option to the Raspberry Pi you will need to add a line of text to a configuration file.
Use the following command to open the config.txt file
sudo nano /boot/firmware/config.txt
Scroll down to the bottom of that file and add the following text. Make sure it’s pasted exactly as you see it in the screenshot:
dtoverlay=allo-boss-dac-pcm512x-audio
With that new line added, hit the following key command to Write Out and save the file:
Control + O
Hit ENTER
Then exit the config file with the following key command:
Control + X
-
Reboot the Raspberry Pi
This is a good time to reboot the Raspberry Pi with the following command:
sudo reboot
Hit ENTER
Then SSH back into the Pi:
ssh username@hostname.local
Hit ENTER
You may also need to re-enter your password.
-
Find the output device number for your DAC
With the DAC hat attached and enabled we’ll just need to find the device number. Check the device number with the following command:
aplay -l
Hit ENTER
This should show you an initial list of devices. For the Allo Boss DAC you’ll want to look for the BossDAC listing.
NOTE: Allo Boss can be powered independantly or via the Raspberry Pi power source (default). If you’re powering the Boss DAC independently for performance reasons, don’t forget to power up your Allo Boss DAC.
rm ~/.asoundrc
If you are asked to confirm the deletion, type yes
Hit ENTER
Then run the following command in Terminal:
cat /proc/asound/cards
Hit ENTER
This will pretty much just confirm the device number of the DAC. You can see in the screenshot that the device number in my case is 3
-
Set the device as the default Soundcard
Now we’ll sent the device number we found as the default soundcard, which should automatically select the DAC as our output device each time you launch the Raspberry Pi.
Use the following command to create and open the sound config file:
sudo nano /etc/asound.conf
Hit Enter
Now, paste the following code block at the bottom of the file:
pcm.!default { type hw card 3 } ctl.!default { type hw card 3 }
Remember to replace the card number with the device number you found in a previous step.
With that new line added, hit the following key command to Write Out and save the file:
Control + O
Hit ENTER
Then exit the config file with the following key command:
Control + X
-
Reboot the Raspberry Pi
This is a good time to reboot the Raspberry Pi with the following command:
sudo reboot
Hit Enter
Then SSH back into the Pi with the following command ( you know this one by now 😊 )
ssh username@hostname.local
Hit Enter
-
Access the Raspberry Pi config file to change the default audio settings
Now you’ll set the newly added DAC as your default audio output in the Raspberry Pi configuration file.
Use the following command to open the Raspberry Pi configuration UI:
sudo raspi-config
Hit ENTER
Select System Options → Audio
Select BossDAC from the output list, then select Ok
Important: The device number in the audio output settings should match the device you set as the default soundcard. If it doesn’t, reboot the Raspberry Pi again and re-check
sudo raspi-config
-
Reboot the Raspberry Pi
Yes, once again you’ll need to reboot the Raspberry Pi with the following command:
sudo reboot
-
Launch Plexamp in your browser to see your device
If you’re using a Headless Plexamp player, you should now see the device in your list of Audio Device options by navigating to Settings → Playback → Audio Output → Audio Device
Note: I’m assuming here that you have your Headless Plexamp configured to launch automatically when you boot up your Pi. If not, you’ll need to launch Plexamp manually.
To launch Plexamp manually enter this command in Terminal:
node plexamp/js/index.js
Hit Enter
Then navigate to:
http://#.#.#.#:32500
Remember to replace #.#.#.# with your Pi’s own IP address, which you can find with the following command:
hostname -I
-
Start Listening
At this point your Raspberry Pi should self-select the DAC hat, by default, each time you power up the Pi. You can test this hooking the output of the DAC to your AMP and start streaming.
If that’s not the case the first thing you should do is reboot the Pi:
sudo reboot