Electronic – Choosing series resistor for Optocoupler LED

opto-isolatoroptoelectronics

How do you choose the series resistor value for the LED side of an optocoupler. My application uses this opto to interface a button that is about 25meters(50 meter wire roundtrip) away from the device.

enter image description here

For choosing R44 or the collector pullup was pretty easy since the datasheet has provided a 1k. On the other side however there is no mention of a resistor. I would like for the led to be able to take inputs from at least 3.3 to 12volts.

And having a look at the input characteristics of from the datasheet the maximum forward current is 60 mA(for a typical LED this is very very large). What would be the minimum current of the LED for so that the PIN can still safely register an "ON" state. Would a higher current(lower value resistor) on the led (30-40mA) be safe for repetitive use?

Going further, to skip using a voltage regulator (it will come from mains anyway) is it possible to use the mains voltage 240 VAC instead since the optocoupler is capable of using AC anyway. How would I choose my resistors then ?

Best Answer

If you want to accommodate a wide range of voltages, the easiest thing to do is to increase the resistance at the phototransistor so it will work at lower currents. I would not go over about 15mA, LEDs age and will eventually drop in brightness to the point where the CTR is not high enough to work. Speed suffers approximately proportionally, but that's not so much a concern with a manual pushbutton.

The next simplest thing is to add a constant current circuit to the input. For example:

schematic

simulate this circuit – Schematic created using CircuitLab

By adding a couple pennies worth of parts, the current is typically maintained fairly constant from about 2V to 25V (at room temperature).

enter image description here

In either case you want to have a lot of margin (maybe 2-3:1) to make sure the transistor saturates and to allow for normal aging. The output current is 3.3mA so if your minimum CTR is 100% you might want 10mA nominal at the LED. That would lead to excessive current with 25V in and a simple resistor R = (3.3V-1.2V)/0.01A = 210\$\Omega\$ so at 25V you'd have 108mA (but not for long).

If you allowed only 15mA at 25V in that would require about a 1.5K resistor, so the current at 3.3V would be only 1.4mA so with a CTR of 100% you'd want more like 7K at the output. Maybe 2K and 10K would be acceptable, again assuming a nominal CTR of 100% minimum over the LED current range of 1~10mA.