Opto-couple confusion – 6N137 or 6N138?

Preamble

Following on from USB to MIDI connections, and Notes on optocouplers, I realised that I, myself, had become a bit confused and mixed up my optocouplers.

Trash80 recommends using a 6N138 in the ArduinoBoy, see the schematic. I had subsequently order a batch of 6N138, in order to build an ArduinoBoy, see Making your own ArduinoBoy. Then I started looking at the use of optocouples for other MIDI applications. However, many other users recommend 6N137 for MIDI applications, and I ended up getting the two confused.

So, how different are they? Are they interchangable? Is the 6N138 the right optocopuler for the ArduinoBoy?

Also, just to add to the confusion, what about the 6N136?

Links to other confusions

There are others, see search.

Details

From 6N138 instead of 6N137

The 6N137 is a different affair from the 6N138 and needs to be calmed down with a high pull-up to avoid transient leaking on the board. The 6N138 is slow, barely fast enough for MIDI, and needs a low pull-up (220 or 470, 1k if you’re paranoid about noise).

From Re: Arduinoboy MIDI. Optocoupler issue (I think):

The 6N138 and 6N139 have Darlington amplifiers and should be interchangeable. Not so the 6N137.

From MIDI to Arduino with a 4N38 Optocoupler

The 6N138 uses a photodiode, but its Darlington output is too slow for MIDI unless you add more components (e.g., a base/emitter resistor) to speed it up.

From Building a midi project with Arduino + scrap components (optocoupler and diode)

The MIDI DIN electrical standard is available for free at https://www.midi.org/specifications-old/item/midi-din-electrical-specification

With respect to the isolator, the standard says:

Sharp PC-900V and HP 6N138 opto-isolators have been found acceptable. Other high-speed opto-isolators may be satisfactory. The receiver must require less than 5 mA to turn on. Rise and fall times should be less than 2 microseconds.

From MIDI IN : many circuits

Optocouplers with Darlington output (like the 6N138) are very slow, especially when the output transistor should switch off.

To get a sufficiently fast raise time of the output signal, the base of the output transistor needs a connection to ground (through a resistor) so that the base charge can be removed quickly. Any value between 4.7 kΩ and 10 kΩ should work fine.

Furthermore, the raise time of the output signal also depends on the value of the pull-up resistor (R1 below). Smaller values result in faster raise times, but very small values increase the power usage when the optocoupler pulls the output low. In practice, about 1 kΩ is commonly used.

kc9zw

From Monotribe, MIDI and me

If you want to do it properly, you can use for example a 6n136 or a 6n138. If you choose to use a 6n136, connect it as pictured above. (Connect +3.3 V, the red wire in the picture, instead of +5V in the schematic.) If you’ll be using a 6n138, you can use the connection below, according to Wooster audio. The part of the circuit that is to the left of the diode is the same as in the 6n136 circuit.

6038673381_ae52d02c08_b

From 6n138 Before and After

For my MIDI projects I’ve use been using 6n138 optocouplers. So far they have all been 5 Volt designs, and the standard schematic with a 270 ohm pullup from the output (pin 6) to Vcc works fine.

However my FPGA synth is 3.3V, and I noticed that I’ve been losing MIDI data and getting UART framing errors. I looked at in the scope and YIKES it looks terrible (top picture) .

I saw this link: Fixing Gameboy-powered Arduinoboy MIDI glitches and tried a 4.7K from VB (pin 7) to ground and it looks so much better (bottom picture).

4925449834_906356c06e_b

and

With the 6N138s I’ve seen in MIDI circuits they usually use a 470R resistor from Vo to the +5V rail, and a 1K from Vb to ground, while Vcc and GND go direct to the rails.

and

i’ve tried this with a Monotribe (also 3.3V) however there’s still some noise when using for example pitch-bend or sending other CC data.
(6n138, 4.7K on pin 7 and 220 on pin 6 )
any solutions for this?

Internal Schematics/Pin outs

The pinouts are the same, however the internals are different

6N136

From https://www.vishay.com/docs/83604/6n135.pdf

6N135 and 6N136 pinout
6N135 and 6N136 pinout

6N137

6N137
6N137

6N138

Darlington transistor pair is used

6N138
6N138

Synopsis

It would appear that the 6N137 is the preferable optocoupler to use, en lieu of the 6N138, although a circuit change would be required in order to use the 6N137 in circuits design for the 6N138.

However, even though the 6N138 is slow, it is probably sufficient for use in an ArduinoBoy, so long as the additional 4.7-10 kΩ base-emitter resistor is used (and the 1 kΩ pull-up). Empirical testing would be necessary to confirm this however. The ArduinoBoy design by Trash80 uses neither of these:

arduinoboy_schematic_1_1_0

2 thoughts on “Opto-couple confusion – 6N137 or 6N138?”

  1. 6N138 has been used in MANY MIDI products for the last 4 decades. As long as you have the Vb resistor (1K seems to be the most common value for this), it performs beautifully.

    Liked by 1 person

Leave a comment