Photovoltaic mode (LEDs as sensors)

also known as: LED as photodiode · Mims technique

Every LED junction generates a small current when light strikes it — and it responds most strongly to wavelengths at or just below its own emission color, because lower-energy photons can't cross its bandgap. An LED is a wavelength-selective photodiode in disguise.

In practice

The classic trick needs no ADC: reverse-charge the LED's few-tens-of-picofarads junction capacitance from a GPIO, flip the pin to input, and time how long photocurrent takes to bleed it away — microseconds in bright light, seconds in darkness. Three LEDs (red, green, blue) give a workable color fingerprint for pennies. Calibrate on a white reference; LED batches vary.

See it for real