Monomepi Raspberry Pi music box

By Russell Barnes. Posted

A Raspberry Pi music box featuring old and new technology in perfect harmony, meet Monomeipi

With hammers hitting the bars of a toy glockenspiel to play a tune, the Monomepi sounds just like an old-fashioned music box, but this Pi-powered contraption is based on new technology… and on quite a lot of LEGO. “It was just my luck that the components fitted with the LEGO bricks almost perfectly!” reveals its creator, Joon Guillen.

He got the idea after seeing a couple of videos of Arduino-based music boxes a few years ago, while working on a Conway’s Game of Life Pi project using a Monome Grid, a versatile piece of hardware that can be used to control music and more.

https://vimeo.com/178279145

Building a Monomepi music box

For the Monomepi, the Monome is connected to a Raspberry Pi 3 running a step sequencer program, which registers the user’s button.presses on the Monome and lights them up accordingly.

The Pi then sends serial commands to an Arduino Uno connected via a ProtoShield kit to eight servo motors, which move makeshift hammers to play glockenspiel notes to match the pattern shown on the Monome. On the latter, the user can switch buttons on and o to alter the sequence as it plays.

stuck to LEGO blocks snaffled from Joon’s toddler!

“The contraption itself took only two or three evenings to build,” Joon tells us. “I focused most of my energy on the software side, so the physical construction was almost an afterthought.”

To build it, he borrowed a bunch of LEGO blocks from his young daughter. “They were the first things I thought of using. I haven’t the talent for crafts, and so LEGO was the quickest way to build the contraption. My daughter even added some blocks of her own in there!” While the construction was quick, the project as a whole took around two months, with Joon working casually over the course of several evenings and weekends. “Most of it was figuring out the step sequencer logic, Arduino code, and optimising performance.”

The main Python program running on the Pi is based on a Monome library Joon had created for his previous project. “That took a very long time, as I had zero Python knowledge when I started out. The library has since undergone several improvements through the years.”

While Joon opted to control his servos via an Arduino, he says there’s no reason why anyone creating a similar project couldn’t trigger them from the Pi itself, using a suitable motor driver board. And if you’re lacking a Monome (quite an expensive piece of kit), a touchscreen could be used instead: “A web-based UI should work, too. Or, if one isn’t necessarily trying to make a step sequencer, push buttons or [a computer] keyboard are viable control alternatives.”

As a part-time musician, Joon plans to sample the Monomepi to use in at least one of his tracks. He’s also looking to improve the project by “adding features to the step sequencer program, such as having more than 16 steps, and the ability to use multiple velocities. Other than that, I am trying to think of more ways to use my servos with the Pi!”

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.