Electronic – Minimize current consulption for MIDI input circuit

low-powermicrocontrollermidi

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

Best Answer

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.