0

I'm currently in the process of getting MIDI input to my Raspberry PI through UART, and in order to follow the standards, I should optically insulate the MIDI cable from the RPI by using an optocoupler in such a way that then there is no current flow, I get logic HI, and when there is current flow, I get logic LOW, so probably the optocoupler is also inverting the signal.

Please note I'm kind of a layman here. I'm currently studying physics, and have always been very interested in electronics, but have never dug deep into this realm. However, I'm interested not only in getting things to work, but understanding why and how they work.

I'm currently planning on using the 6N138 optocoupler. In the diagram provided in the datasheet, there is a diode which I don't get the usefulness of.

enter image description here

The diode in question in the one that connects the base of the phototransistor to Vcc. If I understand correctly, the diode is in reverse bias when Vcc is at a higher voltage than the base of the transistor.

My guess is that this diode allows the base to discharge when there is no longer light arriving from the LED between pins 2 and 3. This, of course it just a guess, but it certainly seems that I'm missing something big here.

1 Answers1

0

The reverse biased diode is the photodiode (PD) .

The Darlington transistor is there to amplify the current. It also has a high variation of hFE current gain. Each of these are rated in CTR or current transfer ratio as the loss x hFE product can often be < 100%

When we need accurate current to voltage sensing of light we just choose a PD and series resistor to measure the voltage rise (R=V/I gain) with some tradeoff on risetime. When we need high gain and high speed, then we choose specialized digital opto chips.

Perhaps you may consider the 10MHz BW https://www.digikey.com/product-detail/en/lite-on-inc/6N137/160-1791-ND/1969175

Tony Stewart EE75
  • 1
  • 3
  • 54
  • 182
  • Thank you very much for your answer. Somewhere on the internet I also read that hooking up pin 7 to ground with a resistor in between would speed up the rise and fall times of the chip. Is this true? If so, what resistor value is appropriate? – ChemiCalChems Jan 16 '18 at 21:28
  • the App Note is best guide – Tony Stewart EE75 Jan 16 '18 at 21:36
  • https://www.fairchildsemi.com/application-notes/AN/AN-3002.pdf but there are better optos if you keep looking – Tony Stewart EE75 Jan 16 '18 at 21:40
  • https://www.digikey.com/product-detail/en/lite-on-inc/6N137/160-1791-ND/1969175 – Tony Stewart EE75 Jan 16 '18 at 21:55
  • @ChemiCalChems See [MIDI IN : many circuits](https://electronics.stackexchange.com/q/165255/29811) and [Minimize current consulption for MIDI input circuit?](https://electronics.stackexchange.com/q/288448/29811). – CL. Jan 17 '18 at 19:26
  • 6N137S are by far most popular in stock and cheap. Many others are becoming or already obsolete. No need for Pin 7 tweeks when when operating at nominal input current and much less than 10Mbd – Tony Stewart EE75 Jan 17 '18 at 20:27