2
\$\begingroup\$

enter image description here

I am reasonably new to this, and I am trying to find the calculations used to choose the component values in this circuit.

Concerning the Optocoupler, from what I can work out:

6N139 Forward Voltage = 1.4V Supply Voltage = 5V

so: 5-1.4/220= 16.36mA through the optocoupler.

But the MIDI standards state that it should be 5mA current loop?

Also, how was the other values calculated? Thank you

\$\endgroup\$
  • \$\begingroup\$ I don't know what resistor I used in my MIDI project anymore, however I used H11L1 optocouplers. \$\endgroup\$ – Michel Keijzers Mar 21 '18 at 13:52
0
\$\begingroup\$

You are right that the MIDI standard specifies a current loop.

If the transmitter is designed according to specifications, it will send a 5 mA current, not a voltage. No matter which resistor you are using in series with this signal, the current will still be 5 mA through the resistor and the opto-coupler LED.

So why is there a resistor at all? Well, most MIDI equipment doesn't implement an actual current loop, but "fake it" by using a voltage signal and a series resistor. The resistor is likely chosen to minimize the current in case such a common semi-voltage signal is applied, and its value selected to be low enough not to cause problems with weak signals and still give a reasonable current through the LED, while high enough to prevent too much current to flow in case higher voltages are encountered.

The extra diode is also technically unnecessary, but useful for protection against reverse polarity. The 220 ohm resistor helps to dissipate power in this case, so the diode does not burn up.

\$\endgroup\$
  • \$\begingroup\$ Yes it is 5mA. So I guess when you say transmitter, you mean an external MIDI controller/keyboard? And the 220ohm is used for protection, as well as the diode? \$\endgroup\$ – konobyBYnight Mar 21 '18 at 15:34
  • \$\begingroup\$ @JackTranckle Exactly. Transmitter = Whatever is connected to your input. The diode is there to protect against reverse polarity, I've updated the answer a little. Also puzzled about the downvote, if there are technical inaccuracies I'd like to know! \$\endgroup\$ – pipe Mar 21 '18 at 15:37
  • \$\begingroup\$ Thank you, there seems to be a small contradiction between two answers. I am unsure which one is correct. \$\endgroup\$ – konobyBYnight Mar 21 '18 at 16:23
  • \$\begingroup\$ @JackTranckle Please detail what you believe those contradictions are, maybe it's important for your understanding of the concepts. I've read the other answer and I don't think it contradicts anything I've written. It's possible that I'm more skeptical about the MIDI documents than the other author, because their example output is not a current loop driver.. :) \$\endgroup\$ – pipe Mar 21 '18 at 17:42
  • 1
    \$\begingroup\$ So the design that I am following (the MIDI reference) is not a true current source? and since it in not, the resistor value changes the the input current. Is this undesired? thank you for your thorough explanation \$\endgroup\$ – konobyBYnight Mar 22 '18 at 12:39
2
\$\begingroup\$

If you create a free account at midi.org, you can get the current version of the MIDI spec here. The spec has a good description of the electrical interface. It's worth looking at.

The recommended MIDI OUT circuit from the spec is shown below. It has two 220 ohm resistors. When you connect this to the MIDI IN circuit in your schematic, there are THREE 220 ohm resistors in the loop, two at the source end and one on the destination end. This gives you around 5ma of LED drive current.

It makes sense to design the MIDI OUT this way so that external to the device, you always have a resistor between the +5V and driver and the outside world. This helps to assure that nothing fries if either of them is accidentally shorted to ground.

midi circuit

\$\endgroup\$
  • \$\begingroup\$ Im slightly confused by where the 3 220ohm series resistors are? There is one at the input of the Optocoupler and 1 at the input of the Opamp. is there a third? and if there is, would the current by calculated by 5-1.4/220x3 = 5.4mA ? \$\endgroup\$ – konobyBYnight Mar 21 '18 at 15:38
  • \$\begingroup\$ @Jack Tranckle, I was focusing on what is driving the MIDI IN. Assuming it meets MIDI spec, the MIDI OUT source, pictured above, will have a 220 ohm resistor in the +5V path and the driver out path. That plus the one at the MIDI IN give you three. \$\endgroup\$ – crj11 Mar 21 '18 at 15:43
  • \$\begingroup\$ Also, your current calculation is correct, assuming 1.4V. The 1.4V is specified for 1.6ma and Vf goes up slightly with current, so the actual current is closer to 5ma. For Vf = 1.7V, you get 5ma exactly. They could also just be considering the max Vf which is 1.7V. 1.4V is the typical Vf. \$\endgroup\$ – crj11 Mar 21 '18 at 15:57
  • \$\begingroup\$ Thank you, that makes sense now. so the actual MIDI OUT is not outputting a 5mA current? not until it is connected with the remaining resistor value that compliment the optocoupler specs, which then meet the MIDI standards? \$\endgroup\$ – konobyBYnight Mar 21 '18 at 16:21
  • \$\begingroup\$ Yes, until you have a current loop from the MIDI OUT +5V, through 220 ohms, through the cable, through the MIDI IN 220 ohms, back through the cable, through the 220 ohms at the driver output and back to the driver, you have no current flowing. \$\endgroup\$ – crj11 Mar 21 '18 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.