Sunday, 10 April 2016

Big Clock: building a MIDI Master Clock, part 1

As part of a musical project I’m involved in, we have a few pieces of old school MIDI hardware (drum machines, arpeggiators etc.) that can be synchronised to a MIDI clock; this is a standard that distributes tempo information around a MIDI network to keep everything running in time. Although it’s straightforward to generate MIDI clock from a computer, we wanted to be able to potentially play out with no laptops involved in the setup, so I decided to investigate building a MIDI clock generator for our hardware rig.

The original (and best) MIDIClock+

Before I set off on the build, I had a look around to see what was available for clock masters. Besides the usual high-end offerings for ‘proper’ studios that were in the mid–4-figure range (GBP), I found the MIDIClock+ device from E-RM in Berlin. If you need a MIDI master clock off the shelf, buy one of these. Seriously, buy one; it has more features and is likely more accurate than the one I’m about to describe.
However, for me it’s not the having but the finding out, so I decided to use some of the features to inspire the design of the Big Clock.

Planned features

We totted up the devices around the two home studios we were working with and decided that 8 outputs were enough. Our combined feature wishlist ended up looking like this:
  • 8 MIDI outputs;
  • A big knob to control tempo
  • An LED display showing the current tempo
  • Start and stop buttons
  • A missile-style launch switch for some to-be-determined function. We needed the switch though.

Electronic design

Most of the hard work in building an embedded micro controller project like this is in the firmware, but you need the hardware to develop on, otherwise generally you are just guessing whether your code will work (although TDD on embedded systems is a possibility and be used to get high quality code written before the hardware is ready - more on that in a later section).

Teensy 3 microcontroller
Photo CC-BY 2.0 by SparkFun Electronics 
For the processor at the heart of the design, I decided to use a Teensy 3 micro controller. This is very like an Arduino but instead of an 8-bit AVR core it has a 32-bit ARM core - I felt that the reasonably high clock rate and power of this would help the timing accuracy of the clock messages that the design would need to support. Additionally, there were some nice features for handling rotary encoders I could foresee being useful for the tempo control knob (see below).
SparkFun Serial 7-Segment Display
Photo licensed CC-BY-SA 3.0 by SparkFun Industries, CC BY-NC-SA 3.0


For the display, I needed to keep the pin count manageable so I opted for the Sparkfun Serial 7-Segment Display, which has 4 digits and individually addressable decimal points etc., and allows the use of asynchronous serial, SPI and I2C interfaces.

For the tempo control knob I picked a rotary encoder with embedded RGB LEDs, because multicoloured LEDs are cool, and everything was going to be built on an full size Adafruit Perma-proto prototyping board.

The housing

I wanted to laser cut a housing for this on the Edinburgh Hacklab laser cutter, based on a Hackaday posting posting I had seen on making a housing for a laser cut PSU. I exchanged some emails with Csaba, the creator of that housing, to try to understand the internals better and he was kind enough to send me his design files to poke around in.

With this information and based on the dimensions of the components I had chosen, I drew up the cutting plan in Draftsight to make sure everything lined up and the components fitted in the box.
Drawing the housing in DraftSight

Once everything looked like it fitted together, I then cut the parts from 4mm ply on the laser cutter.
Laser cutting the parts.
Continue to part 2: assembly.

No comments:

Post a Comment