You are on page 1of 6

ZX-COLOR documentationl1

ZX- COLOR
Color se nsor module
1. Kit c onte nts
ZX-COLOR board
Calibration switch board with cable
JST3AA-8 cable
Documentation
2. Spe c ific a tions
Se nsor : TCS230 programmable RGB color sensing light-to-frequency
converter with 2-White LED illuminators
Ope ra tion mode :
1. Color mode Color reading, output as analog voltage 0 to 5V.
Color and Lightness seperatable 64 steps , suitable for 8-bit or better
A/ D system.
2. Match mode Match color detection, output as active-low
digital signal when read read color match to selected value.
Selected by jumper.
Output : DC voltage 0 to 5V in Color mode and Digital logic in Match mode
Inte rfa c e : One output with 3-pin JSTconnector. Interface with any microcontroller
and INEX s microcontroller boards. Connect to any Analog input pin
in Color mode and any Digital input pin in Match mode.
De te c tion Ra nge :
0 to 5 mm. from the object target.
Color Da ta : 6-bit MSB
Supply volta ge :
+5V 35mA low current consumption for long battery life.
2l ZX-COLOR documentation
3. Mode of ope ra tion
ZX-COLOR has 2 operation modes as :
1. Color mode; Set the Mode jumper to COLOR.
2. Match mode ; Set the Mode jumper to MATCH.
3.1 COLOR mode
ZX-COLOR would be detect the object color and convert to DC voltage 0-5V fed to the
OUTPUTconnector. This mode requires Black & White calibration before using. The internal processor
of ZX-COLOR must get the B/ W reference value. The suitable distance detection is 0 to 5 mm.
3.1.1 How to c a libra tion
(1) Connect the CALIBRATE switch board to the 2-pin JSTconnector on the ZX-COLOR.
Apply +5Vdc supply voltage from Microcontroller board which interface with ZX-COLOR
via OUTPUTconnector.
(2) Prepare the white and black paper that is bigger than ZX-COLOR. If can find the
not shiny paper, it s best. This paper is used to reference B/ W surface for calibration.
(3) Adjust the LEVEL to center point.
(4) Place the ZX-COLOR on top of the white surface. The placing can touch or far from the
suface not over 5mm. Press the CARIBRATE switch to record the reference white value.
(5) Still pressing the CARIBRATE switch and move the ZX-COLOR ontop of the black
surface. Ater that release the switch. In step (4) and (5) must do continue.
At this time, the ZX-COLOR have the B/ W reference value and ready to detect the
any color.
+
S
OUTPUT
COLOR
MATCH
LEVEL
Jumper mode
Output
Switch connector for Black & White reference in Color mode/
Color recognize in Match mode
Sensitivity/Level
TCS230 sensor
White LED
White LED
Color detection area
Figure 1 - ZX-COLOR module layout
ZX-COLOR documentationl3
3.1.2 Color da ta bit of the ZX- COLOR
Internal processing of ZX-COLOR will gives the digital data of target color in 6-bit
MSB. The color and lightness data seperatable up to 64 steps. The data format is shown
below.
>EJ% >EJ$ >EJ# >EJ" >EJ! >EJ >EJ >EJ
R G B r g b - -
Bit 7 a nd 4 a s Re d c ompone nt bits ( Rr)
The full red color value is both bits as 11(R=1, r=1).
None red color component, both bits are 00 (R=0, r=0).
Bit 6 a nd 3 a s Gre e n c ompone nt bits ( Gg)
The full green color value is both bit as 11 (G=1, g=1).
None green color component, both bits are 00 (G=0, g=0)
Bit 5 a nd 2 a s Blue c ompone nt bits ( Bb)
The full blue color value is both bits as 11 (B=1, b=1).
None blue color component, both bits are 00 (B=0, b=0).
Bit 1 a nd 0 : white obje c t de fina tion
Clear to 00 if the target object is not the white object
Set to 11 if the target object is the white object
aouuas
luiasaauinsa:aas
aouav.
aoua
s:r:.ln .o v s nn.vs e
Ivan:aonu v: .n oe+os
os.++no l
a:+.++s
zxcoco
oa.za+l.:uas.++uou uo.v.aa:aa. ++uaara.z
:a au+o un a v.ur +a
Figure 2 - Shows the calibration procedure of ZX-COLOR in COLOR mode
4l ZX-COLOR documentation
The important value are upper 6 bits. The internal processor will convert the color
bit to analog. The DC voltage output is 0 to 5V. The A/ D system must convert the DC
voltage to digital data and analyze for defination the sensing color.
For e xa mple : If ZX-COLOR gives the outpur voltage 2.5V. The microcontroller has 8-
bit A/ D system. The result digital output from A/ D system is 10000000 or 80H. Thus, the
detecion color is Red. Because the bit 7; Red bit (R) is set to 1 .
3.2 Ma tc h mode ope ra tion
Set the jumper to MATCH position for selecting this mode. In this mode user must
record the target color first. After the sensor found the target color, it gives active low to
output.
The target color learning are some step as folows :
(1) Connect the CALIBRATE switch to the JST2-pin connector of the ZX-COLOR.
(2) Bring the target color object to detects with ZX-COLOR. Press the CALIBRATE
swtich for color recognition.
The output of this mode is 2 values as follows :
Logic 1 : Do not de te c t the ta rge t c olor.
Logic 0 : Detect the target color.
For addition, user can adjust the deviation of target value by adjust the LEVEL
potentiometer. With this adjustment, it help the detection to more flexible.
If a djust the LEVEL to le ft e nd, the de te c tion will be stric tly.
If adjust the LEVEL to right direction, the detection will be more flexible.
User can select the operation follows their purpose.
4. Exa mple
This example would be use the ZX-COLORinterface with the AX-11 board and develop
the program with Interactive C.
4.1 Select ZX-COLOR s mode to Color mode.
4.2 Connect the ZX-COLOR to any analog input of AX-11. In this example connect
with AI 29.
4.3 Do B/ W Calibration following the steps in 3.1.1
4.4 Create the color collecting program as follows.
ZX-COLOR documentationl5
void main()
{
while(1)
{
printf(Color: %d\n,analog(29));
sleep(0.1);
}
}
4.5 Download the program to AX-11 board.
4.6 Use the ZX-COLOR to detect the object color. The example program will be collect
the Red, Green and Yeloow data. The example result at 3mm. distance detection are :
Re d : 145
Gre e n : 85
Ye llow : 221
4.7 Use all 3 values to make the detection target color program and shows the
result at LCD screen on AX-11.
Color te sting e xa mple progra m ( Inte ra c tive C)
#define RED 145
#define GREEN 85
#define YELLOW 221
#define OFFSET 2
void main()
{
int color;
while(1)
{
color = analog(29);
if((color >= RED-OFFSET) && (color <= RED+OFFSET))
{
printf(Color = RED\n);
}
else if((color >= GREEN-OFFSET) && (color <= GREEN+OFFSET))
{
printf(Color = GREEN\n);
}
else if((color >= YELLOW-OFFSET) && (color <= YELLOW+OFFSET))
{
printf(Color = YELLOW\n);
}
else
{
printf(Out of Range!\n);
}
sleep(0.1);
}
}
6l ZX-COLOR documentation
Program description
This program loops to read the analog input AI29 that connected with ZX-
COLOR to get the data for defination to target color. This program can detect 3 colors;
Red, Green and Yellow. The criteria of defination are :
Ca se 1 Anaglog reading value is during 143 to 147. The program will
define to Red and shows message Color = RED at LCD screen.
Ca se 2 Anaglog reading value is during 83 to 87. The program will
define to Green and shows message Color = GREEN at LCD scrren.
Ca se 3 Anaglog reading value is during 219 to 223. The program will
define toYellow and shows message Color = YELLOW at LCD scrren.
Ca se 4 Out of 3 case above, program will show message Out of Ra nge !
www.inex.co.th
www.inexglobal.com

You might also like