TCS3200 Color Sensor with Arduino detailed Tutorial

TCS3200 Color Sensor with Arduino

Hey, Guys welcome back to the Techatronic, in this article I will explain color sensor tcs3200 working and interfacing with the Arduino. As we all are aware of the Arduino and its capabilities with the sensor. today we have a sensor that is capable to sense the color. you can use this color sensor in many projects like a Color sorting machine. Color sensor tcs3200 is low powered sensor small in size and capable to read less than 5 colors. so if you want to learn to interface TCS3200 with Arduino please read full article carefully.  I am giving you the step by step guide to learn the Working of this sensor with the Arduino. There are many other Arduino projects like Obstacle avoiding robot using Arduino you can check it also here.

tcs3200 colour sensor with arduino

HTML Image as link
Qries

How does the sensor work?

The working of this sensor is very simple. there are four LED in the sensor which emits the white light and this light incident on the Sensor main chip which is the combination of 8X8 photodiode. so there is 64 diode in the combination which are embedded in a single small chip. the working depends on the main fact which is, every 16 diodes are coated with a different color.  RED, BLUE, Green, and transparent. when the light refracts from these color patterns every four different colors coated photodiodes will receive the different light frequency. which helps the sensor to differentiate between the color. this is a very logical and conceptual thing in the sensor. suppose if any light source does cover by a different color then you can’t see the original color of the light source so there we are using the same concepts. there is also some factor that controls the brightness of the sensor LED. there is Gesture control robot that is also a good project you can check it here.

 

Learn 10+ basic activity & sensor interfacing with our Arduino ebook. Well explained program. And brief circuit diagram WhatsApp and email support. which will help you to learn basic electronics, Arduino Coding, Sensor interfacing with Arduino, Arduino, and much more. buy Arduino Ebook to learn https://techatronic.com/arduino-ebook/

TCS3200 Color Sensor with Arduino working diagram

if u saw in the given diagram you can see everything in a single diagram. how many patterns and how many colors in a single chip. behind this color matrix, there is a matrix of the photodiode. this array of photodiodes does the whole work. the photodiode is an electronic component that reacts to the incident light. there are electrons inside it that get accelerated due to the light energy that’s why they produced a small amount of current. which can be measure in a different light. now, let’s see the given diagram to understand better.

 

TCS3200 WORKING PRINCIPLE

Features and Specifications

  • Input voltage: (2.7V to 5.5V)
  • Interface: Digital TTL
  • High-resolution conversion of light intensity to frequency
  • Programmable color and full-scale output frequency
  • No need of ADC(Can be directly connected to the digital pins of the microcontroller)
  • Power down feature
  • Working temperature: -40oC to 85oC
  • Size: 28.4×28.4mm(1.12×1.12″)

TCS3200 Color Sensor with Arduino code:-

tcs3200 circuit diagram with arduino

You have to connect all the pins accordingly.

https://www.youtube.com/watch?v=6hG9wtrmNgw

Tcs3200  Arduino Code:-

 
#define S0 4
#define S1 5
#define S2 6
#define S3 7
#define sensorOut 8
int redfrequency = 0;
int greenfrequency = 0;
int bluefrequency = 0;
void setup() {
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  pinMode(sensorOut, INPUT);
  
  // Setting frequency-scaling to 20%
  digitalWrite(S0,HIGH);
  digitalWrite(S1,LOW);
  
  Serial.begin(9600);
}
void loop() {
  // Setting red filtered photodiodes to be read
  digitalWrite(S2,LOW);
  digitalWrite(S3,LOW);
  // Reading the output frequency
   redfrequency = pulseIn(sensorOut, LOW);
 
  delay(100);
  // Setting Green filtered photodiodes to be read
  digitalWrite(S2,HIGH);
  digitalWrite(S3,HIGH);
  // Reading the output frequency
  greenfrequency = pulseIn(sensorOut, LOW);
  // Printing the value on the serial monitor
 
  delay(100);
  // Setting Blue filtered photodiodes to be read
  digitalWrite(S2,LOW);
  digitalWrite(S3,HIGH);
  // Reading the output frequency
  bluefrequency = pulseIn(sensorOut, LOW);
  // Printing the value on the serial monitor


 if (redfrequency>25 && redfrequency< 77) {Serial.println("RED COLOUR");} else if (bluefrequency>25 && bluefrequency< 77) {Serial.println("BLUE COLOUR");} else if (greenfrequency>25 && greenfrequency< 77)

{Serial.println("GREEN COLOUR");}

 else
 {Serial.println("NO COLOUR DETECTION");}
}

Leave a Comment