Petroleum Products Color Detecting System Using RGB Color Sensor
Petroleum Products Color Detecting System Using RGB Color Sensor
www.iosrjen.org
I.
INTRODUCTION
With the development of colorimetry and relative theories, color recognition technology is widely used
in different industries. For example, in the petrochemical industry we can preliminary analysis the colloid
content by observing the color of the petroleum products, but in the lube oil there are some additives which has
its own color, so, it is not authoritative to determine the high quality just by observing the color of the products.
So we need to measure the color of the petroleum products carefully so that to distinguish the composition of the
color. There are two methods used for color measurement, spectrophotometry and photoelectric integrating
method. The spectrophotometry is a kind of indirect measurement method, it not measure the color of the object
to be measured directly, but measure the light energy of the reflected or transmission light from the object
indirectly, and then calculate the tristmulus values of the color form spectral characteristics analysis. The
photoelectric integrating method is a kind of direct measurement method, it measure the spectrum energy of the
object directly, so that to get the tristmulus values of the color of the object. In this project we are going to study
a petroleum products color detection system, use the RGB color sensor for tristmulus values acquisition, then
compare the data with the color values defined by CIE, so that to make sure the color of the petroleum products.
The system can not only detect the color of the petroleum products, but also preliminary analysis the colloid
content according to the color measurement results.
II.
If we want to get a new color such as C, we need a process called color matching, in which match the three
primary colors (red, green, and blue) together quantificationally, the quantity of the three colors is called
tristimulus values. So we can express any color C as follow:
C (C ) R( R) G(G) B( B)
(1)
Here the symbol means color matching. In addition, different color also can be expressed as
( ) (called
color stimulation function). It thus appease that color measurement in fact is solving the function
( )
of the
6|Page
( )
lighting source and the spectral transmission factor T ( ) of the object, it is expressed as:
( ) S ( ) T ( )
The stimulation function
( )
(2)
the lighting source and the spectral reflectance transmission factor R( ) of the object, it is expressed as:
( ) S ( ) R( )
According to the tristimulus value formula, the relation between color stimulation function
(3)
( ) and
the
X K ( )x ( )d
Y K ( ) y ( )d
Z K ( )z ( )d
(4)
Where x ( ) , y ( ) , z ( ) are the spectral tristimulus values defined by CIE, can be obtained through the
look-up table, K is a normalization coefficient of the lighting source or illuminate object, it is calculated
according to the formula:
100
S ( ) y ( )d
(5)
The tristimulus values X Y Z of the color under test can be calculate from the formula. Then we can determine
the color of the object.
III.
Since the petroleum products are always liquid, according to the Beer-Lam-bert law, for the liquid color
measurement, transmission method is recommended, so that to get more reliable spectral power distribution
curve and then indentify the color of the liquid accurately. We adopt the transmission method in this project.
7|Page
IV.
HARDWEAR DESIGN
Output
Light
Photodiode
Array
S2
Current-to-frequency
Converter
S3
S0
S1
OE
8|Page
P13
Photodiode type
P10
P11
Frequency scaling
red
powered off
blue
2%
Clear(no filter)
20%
green
100%
6
3
5
4
O UT
OE
V CC
G ND
V CC
V CC
U1
S0
S1
S2
S3
1
2
7
8
1
2
3
4
5
6
7
8
P1 4
P1 5
R ST
+
C1
R5
13
12
S1
15
14
C3
V CC
31
19
18
Y1
C RY ST AL
R ST
C2
17
16
ST C1 2 C 5 A 6 0 S 2
P1 0
P1 1
P1 2
P1 3
P1 4
P1 5
P1 6
P1 7
P0 0
P0 1
P0 2
P0 3
P0 4
P0 5
P0 6
P0 7
INT 1
INT 0
P2 0
P2 1
P2 2
P2 3
P2 4
P2 5
P2 6
P2 7
T1
T0
EA /VP
39
38
37
36
35
34
33
32
RD
WR
1
2
3
4
5
6
7
8
9
V CC
V CC
J1
R2
P2 0
P2 1
P2 2
P0 0
P0 1
P0 2
P0 3
P0 4
P0 5
P0 6
P0 7
2 1 P2 0
2 2 P2 1
2 3 P2 2
24
25
26
27
28
X1
X2
R ESE T
P0 0
P0 1
P0 2
P0 3
P0 4
P0 5
P0 6
P0 7
V CC
R XD
TX D
A LE/P
PS EN
10
11
31
29
V CC
V CC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
12 864
V.
SOFTWARE DESIGN
White is the mixture of the three primary colors in equal proportion according to the color matching
theory. The experiments proved that the proportion of three primary colors is not equal for white color products
detected by TCS230, since the discordance of the sensor sensitive to the three primary colors. It is necessary to
do white balance adjustment before color measuring, so that the three primary colors in equal proportion when
measure white color used TCS230.
After the system is powered on, first adjust the white balance, and then execute the oil color tristimulus values
measurement task. The products color tristimulus values measurement process is as follow: gate on the three
color filter of TCS230 in order, using the timer T0 of microcomputer time the same interval of each channel
respectively, then using the timer T1 count the number of the impulse in each channel, so the tristimulus values
International organization of Scientific Research
9|Page
Close timer T0
System initialization
Count number storage
White balance
Measure Finish
Data display
N
T0 time out?
finish
Y
Fig5 Flow chart of the system
VI.
Before color measuring, we need calibrate the device so that to reduce the system error and improve the
measuring accuracy. The calibration process was done in a dark room that enclosed totally. The tristimulus
values at zero point are R0 G0 B0 which measured by TCS230 in the dark room, then during the following
products color detection process, we got the color tristimulus values by subtracting the T0 G0 B0 from values
measured after white balance process R G B. The tristimulus values of 7 kinds of lubricating oil was measured
by the system, and the results as table 2.The measuring scale is 0-255, the results of the measurement is present
by positive number, and the values at zero point is R0 G0 B0.
Table2 Selectable options of single chip control signal
Oil sample
205
130
65
241
230
145
255
220
170
240
165
96
212
85
30
160
70
45
140
100
20
We found from the experimental that the color of the lubricate oil without additive is from faint yellow to dark
brown, and the pectin content in the oil become higher, the color of the oil become darker. From table2 we
International organization of Scientific Research
10 | P a g e
VII.
CONCLUSION
The petroleum products color detection system based on microcomputer STC12C5A60S2 and color
sensor TCS230 has the advantages of simple construction and ease of handling. Experimental results show that
the system has good effects on the oil products color detection, and measuring results are accurate and reliable.
The application and generalization of the system may have certain practical value on the analysis of petroleum
products.
REFERENCES
[1]
[2]
Chen Jiasheng. Portable liquid color test instrument[J]. Journal of sensor technology,2006,19(1):253-255.
[3]
Hu
Jianmin.
Color
detection
circuit
with
color
sensor
TCS230[J].
Journal
of
sensor
technology,2003,16(4):32-35.
[4]
Lu Chuanying, Yu Haocheng, Sun Jinghui. Color detection system based on TCS230[J]. Jorunal of Jilin
University. 2008,26(6):621-626
[5]
Zhao Xiaofeng,Tang Xinzhong, Luan Lixin etc. The application of petroleum products color tester in
gasoline analysis[J]. Chemical Engineer. 2011,(12):70-71.
11 | P a g e