I’m planning to release PCBs, chip sets and, potentially, a full kit for this module in 2018. It’d be a great help to me if you’d spare the time to tell me whether this would be of interest to you (there’s a form at the bottom of the article).
Thanks,
Dave
I’ve set my self a target for this year – by the time 2018 rolls around, I want to have a live performance setup that has no laptop computer in it.
This brings challenges, as at the moment my laptop (and the Ableton Live software that it plays host to) performs a number of valuable tasks, not least of which is keeping everything (instruments, effects, etc) in sync and running to the same tempo clock.
So, as a first step along the road to freedom from a computer, I chose to address the clock issue. Could I create a clock module that would work for both MIDI and my voltage-controlled analog equipment?
Being from a software-design background, the first thing I did was create a specification:
- Clock must output the same tempo to MIDI and CV (control voltage)
- It should work with it’s own, internal clock source and, optionally, be able to “slave” to an external MIDI clock
- It must recognise (and be able to generate) MIDI stop and start messages, and stop and start the CV clock pulse too
- Tempo must be adjustable on-the-fly, in real time
- There should be visual feedback for current tempo, whether it’s running on internal or external clock, a “pulse” for the current tempo and whether the clock is currently running
I identified fairly early on that this could all be achieved using an ATMega328 microcontroller chip (also known as “Arduino“) via some fairly straighforward programming. All of the individual parts of the software puzzle had already been solved by other people, it was largely just a matter of stitching all of the relevant bits of sample code together.
I decided to utilise a rotary encoder with a built-in push-switch for setting the tempo and starting and stopping the clock. A 4-digit, 7-segment LED display would provide all of the visual feedback.
To develop the software I used an Arduino Nano clone, and started hooking up peripherals (initially just the encoder, display and a toggle switch for internal/external clock) on a breadboard.
At this stage the clock could receive external MIDI, toggle between internal and external modes, I could set a tempo and start/stop the clock. Lots of really great progress quite early on.
However… Arduino runs on 5 volts. My modular environment runs on 12 volts. So, there’d need to be a power converter in the design. Additionally, Arduino outputs 5v from it’s digital outputs. CV signals are typically up to about 10 volts for clock signals, so I’d have to design in a way of boosting the Arduino’s output.
And, as is always the case, the specification expanded a bit along the way:
- It’d be really handy if the gadget remembered the last tempo it was set at when it’s turned off
- How about being able to set the tempo by tapping a switch in time with some music?
- And wouldn’t it be nice if you could do that from a footswitch?
- And if we’re doing that – why not have start/stop on a footswitch, too?
- Outputting a CV clock pulse is great – but having options for whole, half, quarter, eighth beats would be really useful
I decided to split the project into two boards at this point; one to handle the basic clock mechanics and a second board (with a second ATMega328 chip) to handle converting MIDI to CV and dividing the output into a whole bunch of different clock divisions. That way, I could keep the code compact and efficient on the clock board and not have to worry about using up all of my available I/O pins.
To solve the “remembering the tempo” feature, I could write the tempo to the chip’s on-board non-volatile memory (EEPROM). However, there’s a limit of about 100,000 writes to this before it fails. If I simply wrote to it every time the rotary encoder read a change in state it would
- Slow the code execution down
- Burn through those 100,000 writes in no time
Fortunately, this had been solved already – I found a forum post that described a way of detecting the voltage drop on power-off, and which showed how to buffer enough charge in a capacitor to allow the chip the few milliseconds it needed to write to the EEPROM when it sensed the power going out.
Before too long I had a finished breadboard for the clock module, which I converted into a schematic and built a finished board from. I used my homemade Arduino Programmer to burn the chip and then put it to one side and started breadboarding the CV clock divider board.
Again, this turned out to be pretty straightforward, just a case of counting the incoming MIDI clock ticks and pulsing a square wave to the Arduino’s digital output pins. The conversion of 5V to 10V outputs was handled by a sketched schematic in a forum post, which also provided details about output protection. This breadboard went together very quickly as I only had to prove the principle for a single output – I could then just duplicate the basic circuit to the other outputs. I decided that the outputs would be
- Whole note
- Half note
- Quarter note
- Eighth note
- Sixteen note
- Thirty-second note
I designed in a half-dozen expansion pins on the board so that if I want to, I can extend this in the future.