Teensy 3 Midi DIN to CV out

I don’t usually mix my micro controller obsessions with my music making, but a friend gave me Korg Monotron analogue synth as a present, and I really love the filter it has. However, I want to be able to combine the lovely synth sounds it can produce with a keyboard and arpeggiator. So, how about hooking it up to receive Midi signals through a DIN connector.

The basis midi din to cv setup. Midi to CV converter via Teensy 3, then to cv breakout box

The basis midi din to cv setup. Midi to CV converter via Teensy 3, then to cv breakout box

Here’s a small audio snippet of a Korg Z1 arpeggiator driving the Monotron via MIDI DIN to give an example of what I was hoping to achieve by midifying the Monotron.

Marc Nostromo has a really good page on how to setup the Teensy to receive Midi signals via USB from a computer.

However, I needed to have the teensy 3 receive the Midi information via a midi DIN connector from other synth equipment, as I didn’t want to use a computer to send the info. Well, it was as straight forward as hooking up the midi connector to the Serial1 port of the Teensy 3, and then read this incoming data out via Marc’s code with some small changes.

Hooking up the Midi connector to the Teensy3 Serial1 pins requires the signal to be sent through an opto-isolator to protect the Teensy circuitry. I did run the input without the opto-isolator, and it survived, but better to be safe than a dead Teensy3.

inside the Midi DIn to CV out Teensy 3 converter

inside the Midi DIn to CV out Teensy 3 converter

In my setup, I have decided to keep the micro-USB port of the Teensy3 accessible through the housing so that i can reprogramme the Teensy, and I can power the converter via the USB port using a 5v USB connection either from a wall charger or a computer. The monotron breakout box was used, rather than having fixed connections, so that the converter can use 1/4inch jacks. This means that I can use the box for other equipment, and not just the monotron.

I used the SFH618A-2 optocoupler, as this was easily available. There were some comments from Paul @ PJRC regarding this optocoupler and the time it requires for signals. There is a short discussion about using a better one here: https://forum.pjrc.com/threads/29376-SFH618A-2-opto-coupler

Breadboarded SFH618A for testing

Breadboarded SFH618A for testing

After some testing, I found that a 560ohm resistor was the sort of value to use on the output with a 220ohm on the input. You can use a resistor value calculator to get you in the right ball park. I used this one after being point to it by forum user, it worked. http://www.hobbytronica.eu/led-resistor-calculator-for-dc-and-ac-power-supplies/
here is the wiring diagram for the opto coupler.

here is the wiring diagram for the opto coupler.

The schematic and arduino library is described in this link to PJRC Midi connector page.
The basic setup is:
Midi In -> optoisolator -> Teensy3 Rx (pin0) -> splits signals to Pitch/gate/cutoff.

Marc’s code for converting the incoming USB midi stream can be changed to accept the stream from the Serial1 pins (Rx = pin0) on the Teensy 3, by changing the calls from usbMIDI, to MIDI, and altering as below in setup () and loop():
void setup()
// Initialise hardware
Hardware::Configuration configuration;

configuration.audioRate_ = 57600;
configuration.paramRate_ = 1000;

configuration.audioCB_ = onSampleUpdate;
configuration.paramCB_ = onParamUpdate;

bool status = Hardware::SInstance().Init(configuration);

// Initialise midi input callbacks

MIDI.setHandleNoteOn(SOnNoteOn) ;
MIDI.setHandleControlChange(SOnControlChange) ;
void loop()

1 comment on “Teensy 3 Midi DIN to CV out

  1. Pingback: Teensy 3 Midi Din to CV out | orchardelica blog