Raspberry Pi with a Glockenspiel

Raspberry Pi and Glockenspiel

This glockenspiel has been converted to play automatically.

I found a glockenspiel in the local recycling centre and decided to have a go at automating it after seeing details on the Raspberry Pi forum and also on the PICAXE website.

It’s quite a straightforward design, using motors to rotate the hammers downwards and then using a rubber band to lift the hammer upwards one the chime has been struck.

Programming this in Python is relatively straightforward – just allocate most of the GPIO outputs to controlling the motors and then trigger them sequentially. The motors are connected to the GPIO outputs using a pair of ULN2803 darlington driver IC’s. It’s quick but as we’ll see, not the best solution.

I haven’t yet found out how to make the software do a clean exit when CTRL-C is pressed – something to do with creating an exception and then using this to shut down the GPIO outputs. Without this, it’s possible to exit while the motors are energised meaning that the peak stall current is passed through the darlington drivers. I’ve had to replace a couple already.

When I design a PCB for this, I think I’ll use a bunch of discrete darlington transistors (BCX38C) along with a current limiting device.

Overall, the sound is pleasant to listen to. I’d like to refine the software and also include the possibility of using RTTTL ringtones. I’ll probably need to filter out sharps/flats and add some kind of a transpose function. Probably a challenge for later!


14 responses to “Raspberry Pi with a Glockenspiel

  1. Thanks for this updated. I and many others enjoyed your creations, especially this music hack on Exeter piJam. I am also struggling with Ctrl-C problem. Even if I press Ctrc-C to stop the program, still my motors are rotating. I immediately run a dummy program that reset the GPIO pins to output zero current. Please share with me, if you find a way to clean exit a python program.

  2. Pingback: Glock around the clockenspiel | Raspberry World

  3. Pingback: Glock around the clockenspiel | Faweiz Blog

  4. Pingback: Igra zvončkov » Slo-Pi

  5. Polyphony… well, maybe one day! The program controlling this was written late at night the day before showing it at a Raspberry Jam. I only had time to do two tunes, a scale and some arpeggios. As it was, I hadn’t added in any error checking so pressing CTRL-C sometimes left the motors energised which burnt-out the darlington transistor attached to that note. I’ve now learnt to program the error checking (see link above) as well as changing the transistors to something a little more robust.

    I would like to add polyphony but there are other things to take into account:

    First – lots more notes to enter and timings to consider.

    Second – each of those motors pulls a significant current on switch-on. A motor’s start-up current and stall current are many times greater than their running current. The power supply has to cope with this. These little motors pull over an amp on switch-on. I had problems with a plug-top power supply (rated at 1A) not recovering quickly after each pulse (100mS). This limited the maximum tempo that could be played, which made the tunes at the last Raspberry Jam a bit of a drag.

    Overall, I’m sort-of happy as it is. It is relatively simple and easy to program, even with my clunky and hasty coding. I’d like to add RTTTL decoding and sort out a decent power supply, without having to drag my bench PSU around.

    Oh… and I really think it needs to play the theme from “Tubular Bells” by Mike Oldfield!

  6. Pingback: Electronic Hobbies | Glock around the clockenspiel

  7. Pingback: Python powered percussion with the Raspberry Pi Glockenspiel! | Raspberry Pi | Gadget Master

  8. Pingback: Inputs | Manchester CoderDojo

  9. I work at a mid-sized science museum in North Carolina (www.scienceandhistory.org) and am in charge of special STEM projects related to the Raspberry Pi. With one exception all of the projects I put together use an MCP23017 port expander chip to isolate the Pi from the attached devices as well as provide plenty of ports. This project of yours looks really neat and I’m going to work on making one myself for a future museum Raspberry Pi camp.

    I presume you used stepper motors – what voltage?

    Now I need to scour the local Goodwill, etc. for a Glockenspiel.

    Oh, and the try: & except KeyboardInterrup: works great when used with GPIO.cleanup() if you’re not using an MCP23017-type I2C chip.

    • Glad you like the glockenspiel. I didn’t use stepper motors, but rather decided on a bunch of dc motors that had been in my cupboard for years. I’m not sure what their rating is, but I’ve driven them with a 12v supply. They’re driven with a short pulse so I’m pretty sure they’ll last. One thing I did find a little problematic is the PSU – it seems that some of the cheaper plug-top SMPSU’s aren’t good at handling the short pulse, so a linear one might be better. I haven’t yet tried my port expander chip but I can see that as a better/safer way to go.

      I hope you have success with your project – let me know how you get on. If I make progress with my software I’ll post it here.

  10. Nice project. I was searching for some fab projects with Foamex and found your website. Did you also use Foamex for this one just like a pcb case on the next post?

    • We use Foamex for most things at school. It cuts so easily and is really gentle on the cutters. We’re buying these cutters and they seem to work well in our Denford Microrouter. It also cuts easily with a knife. Sadly it won’t laser cut safely (toxic fumes) but we haven’t got a laser cutter anyway. Lastly, it’s cheaper than Acrylic.

      If you need to make a case, box or 3d structure, then use the case designer to help you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s