hi Diver,
I think the point you are overlooking is the high impedance input of a PIC pin, leakage current into a input is in the order of 1uA to 5uA.
Lets assume 5uA, so with an applied voltage of 5V, that equates to a 1megR input.
This 1meg is in effect the load resistor for the reversed biassed LED, so the LED leakage current develops a voltage across the 1meg.
This is how many opto detector are used ie: in reverse current leakage mode.
There is a voltage developed across the LED due to light falling on it, but the leakage current combined with the high resistance 'load' is dominant.
As I have explained I took the trouble to carry a number of tests, with various coloured LED's and CMOS input devices, both in dark and light conditions.
A high was detected in every configuration.
Hi Gobbledok,
I would agree that if the circuit operation is in a critical circuit, the low cost of a 10K is a good investment.
The point that others keep raising in saying it will NOT work without the 10K, is incorrect
I don't see how the LED can be reverse biased when the anode is connected to the positive, although the OP had that at the bottom of the diagram.
I quite agree that it may work without the 10k, but then CMOS circuits may work without any pull up.
The specified leakage current of a CMOS input like a PIC is not what is expected, it is a maximum. 5 µA is so small that most users don't care if it is that or smaller, so the manufacturers won't bother finding out if it is in fact far less than that, which it often is. Also, a simple resistor to ground is a very poor model as the leakage could be positive or negative.
I put together the attached circuit. The inverter is a 74AHC1G04 and the LEDs are HSMY-C170, which are yellow.
When the supply voltage is above 2.5 V, the output LED is off.
At a supply voltage between 1.7 and 2.5 V, the output LED will light if the input LED is illuminated. The higher the supply voltage, the more light that is needed to turn on the output LED.
Connecting a DMM to the input makes it work differently. The input voltage still falls when more light falls on the LED.
The LED is only producing about 0.2 µA. The maximum leakage for the inverter is 0.1 µA at 25 °C
I think that at 5 V, PIC inputs will always be high enough with most LEDs. However, the maximum input high voltage can be as high as 4 V with a 5 V supply, and the LED can easily generate the 1 V needed to keep the voltage below 4 V, so it might not work.