Process of getting MIDI input to my Raspberry PI through UAR
Posted: Wed Jan 24, 2018 11:18 am
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: http://www.kynix.com/uploadfiles/pdf/6N138.pdf, there is a diode which I don't get the usefulness of.
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.
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: http://www.kynix.com/uploadfiles/pdf/6N138.pdf, there is a diode which I don't get the usefulness of.
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.