Introduction:
Thus Arduino RGB Color Detector using TCS3200 Color Sensor is a wonderful project for students who want to have fun with too many colors. In this project, we will be “Interfacing TCS3200 Color Sensor with Arduino” for designing a simple color detector. Earlier we learned about APDS9960 Color Sensor.
Experimental Set-Up has been designed specifically for detecting the frequency of RGB color. The LCD panel directly displays the frequency of RGB color. A combination of all these colors gives a different color. There is various software available which directly converts the combination of RGB frequency into the desired color. The set up is absolutely self-contained and requires no other apparatus.
Bill of Materials:
For designing Arduino RGB Color Detector using TCS3200 Color Sensor we use the following components. Each and every component are described below further.
S.N. | Components Name | Quantity | Purchase Links |
---|---|---|---|
1 | Arduino UNO Board | 2 | Amazon | AliExpress |
2 | TCS3200 Color Sensor | Amazon | AliExpress | |
5 | 16x2 LCD Display | 1 | Amazon | AliExpress |
6 | Potentiometer 10K | 1 | Amazon | AliExpress |
8 | Power Supply 9V | 1 | Amazon | AliExpress |
9 | Connecting Wires | 10-20 | Amazon | AliExpress |
10 | Breadboard | 1 | Amazon | AliExpress |
Color Sensor
What is TCS3200 Color Sensor
TCS3200 RGB Color Sensor For Arduino is a complete color detector, including a TAOS TCS3200 RGB sensor chip and 4 white LEDs. The TCS3200 can detect and measure a nearly limitless range of visible colors. Applications include test strip reading, sorting by color, ambient light sensing and calibration, and color matching, to name just a few. You can check the TCS3200 Datasheet
The TCS3200 RGB Color Sensor For Arduino has an array of photodetectors, each with either a red, green, or blue filter, or no filter (clear). The filters of each color are distributed evenly throughout the array to eliminate location bias among the colors. Internal to the device is an oscillator that produces a square-wave output whose frequency is proportional to the intensity of the chosen color.
The TCS3200 color sensor can detect a wide variety of colors based on their wavelength. This sensor is especially useful for color recognition projects such as color matching, color sorting, test strip reading, and much more.
Features of TCS3200 Color Sensor
- Single-Supply Operation (2.7V to 5.5V)
- High-Resolution Conversion of Light Intensity to Frequency
- Programmable Color and Full-Scale Output Frequency
- Power Down Feature
- Communicates Directly to Microcontroller
- S0~S1: Output frequency scaling selection inputs
- S2~S3: Photodiode type selection inputs
- OUT Pin: Output frequency
- OE Pin: Output frequency enable pin (active low), can be impending when using
- Support LED lamp light supplement control
11.Size: 28.4×28.4mm
Specifications & Pin Details:
RGB Color Detector using TCS3200 Color Sensor & Arduino
Assemble the circuit as shown in the following figure. This figure or Circuit Diagram is for “Interfacing TCS3200 Color Sensor with Arduino” or simply designing “Arduino RGB Color Detector using TCS3200 Color Sensor”.
Working Explanation:
The TCS230 senses color light with the help of an 8 x 8 array of photodiodes. Then using a Current-to-Frequency Converter the readings from the photodiodes are converted into a square wave with a frequency directly proportional to the light intensity. Finally, using the Arduino Board we can read the square wave output and get the results for the color.
To TCS3002D, then choose a color filter, it can allow only one particular color to get through and prevent another color. For example, when choosing the red filter, the Only red incident light can get through, blue and green will be prevented. So we can get the red light intensity. Similarly, when choosing other filters we can get blue or green light.
TCS3002D has four photodiode types. Red, blue, green, and clear, reducing the amplitude of the incident light uniformity greatly so that to increase the accuracy and simplify the optical. When the light project to the TCS3002D we can choose the different types of photodiode by different combinations of S2 and S3. Look at the form as follows.
TCS3002D can output the frequency of a different square wave (occupies empties compared 50%), different color and light intensity correspond with a different frequency of the square wave. There is a relationship between output and light intensity. The range of the typical output frequency is 2HZ~500KHZ. We can get different scaling factors by different combinations of S0 and S1. Look at the form as follows.
Source Code: Interfacing TCS3200 Color Sensor with Arduino
Simply copy this code and upload it to the Arduino board. Make sure to have the same connection as indicated above in the circuit diagram of the Arduino RGB Color Detector using TCS3200 Color Sensor.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
#include <LiquidCrystal.h> LiquidCrystal lcd(7, 6, 5, 4, 3, 2);//RS,EN,D4,D5,D6,D7 const int s0 = 8; const int s1 = 9; const int s2 = 10; const int s3 = 11; const int out = 12; // LED pins connected to Arduino int redLed = 16; int greenLed = 15; int blueLed = 14; // Variables int red = 0; int green = 0; int blue = 0; void setup() { Serial.begin(9600); lcd.begin(16, 2); pinMode(s0, OUTPUT); pinMode(s1, OUTPUT); pinMode(s2, OUTPUT); pinMode(s3, OUTPUT); pinMode(out, INPUT); pinMode(redLed, OUTPUT); pinMode(greenLed, OUTPUT); pinMode(blueLed, OUTPUT); digitalWrite(s0, HIGH); digitalWrite(s1, HIGH); } void loop() { lcd.setCursor(0, 0); lcd.print(" Color Detected ");//printing name color(); Serial.print("R Intensity:"); Serial.print(red, DEC); Serial.print(" G Intensity: "); Serial.print(green, DEC); Serial.print(" B Intensity : "); Serial.print(blue, DEC); //Serial.println(); if (red < blue && red < green && red < 20) { Serial.println(" - (Red Color)"); lcd.setCursor(0, 1); lcd.print(" RED Color "); delay(500); digitalWrite(redLed, HIGH); // Turn RED LED ON digitalWrite(greenLed, LOW); digitalWrite(blueLed, LOW); } else if (blue < red && blue < green) { Serial.println(" - (Blue Color)"); lcd.setCursor(0, 1); lcd.print(" Blue Color ") ; delay(500); digitalWrite(redLed, LOW); digitalWrite(greenLed, LOW); digitalWrite(blueLed, HIGH); // Turn BLUE LED ON } else if (green < red && green < blue) { Serial.println(" - (Green Color)"); lcd.setCursor(0, 1); lcd.print(" Green Color "); delay(500); digitalWrite(redLed, LOW); digitalWrite(greenLed, HIGH); // Turn GREEN LED ON digitalWrite(blueLed, LOW); } else{ Serial.println(); lcd.setCursor(0, 1); lcd.print(" Can't Identify"); delay (500); } digitalWrite(redLed, LOW); digitalWrite(greenLed, LOW); digitalWrite(blueLed, LOW); } void color() { digitalWrite(s2, LOW); digitalWrite(s3, LOW); //count OUT, pRed, RED red = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); digitalWrite(s3, HIGH); //count OUT, pBLUE, BLUE blue = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); digitalWrite(s2, HIGH); //count OUT, pGreen, GREEN green = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); } |
Video Preview and Explanation:
Check more Arduino project here: Arduino Projects
9 Comments
What type of TCS3200 is used? I found many types of them on amazon and ebay
TCS3200 IS ACOLOR SENSOR. Use any. Every sensor basically functions the same
Can you explain in detail how you actually make it?
Assemble the circuit as for connection diagram and upload the code
why the led no active
It is active.
My LCD screen seems very dim when connected up and the LEDs flash very dimly when the colour is detected, any idea why?
can you add more colors?
Can you share PCB design of this