I have the following circuit which I would like to use to connect a MIDI enabled device. I am not getting any signal on pin 5, could it be because the resistor from the base to ground in too small? I am not sure how to calculate it from the datasheet.
I have replaced the opto-isolator, tested the input using an LED and could see the LED light up indicating current flows in the MIDI loop. I have placed a scope probe on the output of pin 5 of the device. pin 6 is now not connected to anything. Normally (idle) the signal is pulled high, when a signal comes in the signal goes low but only down to ~2.8V which is not enough to register as a logic low.
I have replaced R17 with 360 Ohm. Now the signal goes as low as 1.6V.
Update #3 – Final one
I've swapped the 360 Ohm resistor for 1K. Now the signal looks much better and it reaches almost 0V when low. It is worth mentioning the scope claims rise time of 7us and fall time of 3us (probably on the low side). Considering the MIDI freq. with about 32us per bit this is short enough not to have false readings. The MIDI signal goes to an Atmel AVR and from testing I did right now it seems the messages are going through clearly. I agree that this is not the optimal device for this task though, and the circuit one would make for it (if he desires) looks very similar to what is contained by the PC900 optocoupler from Sharp.
The 4N35 is too slow for MIDI.
With a current transfer ratio of 100 % (which is specified for 10 mA, so you get even less for MIDI's 5 mA), you cannot rely on getting more than 5 mA through the output. This means that to be able to drop the full 5 V, you need a pull-up resistor of at least 1 kΩ. And this means that you will not be able to switch at the MIDI baud rate of 31250 Hz (and a digital UART signal requires much more bandwidth than a sine wave):
And with a resistor at pin 6, the CTR would become even worse:
If you really want to use the 4N35, then it is possible to speed it up by adding a transistor as an amplifer with a lower input impedance:
But the simplest method to get the MIDI input to work would be to use a high-speed optocoupler like the H11L1 or 6N137.