The Pimoroni pHAT DAC add-on board is an affordable audio-quality upgrade for your Raspberry Pi Zero W (or the Raspberry Pi 2 and newer). Adding Musicbox provides handy features such as Airplay for iOS and Android devices, streaming, and various online services, with a nice web interface that works out of the box!
At a glance, the pHAT DAC audio specifications are:
- 24-bit audio at 192KHz
- Line out stereo jack
- Optional landing for dual RCA phono connector
- PCM5102A DAC over the Raspberry Pi's I2S interface
- Compatible with Raspberry Pi 3B+, 3, 2, B+, A+, Zero, and Zero W
Before you decide to use Musicbox, there's a few things to consider:
- The recommended way to upgrade is just to download the latest version and reinstall - this means you'll need to back up your configuration and reapply that to the new install
- Pretty much everything in Musicbox runs as the highest privileged root account - from a security perspective, this means you're not applying the Principle of least privilege , meaning that if someone gets access to your Raspberry Pi, they get access to everything on it
- Musicbox is headless, meaning that once it is setup, you don’t need a monitor to run it - it just sits on your network; accessible via a web browser on your computer, or mobile device on the same network.
- A Raspberry Pi 2 or newer, to meet pHAT DAC requirements.
- A pHAT DAC board fitted to your Raspberry Pi’s GPIO pins.
- A suitable amplifier or powered speaker to connect to the pHAT DAC line-level output socket.
- A network connection for your Raspberry Pi, either wired or wireless; this is how you will access your Musicbox web interface.
- A text editor such as vim, nano, emacs or GUI equivalents.
Enabling the pHAT DAC on Musicbox
Step 1: Install Musicbox
- Download Musicbox for your Raspberry Pi flavour:
Pi MusicBox - A Spotify, SoundCloud, Google Music player for the Raspberry Pi, with remote control
- Follow the directions for putting Musicbox onto a microSD card and boot your Raspberry Pi.
Step 2: Configure Musicbox for the pHAT DAC
- Either connect a monitor to your Raspberry Pi, or directly connecting the microSD card to another computer.
- Edit the file in the /boot directory, called config.txt.
To redirect the Pi audio output, comment the
dtparam= line, by putting hash in front of it, as shown:
- Add the following line at the bottom of config.txt:
Reboot your Raspberry Pi. You should now be able to access the web console by visiting your Raspberry Pi’s network address in your browser (it takes a while to come up). Remember to plug your amplifier or amplified speakers into the pHAT DAC line out socket, and not the Raspberry Pi one.
You can get more information on the Musicbox project here:
There's also loads of downloadable 3d printing designs for your Pi at Thingiverse:
The case pictured in this tutorial is from https://www.thingiverse.com/thing:559858 byAdrienadr and is licensed under the Creative Commons - Attribution - Non-Commercial - Share Alike license.