Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MIDI In/Thru using a 6N138 and a 74HC14

Status
Not open for further replies.

Jon Wilder

Active Member
As I had questions about this myself I thought I'd post a helpful diagram for anyone who might happen to wonder how to properly hook up a 6N138 optoisolator as a MIDI Input. This diagram shows both the MIDI In and the MIDI Thru. A MIDI Out is identical to a MIDI Thru, however the input to the first Schmitt Trigger inverter is tied to the UART TX rather than the UART RX. This allows you to send the same OR different data from the UART TX to the MIDI Out rather than just mirroring the incoming data from the MIDI In like the MIDI Thru does.

The 1K resistor from pin 7 to ground is required for the quickest rise/fall time of the output transistor as you only have 32uS per byte. It can be 1K or higher. Some have used values as high as 22K here.

Hope this helps anyone who has this question -

**broken link removed**
 
Nice work Jon. :)

If that schematic is your work (I assume it is) then you may want to put your name and date on it, both for your own credit and to also help others who may need to ask questions about it etc, it is nice to know who the author was.
 
Nice work Jon. :)

If that schematic is your work (I assume it is) then you may want to put your name and date on it, both for your own credit and to also help others who may need to ask questions about it etc, it is nice to know who the author was.

It looks like a standard 1080's circuit for MIDI, and very similar to the one I had published back then (in the Amiga User Group Magazine, and Computer Shopper Magazine). I can't remember what IC I used? (or even if I used transistors?), but mine had one in, one through, and three out - and it used the same 6N138, it was a very popular opto-coupler for MIDI.
 
The circuit itself isn't mine although the artwork itself is as I drew these schematics up myself in Express PCB. The circuit came out of a Marshall JMP-1 valve MIDI preamp, and from what research I've found it appears to be a pretty standard hook up for the 6N138 optoisolator for MIDI In.

What I was hoping to do was have this thread made as a sticky for guys who were wondering how to properly implement a 6N138 optoisolator into a MIDI In circuit. The ones I was finding had pin 7 disconnected and a resistor from pin 8 to the positive rail. However, I had found others who tried that configuration who observed receive errors and such, only to find on a scope that the rising edge of the "1" bits all had a "curve" in them. Tying pin 8 straight to the + rail while installing a resistor to ground on pin 7 seemed to drop the rise time of the output transistor, which sharpened up the rising edge on the "1" bits, which cured the receive errors.
 
Last edited:
The circuit itself isn't mine although the artwork itself is as I drew these schematics up myself in Express PCB. The circuit came out of a Marshall JMP-1 valve MIDI preamp, and from what research I've found it appears to be a pretty standard hook up for the 6N138 optoisolator for MIDI In.

What I was hoping to do was have this thread made as a sticky for guys who were wondering how to properly implement a 6N138 optoisolator into a MIDI In circuit. The ones I was finding had pin 7 disconnected and a resistor from pin 8 to the positive rail. However, I had found others who tried that configuration who observed receive errors and such, only to find on a scope that the rising edge of the "1" bits all had a "curve" in them. Tying pin 8 straight to the + rail while installing a resistor to ground on pin 7 seemed to drop the rise time of the output transistor, which sharpened up the rising edge on the "1" bits, which cured the receive errors.

The resistor on pin 7 is pretty important, as you say it speeds things up.

Bizarrely enough, today I found a MIDI interface I'd built in my bag at work, I'd forgotten it was there :D
 
The 1K resistor from pin 7 to ground is required for the quickest rise/fall time of the output transistor as you only have 32uS per byte. It can be 1K or higher. Some have used values as high as 22K here.

Back in September 1986 (last century :) ETI published a MIDI 4x4 matrix circuit (4 IN - 4 OUT switch selectable) which had pin 7 of the 6n138 unconnected. The PDF from VISHAY for the 6n138 chip also shows pin 7 unconnected in the test circuits. this circuit only uses a single 74LS04 buffer for each MIDI IN . Did you find the addition of the 1k - 4k7 resistor to GND made a discernable difference and did you discover this option from your own experimentation. just curious as I'm resurrecting one of the ETI projects that had been made by a hobbyist (albeit wired incorrectly). regards Gavan.
 
Back in September 1986 (last century :) ETI published a MIDI 4x4 matrix circuit (4 IN - 4 OUT switch selectable) which had pin 7 of the 6n138 unconnected. The PDF from VISHAY for the 6n138 chip also shows pin 7 unconnected in the test circuits. this circuit only uses a single 74LS04 buffer for each MIDI IN . Did you find the addition of the 1k - 4k7 resistor to GND made a discernable difference and did you discover this option from your own experimentation. just curious as I'm resurrecting one of the ETI projects that had been made by a hobbyist (albeit wired incorrectly). regards Gavan.

It's been quite a few years since I tested this circuit so I may have to redo my tests to confirm. But as I recall, allowing pin 7 to float negatively affected the slew rate of the output, causing a delayed and curved rising edge. Adding a pull down to pin 7 fixed the issue. I always used a 1K pull down.

I'll throw one together in the next couple of days and retest to confirm my findings.
 
Back in September 1986 (last century :) ETI published a MIDI 4x4 matrix circuit (4 IN - 4 OUT switch selectable) this circuit only uses a single 74LS04 buffer for each MIDI IN .

Just to clarify, the LS04 also provided the buffers for MIDI OUTs. The switch matrix was used to route the MIDI IN buffers to the MIDI OUT buffers as can be seen (hopefully) in the circuit diagram Sorry about the quality of the JPEG but the only copy I could get was from the State Library on microfiche, so I had to scan it into Photoshop and reverse image it.
regards Gavan.
 

Attachments

  • midimatrix1.jpg
    midimatrix1.jpg
    1.4 MB · Views: 228
My thing is...its proven to work and it's one resistor costing less than $0.10. Is this really even worth a discussion?
 
As I had questions about this myself I thought I'd post a helpful diagram for anyone who might happen to wonder how to properly hook up a 6N138 optoisolator as a MIDI Input. This diagram shows both the MIDI In and the MIDI Thru. A MIDI Out is identical to a MIDI Thru, however the input to the first Schmitt Trigger inverter is tied to the UART TX rather than the UART RX. This allows you to send the same OR different data from the UART TX to the MIDI Out rather than just mirroring the incoming data from the MIDI In like the MIDI Thru does.

The 1K resistor from pin 7 to ground is required for the quickest rise/fall time of the output transistor as you only have 32uS per byte. It can be 1K or higher. Some have used values as high as 22K here.

Hope this helps anyone who has this question -

**broken link removed**

Thanks for posting this. I was just asking questions about this in the MIDI keytar thread.
I'm going to try it with a 74HC14.

https://www.electro-tech-online.com/threads/building-a-midi-keytar.155769/page-1
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top