Color Reorganization Sensor

 

 

The TCS3200 color sensor – shown in the figure below – uses a TAOS TCS3200 RGB sensor chip to detect color. It also contains four white LEDs that light up the object in front of it.

Specifications:

Here’s the sensor specifications:

  • Power: 2.7V to 5.5V
  • Size: 28.4 x 28.4mm (1.12 x 1.12″)
  • Interface: digital TTL
  • High-resolution conversion of light intensity to frequency
  • Programmable color and full-scale output frequency
  • Communicates directly to microcontroller

How does the TCS3200 sensor work?

The TCS3200 has an array of photodiodes with 4 different filters. A photodiode is simply a semiconductor device that converts light into current. The sensor has:

  • 16 photodiodes with red filter – sensitive to red wavelength
  • 16 photodiodes with green filter – sensitive to green wavelength
  • 16 photodiodes with blue filter – sensitive to blue wavelength
  • 16 photodiodes without filter

If you take a closer look at the TCS3200 chip you can see the different filters.

By selectively choosing the photodiode filter’s readings, you’re able to detect the intensity of the different colors. The sensor has a current-to-frequency converter that converts the photodiodes’ readings into a square wave with a frequency that is proportional to the light intensity of the chosen color. This frequency is then, read by the Arduino – this is shown in the figure below

Pinout:

Here’s the sensor pinout:

 

Pin Name

I/O

Description

GND (4)

Power supply ground

OE (3)

I

Enable for output frequency (active low)

OUT (6)

O

Output frequency 

S0, S1(1,2)

I

Output frequency scaling selection inputs

S2, S3(7,8)

I

Photodiode type selection inputs

VDD(5)

Voltage supply

Filter selection

To select the color read by the photodiode, you use the control pins S2 and S3. As the photodiodes are connected in parallel, setting the S2 and S3 LOW and HIGH in different combinations allows you to select different photodidodes. Take a look at the table below:

Photodiode type

S2

S3

Red

LOW

LOW

Blue

LOW

HIGH

No filter (clear)

HIGH

LOW

Green

HIGH

HIGH

 

Interfacing with Arduino:

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:

#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 (R) filtered photodiodes to be read

  digitalWrite(S2,LOW);

  digitalWrite(S3,LOW);

 

  // Reading the output frequency

  redFrequency = pulseIn(sensorOut, LOW);

 

   // Printing the RED (R) value

  Serial.print(“R = “);

  Serial.print(redFrequency);

  delay(100);

 

  // Setting GREEN (G) filtered photodiodes to be read

  digitalWrite(S2,HIGH);

  digitalWrite(S3,HIGH);

 

  // Reading the output frequency

  greenFrequency = pulseIn(sensorOut, LOW);

 

  // Printing the GREEN (G) value 

  Serial.print(” G = “);

  Serial.print(greenFrequency);

  delay(100);

 

  // Setting BLUE (B) filtered photodiodes to be read

  digitalWrite(S2,LOW);

  digitalWrite(S3,HIGH);

 

  // Reading the output frequency

  blueFrequency = pulseIn(sensorOut, LOW);

 

  // Printing the BLUE (B) value

  Serial.print(” B = “);

  Serial.println(blueFrequency);

  delay(100);

}

Application:

Color sensors are generally used for two specific applications: true color recognition and color mark detection. Sensors used for true color recognition are required to “see” different colors or to distinguish between shades of a specific color. They can be used in either a sorting or matching mode. In sorting mode, output is activated when the object to be identified is close to the set color. In matching mode, output is activated when the object to be detected is identical (within tolerance) to the color stored in memory. Color mark detection sensors do not detect the color of the mark, rather, they “see” differences or changes in the mark in contrast with other marks or backgrounds. They are sometimes referred to as contrast sensors.

Reference:

https://randomnerdtutorials.com/arduino-color-sensor-tcs230-tcs3200/

https://howtomechatronics.com/tutorials/arduino/arduino-color-sensing-tutorial-tcs230-tcs3200-color-sensor/

https://create.arduino.cc/projecthub/mjrobot/arduino-color-detection-57e4ce

https://create.arduino.cc/projecthub/millerman4487/arduino-color-recognition-71cd01