The ramblings of an IT Professional, Long Distance Runner, Creative, and Maker of Stuff.
Modular Synthesizer Project
Part 2 - MIDI To CV

Sooner rather than later I'd need to be able to trigger the modular synth from Logic or an external source, so figured I best bite the bullet as this required a bigger mixture of hardware and software and complexity.

Working on the basis that MIDI is pretty universal, it was clear that a MIDI (Musical Instrument Digital Interface) to CV (Control Voltage) convertor was required. In short this module takes MIDI data (serial bytes) interprets them and converts them into a series of either gate signals (on/off) or control voltage signals (0-10v).

I decided that this was one of those "it needs to be a micro-controller" projects, as doing this with pure TTL (Transistor Transistor Logic) would be a real chore. The ATMega328 was the natural choice, given that I've used Arduinos and ATTiny chips for previous projects. Furthermore, since we are dealing with serial data (MIDI), the demands for accurate timing would require a proper hardware UART (Universal Asynchronous Receiver /Transmitter), which suit the ATMega328 nicely.

The basic circuit is based around this Arduino tutorial and simply augmented with details from Larry McGovern's repo.

Rear view
Rear view

The circuit is based around 4x core IC's:

  • ATMega328 - The main microcontroller that orchestrates everything
  • 6N137 Opto-isolator to sit between the MIDI RX pin and the ATMega328 serial RX pin - MIDI standards are based around opto-isolation/coupling to reduce earth loops and to protect equipment.
  • MCP4922 DAC - To generate an analog 0-5V output from the ATMega328
  • TL072 Op-amp - Dual channel op-amp to amplify the note CV output to 0-10v range and to act as unity gain / buffer for the velocity CV output.

With the ATMega328 it was pretty simple to find a circuit and some MIDI libs to start reading MIDI data streams and acting on them, particularly with gate outputs. However, for CV outputs, this required a bit more thought as the ATMega168 doesn't have a native DAC (Digital Analogue Convertor). A bit of research and trawling the 'net, I landed on using a SPI (Serial Peripheral Interface) based DAC - the MPC4922. This provides 2x CV outputs; one for note CV (pitch), the other for note velocity. The later being useful for accenting notes with filter modulation.

The only other catch is that so far we are talking 5v logic level voltage, and in order to achieve 1v/octave across 88 notes, this would mean 0-7.33v range. This is where the op-amp comes in. In hindsight, I should have also used a 2x gain on velocity to get a 0-10v range which is typical of CV output.

This module's thirsty fascia courtesy of Beavertown Gamma Ray.

Panel view
Panel view

I used Larry McGovern's repo for the basis of this with a couple of differences:

  • MCP4922 rather than MCP4822 (essentially 10bit vs 12bit resolution).
  • 6N137 rather than SFH618 opto-coupler which is faster.
  • Bare bones ATMega168 (with bootloader) rather than Arduino mini.
  • Omitted pitch bend and control change.
  • Added changeable clock pulse interval (24 ppq, 12 ppq and 6 ppq), hence 16th, 8th and quarter note pulses.
  • Added MIDI channel DIP switch (4bit) so channel 1-15 selectable or omni-mode.
  • Added tuning pot to the note CV output rather than using series resistors, allows finer tuning to the 1v / octave.
  • TL072 rather than LM324N op-amps as I had a load of TL072 and TL074's.
  • Added FTDI programmer header to allow updates to the software to be easily uploaded.
  • Added clock reset gate to handle stop / start MIDI events.

The result is pretty effective as a mono-channel, mono-phonic MIDI to CV convertor. Doesn't really need to be much else than that to be honest. I've recorded parts 2 and 3 together.

More blog posts in this series: