LEDs are designed to emit light, not detect. But it is true that LEDs can detect light quite well. Even better, unlike light detectors specifically designed to detect light, LEDs detect a relatively narrow band of wavelengths. For example, an LED that emits greenish-yellow light at a peak wavelength of about 555 nanometers (nm) detects green light at a peak wavelength of about 525 nm over a spectral width of about 50 nm. So, the LED can be used as a low sensitivity color sensor for a specific color, depending on the spectral response of the LED.

Every junction diode exhibits some degree of photosensitivity when it receives light comprising an appropriate range of wavelengths. The spectral response of a junction diode depends on a variety of factors, including material chemistry, junction depth, and packaging. The packaging of most devices aims to inhibit sensitivity to radiant flux to maintain the intended function of the device. However, some devices’ packaging and construction techniques allow convenient exposure to light. The most common light-sensitive devices, photodiodes and phototransistors, sense and measure light from a variety of sources. Other light-sensitive diodes, which don’t usually come to mind for light-sensing applications, are LEDs. LEDs, packaged to emit radiant flux, can serve as narrowband photodetectors.

As LEDs can be both emitters and detectors of light, When biased forward, the emit light with a characteristic “diode drop” in voltage across the diode at a current of 10-20 mA. When subjected to light, they generate a backwards biased current proportional to the light striking the diode. The photocurrent generated by a typical photodiode LED is about 50pA. The light emitted and the detected are at nearly the same frequency. A green-yellow LED emits at a wavelength of about 555nM while is more sensitive to light at 525nm. Although a photodiode designed for light emission has a small photocurrent as a detector, this current is readily detected by a microcontroller.

For example, a green LED will be sensitive to blue light and to some green light, but not to yellow or red light. Additionally, the LEDs can be multiplexed in such a circuit, such that it can be used for both light emission and sensing at different times.