I'm using a MIDI input circuit like the one shown in the schematic below. R1 is not touched as driven by the input device. R2 is fed from my internal power supply. The device is very low power so I would like to minimize current consumption as much as possible. I did notice that when having a 220 Ohm resistor the current consumption of the circuit went up. I swapped it for a 5k Ohm resistor and now it's better, however I am wondering how low can I go safely?

The datasheet has a table in it on page 2, however I'm not sure I understand it correctly. The junction of R2 and 6N138's pin 6 go into an MCU's UART module with an input resistance of about 5k Ohm.

MIDI input circuit

  • 2
    \$\begingroup\$ Higher resistor will increase the rise time of the signal. So the next step would probably be to examine the waveform with an oscilloscope to see if it still satisfies the specification you need. \$\endgroup\$ Feb 23, 2017 at 23:39

1 Answer 1


The 6N138 was designed to drive large loads even with a very low LED current (1 TTL unit load = 1.6 mA). The high CTR makes it rather slow; the MIDI specification says that you can use it with "appropriate changes".

With a single pull-up resistor, the output transistor switches off very slowly because it cannot go easily out of saturation, and reducing the load resistor not only increases power consumption, but also does not improve the timing enough so that it would be reliable for MIDI in all circumstances.

One method to improve timing is to add a base bypass resistor (RBE) between pins 7 and 5. It both speeds up switching off and slows down switching on the output transistor, so you have to use a value that balances both to reduce the pulse width distortion:

6N138 RBE
(source: HP's Optoelectronics Application Manual)

So with IF = 5 mA, you can use a pull-up resistor RL = 1 kΩ or 2.2 kΩ, and end up with RBE = 10 kΩ.

An even better method that avoids balancing issues would be to clamp the output transistor with a Schottky diode:

6N138 with Schottky diode

Use any small Schottky diode with a low capacitance, e.g., SD101, BAS70, RB751.

In any case, MIDI ports are idle most of the time, so the pull-up resistor's current probably does not matter that much.

A high-speed optocoupler with a push/pull CMOS output would eliminate the pull-up resistor, but would also have a non-zero power consumption when idle, so it would be likely to be worse overall.

  • \$\begingroup\$ Thanks for the answer, I do have several questions. The 6N138 has a relative high current gain (CTR) of 800% and this means that it operates up the spec. I require with less than If = 5mA. I don't fully understand the diode to be honest, it adds capacitance that would make the transistor switch slower when going low because of the charge on the base and to make things a bit worse, the output is Darlington so it is slower to begin with. It seems to me that the base should be connected to ground through some resistor for faster switching. \$\endgroup\$
    – user34920
    Feb 24, 2017 at 7:55
  • \$\begingroup\$ The high CTR itself is not a problem, but it makes the output rise time longer because it increases the Miller capacitance. The clamp diode is a form of a Baker clamp; it prevents charge buildup in the base, which has a much greater effect than its own capacitance. And the base-to-ground resistor is RBE. \$\endgroup\$
    – CL.
    Feb 24, 2017 at 8:17
  • \$\begingroup\$ VCC = 3.3V + the opto-coupler is also being fed from the same source. Tell me if I got this diode thing right. When the transistor is saturated the Schottky is connected to a potential only a few mV above GND so it is forward biased almost as if parallel to the BE junction but has lower Vf so the transistor will not be able to saturate and charge won't get stored on the base. That's the idea? Problem is that all values would have to be testing this is complicated to calculate. \$\endgroup\$
    – user34920
    Feb 24, 2017 at 8:48
  • 1
    \$\begingroup\$ When the transistor tries to saturate too much, the forward voltage of the Schottky diode increases so much (to roughly 0.25 V) that it shunts some of the base current to the collector, where it flows to ground; the reduced base current then prevents the transistor from saturating. This is a form of negative feedback; it automatically regulates itself so that VCE does not get smaller than roughly 0.4 V. \$\endgroup\$
    – CL.
    Feb 24, 2017 at 8:56
  • 1
    \$\begingroup\$ R2 forms a low-pass RC filter with any parasitic capacitances, and nobody knows them. Assume 10 pF (or 20 pF if you're paranoid), but better measure the output waveform. Anyway, anything from 1 kΩ to 4.7 kΩ is commonly used for this without anybody being worried. And as I said, MIDI ports are idle most of the time (> 99.9 %). \$\endgroup\$
    – CL.
    Feb 24, 2017 at 9:03

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.