WHAT IS COLOR
SENSORS?
• A colour sensor is a type of "photoelectric
sensor" which emits light from a transmitter,
and then detects the light reflected back from
the detection object with a receiver.
• A colour sensor can detect the received light
intensity for red, blue and green respectively,
making it possible to determine the colour of
the target object.
• Color sensors detect RGB values by receiving
ambient light using a photodiode.
Date Your Footer Here 1
WORKING PRINCIPLE
● Colour sensors contain a white light emitter to
illuminate the surface. Three filters with wavelength
sensitivities at 580nm, 540nm, 450nm to measure the
wavelengths of red, green and blue colors respectively.
● Based on the activation of these filters, the color of the
material is categorized. A light to voltage converter is
also present in the sensor. The sensor responds to color
by generating a voltage proportional to the detected
color.
2
WORKING PRINCIPLE
3
APPLICATIONS
● Colour sensors are applied to measure, detect the color
of the surfaces. These sensors have a wide range of
applications in industrial, medical and security systems.
● Some of the applications are the light color temperature
measurement, RGB LED consistency control, medical
diagnosis systems, health fitness systems, industrial
process control, etc
● Colour sensors are majorly used to grade coloured
products, distinguish coded markings detect the
presence of adhesives or data codes on a package.
● The technology has a wide range of applications in
various industries such as textile, automation,
automotive, food, printing, pharmaceutical, and many
more. 4
EXAMPLES
● In the TCS3200, the light-to-
frequency converter reads an 8 x 8
array of photodiodes.
● 16 photodiodes have blue filters, 16
photodiodes have green filters, 16
photodiodes have red filters, and 16
photodiodes are clear with no filters.
TCS3200
5
6
● The TCS3200 and TCS3210 programmable color
light-to-frequency converters that combine
configurable silicon photodiodes and a current-to-
frequency converter on a single monolithic CMOS
integrated circuit.
● The output is a square wave (50% duty cycle) with
frequency directly proportional to light intensity
(irradiance).
● The full-scale output frequency can be scaled by
one of three preset values via two control input
pins.
● Digital inputs and digital output allow direct
interface to a microcontroller or other logic
circuitry.
● Output enable (OE) places the output in the high-
impedance state for multiple-unit sharing of a
7
microcontroller input line.
EXAMPLES
● The AS73211 is a low
power, low noise
integrated color sensor.
● Three channels convert
light signals via
photodiodes to a digital
result and realize a
continuous or triggered
measurement.
AS73211
8
9
● Atlas solved these problems by embedding
the light sensor in a rugged housing below a
layer of transparent epoxy which protects the
sensor from moisture while still allowing light
to get in.
● The resulting light probe is water- and dust-
proof, sleet and ice tolerant, non reactive in
salt water and will readily sink when
submerged.
10
INTERFACE WITH
ARDUINO
• To communicate with the sensor we don't need
anything other than five GPIO pins of the Arduino,
and that is why we have used GPIO 8,7,6,5,4 pins of
the Arduino.
• To power the sensor we have used the 5V and Ground
pins of the Arduino Board.
• The TCS3200 Color Sensor module has 8 pins; those
are VCC, OUT, S3, S2, S1, S0, 0E, and GND. All the
pins of this sensor module are digital, except VCC and
Ground.
11
12
// Initialize the variables // Read the green value
int redValue = 0; greenValue = pulseIn(OUT, LOW);
int greenValue = 0;
int blueValue = 0; // Set the color sensor to detect blue light
digitalWrite(S2, LOW);
void setup() { digitalWrite(S3, HIGH);
// Set the pins for the color sensor delay(10);
module
pinMode(S0, OUTPUT); // Read the blue value
pinMode(S1, OUTPUT); blueValue = pulseIn(OUT, LOW);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT); // Determine the color based on the RGB
pinMode(OUT, INPUT); values
if (redValue > greenValue && redValue >
// Set the frequency scaling to 20% blueValue) {
digitalWrite(S0, HIGH); Serial.println("Red");
digitalWrite(S1, LOW); } else if (greenValue > redValue &&
greenValue > blueValue) {
// Print the headers for the serial output Serial.println("Green");
Serial.begin(9600); } else if (blueValue > redValue &&
Serial.println("Color"); blueValue > greenValue) {
} Serial.println("Blue");
} else if (redValue > 200 && greenValue >
void loop() { 200 && blueValue > 200) {
// Set the color sensor to detect red light Serial.println("White");
digitalWrite(S2, LOW); } else if (redValue < 50 && greenValue < 50
digitalWrite(S3, LOW); && blueValue < 50) {
delay(10); Serial.println("Black");
} else {
// Read the red value Serial.println("Unknown");
redValue = pulseIn(OUT, LOW); }
// Define the pins for the color sensor module
#define S0 2 // Set the color sensor to detect green // Wait for a short period before taking the
#define S1 3 light next measurement
#define S2 4 digitalWrite(S2, HIGH); delay(1000);
#define S3 5 digitalWrite(S3, HIGH); }
#define OUT 6 delay(10);
REFERENCE
• TCS3200, TCS3210 PROGRAMMABLE COLOR LIGHT-TO
-FREQUENCY CONVERTER Texas Advanced Optoelectr
onic Solutions Inc.
• https://www.mouser.com/datasheet/2/588/AS73211_
DS000556_3-01-1366202.pdf
• https://cdn-shop.adafruit.com/datasheets/TCS34725.
pdf
• https://core-electronics.com.au/color-detector-sensor
.html
• https://www.keyence.co.in/ss/products/sensor/sensor
14
basics/color/info/