Optoisolator and resistor ( calculation of LED "ON" voltage )

Hello all,

I am trying to desing 24V optoisolated input for arduino, but I am having problem with logic "0" voltage.
I have used optoisolator TLP627, based on datasheet typical LED forward current 16mA.

So I calculated:
24-1,3 = 22,7V
22,7 / 0,016 = 1,4Kohm

Problem is that optoisolator photo transistoris is saturated enough to pullup arduino IO pin HIGH even with LED forward voltage 2V.
Phototransistor is open collector and connected to arduino pin with pullup resistor 10Kohm.

I have to somehow calculate resistor necessary to keep phototransistor closed if LED forward voltage is less than 4,5V.
Because most of industrial sensor has output voltage ~3V when NO ( not sensing ).

So I have replaced my LED resistor to 4Kohms and tested again, but again photo transistor was switching when LED forward voltage was about 2,6V.

So is there any way how to calculate resistor properly to know what is minimum LED forward voltage to saturate transistor?
Sure this calculation should be based on current to be switched by transistor and CRT ( current transfer ration of optoisolator ), but there is very big range. TLP627 has CRT min. 1000% and max. 4000%.
By the way, what current is needed to pull arduino IO pin high?

Thank you in advance for any advice. Miro

Part like this?
http://www.digikey.com/product-detail/en/TLP627(F)/TLP627(F)-ND/256917

Will turn on with voltage greater than 1 to 1.3V.
If you can’t get the 24V source that low, it will not turn off. Bigger resistor will only let less current thru.
On the Arduino side, very little current goes into a pin to make it high, just 1uA.
With internal pullups enabled, 20K to 50K, then 0.25mA needs to be sunk from the pin to be read as a low.

yes it is exactly the part I have tested.
Yes, resistor is just current limiting…
I think whole circuit would be unstable when resistor would be so big to avoid this unwanted switching with low voltage.

I have just checked Digikey and there is not any optoisolator having LED forward voltage higher than 2V.
Is there any solution to avoid this unwanted switching?
I mean any solution less complicated than OpAmp working in comparator mode.

What if you add a couple of LEDs in series 'below' the opto LED - so then a higher voltage is needed to turn on the opto LED?

Actually I wanted to use optoisolator for AC/DC ( with anit-parallel LED inside ) to have possibility connect input as NPN or PNP.
But solution you propose sounds good, so I could just connect two eternal LEDs in series again anti-parallel connection.

Maybe I could use also two anti-parallel rectifier diode, but it would drops only 0,7V, so your solution with led which could drops ~2V seems to be best for me...

Also it seems as most simple solution. Thank you for your advice. Miro

Ok, let us know if it works.

I have just tested circuit with just one LED in series with optocoupler and it works!

But because my application should be low cost and I do not need LED for status indication ( will be done by LCD ).
I am thinking about another solution, it should be 3.3V zener diode in reverse direction.
If voltage supply will be more than 3.3V zener diode starts to conduct, am I right?
Do you think it could work?

Just because zener diode is cheaper in compare to LEd diode :slight_smile:

In attachment is my idea…
For example if zener diode will be 3.3V… if 3.3V exceeded it should start to conduct.
Maybe I should also calculate voltage drop for second diode in forward direction (0.65V).

OK, if both zener diodes will be 3.3V , and optoisolator LED saturation voltage 1.3V.
What would be voltage needed to switch LED diode?
Is it:
3.3V + 1.3V + 0.65V = 5.25V

or just 3.3V??

idea.png

That circuit should work and 5.25 V is probably OK as a rough guess of the turn on point. However, keep in mind that LEDs do not switch. Their forward current rises exponentially with forward voltage just like an ordinary diode, so they output light over a very large range of currents. Why not just use a much larger resistor in series with the LED, so that you get reliable operation on 24V but not at, say 10V?

The schematic suggests that you are using a Darlington optoisolator, which is sensitive to low levels of light from the LED. An optoisolator using a standard phototransistor would be less sensitive and require more light from the LED.

Zener's & LEDs about the same cost, just a few pennies.

Opto's are not much either

jremington:
That circuit should work and 5.25 V is probably OK as a rough guess of the turn on point. However, keep in mind that LEDs do not switch. Their forward current rises exponentially with forward voltage just like an ordinary diode, so they output light over a very large range of currents. Why not just use a much larger resistor in series with the LED, so that you get reliable operation on 24V but not at, say 10V?

I was also thinking like this...just big resistor.
But question is what is big enough?

So probaby best way is test it, but what if optoisolator you wanna use is only SMD and you are not able to get it for testing.
And I think when resistor will be so big that current going to LED with 10V will be so small to turn phototransistor.....also with 24V would be so small, probably it could work...but, LED would work under minimum declared in datasheet.
And also, what would be real trigger point?
With that zener solution I should clearly know what voltage is needed to trigger the LED.
I found 5.1V led, so I am going to test it.... In accordance to zener datasheet backward current is 20~30mA max, so this will be limited be series resistor and designed for 24V.

I will let you know if it works. Miro

Hello again,

so I tested circuit I posted above and it works :slight_smile:
I have tested with 5.1V zener and calculation of needed volatge is:
5.1 + 0.7 + Vf
I like prefer zener solution, because LED is a bit more pricey, and there is not possible select wanted voltage drop
( it is always betwen 1.7 - 3.4V ).

However thanks to all for help with finding solution. Great community here! Really appreciate it. Miro