DIY Modular Synth: MIDI and CV Master Clock

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.

An early breadboard, very little going on here

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.

Final clock breadboard, hooked in to lots of gear

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.

The rest of the job was just down to mechanics – actually building the thing. I used my usual approach for the panel, the only novel part of the panel build being the rectangular opening that I had to cut for the 7-segment display. I used a fret saw for this and it turned out really nicely (much better than I expected it to, to be honest). The display was mounted using a load of hot glue, everything else just went in as usual.

This is now the main entry-point for MIDI into my DIY modular system. The MIDI clock, together with any incoming MIDI messages is sent to the MIDI breakout board for use by other MIDI-aware modules, and everything is “thru’d” to the MIDI output – so all of my external MIDI gear (and my laptop!) can be slaved to it. The clock divider outputs deliver 0 to 10V square-wave pulses when the clock is running, giving me ample CV outputs to run my sequencer and sample-and-hold modules at differing rates. User interaction is clearly marked, visually economical and obvious at-a-glance and settings are held through power-down cycles.

The clock itself is very stable – the measurements that I did using the MIDI-OX diagnostic tool suggest that this clock is rather more stable and accurate than the clocks in most of my existing MIDI gear!

Finished and mounted in my lovely hardwood case (more of which in another post soon)

The result is everything that I could have wanted from this module. This track is the first outing for it, where it’s syncing

My panel design and cutting guide are available below as 600dpi PDF files. Note that I’ve not included holes for mounting hardware in the cutting guide as these can vary from system to system, depending on your mount/rails/bit of timber of choice. Note also that I use M4 PCB standoffs – you might want to cut the 4mm holes to a different diameter, depending on your standoff of choice.

Panel Design

Panel Cutting Guide

Interested in building this project?

I’m in the process of designing and procuring PCBs for this project; if you’d be interested in buying a PCB, pre-programmed chips or a full kit of parts please let me know using the form below – it will help me to gauge what level to pitch the initial release at, what format to design for, etc.

What format would work best for you?(required) Eurorack Module

5U module

MU module

Stand-alone unit

If you have a modular system, what's your power supply? Not applicable

12V

15V

12V + 5V rail

15V + 5V rail

What package of parts would you find most useful?(required) PCB only

Pre-programmed chipset only

PCB + panel

PCB + chipset

PCB + panel + chipset

Complete kit of all parts

Assembled module

What would you say your level is as a DIY-er? Never built anything

Inexperienced

Pretty handy

Experienced

Expert

If you'd like to be kept informed about this project, please enter your email address below; I won't use your email address for any other purpose.

Hey Dave, thanks for the documentation and sharing! i would like to rebuild the project, or parts of it, to use it as master clock for my eurorack. i cant actually verify the code, it says: error compiling for board Arduino/Genuino. I am quite a noob regarding programming, do you have an idea or hint? greetings Rafael

Hi Rafael
Try setting the board type to “Arduino Nano” or “ATMega328P”. The only other thing that might be causing you an issue is if you’re missing any of the libraries that the code uses – the IDE should tell you if that’s the case, though.

Hi Dave,
thanks for nice documentation. Really great piece of work! I’m trying to build this one but I’ve stucked on sending midi signal from master clock to clock divider which is sending the right bpm “pulse” but only with 0x00. I’ve tried connect it to PC via hairless serialmidi and to Arduino Uno with clock divider code and always with same results. Rx diode on Uno blinking in the metronome style with right bpm asi is on LCD but on the serial output are only zeroes. Any ideas what possibly goes wrong?