@NUSTEMxmas: our festive, robotic, IoT glockenspiel
Every now and then, we (Jonathan and Joe) get an idea stuck in our heads. It’s usually a ridiculous idea, an idea that should never see the light of day. But then, one of us says it out loud…
We’d like to introduce you to the NUSTEM IoT Festive Glockenspiel™.
Whilst you pick your jaw up off the floor, we’ll explain what’s going on and offer a little background as to how we ended up with this creation in our office.
The Glockenspiel has the brains of a Raspberry Pi, and those brains are listening to Twitter. When anyone tweets to @NUSTEMxmas and requests a festive tune, our Pi picks up the message and quickly searches through our vast bank of early 00s mobile phone ringtones for a match. A command is then sent to another Pi elsewhere in the office, which decodes the ringtone and instructs yet another Pi to rev eight servos into action. Those servos move hammers which strike our home-made, only-slightly-out-of-tune, no-sharps-or-flats, plays-with-enough-enthusiasm-to-occasionally-break-itself glockenspiel. We also added flashing lights – synced to the music, obviously – to enhance the festive mood, and a readout so we know who’s requested the song. One of the Pis (we forget which, but probably the first) also tweets a reply to the original requester.
If you’re interested in finding out more about how it works, we’ve documented our code on GitHub. You can download it and (in theory…) build one of these things yourself. Or poke around in our code for festive giggles: we cobbled this whole project together using bits of previous projects or longer-term incomplete ideas, so the system architecture is at the hilarious end of software engineering.
How we got here
The Glockenspiel is a spin-off from our Robot Orchestra workshop. We’ve been running this digital making activity with our schools and as a public drop-in for several years. The workshop (and the robots) have gradually developed, becoming a little cleverer each time:
- First version: Arduino controllers move servos on a fixed beat pattern.
- Second version: Arduinos ‘easily’ reprogrammable, and operating two servos.
- Third version: Wemos D1 controllers commanded over wifi from a Raspberry Pi, hence all playing in sync.
- Fourth version: Command system can parse saved patterns and so ‘play tunes’; controllers can respond to one of eight ‘channels’.
- Fifth version: You know, things get a little hazy somewhere in here…
- nth version: System controlled by a lovely light-up button board, or a less glamorous but more practical on-screen interface. This is both a super-modern visual programming environment, and something that looks uncannily similar to the sort of punched cards that were used to drive weaving looms and started all this stuff off in the first place.
We’ve built the various parts of our system in a modular sort of way, so it’s relatively easy to switch bits in, remove parts, or graft in new ideas. We use this approach in lots of our digital making projects, with the result that ideas and bits of code are easily shared across projects. We also have a habit of attempting projects which are right on the edge of what we think we can do, but which feel achievable because we’ve already solved half the problems in other projects.
(an early version of the robotic glockenspiel – from, like, Tuesday or thereabouts – showing the on-screen direct programming interface. This was before we built the parser for mobile phone ringtones.)
The new parts we’ve built for this version of the project include:
- Using a Raspberry Pi as our servo controller, and driving eight (count ’em, eight!) servos from it. Thanks to Ben Nuttall for pointing us in the right direction for that.
- Handling requests from Twitter. We’ve done this before, but we’ve done a better job of it this time.
- We found a library of suitably festive songs … in RTTTL mobile phone ringtone format, which is one of those things that rather died out in 2004. So we dredged up music theory half-remembered from our pre-GCSE days and leaned on bits of code from others (RTTTL parser; frequency-to-note convertor), and ended up with code which plays ringtones on our…
- …home-made copper pipe glockenspiel. Which was itself inspired by this Instructable. Big thanks to everyone who came to our Raspberry Jam last weekend and mucked in to help build this!
- We added a Pimoroni Displayotron HAT screen, which was intended for a completely different project but was just too bling not to use. Only later did we realise there’s a whole monitor literally right next to it. Oh, well.
- Finally, we hacked some of the older Wemos-based players so they drove twinkly lights rather than servos, and used them to increase the total amount of festive.
We’ll use bits of this system in a variety of ways throughout 2018, so it’s not even the case that we’ve been massively goofing off in work hours. Mostly. Sadly, we didn’t manage to get to ‘posting video clips back to Twitter’ – most of the recipes we’ve seen for that sort of thing are video-only, which wouldn’t work so well for a musical project. So if you tweet us, you’ll just have to trust that the system has indeed played a little tune for us in the NUSTEM office.
Hmm… a little belief? At Christmas? It’ll never catch on.
Leave a ReplyWant to join the discussion?
Feel free to contribute!