How to Build a Raspberry Pi Jukebox Any Non-Geek Can Use

You have tons of options for accessing your computer’s music library through your stereo, but most require some technical know-how to actually use. You can build a jukebox with a Raspberry Pi, a tiny microcomputer that anyone can use, even if they don’t know what a Raspberry Pi is.

When you finish this project, you will have a tiny touchscreen jukebox in your living room that can play, control, and select songs from your music library on another PC (or your NAS ) and then play them back. on your stereo. The interface here is simple to understand, so it’s great for parties or at home, where a few non-geeks might want to enter a playlist without having to learn a complex system, their computer, Wi-Fi password, or whatever. What’s more, it all runs on its own network, so you don’t have to worry about pairing devices or the like. You need to know a little about the command line to complete this project, but that’s about it.

What do you need

Step one: install Raspbian on the Pi

First things first: you need to configure and install Raspbian. If you’re using the PiTFT touchscreen display I used, it’s much easier to customize it with Adafruit’s custom Raspbian image . You will install the image to the SD card the same way you did with Raspbian, but the operating system will already be configured to display. You can follow our guide to create an image here , but here’s a short version:

Window

  1. Download the latest Raspbian and unzip the .img file inside.
  2. Download Win32DiskImager and unzip the application (.exe file) inside.
  3. Insert the SD card into your Windows computer using a card reader.
  4. Open Win32DiskImager.exe, the application you just downloaded, by double clicking on it. If you are using Windows 7 or 8, right-click it and select “Run as administrator”.
  5. If your SD card is not automatically detected by the application, click the drop-down menu in the upper right corner (labeled “Device”) and select it from the list.
  6. In the application section with image files, click on the small folder icon and select the Raspbian .img file you just downloaded.
  7. Click the Write button and wait for Win32DiskImager to do its job. When it’s over, you can safely remove the SD card and insert it into your Raspberry Pi.

OS X

  1. Download the latest Raspbian and unzip the .img file inside.
  2. Download the RPi-sd map builder (be sure to select the correct version for the OS X version you have installed) and unzip the application.
  3. Insert your SD card into Mac using a card reader.
  4. Open the RPi-sd Map Designer. You will be immediately prompted to select a Raspbian image. Select the .img file you downloaded earlier.
  5. You will be asked if your SD card is connected. Since we inserted it earlier, it is, so click “Continue”. You will be presented with SD card options. If you only have one inserted, you will not see anything else in the list and it will be checked. If not, just check only the card you want to use and click OK.
  6. Enter the administrator password and click OK.
  7. You will be asked if the SD card has been removed. This must happen because the application must unmount it in order for it to perform a direct copy. Check again that your SD card is no longer available in Finder. DO NOT remove it from the USB port. If you are sure, click “Continue”.
  8. The RPi-sd card maker finishes preparing your SD card, safely ejecting it, and inserting it into your Raspberry Pi device.

Step two: connect the display

The Raspberry Pi has a GPIO (Universal I / O) that the touchscreen fits into. If you look at your Raspberry Pi, this is a set of pins on the corner. If you haven’t already, click on the display on your Raspberry Pi. With it plugged in, plug in your keyboard, Ethernet cable (or Wi-Fi adapter), and then the power cable. You will be prompted to calibrate the touchscreen. Follow the instructions on the screen and you’re done.

Step three: share your music library on your computer

Before you get started with your Raspberry Pi, you should set up music sharing on your home computer. The process is different for both Windows and Mac.

Window

  1. Go to the music folder on your computer.
  2. Right-click the folder, select Share With, and select a domain. If you’re only on your home network, you can make it public and only accessible to other computers on your home network. Otherwise, select password-protected sharing, then enter your password.
  3. Make a note of the folder location and the name of your computer (it will be something like ThorinPC / Music).

Mac

  1. Open System Preferences.
  2. Click the Share icon.
  3. Make sure the File Sharing checkbox is selected.
  4. Click the + under Shared Folders, select your music folder and click Done.
  5. Back in the Share menu, select Options …
  6. Select Windows File Sharing and enter your password. This will make it easier to grab your Raspberry Pi files.

Now that your home computer is using its music library, you can switch back to your Raspberry Pi.

Step four: install and configure MPD

The core of this project is the Music Player Daemon (MPD). It is a server application for playing music. This means it doesn’t have a GUI, it just lets your Raspberry Pi play music files. You don’t have to dig into the command line to actually use this project after setting it up, but you will need it for the initial setup process. First you need to download MPD and MPC (controller). When you booted up the Raspberry Pi earlier, you should have been at the command prompt after calibrating the touchscreen. If not, and you are using Raspbian, tap the menu icon and select Quit. You will be doing all the work in this tutorial from the Raspberry Pi command line, enter:

sudo apt-get install mpd mpc

Wait for it to install. When finished, you should change a couple of settings by running:

 sudo nano /etc/mpd.conf

Find the line that starts with:

 #zeroconf_enabled "yes"

and remove the # in front of it to uncomment it. Press CTRL + X and select Y to save and exit.

Step five: set up your music library

Then you need to point MPD to your music library. To do this, you will create a folder, and then connect your music library to it. You will need to do most of this with the sudo command because you need root privileges for everything to be installed and working as expected. Let’s start by creating a folder:

 sudo mkdir / mnt / music

Then we’ll make sure it mounts when the Pi boots up. Run this:

 sudo nano / etc / fstab

Then add this line, replacing the computer name with the information and folder name that you collected in the third step for the location of your music folder:

 // Computer name / folder name / mnt / music cifs guest, uid = 1000, gid = 1000, iocharset = utf8 0 0

It should look something like this:

 // WindowsPC / music / mnt / music cifs guest uid = 1000, gid = 1000, iocharset = utf8 0 0

Note : if you require access to shared folders, you also need to replace guest with username=yourusername,password=yourpassword .

When you’re done press Ctrl + X to save and exit. Next, let’s test and make sure the mount is working properly. Enter:

 sudo mount -a

If you do not receive an error message, then it is installed correctly. Now see if all of your music files are there. Run this command:

 ls -l / mnt / music

You should see all of your music files. If that’s okay, you’ll need to create a symbolic link for MPD so that it knows where to look for those files. Enter:

 sudo ln -s / mnt / music / var / lib / mpd / music

The MPD should now be fully configured. You just need to scan your music library to find everything there. Enter:

 mpc update

This will take a while depending on the size of your library, so let it do its thing.

Step six: configure network and USB storage

Next, you’re going to set up Zeroconf, which lets you control your jukebox from other devices if you don’t feel like walking up to it and using the touchscreen. Enter:

 sudo apt-get install libnss-mdns

When it’s finished, run it:

 sudo service avahi daemon restart

Now you can additionally use the application for the mobile phone, for example MPDroid for Android or MPDluxe for iOS, as a remote control for Pi Jukebox. Before we get to that, you can also set up the jukebox to read files from the connected USB drive, which is handy if friends come with a bunch of MP3s on the flash drive. Unfortunately, you can’t just plug in your phone to access your music, because chances are the Raspberry Pi won’t be able to recognize it. To enable USB support, enter:

 sudo apt-get install usbmount

Then point the MPD to the USB sticks:

 sudo ln -s / media / / var / lib / mpd / music /

That’s all. You should now be able to play music from almost anywhere.

Step seven: install the Jukebox software

Right now, your Pi can access and play your music from the command line. It’s pretty boring. Let’s set up a sleek touchscreen interface.

We’re going to use a program called Pi-Jukebox for this. Basically, it is an interface for MPD that allows you to use the touchscreen to control music playback. Installation is pretty straightforward here. On the command line, run:

 git clone https://github.com/mark-me/Pi-Jukebox

With this, all the files required for the Raspberry Pi will be downloaded to the Pi-Jukebox folder. Before we can run it, we need to install Python:

 sudo apt-get install python-pip

Once installed, it’s time to launch the Jukebox software.

Step seven: launch and use the Jukebox software

To start the jukebox, you only need to enter one command:

 sudo python pi-jukebox.py

If all goes to plan, you should see the Pi-Jukebox software on your touchscreen. Here’s what each button means:

For the most part, the interface works as you would expect. You can swipe up and down to browse your library, tap on any of the controls to start and stop playback, and tap on a selection to load it. The Pi-Jukebox works like a jukebox, so you add each of your selections to the current playlist and navigate from there. There is no direct means to simply play the album without adding it to the playlist.

The settings options are pretty straightforward as well, but it’s worth going in there and checking them out. You can set up the jukebox to shuffle, repeat tracks, and more. But either way, you’re set and ready to start listening to your music. If you haven’t already, plug your Pi into your stereo and start jamming.

More…

Leave a Reply