A color sensor module makes it easy to detect colors in your project application, that is, red, green and blue components. It has 4 white light LEDs to illuminate the surface of interest.
This module is based on TCS3200 programmable color light-to-frequency converters that combine configurable silicon photodiodes and a current-to-frequency converter on a single monolithic CMOS integrated circuit. The output is a square wave (50%duty cycle) with frequency directly proportional to light intensity (irradiance).
We’ll learn how to connect the color sensor to Arduino Uno. Part list needed;
– Color sensor module, TCS3200
– Arduino Uno
– Mini breadboard
– Pack of jumper wires
we are going to wire the color sensor to Arduino Uno using the following pin assignments;
for the readings of Red, Blue and Green components, we use the configuration settings by either setting the S0, S1, S2, S3 HIGH or LOW using ‘digitalWrite’ function. e.g. To read Red color value you use;
And finally we use Timer 2 set at 10 milliseconds overflow interrupt to get and send readings through serial
//get red component value
click ‘Run on Arduino’ to upload code to the Arduino board
To view the RGB values use the serial monitor below