Chosing the right resistor on an optocoupler

Hi,

I am planning on using the Sharp PC817 optocoupler: http://www.datasheetcatalog.org/datasheet/Sharp/mXqyrss.pdf

What resistance should I use in my input (if any). I see in the datasheet of the PC817 a forward current of 50 mA and the Aruidno gives 5V, so should I simply use: 5V/0.05mA = 100 ohm?

thanks!

XBerg

there is a drop across the diode of about 0.6 - 0.7 volts so you could use 4.3v/0.05A = 86 ohm then choose a resistor close to that but 100 ohms would deliver 43mA which is close after all you just want to ensure the diode is "glowing brightly"

looking at the data sheet 50mA is absolute maximum typical seems to be 20 mA with a forward voltage of 1.2volts so (5-1.2)/0.02 gives 190 ohms 180 or 220 would do nicely!

Thanks! Another few datasheets and I should be able to fly on my own :)

a forward current of 50 mA and the Aruidno gives 5V, so should I simply use: 5V/0.05mA = 100 ohm?

Yes, but expect to shorten the life of your Arduino - don't forget the per-pin absolute maximum 40mA limit.

Edit: And having read the datasheet of the optoisolator, expect that running that at 50mA would shorten its life too - that is the absolute maximum rating too.

For people getting started, an introduction to choosing resistors for LEDs....

http://www.arunet.co.uk/tkboyd/ele1led.htm