Color Sensor? No problem. I have found the best color sensor in the market. The TCS34725 which has RGB(Red, Green, Blue) and clear light sensing elements. It has a Infrared blocking filter integrated on the chip, minimizes the Infrared spectral components of the light and allows color measurement to be made. IR filter also block infrared lights for use under varied light condition. In this activity, you will learn how the TCS34725 works with help of some electronics components. This activity is also pretty straight forward exercise which helps to easily understand how TCS34725 works.


Hardware Used:

  • Arduino UNO
  • TCS34725
  • Breadboard
  • RGB led
  • 3 – 220 ohms
  • Wires

You can buy this at

Software Used:

  • Arduino IDE

Library Used:

Application Description:

This project is to test how TCS34725 works with the use of some electronic components. With a brief description of TCS34725 it is a light to digital converter which contains a 3 x 4 photodiode array that is composed of red-filtered, green-filtered, blue-filtered and clear(unfiltered) photodiodes. It has also a photodiode which are coated with an IR-blocking filter to refer filters that pass infrared light while completely blocking other wavelengths it which block infrared light for use under varied light conditions and lastly, it is a device that provides a digital return of RGB(Red,Green and Blue) and clear light sensing values.

So what I did here is a basic application of TCS34725 in which it can detect RGB colors with the use of RGB LED.



RGB Colors



Set-up the Hardware:


Code Breakdown:

This part is where you will assign the pins of RGB into the arduino. So i’ve selected the 3 as my red pin, 5 as my green pin and 6 as my blue pin and the last pin is for VCC because i’ve used a common ANODE RGB led. If you have used a common CATHODE then it should be grounded.

Another one, if you have used a common ANODE RGB led set this to TRUE and FALSE if you have used a common CATHODE.

In this part we assign our RGB led to be the output from the RGB sensor. We used this three pins the drive the RGB led.

Lastly, We used AnalogWrite because we expect our output to any number compared to DigitalWrite the outputs are only HIGH and LOW.


There are so many applications of RGB Sensor especially in industries, especially in factories. I remember the time that we had our plant tour, we visit some of mango factories. According to my research most of the mango factories use this Color Sensor in order to sort mangoes that are raw and ripe. Ripe mangoes are the yellow ones and raw mangoes are the green ones. Most vegetable companies also uses Color Sensor to separate according to its color and many more application to this module. Just search and understand what you are doing and everything will be fine.
















Tags : ColorLedmoduleRGBsensorsorting color

Leave a Response