Calculating resistor(s) for photocoupler

This is the first time that I work with photocouplers, so I figured I would post to see if there are any precautions I should take.

I recently picked up some CEL/NEC PS2501-4 (4 photocouplers in a single 16 pin DIP) with the following specs:

Diode:

  • Max Reverse Voltage (VR): 6 V
  • Max Forward Current (DC) (IF): 80 mA/ch
  • Forward Voltage (VF): 1.17 typ. (1.4 max) @ conditions IF=10 mA
  • Reverse Current (IR): 5 ?A

I assume that the diode in the photocoupler behaves like an LED and plug those values into the LED calculator and get 390 ? 1/8W.

Knowing that I don't have any 390 ? resistors handy, I plug in some slightly higher values and see that IF=20 mA & VF=1.4 V gives me a 180 ? resistor. I also check on the low end and find that IF=10 mA & VF=1.0 V gives me a 470 ? resistor.

My questions:

  1. Although optimally I would want a 390 ? resistor, is it safe to use something else in the range between 180 and 470 ? without frying the Arduino or the photocoupler during prototyping? More specifically, I have a 330 ? which I assume will work just fine.

  2. I also figured that during prototyping it may be convenient to have an actual LED wired into each of the photocoupler circuits to monitor my sketch was working as anticipated (i.e. Arduino pin --> LED --> potocoupler --> resistor --> ground). I checked the resistor array wizzard and found that I would need a 150 to 270 ? resistor? So, a 220 ? should work just fine?

  3. The final project will have 20 photocouplers total (5x PS2501-4). Most of the time they will all be off. However, it is possible that one or two of them could be on for longer periods (as in hours) so I would rather over-compensate towards longevity in the final project. If it is unwise to keep the photocoupler anode high for extended periods, would it be possible/preferable to 'cycle' it high/low every half a second or so? The emitter/collector side of the photocoupler is connected to a 3v low current circuit (shorting the buttons on an X360 controller).

  4. Also, for the sake of space, I was considering using resistor arrays. In which case I noticed that bussed 390 ? resistor arrays are not all that common, so would a 330 ? array be acceptable? Even for extended operations?

  5. Should I be cautious/mindful as to how many of the 20 photocouplers are high at the same time when I write my sketch? Would it be possible/probable to fry the Arduino if I accidentally have them all high?

  6. I am planning to connect the finished project to the USB power supplied to the controller (500 mA max, possibly 100 mA). How would I determine the additional load of my Arduino Mega plus my array of photocouplers will put on the controller?

  1. Yes that is correct.
  2. Yes again, providing it is a red LED and you have the forward volts drop correct.
  3. No problem with keeping them on for long periods.
  4. Yes the LED current is not critical.
  5. Be mindful of the 200mA overall limit on the power pin. You could improve your margin by having half of them sink current and the other half source current, then you will only be using 100mA for + and 100mA for ground.
  6. You know the load the photo couplers put on the system, it is the sum of the LED currents. Then give it another 30mA or so for the rest of the circuit.

Thanks for the quick response.

Grumpy_Mike:
2) Yes again, providing it is a red LED and you have the forward volts drop correct.

The LED array wizzard assumes all LEDs are the same, so for the resister it specified I would need an LED with similar characteristics to the diode in the photocoupler. Is there an easy way to determine the specs for an LED? I have a drawer full of them (collected over the years) and have no idea what the specs are.

Grumpy_Mike:
5) Be mindful of the 200mA overall limit on the power pin. You could improve your margin by having half of them sink current and the other half source current, then you will only be using 100mA for + and 100mA for ground.

I don't ever anticipate having more than 4 of them on at the same time, so the 200mA limit should not be a problem.

That being said, strictly for educational/curiosity purposes, please elaborate on the half sink / half source design? Sounds interesting, but I have no idea how to do it. A link to a sample project would be great.

EDIT: I did some searching and reading, I think I get the idea (i.e. half of the LED/photocouplers are wired to 5v and the pins on the Arduino normally high go low to turn them on). But why?

Sourcing current is where the arduino output feeds into the resistor then LED and then ground.
Sinking current is where the arduino output feeds into the resistor then LED and then +5V, of course the LED has to be swapped round and as logic low turns it on.

The LED array wizzard assumes all LEDs are the same,

Better use something else then that is quite poor, the forward voltage drop on a diode can be anything between 1.4V and 3.5V.

Is there an easy way to determine the specs for an LED?

Wire it up to a resistor and power source and use a volt meter to measure the volts drop across the diode.

Grumpy_Mike:
Sourcing current is where the arduino output feeds into the resistor then LED and then ground.
Sinking current is where the arduino output feeds into the resistor then LED and then +5V, of course the LED has to be swapped round and as logic low turns it on.

And that is practical because the limit on the pins is separate from the limit on the +5 source? So without looking up the actual specs, one could theoretically double the power limitation. 200 mA max from pins (default low, set to high for circuit) and then another 200 mA max from +5 V to pins (which would default high and set to low for circuit)?

Grumpy_Mike:

The LED array wizzard assumes all LEDs are the same,

Better use something else then that is quite poor, the forward voltage drop on a diode can be anything between 1.4V and 3.5V.

I found a couple "10-Element Red LED Bargraph" in my bin of LEDs (Radio Shack cat no 276-081) which would be great for monitoring during the prototyping phase.

It has been a couple decades since I have done any actual circuit work (and the web sites I found don't allow for varying LED/diodes), so please confirm my calculations:

LED Bargraph Specs:

  • VF: 2.0 V typ (2.8 V max)
  • IF: 20 mA

Photocoupler Diode Specs:

  • VF: 1.17 V typ (1.4 V max)
  • IF: 10 mA (80 mA max)

Combined in series I get:

VL = 2.0 V + 1.17 V
VS = 5 V
IF = between 10 mA (dim LED is fine) and 20 mA (within the 80 mA max on diode)

R = (VS-VL)/IS = (5-3.17)/0.010 = 183 ? on the high end

R = (5-3.17)/0.020 = 91.5 ? on the low end

So, if 180 ? is too high, I could safely try decreasing the resistance incrementally until it works, but no less than 91 ??

Hi, You guys are doing real Engineering. Cool....

You've been concentrating on the input : LEDs. But what are the output requirements?? What voltage and current will the output devices switch?

Your optocoupler has a current-transfer-ratio of 300, and maybe you don't NEED so much LED current. Maybe?

terryking228:
Hi, You guys are doing real Engineering. Cool....

You've been concentrating on the input : LEDs. But what are the output requirements?? What voltage and current will the output devices switch?

Your optocoupler has a current-transfer-ratio of 300, and maybe you don't NEED so much LED current. Maybe?

I agree with the "maybe". I suspect that once I have the circuit in place I will be able to lower the current/load significantly. But, I wanted to make sure I had my ducks in a row so that I didn't fry the Arduino, the photocouplers, and possibly the controller.

The output requirements are basically to short the 'button' contacts on an Xbox 360 controller. I measured between 0.2 V and 3.3 V on the various buttons with no common ground. The actual current flow is probably minimum, but I have no way to measure it. The photocouplers are probably overkill, but I couldn't find a different way to do it. And, we happen to have these photocouplers at work, so I borrowed a couple (which is why I don't want to fry them). If I can get the circuit to work with one of them (i.e. 4 photocouplers/buttons) then I will order some (they are fairly cheap). If they don't work, then I will have to figure out why and determine a better photo/optocoupler to use instead. A more overall description of the project was presented in a thread in Project Guidance.