2018 International Conference on Sensor Network and Computer Engineering (ICSNCE 2018) 13 The Portable Gas Analyzer Based on the Spectrum Xu Shuping School of Computer Science and Engineering Xi’an Technological University Xi’an 710021, China e-mail: 563937848@qq.com; xusp686@163.com Xu pei School of Computer Science and Engineering Xi’an Technological University Xi’an 710021, China Dong Qiyu School of Computer Science and Engineering Xi’an Technological University Xi’an 710021, China Su Xiaohui School of Computer Science and Engineering Xi’an Technological University Xi’an 710021, China Abstract—It is a problem of spectra analysis of flue gas that how to separate and calculate the concentration of different kinds of gas from continuous mixed gas absorption spectrum signal. So based on experimental data, a new iteration of the circular algorithm is put forward on the basis of Lambert-Beer's law. This algorithm, using the superposition of the absorbance, makes data nonlinear fitting. It takes the advantages of the wavelength optimum and the circular iteration to distinguishing the gas mixture of different composition. Experimental results show that: this method can at once calculate a variety of harmful gas concentration and accuracy up to ± 3%. it has strong anti-jamming capability and is suitable for practical application of engineering. Keywords-Circular Iteration; Ultraviolet Spectrum; Micro-spectrometer; Embedded Systems I. INTRODUCTION With the rapid development of economic and people living standard unceasing improvement the popularity of the development of heavy industry and transportation, with a large number of harmful substances into the environment atmosphere, changed the composition of normal air, worsen air quality[1]. Health problems, which caused by the atmospheric pollution has caused governments and people of great importance to it. Therefore, monitoring SO2 and NOx become one of the important subject of environmental protection[2]. For the accurate monitoring of the real-time quality, ecological environment and pollution to the environment, to provide accurate basis for the environmental protection departments at various levels supervision, management and environment decision, urgent need a large number of modern environmental monitoring instruments. Through to the present situation of flue gas analyzer in the domestic and foreign research and analysis, portable flue gas on the domestic market at present the main monitoring method is electrochemical analysis instrument, infrared gas analyzer and differential absorption spectrum. Electrochemical analysis instrument each sensor can only be measured a chemical composition in flue gas, if need to measure six ingredients you need six sensors. The chemical battery principle led to zero drift in the development of the system and cross interference, sensor lifetime is also difficult to solve the problem[3]. There is no absorption peak to NO2 in the infrared spectrum analyzer, cannot monitor NO2, but can only detect the NO content, through the assumptions to NO2 concentrations. At the same time as infrared spectrum analyzer adopts wheel filter method, each time only one gas measurement, can not measure a variety of gases at the same time[4]. Differential absorption measured gas to uv and visible light waves, on the basis of the differential absorption spectrum by the strength of the differential mailto:xusp686@163.com mailto:xusp686@163.com 2018 International Conference on Sensor Network and Computer Engineering (ICSNCE 2018) 14 absorption spectrum inversion gas concentrations, in the traditional algorithm of differential absorption, the application of least square method of gas concentration for calculating optimal estimation equation is complex, and easy in pathological conditions[5]. Accordingly based on Lambert Beer law and absorbance of dual stack, a mutually recursive iteration is presented more gas concentration decoding algorithm, the process of the algorithm is presented, and verify the effectiveness of the algorithm. This system using the Ocean Optic micro spectrometer combining with embedded technology company has developed a set of portable flue gas analyzer[6]. This instrument is to overcome the disadvantages of the electrochemical sensor, had been achieved and sensor life problems, and at the same time for accurate measurement of gases and no cross interference. II. WORKING PRINCIPLE OF THE SYSTEM Portable flue gas analyzer system structure consists of three parts, part data collection, data processing part and the human-computer interaction part. Data acquisition part by sampling probe, flue gas sampling pump, an ultraviolet light and miniature spectrum analyzer, collecting gas mainly accomplished by ultraviolet light and miniature spectrum analyzer spectrum before and after the data is converted into digital signal transmitted to the data processing part. Data processing part of ARM microcontroller CPU core module and peripheral circuit, main is to electrical signals were collected by using corresponding algorithm to calculate the gas concentration of all kinds of gas in the flue gas composition. The human-computer interaction part consists of LCD display and keyboard, mainly to complete the real-time display of gas concentration, and through the keyboard to control the storage of data and related parameters Settings. III. THE BASIC PRINCIPLE OF LOOP ITERATION METHOD A. Lambert-Beerlaw The mathematical model of Lambert-Beer's law [7-8] said = In the formula: A is absorbance; T is the transmittance, project the light intensity is than the incident light intensity;C is light-absorbing substance concentration; B is the absorption layer thickness. Its physical meaning is: when a beam of parallel light through a vertical uniform a material suction light scattering, the absorbance and the concentration and absorption material suction light is directly proportional to the thickness. Absorbance [16] A binary additive think: if the binary and multicomponent mixture components have absorbed A wave number, the total absorbance at the wave number is equal to the arithmetic of absorbance and at all levels. B. The Mathematical model The logarithmic of Lambert-Beer's law said: lg c R D A K S D          In the formula: A is absorbance; R is photon number (zero point); S is the number of through the photon; λ is selected for a wavelength; K is constant (associated with the length of wavelength and absorption tube); C is a single gas concentration; D is dark spectrum photon number (related to the integration time can take a fixed constant). Two kinds of mixed gas Lambert-Beer absorbance expression can be represented as: 1 1 1 lg R D A S D         2 2 2 lg R D A S D         According to the law of superposition of binary: 1 2 A A A   1 2 1 2 lg lg lg R D R D R D S D S D S D                      i.e. 2018 International Conference on Sensor Network and Computer Engineering (ICSNCE 2018) 15  1 2 1 2 R D R D R D S D S D S D                      By formula (7) can be know in a particular incident light wavelength lambda, the mixed gas of photon number and subtract its dark photons through the photon number, equal to the selected wavelength under different gas on the number of incident photons and through the photon number minus the dark photon number of the product. In the actual gas absorption model of gas absorption and scattering all play a role in the formation of spectrum, so the experiment of gas absorption spectra contain two parts. Part of gas molecules on the absorption of photons, ultraviolet band is mainly caused by the electron transition of the gas molecules absorbed. Another part of the scattering is gas or smoke without selective absorption caused by light attenuation. Because this system adopts the removable detection method, gas extraction, you first after a pretreatment device for flue gas filtration, drying, cooling and other processing. Filtration process can be 0. Lum or above level particle filter out completely, and flue gas molecules of the diameter of the order of magnitude are below 1 nm. Instrument of the selected work between the wavelength of 190 nm - 290nm, greater than the molecules or residual particle diameter, so that the gases to be detected is mainly gas molecules Rayleigh scattering. The actual operation process we with nitrogen gas as zero, the spectral curve is called the zero gas, nitrogen gas molecules, although about 190 nm - 290 nm uv absorption, but also produces Rayleigh scattering. That is zero gas line is light after zero gas scattering spectral lines. By spectrogram, found that in the absence of absorption bands, such as nitric oxide line outside the three absorption peak is coincidence with zero gas lines, namely in the absence of gas absorption bands of two gases scattering light is the same. So the Rayleigh scattering of gas absorption interference can be ruled out by the method of using the zero gas line as a reference. According to the Lambert Beer-law, exclude mie scattering and Rayleigh scattering in gas detection, then the device applicable gas absorption model becomes: 0 ( ) ln( ) ( ( ) ) ( ) i i I L C I         Which represents the light source through 0 ( )I  zero gas scattering by spectrometer in wavelength  after the received light intensity, i ( ) represents the ith kind of gases at wavelength  absorption cross section, L is the length of the pool by absorption, and iC is the ith the concentration of the gas. Which gas is equal to the total absorbance and of each gas absorption degree. IV. CIRCULAR ITERATION STEPS Circular iteration method using various gases in 190 ~ 290 nm band characteristic absorption peak, combined with the absorbance of dual stack, a feature in some gas absorption point assuming that other gas no absorption, launched the initial concentration of the gas, then switch to another characteristic absorption point, the gas absorbed photon number from the measured total absorbed photon number subtracting, get another gas initial concentration, and so on to get the initial concentration of each gas. Then return to the first, the characteristics of the gas absorption point from the total number of photons absorbed minus every other gas absorption of the photon number, again to get the first gas concentration of an iteration, and so on to get other gas concentrations of an iteration, the repeated iteration until the concentration difference between two times smaller than a certain value, the concentration of each gas to the gas concentration accurately. Algorithm steps are as follows. First step: to solve the first gas in the gas mixture of initial concentration 10C , and selects a characteristic wavelength 1 , under the specific wavelength of a gas in the gas mixture has obvious characteristic absorption peak, and other gas absorption peak is small at this point, is to read the value of the absorbed photon number 1S and solve R D S D       is obtained by absorbance look-up table and the concentration of the gas as the initial concentration of mixed gas in the gas. Step 2: solving the second gas in the gas mixture of initial concentration: select the second characteristic wavelength in the wavelength of 2 second kind of gas has obvious absorption peak, and other gas absorption peak is weak, then 2018 International Conference on Sensor Network and Computer Engineering (ICSNCE 2018) 16 read the absorbed photon number 2S considered under the band is only two kinds of mixed gas, according to formula (7) to calculate the second gas absorbance, look-up table against solving calculation, the second gas concentrations, as the second kind of initial concentration 20 C of gases. Step 3: calculating of other gases in the mixed gases, the initial concentration: the mth characteristic wavelengths selected m ,the wavelength of the first m gas has obvious absorption peak, read the wavelength of absorption of the photon number mS by formula (7) and look-up table type inversion calculation of this kind of gas concentration as the initial concentration 0mC of the gas. Step 4: iterative inversion to calculate the first gas concentration of first order recursive: will the desires of all kinds of gas concentration in formula (7), again read 1  of 1 S  , reverse the first gas concentration 11C of first order recursive. Step 5: repeat the second and third step to calculate gas m first order recursive concentration 1mC . Step 6: calculation of gas concentration of the adjacent two iterative error; Calculating first-order differential iteration of each gas is shown in the following formula, 1 1om m C C    Select 1 maximum of first-order differential iteration as the iteration error, i.e 1 1max , 1, 2,...,m m M     Step 7: repeat the fourth, fifth and sixth step, until the iteration error is less than the given value namely. n G     Step 8: termination of the algorithm, it will be the last time the concentration as a final concentration of gases. V. THE EXPERIMENTAL RESULTS AND ANALYSIS The obtained by experiments, 2So , 2No , the NO and 3 NH four gas absorption lines as shown in figure 1, in the range of 190 nm to 190 nm, four types of gas are interfered with each other. At wavelength of 1 (273.33nnl) 2 So and 2No are absorbed. Also at wavelength of 2 (231.33nm) 2 So and 2No are absorbed. Only at wavelength of 3 (225.88nm) NO , 2So and 2No are absorbed. At wavelength of 4 (208.23nm) 3 NH 、 2No and 2So are absorbed. The 2So and 2No have absorbed at each wavelength point, For 3NH and NO , and, as long as the concentration of 2So and 2No first came out, and then the corresponding concentration on wavelength 3 or 4 of the absorbance minus the can get their absorbance. So should first of all, the concentration of 2So and 2No , then the concentration of 3NH and NO . Figure 1. Mixed gas absorption spectrum A. Calculate the concentration of 2So and 2No For the concentration of 3NH and NO are the premise of know the concentration of 2So and 2No . However, 2So and 2No throughout the working wave band are interfered with each other, need an algorithm to eliminate their interference. Here, on the basis of the look-up table using loop iteration method and calculation method to determine the concentration of 2 So and 2No . Figure 2. The absorption spectrum of 2 So and 2 No 2018 International Conference on Sensor Network and Computer Engineering (ICSNCE 2018) 17 As shown in figure 2, At the wavelength of 1 and 2 at the 2So and 2 No were absorbed, they differ greatly in the absorption intensity at two wavelengths, the absorbance of the absorbance of 2No at 273.33nm is far less than the same concentration of 2No in 231.33nm, and the 2So absorbance at 231.33nm is far less than the same concentration of 2So in the absorbance at 273.33nm. Then we can be absorbed in 231.33nm 2No called the main absorption of 2No , 2No in the absorption of 273.33nm is called 2So interference, 2So in the absorption at 273.33nm is the main absorption, in 231.33 absorption interference on 2No main absorption. Iterative method is through circulation calculation to gradually eliminate the interference of 2No on 2So , the true concentration approaching 2So and 2No . Cyclic iteration method to overcome the conflict there understand equations caused no solution of the problem, and this method can be easily implemented by software programming. Statistical chart concentrations of 2So and 2 No calculated with iteration number as shown in the figure 3-4. The abscissa is the number of iterations, the longitudinal concentration coordinates 2So and 2No (ppm). 0 10 20 30 40 50 60 1 2 3 4 5 Figure 3. The results of calculation curves of iteration number and 2 So concentration 239 240 241 242 243 244 245 246 247 248 1 2 3 4 5 Figure 4. The results of calculation curves of iteration number and 2 No concentration According to the running results and statistics can be seen in figure, the process of iteration is a successive approximation process, the calculation results of 2So with the increase in the number of iterations decreases gradually, and tends to be stable, but 2No is exactly the opposite, results with increasing iteration times increase. Cyclic iterative method in two iterations later effect is not obvious, which is to say as long as two iterations. This can be calculated through 2No and 2So concentrations. B. Calculate the concentration of NO and 3NH Because the NO and 3NH absorption in the selected wavelengths of 3 and a wavelength of 4 does not interfere with each other, so it can be separated by the concentration of total absorbance and the 2So and NO : calculation. Hypothesis has been obtained in the mixed gas of 2No and 2So for C1 concentration and C2 concentration, the NO and 3NH for C3 and C4, then at the wavelength of 3 according to the superposition of absorbance of the available, 0 3 1 2 1 2 lg( ) I I A A A A A A      1 A is the C1 concentration of 2No absorbance at 225.8nm, 2A is the C2 concentration of 2So absorbance at 225.8nm, A is a mixture of gases in the 225.88nm total absorbance at 225.88nm, 3A is NO of total absorbance. 0 I is the spectral intensity of 225.88nm through zero gas, I is the intensity of 225.88nm through transmission into the mixed gas after, can be obtained directly by the spectrometer, 2A and 3A concentrations of A and 2No obtained by. Absorbance of 3A so you can get the NO in 225.88nm, then according to the concentration and absorbance at 225.88nm correspondence between the NO table to calculate the concentration of NO . The absorbance of 4A 3NH can be obtained with the same method in 208.23nm, then according to the corresponding relationship between concentration and absorbance at 208.23nm 3NH for 3NH concentration. VI. CONCLUSION Main harmful components for atmospheric environmental pollution monitoring requirements, using uv wavelength grating type continuous frequency measuring method, 2018 International Conference on Sensor Network and Computer Engineering (ICSNCE 2018) 18 precision is put forward to solve the various harmful ingredient concentration of recursive iteration fast inversion algorithm, and validates the effectiveness of the algorithm. Portable flue gas analyzer based on this algorithm is based on embedded technology, sensor based on micro spectrometer data collection, using uv light source through the spectrum analysis method analysis of flue gas concentration, achieved through the use of a miniature spectrum analyzer to a variety of gas composition at the same time for the purpose of accurate measurement. The product has compact structure, high measuring accuracy, strong anti-interference, high sensitivity etc, has a broad application prospect and popularization value. ACKNOWLEDGMENT The authors wish to thank the cooperators. This research is partially funded by the Project funds in shaanxi province department of education (15JF019) and the Project funds in shaanxi province department of science industrial projects(2015GY067). REFERENCE. [1] Zhu Fa-hua, Li Hui, Qiu Shu-guang. Development and Application of Continuous Em ission Monitoring Technology[J]. Administration and Technique of Environmental Monitoring 2010(22) [2] Lei Tian-xue. The present situation of the portable flue gas analyzer[J]. Administration and Technique of Environmental Monitoring. 1998(10) [3] Ju Hui, Wu Yi-hui, Development situation of micro spectrometers[J]. Optics and Precision Engineering. 2004.9(4). pp372-376 [4] Shi Baosong, Sun Shouhong, Zhang Wei.Application of CCD in the portable spectrometer[J].Electronic Measurement Technology. 2010(11) [5] Limited ARM Development Guide 2000-2001. ARM DOI. 2000.06. [6] Dong, Qing. Ocean wave spectrum from SAR image using 2D-ARMA model.IEEEInternational Geosciences and Remote Sensing Symposium, 2005, 991-994 [7] Chen Zhi-gang. Discussion on Application of Lambert-Beer law in test [J]. Acta Metrologica Sinica.1985(1) [8] Pop, Paul.Embeddedsystems design:Optimization challenges.Lecture Notes in ComputerScience, 2005, 35(24):16-20