Previously I have made a colour sensor using Arduino but don’t have the time to update it on my blog. Today I am going to share the details of this mini project. Basically, the sensor consists of three LEDs and Light Dependent Resistor (LDR). The LDR will detect the colour and display it to another RGB LED. Besides display it on the RGB LED, the colour will also display on PC. RGB LED is commonly used in display colours on LCD or OLED such as the monitor and television.

My colour sensor on stripboard

There are actually many methods to detect colour, but using only LED and LDR should be the cheapest way to do this job. Let me explain how this sensor works. First, the LDR has to detect the contrast between black and white surface. To detect the colour, each LED takes turn to shine onto the surface and the Arduino will read the voltage on LDR.

rgb colour
RGB Colour

I made the colour sensor on a piece of strip board. It consists of 3 colour LEDs, which is red, green and blue and also a Light Dependent Resistor (LDR).

color sensor
Schematic for colour sensor
Green LED
Blue LED

After having the contrast in black and white, now the LDR is ready to detect different colour surface. Again, the three LED, Red, Green and Blue will take turn and shine on the surface. Next, Arduino will read the voltage on LDR and do some calculations to get the colour value.

Finally, we will use the colour value to display it on another RGB LED. The output RGB LED requires Pulse Width Modulation (PWM) pin on the Arduino. Since the PWM output on Arduino is 8 bit, this gives us 8 bit resolution, 255 steps on each colour. As mentioned before, the output is also displayed on the PC. Arduino will communicate with the PC through serial communication and pass the colour value to Processing. Some calculations will be done on Processing and display the colour on PC.

Some images on the output RGB LED. Note that I am using a clear RGB LED, so to have a better display on LED, I put a piece of paper covering the LED to diffuse the light.

Output RGB LED with a piece of paper covered on it
Output RGB LED without paper covering
Colour sensor prototype on breadboard

Finally, a video on this colour sensor. Enjoy 😀