[Tutorial] Phoniebox

So this is my Tutorial for the Phoniebox, also known as Jukebox4Kids.

Here, you will learn to use a Raspberry Pi 3B+ to build a Music Player, which will play audiotracks and streams by putting a RFID-Tag on top of it. The finished Box looks like this:

I used MiczFlors Phoniebox-Script and Splittscheids Tutorial.

The following hardware is used inside my Box, you can of course use different stuff:

  • OnOffShim – Used to Shutdown the RaspberryPi and the Powerbank aswell
  • EasyAcc 20000 mAh – I used another cheap  powerbank before, but sometimes the Box wouldnt boot properly so I used this one. Another advantage with this bank is, that you can charge it while the Box is running
  • Jumper cables – We want to solder as much as we can in the end, but for the prototyping/work in progress we will need to be kind of adaptable
  •  Header Connectors – At first I soldered the Jumper-Cables directly onto the platines, then I thought I soldered something wrong and wanted to built it more.. professional and used these.
  • LEDs – To customize the Buttons
  • Breadboard – Used to test the wiring
  • Circuit board – to solder the LED-/Button- connections
  • Raspberry Pi 3B+ – I used the Raspberry 3B+, because it has built in WLAN, is kind of fast and has standard USB-Ports. You can as well use any other Pi
  • MicroSD card – you should take a fast card, so the box won’t take hours to boot
  • Speakers – The limiting factor with speakers will be the output power and the size. I used some old usb-speakers I had lying around..
  • Micro-USB to USB-Adapter – to charge the Box without the need to open it up
  • Arcade Buttons – You should think about which Buttons you want to buy, I just bought the ones recommended in the tutorial i used, now i think i shouldve paid more attention to the style I want to achieve.
  • RFID-Reader – The Reader for the NFC-Tags
  • HiFiBerry MiniAmp – The onboard sound-output is not shielded properly or at least there can be a lot of noises coming from it. So i decided to use a external soundcard.
  • Flachsteckhülsen“ – I forgot those, they are used to connect the Jumpercable with the Arcade Buttons

What else do you need?

So lets get it on!

The first thing I did was installing Raspbian Lite and the Phoniebox Script

You will need to flash the Raspbian-Image with the Win32DiskImager.

You simply add the Image, choose the correct drive-letter and hit „write“.

When it is finished, you create two files in the boot-partition.

„ssh“ without file-extension


„wpa_supplicant.conf“ in which you insert the following code:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

The first file enables ssh on your Pi, which is essential to remote-control it, and the second connects it to your local network (be sure to change the „XX“ with the correct country code). I recommend to connect the Pi to an LAN first, because we need to download a lot of stuff, it will work with WLAN aswell though.
You then put the sd-card into your RaspberryPi, plug in the RFID-reader and turn it on.
The connection via ssh works with PuTTy, essentially you look for the IP of the RaspberryPi on your Router-Settings, put it into Putty and open up the connection.
Login is „pi“
password is „raspberry“
As soon as you are connected, you should change your password with

To get the latest updates for Raspbian, type in

sudo apt-get update

sudo apt-get upgrade

This will take some time, after you are finished, you can install Jukebox4Kids with

cd; rm buster-install-*; wget https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/master/scripts/installscripts/buster-install-default.sh; chmod +x buster-install-default.sh; ./buster-install-default.sh

The installation asks you some stuff.

WiFi -> n

PCM as iFace -> no, should be „Master“ (if you use a HiFiBerry MiniAmp)

mpd -> y

default locations -> y

Start the first part of the installation with another y and wait some time.

It will ask you for the USB-RFID-Reader after some time, the correct one is (and the only option should be) „0 HXGCoLtd Keyboard“

When the installation has finished, we install OnOffShim:

curl https://get.pimoroni.com/onoffshim | bash

Don’t reboot at the end, instead change some things in the

sudo nano /etc/cleanshutd.conf


There are two more thing to do, if you want to use a HifFiBerry MiniAmp:

sudo nano /etc/asound.conf

and copy this into it:

pcm.hifiberry {
    type softvol
    slave.pcm "plughw:0"
    control.name "Master"
    control.card 0
pcm.!default {
    type plug
    slave.pcm "hifiberry"

now edit the config.txt

sudo nano /boot/config.txt


find the dtparam line and put a # before, which makes it a comment and add the second line.

Great! There a a couple of things, we need to install/change in the code, but for now we should have a working Phoniebox client. We can shut the Pi off with

sudo poweroff -h

Now we start throwing hardware together!

The following things need to be done:

  • Connect OnOffShim with RPi
  • Solder circuit board for LEDs and Buttons
  • Solder Jumper cables onto the buttons
  • Connect HiFiBerry MiniAmp with RPi
  • Connect Speakers with MiniAmp
  • Connect LEDs and Buttons with RPi
Thanks to splittscheid

Lets start with some circuit diagrams from splittscheid:

As you can see, we connect on side of the button with Pin 20, which is „Ground“ and the other side between two resistors, which connect to Pin 17, which is „3V“, and Pin 40, which is „GPIO21“.

If the Button is pressed, the circuit is closed and our RaspberryPi gets the signal, that GPIO21 got pressed. The resistors are needed, so we don’t get a false signal.

Next we got the full diagram for the Buttons including LEDs:

Thanks to splittscheid

I know it looks a bit complicated, but give it some time, try to think it through and then just do, what I have done, copy the work of someone else:

Thanks to splittscheid

Since I dont use a OLED-Display, I didn’t solder the part on the right. My result for the buttons looks like this:

And here is my LED circuit board:

Some things to take care of:

  • Be sure to have proper connections. In the right button picture you can spot one connection, which isn’t working (2nd row, middle connection). It took me 3 hours of code-checking and reinstalling everything from scratch to find out, why one button wasn’t working
  • use a „third hand“ (Link)

Now we connect everything..

First the OnOffShim:

Thanks to splittscheid

Pin 2 or 4 connects to RPis Pin 2 or 4

Pin 6 connects to Ground (Pin 6)

Pin 7 connects to Pin 7 (GPIO4)

Pin 11 connects to Pin 11 (GPIO 17)

HiFiBerry MiniAmp:

Pin 1 (3V) connects to RPis Pin 1 (3V)

Pin 12 (GPIO18) connects to Pin 12 (GPIO18)

Pin 19 (GPIO35) connects to Pin 19 (GPIO35)

Pin 38 (GPIO20) connects to Pin 38 (GPIO20)

Pin 40 (GPIO21) connects to Pin 40 (GPIO21)

And the speakers connect to the Amp +/-/-/+ (red, black / black, red)

Now, connect the LEDs and Buttons to the RPi. Which GPIO you use is on your own, you just have to remember every connection (write it down), because we need to assign the Buttons and LEDs in the Script later.

At last you connect the Powerbank with the OnOffShim.

Ok, thats it! That was easy, wasn’t it? If you did everything right, you can now push the power-button and the Pi should boot.

Log into it via ssh and install the GPIO software:

sudo apt-get install python3-gpiozero python-gpiozero

copy the python script into the scripts folder

sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/gpio-buttons.py.sample /home/pi/RPi-Jukebox-RFID/scripts/gpio-buttons.py

and make it executable

sudo chmod +x /home/pi/RPi-Jukebox-RFID/scripts/gpio-buttons.py

Next we let the Phoniebox autostart at every boot:

Copy the service config files:

sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-rfid-reader.service.stretch-default.sample /etc/systemd/system/phoniebox-rfid-reader.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-startup-sound.service.stretch-default.sample /etc/systemd/system/phoniebox-startup-sound.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-gpio-buttons.service.stretch-default.sample /etc/systemd/system/phoniebox-gpio-buttons.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-idle-watchdog.service.sample /etc/systemd/system/phoniebox-idle-watchdog.service

reload the daemon

sudo systemctl daemon-reload

and enable the services

sudo systemctl enable phoniebox-idle-watchdog
sudo systemctl enable phoniebox-rfid-reader
sudo systemctl enable phoniebox-startup-sound
sudo systemctl enable phoniebox-gpio-buttons

Awesome. Now we edit the python script:

sudo nano /home/pi/RPi-Jukebox-RFID/scripts/gpio-buttons.py

In the script, find this part:

shut = Button(3, hold_time=2)
vol0 = Button(13,pull_up=True)
volU = Button(16,pull_up=True,hold_time=0.3,hold_repeat=True)
volD = Button(6,pull_up=True,hold_time=0.3,hold_repeat=True)
next = Button(26,pull_up=True)
prev = Button(27,pull_up=True)
halt = Button(24,pull_up=True)
#reco = Button(6, pull_up=True) # Choose GPIO to fit your hardware
#play = Button(12,pull_up=True) # Choose GPIO to fit your hardware

Here, you change the numbers after Button(XX,..)

to the GPIO numbers you connected the Buttons to. Important: if you connected the volU(Volume Up)-Button to Pin 33(GPIO13) you change it to 13, not 33!

Now we clone the LED Script from splittscheid:

git clone https://github.com/splitti/phoniebox_led_control --branch master
sudo ln -s ~/phoniebox_led_control/service/phoniebox_led_control.service /etc/systemd/system/phoniebox_led_control.service
sudo systemctl daemon-reload
sudo systemctl enable /etc/systemd/system/phoniebox_led_control.service

and edit the led.py:

sudo nano /home/pi/phoniebox_led_control/led.py

I changed it completely to learn some python, you can just change the GPIO numbers if you want or you change the whole thing. If I have time, I will change this part of the tutorial by uploading my script to github..

import signal
import os
from time import sleep
from gpiozero import PWMLED, Button, LED
from signal import pause
from subprocess import check_output

ledprev = PWMLED(12)
ledplay = PWMLED(5)
lednext = PWMLED(22)
ledvolup = PWMLED(11)
ledvoldown = PWMLED(23)

buttonprev = Button(27)
buttonplay = Button(24)
buttonnext = Button(26)
buttonvolup = Button(16)
buttonvoldown = Button(6)

def GetShell():
    process = check_output("/bin/ps -ef | grep mopidy | grep -v grep | awk '{print $2}'", shell=True)
    process = process.decode()
    return process

def flash_leds(interval):

def ledbuttonctrl():
    ledprev.source = buttonprev
    ledplay.source = buttonplay
    lednext.source = buttonnext
    ledvoldown.source = buttonvoldown
    ledvolup.source = buttonvolup

if not process:

while True:

start the service:

sudo service phoniebox_led_control start

Done. Now reboot your Pi with

sudo reboot
You now can connect to your Phoniebox in the browser:


and connect your first RFID-Tag.

Everything should be running, congratulations and have a lot of fun, you now have the hardware, you just need a case. I built a custom case in 3D and a friend of mine printed it for me, I recommend to check some ressources like Instagram (#Phoniebox) and MiczFlors GitHub Site for inspiration on how your Phoniebox should look like.

There are some tweaks to let it boot a lot faster:

add the following lines to:

sudo nano /boot/config.txt

# Disables loading Bluetooth
# Boot Delay Time
# the rainbow splash screen will not be shown on boot
# use full speed of the sdcard (fast card needed for this)

Next, we add a few lines in the
sudo nano /etc/dhcpcd.conf


ARP checks, if the IP in the LAN is free, the others are selfexplaining, you only need ip4 in your local network.

Next thing is to disable some services, we won’t need for our MusicBox:

sudo systemctl disable keyboard-setup.service

sudo systemctl disable wifi-country.service

sudo systemctl disable triggerhappy.service

sudo systemctl disable dphys-swapfile.service

sudo systemctl disable hciuart.service

sudo systemctl disable raspi-config.service

sudo systemctl disable exim4.service

Last, we change the

sudo nano /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty3 root=PARTUUID= rootfstype=ext4 elevator=
deadline noatime nodiratime fastboot fsck.repair=yes rootwait loglevel=1 quiet logo.nologo

I will upload the .stl files of my case model tonight, if you have questions, just write in the comments. Thanks for reading.

And now here are some pictures of my work

Disclaimer: if you buy something from Amazon via the links on this website, I get a small revenue

16 Gedanken zu “[Tutorial] Phoniebox

  1. This looks like a brilliant idea!

    I have a question though:

    All the RFID Tags I found on the market are huge cards. Where did you find tiny tags tu build them into a toothbrush?


    1. The Tags themselves are just about half a centimeter in diameter and the antenna is about 2 cm in diameter. I used those : https://amzn.to/36TZBq1
      And just glued the whole thing beneath my figures. If you are building a Phoniebox, let me know, how it looks!


  2. Hi!
    I followed your instructions to the letter, with the same parts (except my buttons don’t have LEDs), but I’m running into a problem. When the phoniebox software installs and it asks me about the RFID reader (in my case the same as yours, a Neuftech USB reader), I tell it there’s a USB reader, and then it shows an error installing something called „evdev“. Everything goes smoothly, but I can’t use the RFID reader. I’ve been reading through the github bugs, but they’re a bit technical for me 😦
    I have no idea what to do, been at it for about two months on and off, and reinstalled at least 5 times. Any chance you could lend a hand? Thx in advance…


    1. Thanks! That’d be awesome. I’ve copied the output when I try to configure it. It says:

      Traceback (most recent call last):
      File „/home/pi/RPi-Jukebox-RFID/scripts/RegisterDevice.py“, line 4, in
      from Reader import get_devices
      File „/home/pi/RPi-Jukebox-RFID/scripts/Reader.py“, line 23, in
      from evdev import InputDevice, ecodes, list_devices
      ModuleNotFoundError: No module named ‚evdev‘
      chown: cannot access ‚/home/pi/RPi-Jukebox-RFID/scripts/deviceName.txt‘: No such file or directory
      chmod: cannot access ‚/home/pi/RPi-Jukebox-RFID/scripts/deviceName.txt‘: No such file or directory


      1. I don’t have much spare time right now, have you tried installing it from scratch again?


      2. I’ve gone through clean installs 4 times, every time from scratch (formatting and installing raspi os lite every time).
        I’ll have a go at it again this weekend. Thanks for your time!


      3. OK, so… first of all, turns out I tried it on Bullseye, but Buster is recommended. And a friend lent me his RPi3B+, so I tried it on that. Installed phoniebox on Buster, same problem. Then I did this: https://core-electronics.com.au/projects/kids-music-box/ –> Step 4. And it worked.

        So I chucked the SD card into my (supposedly exactly the same model RPi) and it doesn’t want to work with the card reader. Back to the other RPi, and it works. So it looks like it’s got something to do with my specific RPi…

        Anyway, problem solved, maybe? Thx for your time!

        Gefällt 1 Person

      4. Oh that’s great news! Congrats, maybe you can post a picture of your finished box, once you are done?


      5. This is the result. It’s a wooden decorative savings box, nothing special and the back is held on by clips, so that needs to change. But is was pretty and the right size.
        You can’t see the power button because it’s on top, but they’re all simple N/O push buttons.
        I may put some led ones in there later on, but for now, this works. Daughter is happy, daddy is happy.

        Gefällt 1 Person

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit deinem WordPress.com-Konto. Abmelden /  Ändern )


Du kommentierst mit deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s

Diese Seite verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden..