Introduction: A Jukebox With Raspberry Pi
This tutorial that will allow you to build this Jukebox (or a your custom model :) ).
This project,requires a minimum of DIY attitude, confidence with audio cables and computer science in general.
Note:The software provided on this tutorial by the author itself, is under license GNU GPLv2.
- Raspberry Pi
- Related cables (hdmi, audio etc)
- Buttons + USB controller and LED lights
- Car hifi
- 12 volts power supply (even an old one or PC can go well)
- RCA switch
- RCA audio input
- Raspbian GNU Linux (I used version 9.6)
- Fruitbox (I used version v1.12.1)
- Custom scripts and configurations (to be downloaded later on this guide)
Step 1: Hardware
In this section, I put only a few of details, because it is similar to a procedure to build an arcade cabinet, and the network is full of guides (ask uncle Google).
I will only say that this includes:
- The monitor
- the controls
- the Raspberry Pi 3B+ (but it works with Raspberry 2 as well).
- Various cables
- Lights and various
I put only some pictures about the construction phase as inspiration for your project.
Optionally, you can add the car hi-fi, to listen to CDs as well. According to someone, this distorts the project a bit, but in my opinion it turns it into a mobile hi-fi rather than a giant MP3 player :)
To connect a power supply to a car radio, there is another tutorial list . To switch between the CD, the jukebox and any other audio source, you can use an rca switch , available in the main online stores.
Step 2: Software
In my opinion this section is the most interesting one, as it contains the customization I made to make the jukebox part work, which is the core of the project.
The advice I give, which I myself put into practice, is to buy the minimum hardware to be able to prototype. By doing so, if we realize that the project is too ambitious, we would reduce costs in case of abandonment.
We proceed by steps:
Download and install Raspbian on the Raspberry
First configurations and tests
NOTE: All commands assume a default Raspbian and fruitbox installation.Customization of these may not guarantee correct operation, which is not guaranteed regardless
At this point, Fruitbox should be in the /home/pi/rpi-fruitbox-master directory.
Let's copy our MP3s to the folder /home/pi/rpi-fruitbox-master/Music/ (create it if it doesn't exist) using our favorite SFTP client (for example Filezilla ).
I recommend no more than fifty files as test (later you will add all the MP3s).
We launch a first execution of the program as described in the guide:
./fruitbox –cfg skins/[YOUR_THEME] /fruitbox.cfg
Where [YOUR_THEME] is one of the following default skins:
Try various skins, using the keyboard as temporary input, but consider that the required buttons are different for skins, and this will impact the final choice of physical buttons.
Any of the guides for building an aracade cabinet, mentioned above, should explain how to connect a USB controller to the corresponding buttons.
To check how the buttons are recognized by the system, run the following commands:
sudo ./fruitbox –test-buttons –cfg ./skins/[YOUR_THEME]/fruitbox.cfg
Click on each button and take note of the code generated on the screen. Modify on your PC the fruitbox.btn configuration file, replacing for each key you want to map the corresponding code we took noted of, in the previous step.
Copy the fruitbox.btn configuration file via SFTP on this path:
Relaunch the fruitbox application as shown above:
./fruitbox –cfg skins/[YOUR_THEME] /fruitbox.cfg
Check if the keys works.
Set up automatic start of fruitbox at boot and shutdown at exit
First we need to set the automatic login to the user pi.
At the ncurses menu (the gray one with a blue background, for example) select:
3 Boot Options Configure options for start-up
B1 Desktop/CLI Choose whether to boot into the desktop environment or the command line
B2 Console Autologin Text console, automatically logged in as 'pi' user
Exit by selecting
And to the question:
Would you like to reboot now?
At this point we verify that when Raspbian restarts, the password is not required to log in as user pi.
Now we have to automate the start and stop. First we download the jukebox.conf file.
Let us modify this file by uncommenting (ie: deleting the hash mark #) our favorite skin.
Download the runjb.sh script. Then copy the runjb.sh and jukebox.conf files via SFTP to the /home/pi directory of our Raspberry.
Finally, on the Raspbian terminal (the text-based startup screen) let's execute:
chmod 770 /home/pi/runjb.sh
chmod 770 /home/pi/jukebox.conf
echo "/home/pi/runjb.sh" >> /home/pi/.bashrc
At this point we only need to restart the system and verify correct operation.
Step 3: Conclusion and Extra
If all the previous steps have been correctly executed, have fun assembling and decorating your jukebox.
Update the MP3 list
- Add the files in /home/pi/rpi-fruitbox-master/Music/ directory.
- Delete the file /home/pi/fruitbox.db
- Restart fruitbox
The file rpi-fruitbox-master/skins/[YOUR_THEME]/fruitbox.cfg contains interesting configurations including:
- The possibility of performing random songs after a certain period of inactivity
- The possibility of managing the coin mechanism
- Much else…
If you don't like "start-up logs" which are the standard output of the Raspbian start, you can customize it with the image you prefer ( guide ). But the procedure is not for newbies. I personally left them because if something goes wrong I want to understand what it is.
For my project I modified the skin based on the original WallJuke. If you really want to have my face on the spinning vinyl you can download it here
Note:This tutorial is available in Italian as well