Blog  |  Publications  |  Puzzles
Fun & Games  |  About

Wireless Carillon Project

For the past few days, I’ve been preparing a wireless carillon that will hang on our Christmas tree this year. The carillon is a set of 9 brass bells, which can play different tunes. It is connected to an Arduino micro-controller that controls the bells. The Arduino receives messages from my desktop computer via an XBee radio. The desktop computer can trigger the bells in a variety of ways.

I’ve programmed my carillon to chime the quarter hours, like a grandfather clock, and to play a collection of different short tunes to tell me about the state of the world, and the Internet. The bells play “We’re in the money” when I get notified of an electronic payment, “Baby it’s cold outside” when the thermostat gets turned down (or up?), and “Home on the Range” when we come back from an outing. I can easily create more interesting triggers using IFTTT. Once the tree is set up, I’ll be able to play the bells directly from my cell phone.

As a long-time programmer with virtually no electronics experience, this is my first Arduino project that involves more than lighting a few LEDs, and I’m very happy with the way it is turning out.

The project started last Christmas when I visited my friend Beatrice, and she showed me a mass-market set of caroling christmas bells on her Christmas tree. Apparently these things have been around since 1989, but I had never seen one before. I immediately bought a set on EBay for twenty bucks, so it could be hacked.

The built-in micro-controller plays a never-ending stream of Christmas carols, which is cool/annoying, but I wanted to be able to control it myself, which is even more cool/annoying. It seemed like a natural for an Arduino project. One of the cool things about these bells is that the solenoids are already built-in to each bell, which greatly reduces the amount of work needed to make them ring. When the voltage is raised, a clapper on a flexible wire strikes the bell, and then springs back to a natural resting position, which prevents accidentally damping the bell by leaving the voltage high too long. Since there are only 9 bells, that’s enough to be played by an Arduino Uno while leaving a few pins left over for serial communication or other needs.

In March, I took these bells to SpecWork, a local Hack-a-thon, with the intent of using them to provide live sound effects for a video game. My electronics hacking skills are not that great, but CStone (Brandon Creighton) was on hand to help out. We opened the case that contains the bell controller and found that the bells were connected via individual wires to a mysterious custom IC that was dated 1989. My intent was to replace that IC with an Arduino.

CStone measured the line triggering a bell on his oscilloscope, which showed a 17v trigger. We decided to try a 9v battery to trigger them, and it worked! CStone disconnected the two bunches of wires, and connected them to the Arduino, with an individual N-Channel mosfet for each bell. The 9v worked okay, but I was having trouble getting a couple of the bells to ring consistently. I found out later that using the 12v power supply that came with the bells fixed this problem.

Below is a video of the bells ringing while I’m playing the game 2048. For the 2048 project, I used the Firmata driver on the Arduino, and wrote a node.js backend that could talk to the Arduino via Firmata, so I could chime individual bells via a REST API. I then modified a local copy of the 2048 game to ring the bells via this API (this amounted to inserting a couple lines of code in the 2048 game). In the video, you can also hear some additional digital sounds I added to add ambience to the game.

Ultimately, though, I wanted to use the bells to do more interesting things than playing that one game, and I didn’t want to have to keep a computer adjacent to my Christmas tree.

I moved the project to a larger breadboard, added a socket for the 12v power supply that comes with the bells. I also added some resisters to reduce spurious rings when I power on, although I don’t think they are a necessity for this project.

I then swapped in a different Arduino clone (a RedBoard from SparkFun), and picked up a couple of XBee radios. One radio sits on an XBee Shield on it, mounted on the RedBoard, and the other sits on an XBee Explorer Dongle hooked up to my desktop computer via USB. Now I can control the bells by sending messages to the Arduino via radio. The total cost of the project, including radios, is about $140. However, if you don’t use the radios, it’s about $50. Jamie Robertson and Joe Hager helped me figure what was needed here, and the book “Building Wireless Sensor Networks” by Robert Faludi was also helpful.

Programming the Arduino to use the radios is almost identical to programming it to use a serial connection. The main difference is that you can’t send entire strings and expect the radios to handle it — I found I had to insert little delays (around 10 milliseconds) between each character as I send a string.

When I googled “Firmata XBee” I saw that I might run into some issues using Firmata with XBee. Also, since I was using radios, I wanted to have a little more local control over rhythm, so in place of Firmata, I wrote a short Arduino script that chimes the bells according to a simple serial protocol. The protocol is intended for music: it allows different tempi to be specified, and for chords to be played. Here are the first few notes of the “Star Wars” theme:


The letters in the beginning are used to set the tempo of each note, and the numbers indicate note numbers. The hyphens are delays (used to extend notes), and ampersands (not shown) are used to indicate chords.

I replaced the node.js backend with a Python/Flask backend, based on a very flexible Flask framework by my colleague Ray Scanlon, which I’m going to call “FlaskRack” since he hasn’t given it a name. This framework allows you to make a set of modular services, each running in its own thread, and each of which has a publish/subscribe hook. It’s really good for making Kiosks that involve talking to diverse bits of hardware. I made a few different Flask modules using FlaskRack:

* “Chime” talks to the Arduino via an XBee Explorer that is connected to a local serial port. I can publish to this module via a REST API to send melodies to the bells from a web browser.

* “Transcribe” has a catalog of carols/songs that can be requested by name – it talks to “Chime”. You can publish to this module to request songs by name.

* “Clock” chimes the quarter hours, like a Westminster-style grandfather clock – it talks to “Chime”.

* “PushBullet” subscribes to the PushBullet API/service, which works nicely with IFTTT, and enables me to create a wide variety of interesting triggers to ring the bells. For example, I can trigger melodies when my Nest Thermostat detects motion, or that the temperature has dropped. This module talks to both “Transcribe” and “Chime” depending on which kind of trigger is used.

I’ll be using the Chime and Transcribe APIs to control the bells from my cell phone.

You’ll find the Flask backend and the Arduino scripts on Github.

More info available upon request.

Thanks to CStone, Matt Pinner, David Guttman, Jamie Robertson, Joe Hager and Ray Scanlon for advice, soldering, code and general expertise.

Comments are closed.