Adding a LED in Arduino Input with Optocoupler

Hi, I wanna add a LED in Optocoupler PC 817 output (which is the input of arduino uno).

Is my schematic diagram is correct ?

You have:
+5V -- 10kOhm -- 470 Ohm -- LED -- GND

If I read the datasheet correct, then the PX817 can sink only 5mA. If your LED lights at 2.5mA, then it will work.

Yes but R3 will ensure that the current down the opto will be no more that 0.5mA so that is not a lot of current to drive an LED, unless it is a white one there is little chance it will light up.

But it will aso ensure that the LED will only get 0.5 mA

I thought that is what I just said?
It will actually draw a bit less that that as you have an extra half K as well.

Is the input to the arduino ever going to go high enough to read as a HIGH?

Remove R3, and connect the indicator LED/resistor between 5volt and inputPin.
Enable internal pull up on the pin with pinMode in setup().

pinMode(optoPin, INPUT_PULLUP);

Make sure the opto LED gets at least twice the current of the indicator LED.
Leo..

@Wawa Thanks, your suggestion is working and mine was not...