Post

Pimp My moOde

Pimp My moOde

I’ve been running moOde on a trusty RaspberryPi Zero W plus the HiFiBerry DAC+ for ages. When I found out that the RPi0 is now unsupported by ArchlinuxARM, I got curious and realized that moOde also dropped support for it in the latest updates. Sure sign that an update to the RPi0 @ gen2 is in order :)

Migrating was a breeze, since there is little to no configuration needed for moOde. However, with the help of genAI coding models, I figured I could pimp the experience a bit

  • add an NFC reader via SPI to read tags and cue playlists
  • design stickers for the NFC cards (credit-card shaped)
  • utilize the GPIO pins to talk to the IR remote ports of my Marantz amp.

Role of AI Assistants

The genAI coding assistants actually made it a pleasant to iterate on the ideas; most of the time, it got me 80% there, with only little manual corrections (except for the sticker design). It also made research a lot easier as the LLM can convert even a badly put question into an expertly framed query. This way, “approximate knowledge of many things” is easily refined and distilled, and in the end one can pick up the trails and dive into rabbit holes oneself.

Integration into the homelab

Now, what are those puzzle pieces and how do they come together? The central pieces are the services run on the RPi0 (moode, nfc listener & mqtt event generator), Home Assistant (mqtt broker), and the music server (jellyfin).

jellyfinmqtt brokermoOdenfc-mqtthomelabproxmoxhome assistantRasPi 0 W

The NFC reader on the RPi0 is managed by a small python script, that translates read events into MQTT messages. These are sent to the MQTT broker running on Home Assistant, and are directly registered as Home Assistant tag events. These tag events can now be used to build automations to cue playlists.

It is a bit round-about, but for now it is super flexible, works quite fast and can be expanded ad libidum.

NFC cards

Now, I needed to make stickers for the NFC tags with the album art and a nice design. The solution is a folder with album art, a CSV containing all relevant data, and a latex template that pulls in the informations and creates a deck of cards. This can easily be printed with an online retailer focusing on VISA stickers for a nice finish.

By the way, I’ll be putting SLIX-L tags on the Mifare classic tags in order to make the NFC library interoperable with the tonie box, so the kids can enjoy some Papa music as well. Maybe there will be a special 3d printed holder with magnets, to make things easier to handle…

Usability

Now, the last thing to work out is volume control. moOde operates in the fixed volume mode, since it is hooked up to my stereo amplifier. That means, volume can only be changed by getting up or using the—otherwise useless—remote. The idea is to use the two IN/OUT remote ports of the amplifier, to talk to the stereo via software / GPIO signals. Then, the remote can be used for other things (skipping, etc), and the volume in MPD could directly control the physical volume knob on the amp. At this point, there are a few issues to iron out:

  • pick gpio pins and do some soldering
  • write a lirq service (in / out)
  • interface with MPD/moOde for volume / skip / etc.

I guess this will be a second post.

This post is licensed under CC BY 4.0 by the author.