Hi, I’m the ChuckBerry!

Mathijs Lagerberg
Pixplicity
Published in
5 min readMay 1, 2022

Control the music with a smart shelf, in an intuitive and playful manner.

Blinking lights and fresh music fill our office whenever you put something on the smart shelf.

Don’t you miss the days when you manually picked a cd or a vinyl album to play, or a mixtape you carefully put together, rather than having The Algorithm play a ‘mood’ for you? The physical act of putting a cartridge into a playback device, it had something magical. The simple push of a button. No fumbling for a password, no interruption from a Windows update, no keyboard, no loading times. But, unfortunately, all your music is in the cloud nowadays. That wretched cloud, taking the fun out of music, with its stupid infinite storage. Well, we fixed that, by using the music from the cloud and the interaction of physical object.

Old man yells at the cloud

Enter: the ChuckBerry!

We hooked up a Raspberry Pi to an NFC sensor, and made it so you can chuck an NFC tag onto it to play music. And then we came up with a very forced pun to name it after a musician. (In our defense: the other Raspberries at our office are called Snozberry, Dingleberry and Halleberry so we had a theme going.)

A shelf, LED lights, and a welcome message, stuck to a frame decorated by our in-house graffiti artist (me).

The format is easy: we simply took a whole bunch of different NFC tags, configured a tiny computer to start different Spotify playlists whenever it detects one of those tags on a sensor hidden in a small shelf, and then stuck the NFC tags to everything we could find.

UML diagram of the components

Simply put the object, with a tag stuck to the bottom of it, onto the shelf and the rest happens automatically! Enjoy the music. You’re welcome.

Chuck Berry on the ChuckBerry

First, we printed funny faces of everyone in the office and let them submit their favourite playlists. It was fun for a while. Then we went overboard. Putting the Pacman-shaped salt shaker onto the shelf plays the Pacman tune. A random Christmas ornament kicks off the horrible, horrible Greatest Christmas Hits list. A tube of sunblock? Summer hits. An Android figurine: ‘Paranoid Android’ by Radiohead, of course. Naturally, a paper cardboard cutout of Chuck Berry is present. A table tennis bat plays the Batman tune, some chess pieces play Kings of Leon and Queen respectively. At some point even a tiny kruidenstrooier appeared, connected to the greatest hits of the Spice Girls.

Waka waka

The hardware.

Because we’ve done a project with smart shelves before, we could basically scrap this together with parts we had at the office. Lucky us! There are many ways to build your own, this is what we used:

  • A Raspberry Pi. Ours runs Raspbian Light. Any model will probably do, we picked one with an 3.5mm audio jack for convenience.
  • An NFC antenna (plus driver and controller) from the Nexmosphere XR-range. There are NFC readers created for the Raspberry Pi, but we found the Nexmosphere components ideal for rapid prototyping of projects like these. The size of the sensor also ensure you don’t have to be too precise when placing the tags onto the shelf.
  • A Colored LED strip. Not necessary at all, but if you make a music player, why not do it in style. We used the Twinkly Flex strip, which does not hook up to the Pi directly, but can be controlled over the local network.
  • A speaker. We chose to plug ours directly into the Pi, but since we’ll be using Spotify Connect, you don’t have to do this. The Pi is able to control playback on any Spotify-connected device, as long as you have a paid subscription.
The hardware. From left to right: speakers (off screen), a Raspberry Pi 3 model B, and an NFC antenna (top) and its driver and controller (the two blue boxes bottom right).

The software.

A few simple Python scripts control the logic behind the ChuckBerry. This was surprisingly easy, seeing there are Python packages for pretty much everything you can think of.

We installed standard Raspbian Light (now: Raspberry Pi OS) with the WiFi and SSH preconfigured using the Raspberry Pi Imager. Then installed these packages using pip3:

  • spotify-cli — a Spotify remote. Log in once with your account, and using very simple commands you can control your Spotify music on whichever device is currently playing
  • raspotify — turns the Raspberry Pi itself into a Spotify connected speaker. Even without the smart shelf, you can now cast your music to the ChuckBerry. This part is optional if you already have a Spotify connected speaker, like a Chromecast Audio.
  • xled — complete package to communicate with the coloured Twinkly LED lights
  • pyserial — helps making communication with the usb device very easy. We only need to listen to some basic events from the Nexmosphere procotol [PDF].
  • pyttsx3 —a very easy text-to-speech module. Because the ChuckBerry does not have a screen, we made it talk back over the speakers so the user knows what is what.

I won’t go into detail on how all of these are put together right now, because all of that is explained on Github, where we open sourced the code. So you can build your own!

Feel free to reach out if you need some help creating one of those for your office, we’d be happy to!

I’m Mathijs “Mat” Lagerberg, founder of Pixplicity. If you want to know more about the cool stuff we build at Pix, have a look at our portfolio. Cheers!

--

--