• No results found

Petroleum products color detecting system using RGB color sensor

N/A
N/A
Protected

Academic year: 2020

Share "Petroleum products color detecting system using RGB color sensor"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

ISSN (e): 2250-3021, ISSN (p): 2278-8719

Vol. 05, Issue 05 (May. 2015), ||V1|| PP 06-11

Petroleum products color detecting system using RGB color sensor

Song Jinbo, Duan Zhiwei

School of electric and information engineering, Northeast Petroleum University,Daqing 163318,China

Abstract: - In this project we are going to study petroleum products color detection system, which is based on

colorimetry and color measurement theories. We use the RGB color sensor TCS320 as the color acquisition unit,

enhanced 51 series microcontroller STC12C5A60S2 as the control unit. In order to increasing the system

accuracy and reliability, we use the software processing methods such as white balance adjustment and

instrument zero calibration. Experiment proof that the system has the advantages of simple hardware structure

and strong anti-interference capacity.

Key words: - TCS320, color detection, microcontroller STC12C5A60S2

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.

TRISTIMULUS VALUES MEASURING PRINCIPLE

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

(2)

The stimulation function

(

)

of transparent objects is related to both the spectral distribution

S

(

)

of the

lighting source and the spectral transmission factor

T

(

)

of the object, it is expressed as:

)

(

)

(

)

(

S

T

(2)

The stimulation function

(

)

of non-transparent objects is related to both the spectral distribution

S

(

)

of

the lighting source and the spectral reflectance transmission factor

R

(

)

of the object, it is expressed as:

)

(

)

(

)

(

S

R

(3)

According to the tristimulus value formula, the relation between color stimulation function

(

)

and the

tristimulus values of the color is listed in below.

  

d

z

K

Z

d

y

K

Y

d

x

K

X

)

(

)

(

)

(

)

(

)

(

)

(

(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:

S

y

d

K

)

(

)

(

100

(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.

DESIGN OF COLOR DETECTING SYSTEM

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

(3)

The functional modules of the system are as follow: LED lighting units, RGB color sensor units, control units

and color information display units. Fig1 is the structure of the overall detecting system in block diagram.

IV.

HARDWEAR DESIGN

4.1 Lighting units

The lighting source and collimating system constitute the lighting units. The lighting source is made up

of six white patch type high brightness LED, which distribute uniformly on a diameter of about 3cm

circumference. The collimating system adopts double cemented lens, then we place the LED lighting source at

the focus of the collimating system. After the system is powered on, open the lighting source, then the

collimating system converts the unparallel nouniform LED light intensity to a parallel and uniform light

intensity, so that facilitate the application.

4.2 Measurement and control units

This design adopts RGB color sensor TCS230 produced by TAOS, it can convert the colorful input light to

frequency signal as output, since the TCS230 chip integration with 3 kinds(red, green and blue) of color filter.

TCS230 is the first RGB color sensor chip compatible with digital interface. Fig2 and fig3 are the soic package

and functional block of TCS230

Fig2 Soic package of TCS230

Fig3 Functional block diagram of TCS230

The microprocessor adopts industrial-grade microcontroller STC12C5A60S2. It is a new generation of 8051

single chip, compare with the traditional 8051, it has the advantages of high speed, low power consumption and

strong anti-interference, its instruction code is fully compatible with traditional 8051, but faster than the

traditional 8051 8`12times.

The operation mode of the filter in the color sensor is controlled by the two I/O ports P12 and P13

during the color measurement. When the sensor TCS230 color filter in a state of selecting module, it passes

through only the specific primary color, but remove the other two primary colors, so that we can obtain the

output frequency of the primary colors within the stipulated time. The power off mode or the value of

output-scale-factor is controlled by the two I/O ports P10 and P11, since different output-scale-factor

corresponding to different measurement range. The frequency output of the TCS230 is connected with the I/O

S0 S1 OE

S2 S3 Photodiode Array

Current-to-frequency Converter Light

(4)

port P14 in the MCU. Table 1 list the combing control signal in MCU.

Table1 Selectable options of single chip control signal

P12 P13 Photodiode type P10 P11 Frequency scaling

0 0 red 0 0 powered off

0 1 blue 0 1 2%

1 0 Clear(no filter) 1 0 20%

1 1 green 1 1 100%

4.3 Color detection circuit design

The hardware circuit design of the system includes color sensor circuit, MCU smallest system and 12864LCD

display circuit. Since the output of the TCS230 is digital signal, it is not necessary for the system to have A/D

convertor, so we can simply connect the color sensor to the MCU. In the MCU smallest system, the reset circuit

adopts manual reset, the crystals adopts external clock circuit. In this project we enhance the driving capability

of P0 port by connecting externally 4.7

k

pull-up resistor RB1, since the structure of P0 port in the MCU is

open-collector. In fact we can adopt inner crystals and power-on reset to simple the circuit design. The display

circuit adopts the back light character type 12864 LCD, the power voltage is 5 volts, the tristimulus values are

displayed on it. Fig4 is the color detection circuit of the system.

P1 0 1 P1 1 2 P1 2 3 P1 3 4 P1 4 5 P1 5 6 P1 6 7 P1 7 8 INT 1 1 3 INT 0 1 2 T1 1 5 T0 1 4 EA /VP 3 1 X 1 1 9 X 2 1 8

R ESE T 9

R D 1 7

W R 1 6

P0 0 3 9 P0 1 3 8 P0 2 3 7 P0 3 3 6 P0 4 3 5 P0 5 3 4 P0 6 3 3 P0 7 3 2

P2 0 2 1 P2 1 2 2 P2 2 2 3 P2 3 2 4 P2 4 2 5 P2 5 2 6 P2 6 2 7 P2 7 2 8

R XD 1 0 TX D 1 1 A LE/P 3 1 PS EN 2 9

ST C1 2 C 5 A 6 0 S 2 U 1 S0 1 S1 2 S2 7 S3 8 O UT 6 O E 3 V CC 5 G ND 4

TC S2 3 0

R 5 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0

1 2 8 6 4 J 1 1 2 3 4 5 6 7 8 9 R B1 C 3 C 2 Y 1 C RY ST AL

+

C 1

S1

P1 4 P1 5

V CC P1 4

P1 5

V CC R ST

V CC R ST V CC P0 0 P0 1 P0 2 P0 3 P0 4 P0 5 P0 6 P0 7 P2 0 P2 1 P2 2 R 2 V CC V CC P2 0 P2 1 P2 2 P0 0 P0 1 P0 2 P0 3 P0 4 P0 5 P0 6 P0 7 V CC V CC V CC

Fig4 Color detection circuit of the system

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

(5)

R, G, B can be calculated by the number of impulses in each channel. The program flow chart of the system is as

Fig5.

Fig5 Flow chart of the system

VI.

EXPERIMENTAL PROCESS ANALYSIS

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 R G B

1 205 130 65

2 241 230 145

3 255 220 170

4 240 165 96

5 212 85 30

6 160 70 45

7 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

System initialization

White balance

R/G/B switch gate

Timer T0 and counter T1

T0 time out?

Close timer T0

Data processing

finish Measure Finish Count number storage

Data display N

Y

Y

(6)

found that the system we designed can be used for detecting the color of different petroleum products, and have

higher accuracy. Compare the measured values with the specified values of different colors cited by CIE, we can

get the color of the oil product determinately.

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] Parichat Kinnaree, Singthong Pattanasethanon, Somsak Thanaputtiwirot, Somchat Boontho.

RGB Color Correlation Index for Image Retrieval[J]. Procedia Engineering, 2011, Vol.8 , pp.36-41

[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

References

Related documents

Da ta m an ag emen t Prerequisite skill: Can be achieved through credit in secondary course, GRCC Challenge Exam completion or CO 101 Introduction to Computer Applications

Citation: Pakpahan, Eduwin, Hoffmann, Rasmus and Kröger, Hannes (2017) Retrospective life course data from European countries on how early life experiences determine health in old

While not a focus of the Data Center Research Partnership, NEEA’s existing commercial real estate initiatives such as the Existing Building Renewal Initiative may provide

Botswana should continue to work on implementing its action plan to address its strategic deficiencies, including by: (1) assessing the risks associated with legal persons,

Diesel engines are relatively high emitters of oxides of nitrogen (NOx) and particulate matter (PM) (Chaichan, 2013). As a result for no specialized study about the

Eleven municipal officials representing eight Tennessee cities (Berry Hill, White House, Spring Hill, Dickson, Thompson Station, Shelbyville, Oak Hill, and Portland), attended

The greatest absolute increases (from 1998-1999 to 2008) in hospital facility expenditures during 1 year per patient with AMI were for percutaneous coronary intervention ($571)

To many white farmers promoting a black commercial farming class was more desirable than what they saw as expanding communal areas through small-scale resettlement..