With a growing number of children the need for more than one music player is quickly arising. As you know I am fond of free software, so I decided to build something with, tadaaaah: free software 😉 Fortunately there is a great project on the internet: the PhonieBox
It is a collection of scripts that creates, on top of a raspberry pi, a music player with an interface for an RFID-Reader, Arcade-Buttons to control volume and skip tracks, and a webserver to upload music files to the raspberrys internal SD-Card. You can also add youtube-links, webradio and even play spotify-playlists.
The installation is pretty straight forward and there is no soldering needed. Everything can be installed “plug and play” via USB if you want to. It can even run on a USB-powerbank for mobile use.
What do I need to build one ?
Of course every PhonieBox can look different and also can contain various hardware. Here are the parts for my setup:
- Raspberry Pi 3 (buy used one from Ebay Kleinanzeigen) – At least 3 USB-Ports are needed for my setup, so no Raspi Zero for this setup
- micro SD-card to host the Operating System, the PhonieBox software and the Music/Audiobooks (16 GB should sufficient though)
- Housing – Bamboo Tissue Box with large hole and removable Backside
- Alloy Punched plate from Baumarkt / Homedepot
- wooden plate and legs for raised floor (to attach the pi)
- USB-Powered Speakers e.g. Trust Leto
- RFID-Reader e.g. from Neuftech
- RFID-Tags (round, sticky) to attach them to figurines
- USB-Connector for Arcade-Buttons
- Arcade-Buttons themselves
- Micro-USB-Cable
- Micro-USB-Poweradapter with Power-Button
Some parts can be bought second hand and others you might have unknowingly stored in your basement. Others can (unfortunately) only be bought via Amazon oder AliExpress. Please try to reuse old hardware for this project.
Building the Housing
For the housing I chose a tissuebox out of bamboo and covered the diamond-shaped hole with a alloy punched plate. The buttonholes are drilled with a 23(!)mm wooddrill. The drill should have the exact size to make the buttons fit. I have one button for “next”, one for “play/pause and shutdown” and two for “volume up” and “volume down”.
Behind the plate the Speakers are installed. The speakers are small, usb-powered and connected to the headphone jack of the raspberry pi. The RFID-Reader and the USB-Connector for the arcade buttons are also connected via USB.
The speakerhousings are torn apart and the front is mounted with tiny screws to the punched plate. The speakers are hotglued to the plastic front. The speaker-poti (volumecontrol) is glued to the bottom of the box. The RFID-Reader on top is also hotglued to the middle of the top, the USB-arcade-button connector to the side.
To make use of all the space in the box (3 dimensions, not only 2 😉 I have installed an intermediate wooden floor which stands on 3 wooden legs. The raspi is installed on that floor and the cables and the poti from underneath are accessible through holes in the plate. There is also spare for the RFID-Reader.
The Software
First of all download raspios and install it on your sd-card:
sudo umount /run/media/user/*
sudo dd if=2021-05-07-raspios-buster-armhf-lite.img of=/dev/mmcblk0 status=progress
sudo touch /run/media/user/boot/ssh
After installing enable ssh:
sudo touch /run/media/user/boot/ssh
and activate wifi headless via placing wpa_supplicant.conf in the /boot directory (no need to adapt it, as we want just to enable wifi but not to connect to a certain network, see below ad-hoc-network)
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WIFI_SSID"
scan_ssid=1
psk="WIFI_PASSWORD"
key_mgmt=WPA-PSK
}
Plug in the card, boot and login via ssh to install the PhonieBox Software via the installerscript. I have chosen to install the ad-hoc-network-script as it provides a self published ad-hoc network which you can connect to in case you don’t want to / can’t install it in your home network.
cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/develop/scripts/installscripts/buster-install-default-with-autohotspot.sh; chmod +x buster-install-default-with-autohotspot.sh; GIT_BRANCH=develop bash ./buster-install-default-with-autohotspot.sh
The wifi is available, after unplugging the network-cable, at:
- SSID: phoniebox
- PW: PlayItLoud
- IP: 10.0.0.5
The Phoniebox also provides a certain script to install the arcade-buttons which needs to be called separately after the installation of Rasbpian OS and the installation script of the PhonieBox:
cd /home/pi/RPi-Jukebox-RFID && sudo ./components/controls/buttons_usb_encoder/setup-buttons-usb-encoder.sh
Shutting down the Box
Due to the lack of a separate shutdown button (for security reasons, i don’t want anyone to accidentially push it) I have changed the push-buttons python script with the help of the PhonieBox community. The Phoniebox shuts down after pushing the “play/pause”-button 3x within one second:
cd /home/pi/RPi-Jukebox-RFID && sudo mv ./components/controls/buttons_usb_encoder/buttons_usb_encoder.py ./components/controls/buttons_usb_encoder/buttons_usb_encoder.py.bak
cd /home/pi/RPi-Jukebox-RFID && sudo nano ./components/controls/buttons_usb_encoder/buttons_usb_encoder.py
#!/usr/bin/env python3
import sys
from threading import Timer
sys.path.append(".") # This command should be before imports of components
import logging
from evdev import categorize, ecodes, KeyEvent
from io_buttons_usb_encoder import button_map, current_device
from components.gpio_control.function_calls import phoniebox_function_calls
logger = logging.getLogger(__name__)
count = 0
def counterDecrease():
global count
count = count - 1
try:
button_map = button_map()
function_calls = phoniebox_function_calls()
for event in current_device().read_loop():
if event.type == ecodes.EV_KEY:
keyevent = categorize(event)
if keyevent.keystate == KeyEvent.key_down:
button_string = keyevent.keycode
if type(button_string) is list:
button_string = '-'.join(sorted(button_string))
try:
function_name = button_map[button_string]
try:
getattr(function_calls, function_name)()
if function_name == 'functionCallPlayerPause':
count = count + 1
r = Timer(1.0, counterDecrease)
r.start()
if count >= 3:
function_calls.functionCallShutdown()
else:
count = 0
except:
logger.warning(
"Function " + function_name + " not found in function_calls.py (mapped from button: " + button_string + ")")
except KeyError:
logger.warning("Button " + button_string + " not mapped to any function.")
except:
logger.error("An error with Buttons USB Encoder occurred.")
make sure to run the button script again after that change:
cd /home/pi/RPi-Jukebox-RFID && sudo ./components/controls/buttons_usb_encoder/setup-buttons-usb-encoder.sh
Figurines and Handle
For creating the “Phonie”-Figurines I used my Ender3 3D-Printer. Also the Handle of the Box is 3D-printed from thingiverse.

The figurines can be found on Thingiverse (make sure to scale them correctly… in my case roughly 6cm in height):
- Vampire plays “der kleine Vampir”
- Witch Hat plays “die kleine Hexe”
- Chicken plays “Oy Oy Emine”
- Dog plays “Paw Patrol”
- Fireman Sam play “Fireman Sam”
The figurines work with a glued-in RFID-Tag underneath:
Audiobooks
I have downloaded quite a lot of audiobooks through youtube and the youtube-downloader available on fedora. I have stored them on a usb-thumbdrive and after a successfull installation I copy the files to the internal audiofolder path:
sudo mkdir /media/temp && sudo mount -t vfat /dev/sda1 /media/temp
sudo cp -r /media/temp/h\?rb\?cher/* /home/pi/RPi-Jukebox-RFID/shared/audiofolders/
Hallo hast du einen akku benutzt ?
Hallo Worschdmo,
interne Powerbank geht wegen fehlender Passthrough-Funktion (gleichzeitig laden und Raspi versorgen) nicht. Aber anstatt eines Netzteils kann man eine ganz normal Powerbank dran hängen.
Grüße
Arvid