Professional Documents
Culture Documents
HCM
TRƯỜNG ĐẠI HỌC BÁCH KHOA
LỚP: TT01
2. Working Principles
Three basic types of equipment are needed to determine a material's color. A
light source must illuminate the material's surface in order to identify the colored
surface and measure the wavelength reflected by it.
A white light emitter built within the color sensor illuminates the surface. To
measure the wavelengths of red, green, and blue colors, respectively, the three
filters have wavelength sensitivities of 580 nm, 540 nm, and 450 nm.
3
The classification of the material's hue is based on how these filters are
activated. The sensor also has a converter for converting light to voltage. By
producing a voltage proportional to the measured color, the sensor reacts to color.
By simultaneously illuminating the material surface with Red, Blue, and Green
LEDs, color may also be detected. Here, the sensor only uses light to convert the
voltage instead of any filters. For color detection, the largest amount of light reflected
by the material's surface when it is irradiated with red, blue, and green light is
determined.
3. Applications
Color sensors are used to measure and detect the color of surfaces. These
sensors have a wide range of applications in industrial, medical, and security
systems.
Some of the applications are light color temperature measurement, RGB LED
consistency control, medical diagnostic systems, health fitness systems, industrial
process control, and more.
4
Some color sensors can detect various hues in addition to RGB. To precisely
identify the color of the substance, the IR and UV rays will be filtered away. There is
a configurable light frequency converter included in the sensor as well. These
sensors can often be readily interfaced with a microcontroller since they are quite
tiny.
Figure 5. TCS3200
a. Schematic
Ports Description
b. Specifications
- Convert light intensity to high resolution frequency.
- Different color filters and output frequencies are selectable by programming.
- Interfaces directly with a microcontroller.
- Voltage: 2.7 - 5V.
- Size: 28.4 x 28.4mm.
- Output frequency with 50% pulse width.
6
S2 S3 Type of Filters
L L Red filter
L H Blue filter
H H Green filter
L L Power down
L H 2%
H H 20%
H H 100%
2. TCS230
One of the popular color sensors, the TCS230 has a light-to-frequency
converter and a current-to-frequency converter built onto a single CMOS chip. It can
tell the difference between white, blue, green, white, and red. With a frequency
precisely proportional to light intensity, the output signal is a square wave.
The photodiodes in an 8x8 array are read by the light-to-frequency converter.
16 photodiodes, 16 of which have blue filters, 16 of which have green filters, 16 of
which have red-green filters, and 16 of which do not.
7
Figure 7. TCS230 V1
a. Schematic
Ports Description
b. Configuration
8
S2 S3 Type of Filters
L L Red filter
L H Blue filter
H H Green filter
L L Power down
L H 2%
H H 20%
H H 100%
2. Schematic.
Figure 9. Mapping
9
3. Arduino code.
There are two sketches for this project:
- Reading and displaying the output frequency on the serial monitor. In this part
you need to write down the frequency values when you place different colors
in front of the sensor.
- Distinguish between different colors. In this section you’ll insert the frequency
values picked previously on your code, so that your sensor can distinguish
between different colors. We’ll detect red, green and blue colors.
a. Reading the output frequency
void setup() {
// Setting the outputs
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
In the previous step when we have maximum blue we obtain a first frequency
and when we have blue at a higher distance we obtain a second frequency.
So, the first frequency corresponds to 255 (in RGB) and the second frequency
to 0 (in RGB). We’ll do this with the Arduino map() function. In the map() function you
need to replace XX parameters with your own values. #define S0 4
#define S1 5
#define S2 6
#define S3 7
#define sensorOut 8
void setup() {
// Setting the outputs
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
void loop() {
// Setting RED (R) filtered photodiodes to be
read digitalWrite(S2,LOW);
12
digitalWrite(S3,LOW);
delay(100);