One of the first lessons that an electronics student learns is that an LED provides light from current flow. But, did you know that an LED put in backwards provides current flow from light? Yes! It’s true.
Don’t believe me?
A multimeter in voltage measurement mode detects voltage in a discrete LED when held close to a light source.
Hook up a high-quality ultra-bright red LED by itself (no battery or other circuitry) to a multimeter in voltage measurement mode. Put the LED against a light source, such as a desk lamp. See the voltage? Now, hide the LED in a dark place. See a decrease in voltage?
An LED (light emitting diode) is a photosensitive semiconductor with a lens. The LED acts as a photodiode.
Photodiodes are used in robots and devices as light sensors. Photodiodes have a spectrum wavelength to which they are most sensitive, usually infrared. But, not surprisingly, a reversed LED is most sensitive to the same color of visible light as it normally emits. For example, if a circuit uses a reversed green LED, the most current will flow from exposure to green light.
Unfortunately, even under the best conditions, photodiodes (and reversed LEDs) don’t provide a lot of current flow. The output of the photodiode needs to be amplified for the light-detection signal to be useful in most circuits. A photodiode amplified by a built-in transistor is called a phototransistor.
You can connect a standalone photodiode to the input of a standalone transistor. But, it isn’t easy to control the gain of a single-transistor amplifier, and there are issues with signal noise and the amount of input current required. Instead, a better method for amplifying low-power signals in a high-quality repeatable way is an op amp chip (operational amplifier).
Putting this all together - a color sensor can be made from a reversed LED and an op amp chip. In fact, TAOS did just that with their TSLR257 (red), TSLG257 (green), and TSLB257 (blue) sensors.
Example schematic for amplifying a photodiode using an op amp.
Sadly, the TAOS TSLx257 family of color sensors has been discontinued. It’s too bad because they were a compact and easy solution.
However, this same type of circuit appears in white papers and technical notes for both National Semiconductor’s and Texas Instrument’s op amps. So, you can build a color sensor circuit using their parts.
Although the circuit will be a lot larger than one integrated into a single component, you'll be able to select specific wavelength sensitivity through your choice of LED color. And, you'll be able to determine the desired amount of signal gain through your choice of feedback resistance.
On the next page you'll see the complete schematic and solderless breadboard for the reversed LED color sensor. The remainder of the article is devoted to a series of oscilloscope traces showing the photodiode signal in action. These trace tell the story of why certain parts in the circuit improve the accuracy of the digital output and the signal-to-noise ratio on the input.