Is it possible to make a color sensor out of an RGB led and phototransistor?

I want to build a simple color sensor, can i do that with and RGB led and a phototransistor?

Any tutorial or suggestion?

Thanks ;D

Yes you could make one that way but a LDR would be easier http://www.instructables.com/id/Color-Sensor/

Don't see why a LDR would be particularly easier. The main problem with LDRs is their slow response - in the order of a tenth of a second or more (particularly to decreasing illumination).

The only reason a phototransistor could be a problem is that it is a current mode device and if you use the internal pull-up, I gather that tends to act as a current source which would limit the linearity and dynamic range.

Smug: I want to build a simple color sensor, can i do that with and RGB led and a phototransistor? Any tutorial or suggestion?

As an exercise probably an interesting thing to do/learn but from a practical point of view a colour detector can be very cheap

Hi, you would have to check the spectral response of the phototransistor. This is to see if it is sensitive enough to the range of colours you want to detect. Also the spectral output of the RGB LED to see if its output levels are equal or adequate.

If not you may have to do a calibration run to match and compensate for the differences, the same goes for the LDR.

Tom.... :)

I think it will probably work OK in practice. But in theory it may not work for all coloured objects. This is why:

Most colour sensors use a true white light to illuminate the object, a white that contains all possible colours. Then 3 colour filters are used in front of the sensor(s). The colour filters have a peak "transparency" (I can't think of the exactly correct word) at red, green and blue wavelengths, but also allow wavelengths either side of that peak to pass, but with decreasing transparency as the wavelength gets further from the peak.

Using an RGB led, even when the colour is apparently white, its not truly white, it actually contains wavelengths in 3 narrow bands around red, green and blue.

So imagine an object that reflects only yellow light, i.e. only reflects wavelengths in a fairly narrow band around yellow in the spectrum.

With a traditional colour sensor, the true white light contains some yellow wavelengths. These are reflected and can pass through the red and green filters. The sensor can then interpolate between the readings from the red and green sensors and figure out that the object is yellow.

With the RGB idea, the light source contains no yellow wavelengths, so the object appears dark when illuminated with either red or green wavelengths, and the sensor can't determine the colour.

In practice, most "yellow" objects will reflect a range of wavelengths centred around yellow, and will therefore reflect some red and some green light, enabling the sensor to detect the object.

Here endeth the physics lesson....

Paul

LEDs act as photodiodes and respond to light only in a fairly narrow range, somewhat blue-shifted from their emission. So, an RGB LED can be used as a single-pixel color camera. Below are a couple of examples of the wavelength response curve for individual LEDs

Green LED response curve: http://laser.physics.sunysb.edu/~tanya/report2/

IR LEDs: (from a publication by Forrest Mims)

LED_response.png