Music Player based on Raspberry Pi A and B (rev. 2 with P5 header)
Music Player based on Raspberry Pi A and B (rev. 2 with P5 header)
With the newer generations of Raspberry Pi releases, many people will have to replace their older Raspberry Pi model A or B with a new Raspberry Pi A+, B+, 2 or 3. But it would be a shame to throw the old Raspberry Pi away. While it’s true that the new generations are more powerful, there are many things that don’t need much processing power. One of these is music playback. Here is a simple way to use a HiFiBerry DAC to transform your old Raspberry Pi into a high-quality audio system in about a half-hour. These instructions assume you have the standard HiFiBerry with the RCA connectors, and are using a Windows PC or Mac for setting up and controlling the system.
Step 1: Add the P5 header to the Raspberry Pi
I2S is the source of the highest-quality audio available from the Raspberry Pi. Here is how to get access to this great audio stream. You need a revision 2 of a Raspberry Pi A or B (1st generation of Raspberry Pi). Most of these Raspberry Pi’s are revision 2, but here is how to recognize each version: The biggest visual difference is the addition of the 2 gold-ringed mounting holes on version 2.
An 8-pin header is supplied with the HiFiBerry DAC; it needs to be soldered into the holes adjacent to the GPIO connector (labeled P5). The picture on the left shows the holes for locating the new header just below the big GPIO connector. The picture on the right shows the new header in place. This is really not that hard, but there is a great demonstration video if you need to see it by yourself; it can be found on the ‘First Steps’ instruction page.
Step 2: Plug it all together
If you have the nylon spacer, install it into the Raspberry Pi mounting holes. Alternative spacers can work as well, but be careful not to short anything on either board.
Plug the HiFiBerry DAC onto the GPIO and P5 headers and onto the spacer. Be careful to make sure all three align before pushing the DAC down. It’s a snug fit, but doesn’t take much force. Fix it in place with the nylon nut on top of the spacer.
Now that the hardware’s sorted, it’s time to connect your Raspberry Pi assembly. You’ll only need to connect the power supply into the microUSB socket and plug your Ethernet cable into the Ethernet socket (wireless is easy, but that’s for next time). Then, connect your RCA cables from your amplifier to the sockets on the HiFiBerry DAC.
Step 3: Create a Volumio SD card using the HiFiBerry installer
Volumio is a great pre-packaged operating system distribution for the Raspberry Pi. It is based on Debian (like Raspbian), but has a lot of audio optimizations and provides a simple interface for playing audio right from startup with minimal tweaking around. Find all the information (and downloads) here: http://volumio.org
To make the installation even easier than downloading their image from this webpage and installing it on an SD card, we’ve included it in our installer, which downloads and installs Volumio with the DAC preconfigured. You can find the installer for Windows and Mac here: https://www.hifiberry.com/guides/hifiberry-installer/ .
Download the installer and run it on your system as described in the article. If you’re in Windows, make sure you run it with a right-click “Run as administrator”. Insert the SD card in your computer’s SD card writer and either follow the installer’s guide to select the right distribution, or just select “I know what Linux Distribution I want to install”, and directly after choose Volumio from the selection options. On the next screen, select your Raspberry Pi model, which should be Model A or B, since this is the guide for the first generation models.
On the following page, select the audio board you are using, e.g., the DAC.
After this is done, the installer starts downloading the distribution, preconfigures it, and installs it on your SD card. This all takes a while. Once it’s done, you just have to insert it into your Raspberry Pi.
Step 4: Configure Volumio
Power up the Raspberry Pi and wait for it to boot. Connect to Volumio from any computer on your network by entering the following address into the address bar of your browser: volumio.local. You should see the main Volumio screen that will look something like this:
Setup your music source by going to the top right side of the Volumio screen, click on ‘Menu’, and select ‘Library’ from the pull-down menu. This now shows the possible sources for your audio files that Volumio can handle. Assuming you have some audio on an NAS drive, click on ‘add new mount’. On the new screen you’ll need to enter the following information:
- Source name: You can be creative here—it’s is just for your reference when accessing music later.
- Protocol: You can probably leave this at SMD/CIFS in a Windows environment.
- IP address: You need to enter the address of your NAS drive. If you’re not sure about this, a network scanner can be useful. For instance, try this one: http://www.advanced-ip-scanner.com/
- Remote directory: This is the directory where your music can be found on your NAS drive.
- Click ‘Save Mount’. There will be a pause with a ‘Connecting’ message, after which you’ll see a message from Volumio telling you that it’s scanning your music collection and indexing it. The index will allow it to rapidly list your music collection. Don’t panic if this takes quite a long time—this indexing only happens once. You’ll also need to repeat the indexing if you add files to your music collection.
If you used the installer as described above to install the system, this is it—everything is ready to use.
If you installed Volumio directly from a download from their webpage, you’ll need to select the HiFiBerry DAC as the output. Select ‘System’ from the top right side drop-down menu. On this new page, scroll down to the entry ‘I2S Driver’, select ‘Hifiberry’, and click on ‘Apply’.
Once all this setup is complete, reboot your Raspberry Pi by selecting ‘Turn off’ on the top right side drop-down menu, and select click on ‘Reboot’.
Step 5: Enjoy great audio
Once the Raspberry Pi has rebooted, go back to the main Volumio page and choose something to listen to by clicking ‘Browse’ in the bottom left of the screen. This will show you a list of music sources that you’ve configured. One of these should be the NAS label that you entered above. Click on this and you’ll see the top-level listing of your music collection. Just browse through, select your favorite, and enjoy great-sounding audio.