Arduino Color Sensor Tutorial

Home/Uncategorized/Arduino Color Sensor Tutorial

Arduino Color Sensor Tutorial

In this video Arduino Color Sensor Tutorial we are going to see how use the TCS230 color sensor with Arduino. It is a very interesting sensor that will enable us to build some amazing projects. Without any further delay, let’s get started!

Arduino Color Sensor Tutorial – The Parts

Hey guys, I am Nick and welcome to a channel that is all about DIY electronics projects with Arduino, Raspberry Pi, ESP8266 and other popular boards. In this video we are going to learn how to use the TCS230 color sensor, a very interesting sensor. I have built a simple project to demonstrate that this sensor is really capable. I use an Arduino Uno and a 1.8” Color TFT display and of course the color sensor. As you can see, the sensor detects the colors and it displays them on the screen. The color we get on the screen is pretty close to the real color of the object. Cool isn’t it? Now, let’s see the parts that we need in order to build this project.


Arduino Uno:

Color Sensor:

Color TFT:

Small Breadboard:

Jumper Wires:

3 in 1 wires:

Power Bank:

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!


Let’s now see the software side of the project. In order to use the color sensor we need two libraries. We need the TCS230 library and the Frequency library. We also need two libraries for the display. You can find links for all the libraries we use in the description of the video.


Color Sensor Library:

Frequency Count:

Adafruit ST7735:

Adafruit GFX:

Arduino Color Sensor Tutorial – The Code

First of all we initialize the display and we display the splash screen. Next we initialize the sensor and we read the color from it. We set the first color we read as Black because first have to calibrate the sensor. Next, we read the sensor again and we set the color we read as white. After the calibration is over we read the sensor and we display the color we get on the display. Before printing the color on the display we first have to convert it to a 16bit value. The color sensor outputs a 24bit color value but our display can only display 16bit colors. That’s why we need to convert the colors before printing them with this function. With this line of code we display a small rectangle with the color we read from the sensor. As always you can find the code of the project in the description of the video below.

As you see, the color sensor is a great addition to our Arduino sensors. With this sensor available we can build many interesting projects. We can add a color sensor to a robot, or robotic arm or we can build a color sorting machine. I am really interested in a color sorting machine that will have a practical implementation. I live in Greece and many Greek farmers grow olive trees for a living. They sell either the olive oil they produce or the olives for consumption. Black olives are sold in higher prices than green olives. What if we could sort the olives by color with the help of a simple and low cost Arduino machine? That would mean better income for farmers and less time sorting the olives by hand. I will try to build a project like this in the future and post a video about it. I would love to hear your thoughts on the color sensor. What other projects do you plan to build with a sensor like this? Please post your comments or ideas below. Thanks!










Never miss a video: Subscribe to


One Comment

  1. Tom April 2, 2017 at 9:09 am - Reply

    Hi I have run through the calibration library that comes with the TCS230 and even then the colours don’t appear vibrant they are more quite dark.. I was wondering if there’s any hints you have to getting the sensor return a more vibrant representation of the colours?

Leave A Comment