This is a project I kept postponing for years but when I eventually got my hands on all the required parts I had no longer an excuse and eventually built the first. It’s a portable music player for children that does not require internet access. It features selections of pre-installed music or audio books via RFID cards, that may come in all shapes and may even be integrated in toys. There are also 3 to 5 playback controls in the form of huge arcade buttons. Ideal especially for our middle one, who has to endure stationary stay for most of the week in a hospital.

And while this box is still missing proper decorations and button decals it’s full functional and portable. Also hey, kids ain’t stupid – they find the proper button without decal too. Even the baby found out where to put the RFID cards for the music to change 😉

The leg work for this was done by @xfjx@chaos.social and the project is described in great detail at https://www.voss.earth/tonuino/ – I did however not order the offered PCB and just soldered everything to a generic maker board to keep the costs down. Just like the arcade buttons, that I had left over from another project, I also have a bunch of such boards. The speaker was salvaged from an old entertainment system that broke down long ago and the box… ah well I guess it speaks for itself. Can’t say I was happy with the drill but the box was just perfect for our purpose.

First we built a test setup after salvaging all the needed hardware. The Ardunio parts are off the shelf, nothing special here. I had to improvise a little on the wiring due to missing wires. I opted for the older branch that just needs Arduino Studio, to install the software itself. There is a more modern version using platformIO but something with that does not like my vscode and I never managed to successfully compile it.

I eventually got the idea how the RFID cards worked and could be trained to the system and also did some tests like it’s maximum power usage. It has a passive speaker and cranked up to max it would consume 0.09A max – and on regular volume it was sitting at comfortable ~0.06A. Which is pretty fine. This would run for days with a decent power bank that could be dropped right into the box later if no external PSU is used.

Next was preparing the box. Luckily I had just the right drill for the buttons but making the holes was a pain in the neck. This had to be done very slow because the hard plastic would easily rip and splinter. I opted for a very massive USB connector in the end because the microUSB one used first broke on the 3rd use already. That was probably a little bit too cheap. The replacement is way more sturdy, which is kinda what I want for the children anyway. Everything the box needs to operate, like an old phone charger, a very long USB cable, and the RFID cards do fit inside the box for transport.

So one of the questions left was what to put on it’s internal SD card. Some of their favourite music, of course. What else though? Easy. We have a public audio centre at https://www.ardaudiothek.de/ offering a lot of stories and podcasts even for children. Downloading them one by one manually was cumbersome though. Luckily @1337core@chaos.social was just releasing his first version of Audiothek Downloader at https://github.com/Leetcore/audiothek-downloader so I had more gigabytes than the SD card could manage in minutes. The only issue was that the SD card needs the audio files enumerated so I did some quick scripting to rename the downloaded files. I had also no use for the downloaded cover images. It’s not beautiful but it got the job done:

#!/bin/bash

folder=$1
oldpwd=`pwd`

if [[ -z $folder ]]; then
    echo "Missig paramater id"
    exit
fi

folder="output/${folder}"

if [[ ! -d ${folder} ]]; then
    echo "Missig folder ${folder}"
    exit
fi

cd $folder
shopt -s extglob
for filename in +([0-9])_*.*; do
    [ -e "${filename}" ] || continue
    oldfile=${filename}
    # remove including the first underscore to get the index
    index=${filename%%_*}
    index=${index##+(0)}

    # pad the number with zeros
    newfile=`printf %03d ${index}`
    # combine new index with old filename, remove up and including first underscore
    newfile=${newfile}_${filename#*_}
    if [[ ! -f ${newfile} ]]; then
        mv -v "${oldfile}" "${newfile}"   
    fi
done

declare -i n=1
declare -i i=1

for filename in *.mp3; do
    [ -e "$filename" ] || continue

    target_dir=`printf %02d ${i}`
    if [[ ! -d ${target_dir} ]]; then
        mkdir ${target_dir}
    fi
    
    target_file=`printf %03d ${n}`

    if [[ ! -f "${target_dir}/${target_file}" ]]; then
        mv -v "${filename}" "${target_dir}/${target_file}.mp3"
    fi
    n+=1

    if (( n > 255 )); then
        n=1
        i+=1 
    fi

done

cd $oldpwd
exit 0 

This goes into e.g. to-tonUINO.sh into the root folder of the Audiothek Downloader where it can be executed after downloading a category. Like this for example:

python3 audiothek.py --url 'https://www.ardaudiothek.de/sendung/big-baeaeaem-wissen-ohne-filter/96510766/'
./to-tonUINO.sh 96510766
Renamed '24_Warum_mobben_wir_andere.mp3' -> '024_Warum_mobben_wir_andere.mp3'
Renamed '25_Warum_bekommen_Mädchen_bessere_Noten.mp3' -> '025_Warum_bekommen_Mädchen_bessere_Noten.mp3'
Renamed '26_Wie_sieht_die_Schule_der_Zukunft_aus.mp3' -> '026_Wie_sieht_die_Schule_der_Zukunft_aus.mp3'
Renamed '024_Warum_mobben_wir_andere.mp3' -> '01/001.mp3'
Renamed '025_Warum_bekommen_Mädchen_bessere_Noten.mp3' -> '01/002.mp3'
Renamed '026_Wie_sieht_die_Schule_der_Zukunft_aus.mp3' -> '01/003.mp3'

The resulting folder|s can be renamed, depending on what is already on the SD card, and moved to the SD card. It also makes sense to set the RFID card to audiobook mode so the TonUINO saves the position for the listener and does not start at the beginning again.

Now it’s up to the children to do some decorations. Our oldest wants her version built into a box that looks like a book. Hope we can get that one done soon too.