Im trying to connect a MIDI input cable to an arduino. To do that, I need an optocoupler, that secures the internal circuits from damage.

This is the schematic as shown by the MIDI specification: edit: The input uses 5V. MIDI Input

I have a PC123 optocoupler by Sharp lying around, so I'd like to use it in the circuit. The problem is, that I'm not quite sure if this optocoupler can be used for this circuit. I think that the maximum ratings are acceptable but maybe I'm missing some details.

PC123 ratings

these ratings can be found in the specification here.

  • \$\begingroup\$ What are the midi in voltage levels? \$\endgroup\$
    – Andy aka
    Commented Oct 17, 2015 at 12:21
  • \$\begingroup\$ The voltage is 5V (used in combination with 0V to create a bitstream of data). \$\endgroup\$
    – tly
    Commented Oct 17, 2015 at 12:56

2 Answers 2


There is no problem with the absolute maximum ratings.

However, there might be problems with the other parameters of this optocoupler. The MIDI specification calls for a high-speed optocoupler. which the PC123 is not.

At the 5 mA specified for the MIDI current loop, the PC123 has a guaranteed current transfer ratio of at least 50 %. This means that to get a 5 V signal out, you need at load resistor (Rd above) of at least 5V/2.5mA = 2 kΩ. As the datasheet shows, the typical raise/fall times in this case are about 20 µs:

PC123 response time vs. load resistance

This is way more than the 2 µs limit of the specification. At 31250 baud, the length of a single bit is 32 µs; this optocoupler will distort the signal beyond all recognition.

With the Arduino's Schmitt trigger inputs, and a portion of luck, you might actually be able to get the signal out, so you might as well try it. However, this is nothing I would recommend you rely on.

If you don't want to buy a suitable optocoupler like the 6N137, 6N138, or H11L1, you could try to use additional circuitry to prevent the phototransistor from saturating and to amplify its signal:

MIDI input with phototransistor optocoupler and transistor amplifier

  • \$\begingroup\$ Thanks for the clarification. I totally forgot the connection speed, it seems to be reasonable to buy an appropriate optocouper instead. \$\endgroup\$
    – tly
    Commented Oct 17, 2015 at 16:49

You can expect forward current If = (5V-1.2V) / 220 ohm = 17mA. Ic is (5V-Vcesat) / 280ohm = approx 4.7/280= 17mA.
IMO it shall work without any problem.

  • \$\begingroup\$ MIDI is specified a 5 mA; you forget the other two 220 Ω resistors in the sender. \$\endgroup\$
    – CL.
    Commented Oct 17, 2015 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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