Optocoupler 4n25 & rx input?!


Does anybody know how much is the voltage difference when logic 0 appears between 4th and 5th pin of an MIDI output conector? I have Agilent 4N25 optocoupler and i don’t know how to set it rigth for midi transmition.

So far I tested optocoupler working as a switch for an simple LED running in the other side of optocoupler. When I want to connect an RX (pin 0) of Arduino Duemilanove to the circuit, the input doesn’t read anything.

In the manual it says that typical Vf 1.2 V must be on 1st , 2nd pin for 10mA current flow through. But I don’t know how to set it to 1.2 V because I don’t know the voltage drop between 4th and 5th pin.
I decided that 220 Ohm would be just fine, also everyone on the web use it so I suppose it would make enough current to control a diode inside optocoupler, but on the other side nothing happens still. When I’ running a LED for indicator it says that the current flows right.
Why my arduino reads nothing. Is there some mistake in the circuit or it’s a only problem with my arduino serial input, because without optocoupler RX input works just fine. So?

My circuit:

Can someone help me to find mistake in this situation please!

Best regards!

Optocoupler’s manual:

That circuit is wrong. the MIDI standard is a current loop, it dose not consider the voltage across those pins.
You should also not have a ground connection on pin 2.

But I don’t know how to set it to 1.2 V

You don’t set it, its a property of the LED in the opto coupler.

Have a look at this for a MIDI input circuit:-
To see how to do it right. there is a lot of incorrect circuits floating about for this.

Thank you Mike for reply!

I don't see much diference in both circuits, only 6N139 opto has a darlington tranzistor inside. It provides only more current between 6th and 5th pin and the Vcc is conected with diode reversed to the 1st base & 5V to the 1st colector. Actually I don't know how big the difference is! :) What is it so different from my optocoupler instead of bigger current flow, I don't know. On the other hand arduino reads voltage at the same point as in my circuit so in this aspect I don't see difference.

Tell me how to modify my circuit correctly that it's going to work with 4N25 tranzistor or it is better way to buy 6N139 tranzistor because it's not going to work anyway?

Tell me where I'm wrong? What's the solution? :-/

You need a 220R in before the reverse polarity protection diode to protect it. Also you have pins 4 & 5 swapped over compared to my circuit. Also increase the 280R in the collector, that is asking for too much current from the photo transistor and the available photons will not be able to supply it. Try a 10K or go higher.

thank very much!

it's working now! :o

It was the current that was too big, like it's written in the manual ( Ic= 2mA, if Ice= 10V & If =10mA) -> small Ic, is it. I didn't think of current that would be a problem, so thanks man ;)

best regards