# MIDI IN > OUT Delay with teensy and opto 6N137

#1

Hi guys

I’m having a problem building a midi input/output circuit.

The circuit works. The problem is that i’m experiencing a minimal delay (about 10ms) when sending notes.
I’m using a teensy 3.2 with a 6N137 opto.
As this is going to be a sequencer, i need it to be exact.

The circuit goes like this:
MIDI OUT:
MIDI jack Pin 5 - 10 Ohm resistor - Pin 1 (TX)
MIDI jack Pin 4 - 33 Ohm resistor - 3.3v
MIDI jack Pin 2 - GND

## MIDI IN: MIDI jack pin 4 - 220 Ohm resistor - 6N137 pin 2 MIDI jack pin 5 - 6N137 pin 3 6N137 pin 2 - 1N4148 diode - 6N137 pin 3 6N137 pin 5 - GND 6N137 pin 6 - pin 0 (RX) 6N137 pin 8 - 3.3V 6N137 pin 8 - 5.6K resistor - pin 0 (RX) 6N137 pin 5 - 100nF capacitor - 6N137 pin 8

I don’t know if this is a hardware or software problem anymore.

#2

omg… I solved it putting RunNotes first and then Sync…

Anyway… I would love to have an opinion about my circuit of someone experienced in electronics

#3

Why don’t you post an image of the circuit? It’ll take me a few seconds to check it just looking at the image!

Regarding the MIDI out circuit, I assume for my circuits a voltage drop of 1.7V for the opto-isolator and a required current of 5mA. At 5V, this gives ((5.0 - 1.7) / 0.005 - 220) / 2 = 220 ohms for the two resistors on the transmitter side (consistent with the schematics published in the original MIDI specs); and at 3.3V, this gives ((3.3 - 1.7) / 0.005 - 220) / 2 = 50 ohms (you’ll find 51 ohms resistors in the MIDIpal and Yarns for example). I’ve never seen an occurrence of a Yarns or MIDIpal unable to drive a piece of MIDI gear.

If you base your calculations on the 6N138 specs, you have a voltage drop of 1.4V and a current of 7.2mA (Source: https://mitxela.com/other/ca33.pdf); and that’s how you derive that the two resistors should have a total resistance of 43 ohms. Note that a lot of current will flow through the 10 ohms resistor in case of a damaged cable - you’ll have to use 0.5W resistors.

#4