Hello, geeks, We are back with a new interesting article on the color sensor (TCS3200) and also its working principle. It has a very interesting phenomenon in the working of color sensor I will share that information with some illustrations in this article.
First of all, we get a doubt about what is a colour sensor, why we need it?
What is the working principle behind color sensor?
Don’t worry, I am going to answer all these questions in this article.
Our first question is very simple to answer a color sensor is a device that senses the color of the object present in its vicinity by giving different RGB values.
Every color in this world is made of a combination of red, green and blue colors. The change in the percentage of these three colors leads to different colors. Every color is identified by the percentage of red, green and blue colors present in it.
External appearance of color sensor :
Now let’s discuss the external look of the color 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 discuss below.
A color sensor consists of an 8×8 array of Photodiodes. Out of which 16 are Red filter photodiodes, 16 are Green filtered photodiodes, 16 are Blue filtered photodiodes and remaining are no filter photodiodes.
All these same color photodiodes are connected in parallel for accurate output to the microcontroller.
The sensor array looks like below.
Working:
Now when we come to the working of the TCS3200 it is a programmable color light to frequency converter that contains photodiodes and current to a frequency converter. The output 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 column.
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 voltage
Selectable options:
S0
S1
OUTPUT FREQUENCY SCALING (Qf)
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 color detection the color can be noted by its RGB values on the Serial monitor.
Here are 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 color instead of going for image processing.
2. In color sorting machines.
3. In toys for children to learn colors.
Stay tuned on this site. We will be back with interesting articles on various sensors
The customer will probably click along the first few sites and the remainder go unnoticed.
Get her to pose with the bird or lie personal with the hamster.
This proves that a lot people actually optimise their web feuille.
The customer will probably click along the first few sites and the remainder go unnoticed.
Get her to pose with the bird or lie personal with the hamster.
This proves that a lot people actually optimise their web feuille.