Search Here

Colour sensor - TCS3200

                

Colour sensor - TCS3200

Hello geeks I am back with new intresting article on colour sensor(TCS3200)  and also its working principle. There is a very intresting phenomena in working of colour sensor I will share that information with some illustrations in this article.

First of all we get a doubt what is a colour sensor, why we need it?

What is working principle behind it ?

Dont worry, I am going to answer all these questions in this article.

Our first question is very simple to answer a colour sensor is a device that senses the colour of the object present in its vicinity by giving different RGB values.

Every colour in this world are made by the combination of red,green and blue colours. The change in the percentage of these three colours lead to different colours . Every colour is identified by the percentage of red, green and blue colours present in it.

External appearance :

Now lets discuss about the external look of the colour sensor TCS-3200 . The module looks as in the below figure with 4 LED lights on the four corners of the device for the greater luminescence. It contains 8 pins to be connected to a microcontroller that I will dicuss below.


A colour sensor consists of 8×8 array of the Photo diodes. Out of which 16 are Red filter photodiodes, 16 are Green filtered photo diodes, 16 are Blue filtered photo diodes and remaining are no filter photodiodes.

All these same colour photo diodes are connected in parallel for accurate output to the micro controller.

The sensor array looks like below.

Working:

Now when we come to the working of the TCS3200 it is a programmable colour light to frequency converter that contains photodiodes and current to frequency converter. The out put is a square wave with the frequency directly proportional to light intensity.

The block diagram looks like

TCS3200 contains 8 pins namely they are Vdd, Gnd, OE, S0,S1,S2,S3.

The input out pins are given as below and their functions in the third coloumn. 


TERMINAL

NAME        NO.

I/O

DESCRIPTION

GND

4

 

Power supply ground. All voltages are referenced to GND.

OE

3

I

Enable for f0 (active low).

OUT

6

o

Output frequency (f0).

SO, S1

1,2

I

Output frequency scaling selection inputs.

S2, S3

7,8

I

Photodiode type selection inputs.

Vdd

5

 

Supply vottage


Selectable options:


S0

S1

OUTPUT FREQUENCY SCALING (fQ)

L

L

Power down

L

H

2%

H

L

20%

H

H

100%


S2

S3

PHOTODIODE TYPE

L

L

Red

L

H

Blue

H

L

Clear (no filter)

H

H

Green

Usually we use S0-H, S1-L with 20% output frequency scaling.

Here below I am leaving the code for the colour detection the colour can noted by its RGB values on the Serial monitor.

 

Here’s the connections between the TCSP3200 and the Arduino:

 

S0: digital pin 4

S1: digital pin 5

VCC: 5V

S3: digital pin 6

S4: digital pin 7

OUT: digital pin 8

Code

1. Reading the output frequency

Upload the following code to your Arduino board.

// TCS230 or TCS3200 pins wiring to Arduino

#define S0 4

#define S1 5

#define S2 6

#define S3 7

#define sensorOut 8



// Stores frequency read by the photodiodes

int redFrequency = 0;

int greenFrequency = 0;

int blueFrequency = 0;

 

void setup() {

  // Setting the outputs

  pinMode(S0, OUTPUT);

  pinMode(S1, OUTPUT);

  pinMode(S2, OUTPUT);

  pinMode(S3, OUTPUT);

 

  // Setting the sensorOut as an input

  pinMode(sensorOut, INPUT);

 

  // Setting frequency scaling to 20%

  digitalWrite(S0,HIGH);

  digitalWrite(S1,LOW);

 

   // Begins serial communication

  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);

 

   // Printing the RED value

  Serial.print("Red= ");

  Serial.print(redFrequency);

  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 GREEN value 

  Serial.print(" Green = ");

  Serial.print(greenFrequency);

  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 BLUE  value

  Serial.print(" Blue= ");

  Serial.println(blueFrequency);

  delay(100);

}

 

Applications of TCS3200

1. In low level projects for primary identification of objects by colour instead of going for image processing.

2. In colour sorting machines.

3. In toys for children to learn colours.

 

Stay tuned to our blog . I will be back with intresting articles on various sensors.

  

                                     

More Posts

Compact Fluorescent Lamp Circuit (CFL)

Arduino UNO

SMD Register coding

Thermoelectric Generators AKA Peltier Modules

Capacitors

PN Junction Diode

Introduction To Raspberry Pi

Gas sensor

What Are Resistors?

INTERFACING OF ARDUINO WITH ULTRASONIC SENSOR

Archived