MIDI 5 pin DIN and TRS swiching circuit


Well-known member
As part of my soon to be revealed project, I am working on a circuit that offers both 5 pin DIN MIDI and 3.5mm TRS jack conectors. I have a load of TRS switching jacks which are readily available.
Please take a look at the attached schematics. I am second guessing myself as I am not sure I have pins 4 and 5 correct on the 5 pin DIN. Also if you notice any glaring errors in the optoisolation on the MIDI in and the use of the hext inverter to protect the MIDI outs.....

I am also going by the pin out of the TRS that 5 is the tip, and 2 is the sleeve. I will endeavour to test this tomorrow....

Re the 74HC14 hex inverter, I ported this approach from the tSynth project, I suppose the idea is to use two passes on a hex inverter to offer some level of protection... As well as USB midi, my project offers 1X Serial MIDI in and 2X serial MIDI out connectors using both 5 pin DIN and these switching TRS connectors. By using the TRS the DIN socket is bypassed.

the jacks are: https://www.amazon.co.uk/HALJIA-Socket-Headphone-Stereo-Connector/dp/B07422MCSX

I have gone with MIDI TRS type A as this is suggested to have become the defacto standard as mentioned here: https://minimidi.world/

MIDI in din5 TRS switching circuit.jpg

MIDI out din5 TRS switching circuit.jpg

HALIJA diag1.jpg

HALIJA diag2.jpg

Hi snowsh

For what it is worth (if someone else is still looking for a working solution), I implemented this circuit and got the wrong MIDI messages from my MIDI controllers.

I initially thought it was because I was using a 6N139 instead of a 6N138 but they appear to be identical.

After searching various forums I came across a good answer on stackexchange at https://electronics.stackexchange.com/questions/165255/midi-in-many-circuits

The answer states that "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."

The bottom line is that you need to connect pin 7 (of the 6N138/9) to ground using a 4.7k-10k resistor.

I used a 10k resistor with your midi-in circuit and it worked perfectly.

P.S> I did not use any Schmitt triggers for the output and it works fine.

Thanks for your initial query.

I am also going by the pin out of the TRS that 5 is the tip, and 2 is the sleeve. I will endeavour to test this tomorrow....

At this TRS socket, 5 is the tip, 2 is the ring and 1 is the sleeve.
For reference the TRS plug: