Mumbling about computers

Spicing up a robot vacuum

Posted on under [ ]

Some time ago, I bought a Dreame Z10 Pro robot, which I immediately un-clouded by installing Valetudo.

A friend challenged me to make this thing play Ride of the Valkyries as it vacuums, so I immediately started hacking at it.

These robots pack a surprisingly large amount of computing power; 512MB of ram and a 4-core, 1.4GHz, Cortex A53 processor (aarch64), running a 4.9 kernel.

The first thing I did, was to validate whether this was possible at all with a super high-tech approach, pressing this button:

while looking at the output of htop, which, for a brief second, displayed:

/bin/sh /ava/script/mediad_script.sh /audio/EN/7

The script, like the rest of the firmware image, is pretty low quality. I dug through a few levels of sources and "manually" evaluated all the conditions, the code that executes is just 4 lines:

SET_AMIXER_CMD="amixer cset numid=6"
MAX_MEDIA=31
${SET_AMIXER_CMD} ${MAX_MEDIA}
ogg123 ${1}.ogg

Oddly, I failed to copy the file, as the ssh server (dropbear) does not support the sftp protocol

$ scp root@vacuuminator.labs:/audio/EN/7.ogg .
sh: /usr/libexec/sftp-server: not found
scp: Connection closed

However... it still has cat

$ ssh root@vacuuminator.labs "cat /audio/EN/7.ogg" > 7.ogg

🧠

With the 7.ogg on hand, I checked its format: it is a 16kHz, single-channel file, which is (apparently) all that the audio hardware supports.

I converted my track to match the supported format:

$ ffmpeg -i valkyries.m4a -ac 1 -ar 16000 valkyries.ogg

I then built a very simple OGG player in Rust, which lets me start and sto the music track dynamically, and this is the result: