Short-Time Fourier Transform and Decision Tree-Based Pattern Recognition for Gas Identification Using Temperature Modulated Microhotplate Gas Sensors

Because the sensor response is dependent on its operating temperature, modulated temperature operation is usually applied in gas sensors for the identification of different gases. In this paper, the modulated operating temperature of microhotplate gas sensors combined with a feature extraction method based on Short-Time Fourier Transform (STFT) is introduced. Because the gas concentration in the ambient air usually has high fluctuation, STFT is applied to extract transient features from time-frequency domain, and the relationship between the STFT spectrum and sensor response is further explored. Because of the low thermal time constant, the sufficient discriminatory information of different gases is preserved in the envelope of the response curve. Feature information tends to be contained in the lower frequencies, but not at higher frequencies. Therefore, features are extracted from the STFT amplitude values at the frequencies ranging from 0Hz to the fundamental frequency to accomplish the identification task. These lower frequency features are extracted and further processed by decision tree-based pattern recognition. The proposed method shows high classification capability by the analysis of different concentration of carbon monoxide, methane, and ethanol.


Introduction
An electronic nose is an instrument that imitates the functionalities of biological olfactory, which typically consists of an array of chemical sensors (usually gas sensors) and a pattern recognition system [1][2][3].The electronic noses have been applied in some fields where odors or odorless volatiles and gases are thought to play roles [4], such as disease diagnosis [5], food quality [6,7], agricultural applications [8], environmental monitoring [9,10], and automotive industry [11].
The selectivity and sensitivity of most gas sensors are dramatically dependent on the operating temperature, since the reaction rate of different analytes and the stability of surfaceadsorbed oxygen species are a function of temperature.Operating temperature modes of sensors can be divided into two categories: (i) the constant operating temperature (e.g., the heating voltage is set to 5 V) and (ii) temperature modulation (e.g., the sensors are driven by self-adapted or periodic heating voltages) [12][13][14][15].Temperature modulation alters reaction kinetics at the sensor surface [16].Measuring the conductivity of a metal-oxide chemical sensor at different temperatures can provide a wealth of discriminatory information.The previous works have showed that temperature modulation of sensors can improve selectivity [17][18][19], while more complicated algorithms are required [20].In the last ten years, the focus has been on analysis of dynamic sensor signals [21][22][23][24], and the Fast Fourier Transform (FFT) or the Discrete Wavelet Transform (DWT) [25,26] for feature extraction has been frequently used.Many scholars used the FFT transform to extract the harmonic components as the features (e.g., Vergara and coworkers computed the absolute values of FFT and extracted the values of six harmonics corresponding to six modulating frequencies) [27].However, these harmonic components are heavily dependent on the frequency of the operating temperature [25].Therefore, a more practical method must be developed to overcome this problem.
In addition, gas molecules are carried by air flow and distributed by turbulence [28].Since the gas concentration in the ambient air usually has high fluctuation over time, it is difficult to extract transient features in this situation.The sensing in both time and frequency domain is necessary while it is more complicated.Although there have been many works in a single domain, a limited number of works have been addressed to combine both domains.The Short-Time Fourier Transform (STFT) is a way to extract the main features from the time-frequency domain.For example, Nimsuk and Nakamoto used the STFT method to improve the capability of odor classification in dynamical change of concentration using a quartz crystal microbalance (QCM) sensor array [29].However, the applicability of STFT method for temperature modulated microhotplate gas sensors has not been reported yet.
In this paper, the STFT is calculated over the responses of SnO 2 microhotplate gas sensors, and the relationship between the STFT spectrum and sensor response is further explored.The optimal features tend to be contained in the lower frequency responses of the sensor close to direct current (DC).Therefore, features are extracted from the STFT amplitude values at the frequency ranging from 0 Hz to the fundamental frequency to fulfill the identification task.The gas identification effect of the proposed method is demonstrated by the analysis of carbon monoxide, methane, and ethanol with different concentrations.Various waveform types and periods of the heating voltage are studied, and results show that it is possible to find the optimal features to obtain excellent identification of the gases studied regardless of their concentrations.The structure of the paper is as follows.Section 2 introduces the experimental setup and the dataset acquiring procedure.Section 3.1 presents the methodology based on STFT to select the optimal features.The recognition results are shown in Section 3.2, and the conclusions of this work are outlined in Section 4.

Experimental
2.1.Microhotplate Gas Sensors.The four-element microhotplate gas sensor arrays are fabricated using complementary metal-oxide semiconductor (CMOS) and post-CMOS technology [30].Figure 1(a) shows the photo of a sensor microarray and Figure 1(b) shows the packaged gas sensors.
The main body of the sensor is a square freestanding membrane supported by four bridge arms.In the center membrane, a tungsten thin film resister that has the snake shape is designed to monitor the temperature of the microhotplate as well as to heat up the membrane.The SnO 2 sensitive film is sputtered on the top of the microhotplate, and Pt catalyst with a thickness of 1 nm is sputtered for improving its selectivity.
The thermal efficiency of the microhotplate is subsequently acquired by electrically heating with a digital source meter (Keithley 2400) and measuring the resistance values.The measurement results show that the thermal impedance of the microhotplate with electrodes and sensitive materials is about 16 ∘ C/mW.The thermal response of the coated membranes is near 8 ms (10% to 90% rise time) when working at 300 ∘ C [30].

Experimental Setup and Data Collection.
Experimental setup and the measurement circuit are showed in Figure 2. The testing chamber containing a microhotplate sensor array is connected to a gas mixer controlled by the mass flow controllers (MFCs).The chamber volume is 300 mL.The Sensor Step 1. Dry air at a constant flow rate of 330 sccm by the flow system is circulated through the testing chamber for 1200 s to measure the baseline steady-state sensor response.
Step 2. The gas with the desired concentration is injected into the testing chamber for 600 s.
Step 3. The testing chamber is cleaned with dry air for 900 s.Then, the measurement steps are replicated for subsequent measurements.
Table 1 shows the dataset in detail.Figure 3 shows the measured voltages when heating voltage is a sawtooth modulation waveform at period of 40 s.As shown in Figure 3, the sensor has higher sensitivity to carbon monoxide compared with methane and ethanol.Moreover, the measured voltages are greatly influenced by the operating temperature.There are two main reasons.(i) Microhotplate can reach a stable temperature in several milliseconds, so the temperature of the microhotplate will mostly follow the shape of the heating voltage with frequency lower than 1 Hz.(ii) The sensors take about 1 to 2 minutes to reach a steady adsorption state and about 2 to 3 minutes to reach a steady desorption state.As a result, because of the low thermal time constant, the shape of sensor response is similar to the heating voltage.A slight modification of the response is found in the presence of three reducing gases.In this work, similar results are obtained with the other modulation waveforms.

Feature Extraction Based on STFT Method. Short-Time
Fourier Transform (STFT) is a method that FFT transform is applied after the signal is cut out by the window function.For an arbitrary signal () in the time domain, STFT is defined as [31]   where () is the original signal in time domain.ℎ() is a STFT window function with  = 0 as the center, and the length of ℎ() is , 0 <  ≤ 1500.In this paper,  is 1/4 of the total length of ().That is,  = 375.
Then, (, ) can be described by the following matrix: where  , is the STFT value.The frequency of th row is   = /.In this paper, a 1024-point FFT transform is used.That is,  = 1024,  = 1024,  = 1500.
In order to reduce the drift of the sensors and the background noise, the sensor responses need to be preprocessed by () = ( gas () −  air )/ air , where  gas () and  air are the measured voltages in gas and in air, respectively.
Figure 4 shows the STFT amplitude spectrum of the sensor response with rectangular modulation waveform at 4 s period.The STFT amplitude values vary with time at different frequencies.The -coordinate of 600 s is the dividing line of feature vectors.The curve rises up fast on the left side and descends down quickly on the right side.The essence of this phenomenon is mainly related with the sensor resistance.The reducing gas is injected into the chamber in the first 600 s, which leads to the decrease of the sensor resistance.The dry air is injected into the chamber from the time of 600 s to 1500 s, and sensor resistance gradually increases.At the same time, Figure 4 shows the distribution of frequency.It is mainly composed of a 0.25 Hz fundamental wave frequency and some lower frequency responses close to DC, and, with the increasing of frequency, the amplitude spectrum rapidly decreases to 0.
In order to extract the optimal features, the frequency distribution of the sensor responses should be clearly analyzed.As seen from Figure 5, the frequency distribution obtained by STFT shows that the DC component ( = 0Hz) is The STFT amplitude F r e q u e n c y ( H z ) T im e (s ) heavily dependent on the steady-state response associated with the gas concentration.This coefficient is not used for identification task among different gases, since the system aims at identifying the gas regardless of its concentration.Suppose  0 is the fundamental frequency and  is the period of heating voltage, the fundamental frequency will be  0 = 1/, and the harmonics have frequencies of 2 0 , 3 0 , 4 0 , . .., and so forth.Harmonic frequencies are equally spaced by the width of the fundamental frequency and can be found by repeatedly adding that frequency.As shown in Figure 5, the harmonic frequency depends much on the period of the heating voltage.Therefore, when the period of the heating voltage changes dynamically, for example, selfadapted operating temperature, the harmonics are not used for the recognition task.
In fact, because of the low thermal time constant, the sufficient discriminatory information is preserved in the envelope of the response curve, but not at higher frequencies.The optimal features tend to be contained in the lower frequency responses of the sensor close to DC.Therefore, features are extracted from the STFT amplitude values at the frequency ranging from 0 Hz to the fundamental frequency  0 to finish the identification task.
The -coordinate of the fundamental frequency is  = /( ⋅   ), where  is the period of heating voltage and   is the sampling rate.In this work,   = 1 Hz,  = 1024.Because the maximum modulation period is 80 s, the smallest fundamental frequency  0 is 12.5 mHz, and the corresponding -coordinate value is  = 12.As a result, 11 frequencies that range from 0.97 to 10.67 mHz with 0.97 mHz interval can be selected, and the corresponding feature vectors are 6 shows the feature vectors of 11 frequencies for 3 analytes.

Decision Tree-Based Pattern Recognition.
Decision tree is one of the most well-known methods used for extracting classification rules from data [32].As for classification problems, decision tree is a top-down process, finding classification rules according to the nodal path to a leaf node.Firstly, get the branches down from the node, and then get the labels of the samples at the leaf node by comparing the attributes of the internal nodes.Each child node is divided again according to the comparison of attribute values.Repeat the above steps until it reaches the classification criteria [33,34].
There are many window functions with different shapes.Short-Time Fourier Transform is also defined as Gabor Transform if Gaussian window function is selected.Window function makes the STFT observe the features of the sensor responses from time-frequency domain.Aimed at high time resolution, a narrow window function should be selected.Aimed at high frequency resolution, a wide window function should be selected.Hence, it is very important to select the shape and length of the window function.In this work,  is 1/4 of the total length of the measured voltage ( = 375).
The effects of 8 window functions are tested.The window functions are Boxcar window, Hamming window, Hann window, Gaussian window, Taylor window, Blackman window, Tukey window, and Triangle window.
The specific process of the algorithm for each heating waveform is summarized as follows: (1) select a desired window function (e.g., the hamming window function), and calculate the optimal feature vectors   , (2 ≤  ≤ 12) of all samples by STFT method; (2) reduce the dimensions of the vector   , (2 ≤  ≤ 12) by PCA, and only retain the first 10 principal components; (3) put each feature vector into the decision tree classifier for pattern recognition, respectively; (4) the process described is replicated for the other window functions.
Meanwhile, the classifier uses 12-fold cross-validation method to test the robustness of the algorithm.The original sample is randomly partitioned into 12 equal sized subsamples.Of the 12 subsamples, a single subsample is retained as the validation data for testing the model, and the remaining 11 subsamples are used as training data.The cross-validation process is then repeated 12 times, with each of the 12 subsamples used exactly once as the validation data.The 12 results from the folds can then be averaged to produce a single estimation.
Tables 2-5 show the recognition accuracy of the first 11 feature vectors for 4 heating waveforms.For the rectangular waveform, the best window function is Hamming or Taylor window function and the selected frequency is 5.82 mHz.For the sawtooth waveform, the best choice is Taylor window function and frequencies range from 3.88 to 7.76 mHz.For the sinusoidal waveform, we can select Hann window and frequencies range from 3.88 to 4.85 mHz or Gaussian window and frequencies range from 5.82 to 7.76 mHz.
In order to analyze the effect of operating temperature waveform, the selected frequencies are extended to the first 50 frequencies that are   = /1024, (0 ≤  ≤ 49).Their corresponding feature vectors are   , (1 ≤  ≤ 50).Then, we, respectively, put   into decision tree system to identify three kinds of gases.In the end, the average accuracy rate of each frequency with 8 window functions is calculated in order to avoid the influence of the window function waveform.The average accuracy rates of four modulated operating temperature waveforms are showed in Figure 7.If the selected frequency is lower than 2.91 mHz, the accuracy of the rectangle waveform is highest.If the selected frequency is higher than 2.91 mHz, the accuracy of the sawtooth waveform is highest.A feature combination that describes the original data perfectly can make the classifier work more efficiently.In this work, the optimal combinations of 11 features are optimised by Genetic Algorithm (GA).GA is adaptive heuristic search algorithm premised on the evolutionary ideas of natural selection and genetics [35].The basic concept of GA is designed to simulate processes in natural system necessary for evolution, specifically those that follow the principles first laid down by Charles Darwin of survival of the fittest.As such they represent intelligent exploitation of a random search  within a defined search space to solve a problem.The specific algorithm is as follows.
Step 1. Randomly generate initial population (0), and the size of (0) is set to 20.
Step 3. Selection, crossover, and mutation are set to roulette wheel selection, single point crossover, and single point mutation, respectively.
Step 5. Repeat Step 2 until satisfying solution is obtained.
Tables 6-9 show the optimal feature combinations selected by GA and their classification accuracies.The classification accuracies of the optimal feature combinations are 100% in all cases.
The recognition accuracy of the presented method is compared against the standard Fast Fourier Transform (FFT) and the Discrete Wavelet Transform (DWT).For FFT method, a 1024-point FFT is computed and the absolute values of the eight harmonics corresponding to the modulating frequencies are extracted.Eight harmonic frequencies are 250 mHz, 100 mHz, 50 mHz, 33 mHz, 25 mHz, 20 mHz, 17 mHz, and 12.5 mHz.Put 8 features into the decision tree classifier for pattern recognition.When analyzing Discrete Wavelet Transform, 3-level decomposition and the fourthorder Daubechies (db4) are selected.The third-level decomposition coefficients are extracted as features.PCA is used to reduce the dimensionality of features and keep only the first 10 principal components.Decision tree classifier and 12-fold cross-validation are applied for all of the pattern recognition systems.The recognition accuracy of three reducing gases is showed in Table 10.
As seen from Table 10, three reducing gases could be identified by FFT method with the highest accuracy rate of 79.17%, which is significantly worse than the identification rate reached when STFT method is used.DWT method outperforms FFT but obtains worse gas identification performance than STFT method.Meanwhile, the STFT is not only accurate, but also easy to understand compared with DWT method.

Conclusions
This paper introduces a novel method to extract optimal features of microhotplate gas sensors that modulated with different frequency operating temperature.The lower frequency amplitudes are extracted by STFT method, and the optimal feature combinations are selected by GA, since gas information tends to be contained in the lower frequencies, but not at higher frequencies.
We then evaluate the performance of our method by using the decision tree classifier and obtain high classification capability.Moreover, it is found that the proposed method is robust against not only dynamical heating frequency changes, but also different concentration levels.Therefore, we conclude that the proposed method could improve the recognition performance of temperature modulated microhotplate gas sensors.

Figure 1 :
Figure 1: The photos of microhotplate gas sensor arrays.(a) SEM photo of a four-element gas sensor array.Each sensor element is a square freestanding membrane supported by four arms.A tungsten thin film resister is embedded in the membrane acting as both heater and thermometer.The SnO 2 sensitive film is sputtered on the top of the microhotplate.(b) Microhotplate gas sensors packaged with DIP16 or TO5.

Figure 3 :
Figure 3: The typical output voltages and heating voltage.(a) The output voltages when the sensor is exposed in three analytes: 50 ppm carbon monoxide, 2000 ppm methane, and 30 ppm ethanol, respectively.(b) The heating voltage is sawtooth modulation waveform at 40 s periods.
The STFT amplitude F r e q u e n c y ( H z )T im e (s )F r e q u e n c y ( H z )T im e (s )

Figure 4 :Figure 5 :
Figure 4: The STFT amplitude spectrums of sensor responses to three analytes modulated with the rectangular modulation waveform at 4 s period.Hann window is used as the window function.The length of the window function is 375.(a) 150 ppm carbon monoxide; (b) 3000 ppm methane; (c) 50 ppm ethanol.

Figure 7 :
Figure 7: The recognition accuracy rates of four modulation waveforms.Decision tree classifier and 12-fold cross-validation are applied for the pattern recognition system.
Experimental setup for data acquisition.(a) The gas mixture is injected to the testing chamber at a constant flow rate, with gas components and concentrations controlled by the MFCs.The gas sensors are placed in the testing chamber, and the data is recorded by computer.(b) The measurement circuit.Each gas sensor has two resisters.  is acting as both heater and thermometer, and   is the resistance of the gas sensing film.  is the heating voltage for temperature modulation.  and   are constants and   is recorded as the sensor data.

Table 1 :
The dataset in detail.

Table 2 :
The recognition accuracy for the rectangle waveform (decision tree classifier and 12-fold cross-validation are applied to the identification of gases) (%).

Table 3 :
The recognition accuracy for the sawtooth waveform (decision tree classifier and 12-fold cross-validation are applied to the identification of gases) (%).

Table 4 :
The recognition accuracy for the sinusoidal waveform (decision tree classifier and 12-fold cross-validation are applied to the identification of gases) (%).

Table 5 :
The recognition accuracy for the triangular waveform (decision tree classifier and 12-fold cross-validation are applied to the identification of gases) (%).

Table 6 :
The optimal feature combination selected by GA and the recognition accuracy for the rectangle waveform (%).

Table 7 :
The optimal feature combination selected by GA and the recognition accuracy for the sawtooth waveform (%).

Table 10 :
The recognition accuracy when FFT and DWT approaches are used (%).