Combination MIDI In and Out jack
Mag748
Posts: 266
Hello,
I am interested in learning about ways I could design a single MIDI jack (5-pin DIN) that could be used for both MIDI In and Out (although not simultaneously). The reason for this is I am designing a small portable midi device that has the ability to "learn" a midi command from a controller, and then play back that command later. Because I want the device to be samall, ideally a single 5-pin DIN jack that could act as the input while "learning" and then switch to an output when transmitting would be perfect. I could not find any resources on this being done before.
I do realize this goes against the MIDI specification as it states there is to be a separate Input and Output, but I think this would be cool anyway. I was thinking about having an analog switch act as a type of relay to switch between the input and output circuits. But if anyone has any input on this, I would greatly appreciate it.
Thanks,
Marcus
I am interested in learning about ways I could design a single MIDI jack (5-pin DIN) that could be used for both MIDI In and Out (although not simultaneously). The reason for this is I am designing a small portable midi device that has the ability to "learn" a midi command from a controller, and then play back that command later. Because I want the device to be samall, ideally a single 5-pin DIN jack that could act as the input while "learning" and then switch to an output when transmitting would be perfect. I could not find any resources on this being done before.
I do realize this goes against the MIDI specification as it states there is to be a separate Input and Output, but I think this would be cool anyway. I was thinking about having an analog switch act as a type of relay to switch between the input and output circuits. But if anyone has any input on this, I would greatly appreciate it.
Thanks,
Marcus
Comments
The unit will be battery powered. Which also requires the solution to use little power. The analog switch solution only adds a small quiescent current drain. I haven't looked at how much current the optocoupler would consume as part of the input circuit, but hopefully not much. Getting them to work with the same jack may make that more complicated.
True, not quite as simple as some other communications protocols, but not all that difficult either. For MIDI (that typically runs at +5V) you might be able to put 3 receivers in series but that is about the limit. The attached diagram has the typical MIDI in and out circuits on the left and a combined in/out circuit on the right. As long as the base of the PNP transistor is held at +5V (idle state) it will draw no power and have no effect on the receive circuitry. When sending data pulling the base low will send current through the leds of the internal optoisolator and the connected MIDI receiver. The base of the PNP needs an inverted signal which could be done by the uP or an NPN transistor.
I have not tested this circuit for MIDI so the resistor values may need to be changed a bit.
I tested your design in LTSpice (with the change to an NPN transistor to ground as lanternfish pointed out) and it seems to work well. I will go ahead with this circuit in my project.
Thanks,
Marcus
there are some issues with this design that people should be aware
of.
First, because 3.3V is connected directly to pin 4 of the combined
MIDI In/Out jack without a current limiting resistor, a defective
MIDI cable could short the power supply directly to ground (pin 2).
Also, if two MIDI devices incorporating this circuit are connected
together, that would short those power supplies together. A 33 ohm
1/2 watt current limiting resistor could be added between V1 and
Pin 4 of the MIDI jack, and R3 could be changed to 10 ohms, but one
shouldn't assume that circuit to work well under all circumstances
without further study.
Second, MIDI outs are supposed to have pin 2 grounded, and MIDI ins
are supposed to have them unconnected, to prevent ground loops. What
should this circuit do? One might connect pin 2 to ground via a small
capacitor (0.1 uF typical) to block DC when used as a MIDI in yet
provide a low impedance return path for high frequencies when used as
a MIDI out. But again, that isn't guaranteed to work well under all
circumstances without further study.
Respectfully submitted,
The MIDI Manufacturers Assoc
www.midi.org