We will be making this colour sensor on a breadboard, but it is easily transferred onto a prototyping board, and for those who fab their own boards, this would be an awesome kit that is super cheap to throw together. I am sure it would only take about two minutes to write a gerber file for this circuit and make a nice little finished sensor.
Step 1: Gather Some Parts
- a breadboard (not required, but it is how I will walk you through it.)
- an RGB LED (alternatively you could use 3 LEDs)
- A 220 ohm resistor
- A CdS photocell (these can be salvaged out of all kinds of things like nightlights or garden lamps)
- An Arduino, or a clone. I am using a RBB in this example
Tools you will need
- A computer
- a cable to upload to your Arduino
Step 2: A Little Theory
We see colour as a frequency of light reflected from an object. So different colours reflect different wavelengths which our eyes then interpret as colours. (Maybe brain...I am no scientist)
A common CdS photocell has a very similar response to colour as the human eye.
Because colours absorb certain wavelengths and reflect certain wavelengths, we can use different wavelengths(colours) of light and take readings(from a sensor that has nearly human responses) and thereby make a pretty good guess at what colour the sensor is being exposed to.