The selective detection of ammonia (NH3), nitrogen dioxide (NO2), carbon oxides (CO2 and CO), acetone ((CH3)2CO), and toluene (C6H5CH3) is investigated by means of a gas sensor array based on polyaniline nanocomposites. The array composed by seven different conductive sensors with composite sensing layers are measured and analyzed using machine learning. Statistical tools, such as principal component analysis and linear discriminant analysis, are used as dimensionality reduction methods. Five different classification methods, namely k-nearest neighbors algorithm, support vector machine, random forest, decision tree classifier, and Gaussian process classification (GPC) are compared to evaluate the accuracy of target gas determination. We found the Gaussian process classification model trained on features extracted from the data by principal component analysis to be a highly accurate method reach to 99% of the classification of six different gases.
Keywords: feature extraction; gas sensor; pattern recognition; sensor array
The control and monitoring of toxic gaseous substances, such as ammonia, nitrogen oxides, and various volatile organic compounds, is crucial in automotive, defense, aviation, chemical, medicine, and food industries [1,2]. Research on chemical sensors is currently focused on the fabrication of multisensor arrays for enhanced detection and identification of various chemical compounds. In most cases, the cross-sensitivity toward different chemical analytes is unavoidable, regardless of their oxidizing or reducing nature. Many authors have suggested a number of ways to overcome the drawbacks of cross-sensitivity/selectivity and reliability of the sensor arrays [3-5]. One powerful tool to address the abovementioned drawbacks is the implementation of a multisensor array combined with appropriate pattern recognition and classification tools . Recently, classification in gas sensing applications has been carried out by principal component analysis to identify the difference between VOCs, supported by a vector machine to distinguish between acetone, nitrogen dioxide, and ammonia, and by a neutral network model to distinguish between ammonia and formaldehyde gas [7-9].
In our previous work , we demonstrated a combination of organic (polyaniline, PANI) and inorganic (carbon nanotubes (CNT), SnO2, TiO2) materials in a gas sensors based on nanocomposite layers with good sensitivity, temperature stability, reversibility, which was operating at room temperature. Herein, we extended our study by applying other nanocomposite sensing layers, namely PANI/ZnO, PANI/WO3 (nanopowder), PANI/WO3 (nanotubes), PANI/In2O3, PANI/C60 (fullerene), PANI/nanocrystalline diamond (NCD), and PANI/BaTiO3, deposited on a flexible sensor array platform with a new design. Seven different nanocomposite sensing layers deposited on the array were exposed to six different gases (ammonia, carbon dioxide, nitrogen dioxide, carbon monoxide, acetone, and toluene). Moreover, the obtained data were used for machine learning classification.
Many pattern recognition models based on intuitive, linear and nonlinear supervised techniques have been explored in E-nose data [11,12]. A considerable number of studies have been implemented in recent years using different statistical analysis algorithms, like principal component analysis (PCA), linear discriminant analysis (LDA), k-nearest neighbors algorithm (KNN), support vector machine (SVM), decision tree classifier (DT), random forest (RF), and Gaussian process classification (GPC) in order to enhance the discrimination of gases and get better selectivity . In this work we suggest a new method in our classification system by combining the abovementioned methods and using the output of the two most powerful techniques in dimensionality reduction and increasing interpretability. We apply PCA and LDA as input data for five machine learning algorithms with a 10-fold cross-validation method.
The preprocessing stage was implemented by applying PCA and LDA on the extracted dataset [14,15]. Five different kinds of flexible pattern recognition algorithms have been used for the classification of gas sensor data using a 10-fold cross-validation to reach the highest classification rate.
The sensors layers were investigated by scanning electron microcopy (SEM), Raman spectroscopy, current–voltage and temperature analysis, and gas sensing analysis. Further, statistical classification analysis was implemented for the evaluation of target gases.
The surface morphology and uniformity of additives in PANI of the deposited active layers were examined by scanning electron microscopy (TESCAN FERA3 GM), as shown in Figure 1a–h. All nanocomposite active layers, that is, PANI/ZnO, PANI/WO3 (nanopowder), PANI/WO3 (nanowires), PANI/In2O3, PANI/C60, PANI/NCD, and PANI/BaTiO3 have similar morphological features with a uniform distribution of additives in polyaniline. We can observe small ZnO flakes and WO3 nanowires homogeneously distributed in the layers.
Pristine PANI was examined by SEM (Figure 1h) and Raman spectroscopy (Raman spectrometer Renishaw inVia Qontor) at room temperature with 633 nm excitation wavelength (Figure 2). The spectrum of pristine PANI is typical of the emeraldine salt, showing the following main bands: (1) 748 cm−1 (Q ring bending, C–C ring deformation); (2) 810 and 870 cm−1 (out-of-plane C–H vibrations in the aromatic rings); (3) 1169 cm−1 (C–H bending of the quinoid rings); (4) 1221 and 1260 cm−1 (C–N in benzene diamine units); (5) 1336 cm−1 (C–N+, characteristic band of the polaron radical cation); (6) 1412 cm−1 (phenazine structures); (7) 1498 cm−1 (C=N of the quinoid nonprotonated diimine units); (8) 1590 cm−1 (C=C stretching vibration of the quinonoid ring) [16,17].
Figure 3 shows current–voltage characteristics of active layers. These characteristics were examined for currents up to 200 mA and exhibit an almost linear character.
Figure 4 shows the temperature dependence of the relative resistance of PANI/nanocomposite layers for different temperatures. All layers exhibit a decrease in resistance with increasing temperature and composite layers exhibit lower temperature dependences in comparison to a pristine PANI layer. The resistance R0 and the average temperature coefficient of resistance (TCRs) values of the prepared sensing layers are given in Table 1. All active layers have a negative temperature coefficient. The resistivity of these nanocomposites depends on the p–n depletion layer width on the interface between the n-type nanoparticles and the surrounding p-type PANi molecules.
Table 1: Average TCRs of prepared sensitive layers in range from 20 to 80 °C.
|Layer||R0 (Ω)||TCR (K−1)|
The gas sensing characterizations of sensitive layers were performed using a custom-built apparatus (Figure 5). The characterization system consists of mass flow controllers (Bronkhorst High-Tech) for setting the required gas concentration, a source-meter (Keithley, Model 2400) for resistance measurement of active layers, an air-tight chamber with electrical feedthroughs for the sensor array, a relay multiplexor for switching four sensor elements, and a Labview-based data acquisition system.
The sensing layers were tested towards carbon dioxide (250 ppm CO2), carbon monoxide (25 ppm), ammonia (25 ppm), nitrogen dioxide (25 ppm), acetone (6%), toluene (500 ppm) and humid air (RH) in synthetic air (SA) at room temperature. The response of the sensing layers was calculated by the relative resistance change:
where R0 is the resistance at room temperature in synthetic air and Rg is the resistance of the sensor in the presence of the specific gas.
The dynamic responses of sensing layers for gases are displayed in Figure 6. The experiment consisted of 5 min of sensor exposure to a certain gas concentration and 5 min of purging at a flow rate of 100 mL·s−1. It is evident that all active layers have the highest sensitivity and clear response to NH3. All active composite layers except PANI+ZnO exhibit a higher sensitivity toward NH3 in comparison to a pristine PANI layer. PANI+ZnO composite shows the lowest sensitivity to all gases. Moreover, the resistance decreases when the polyaniline composite sensing layers are exposed to toluene. In addition, the sensor responses of all sensing layers to NO2 gas are nearly three times lower than those to NH3.
Due to the high sensitivity to NH3 gas, the sensing layers were also tested towards different concentrations of NH3 at room temperature (Figure 7). It is evident that all sensing layers demonstrate an enhancement in sensitivity to the highest gas concentration (50 ppm) as well as incomplete reversibility.
When the operating temperature increased up to 80 °C, the sensing layers showed an at least three times lower response to ammonia in contrast to the room temperature measurements (Figure 7), but with almost complete reversibility (Figure 8).
The gas sensing mechanism of nanocomposite layers based on PANI was discussed in . Polyaniline is known as one of the most famous p-type conductive polymers. During the exposure to a reducing gas (NH3), the emeraldine salt form of polyaniline is converted to the emeraldine base form leading to an increase in resistance due to the decrease of hole density within the p-type film . In the case of the hybrid structures, a p–n heterojunction is formed between polyaniline and n-type nanostructures such as ZnO, WO3, In2O3, or fullerene . The protons from polyaniline are transferred to the NH3 molecules. This results in a widening of the depletion layers on p–n junctions and, thus, the resistance increases . All these effects are reversible when the reducing gas is replaced by air. Beside these effects, nanostructures added into polyaniline increase the initial resistance due to larger disorder and deformation of the polyaniline conjugation chains. The summary of the gas sensor responses for all active layers is shown in Figure 9. All layers show an increasing resistivity as a clear response to CO, CO2, NH3, and NO2.
Additionally, to exclude the influence of humidity on the sensor signal, the sensor arrays were exposed to various relative humidity levels ranging from 20% to 80% (Figure 10). The obtained results show a decreasing sensor response with increasing RH% value. This change in response toward relative humidity is due to the adsorption of water molecules and an increase of charge concentration due to PANI doping and the formation of charge transfer complexes . The decrease of electrical resistance is caused by the greater mobility of the dopant ions, related to the development of PANI chains. Furthermore, the swelling effect contributes to the change in resistivity .
A data preprocessing stage was applied on the gas sensor responses to improve the overall pattern analysis performance. It was implemented by applying PCA and LDA on the extracted dataset of exposing six different gases to sensor arrays with seven different PANI/nanocomposite sensing layers. Figure 11 presents two-dimensional LDA and PCA projections of the extracted features. Regarding the LDA results, LDA1 describes approximately 72% and LDA2 describes 20.6% of data variation. By using the LDA method, a good classification with clearly separated clusters is obtained for NO2, CO2, acetone, and NH3, but an overlap (overlaps are highlighted by oval-shaped drawings) was detected between CO and toluene. Applying the PCA method, we found that PCA1 describes approximately 94%, while PCA2 only 3.6% of data variation. These results demonstrate that PCA2 could be neglected in comparison with PCA1. Therefore, by analyzing the data projection on PCA1 to evaluate the behavior of the sensors, a high classification in clearly separated clusters is obtained for all gases via PCA. However, PCA and LDA results should be evaluated by machine learning algorithms for high accuracy. The generated feature set by PCA and LDA was provided to the classification algorithms as input vectors, Then, the training/testing process of SVM, KNN, DT, RF, and GPC classifiers was executed by using the 10-fold and 2-fold cross-validation approach. Table 2 shows the classification rate percentage of the sensor array after applying different classification algorithms.
Table 2: Gas classification rate.
|K- fold cross-validation||K = 10||K = 2|
|Classifier||PCA (%)||LDA (%)||PCA (%)||LDA (%)|
For visualization, Figure 12 illustrates the classification accuracy of the test samples based on the presented five classifiers. The result shows that, by applying 10-fold cross-validation method, 10–90% of training and test samples were analyzed. KNN, RF, DT, and GPC classifiers yielded a higher classification rate when the PCA method was used as input vector. A different behavior was detected for SVM, where a higher classification rate was achieved by the LDA method as input vector for SVM. The highest rate with 99% classification of the target gases was achieved by using PCA as input vector to train the GPC classifier. Results show that using a smaller amount of training samples, such as the 2-fold cross-validation method in which 50% of training and test samples were analyzed, could strongly decrease the classification rate. In the case of the RF classifier, classification decreased by 30%. The same result of a 30% decrease was obtained for KNN. However, GPC still shows a very high classification rate (85%) even with 50% less training samples, which proves the high capacity and powerful discrimination of using the PCA–GPC combination for E-nose and gas sensor applications.
The usage of a powerful classification system based on statistical analysis and machine learning algorithms is a prime need for sensing applications in different fields, such as gas detection and monitoring [22,23], food industry , and agriculture . However, the potential of such electronic nose systems varies according to the implemented classification system. Only between two and four different statistical analysis and classification algorithms were used in the cited literature [22-25]. In this work, we developed a robust system with seven different mathematical algorithms and we examined the interaction between these algorithms. The seven algorithms were studied in deep using different combinations and the highest classification rate was obtained by PCA/GPC.
We presented the fabrication and characterization of seven different composite sensors based on polyaniline. These sensors were used in gas sensing arrays. The sensitivity and selectivity of the gas sensing system was successfully tested on a set of six different gases. The improvement of the selectivity was analyzed by implementation of a complex statistical classification system. The strength of statistical analysis and classification algorithms was determined and was based on several factors such as data field application, parameters, behavior of the system, and the convenience of data behavior and the data correlation regarding the mathematical algorithms and calculations. For different data patterns the algorithms show different strength and reliability. For our system it was possible to perform a suitable preprocessing and feature selection of the dataset by PCA for powerful predictions with uncertainty determined by GPC, which summarizes the distribution of random variables and define the covariance function of the data, a crucial ingredient for our system predictions. The highest classification rate of about 99% was obtained for our classification system using PCA and GPC.
The sensor array with four interdigitated electrode systems was manufactured as a flexible printed circuit board (DuPont Pyralux AP8535 with 75 µm thickness, double-sided, copper-clad laminate in an all-polyimide composite of polyimide film bonded to copper foil). It contains the heating elements and the temperature sensors for the temperature controlling of individual sensing layers. The heating element can also be used for the desorption of measured gases or heating slightly above the ambient temperature in order to reduce temperature fluctuation. The 18 µm thick Cu interdigitated electrodes were covered with a 12 µm thick gold layer to improve the corrosion resistance. The width and spacing of interdigitated electrodes are 100 µm. The heating element (surface-mounted device SMD0402 resistor with an electric resistance of 50 Ω) and a platinum temperature sensor (SMD0603 Pt1000) are placed on the bottom side of each sensor by soldering with Sn0.63Pb0.37. The sensor size array is 16.2 mm (width) × 16.2 mm (length) with the sensing layer size of 1.7 mm × 1.7 mm. A pin header connector is used for connection of the sensor array.
Sensor arrays with PANI/nanocomposite (PANI/ZnO, PANI/WO3 (nanopowder), PANI/WO3 (nanowires), PANI/In2O3, PANI/C60, PANI/NCD, and PANI/BaTiO3) sensing layers were fabricated similarly as reported in . The whole fabrication process of the sensor array is described in Figure 13.
First, the protonated emeraldine salt form of PANI was prepared by oxidation of 0.2 M aniline hydrochloride with 0.25 M ammonium persulfate at room temperature (25 °C). The precipitate obtained after the polymerization was filtered and purified by 0.2 M hydrochloric acid and acetone. Subsequently, pure polyaniline was dried over silica gel in a desiccator for 24 h.
Next, the dispersion solutions were prepared by mixing 24 mg PANI and 5 mg additives (zinc oxide, two forms of tungsten oxide, indium oxide, fullerene, NCD, and barium titanate) in 2 mL xylene. Table 3 shows properties of the used additives. The prepared solutions were mixed in a shaker for 30 min and subsequently ultrasonicated for 30 min. Finally, the obtained dispersion solutions were deposited by a micropipette on the interdigitated electrode arrays. After that, the deposited sensor layers were dried using the integrated heating elements at 60 °C for 2 h and whole sensor array was subsequently dried in a desiccator over silica gel for 24 h. Before the deposition, the sensor array platforms were cleaned in acetone and isopropyl alcohol for 15 min and then exposed to hexamethyldisilazane (HMDS) for 2 h to improve the adhesion of sensing layers.
Table 3: Properties of the used additives.
|zinc oxide (ZnO)||nanopowder, particle size < 50 nm, surface area > 10.8 m2·g−1|
|tungsten oxide (WO3)||nanopowder, particle size < 100 nm|
|tungsten oxide (WO3)||nanowires, diameter 50 nm, length 10 µm|
|indium oxide (In2O3)||nanopowder, particle size < 100 nm, 99.9% trace metals basis|
|fullerene (C60)||sublimed form|
|nanocrystalline diamond (NCD)||nanopowder, particle size < 5 nm|
|barium(IV) titanate (BaTiO3)||nanopowder (cubic crystalline phase), particle size < 100 nm, ≥99% trace metals basis|
The classification capability for the gas sensor arrays was analyzed and studied to achieve the highest classification rate by constructing a classification system according to the block diagram in Figure 15. PCA and LDA were implemented and applied in order to extract the data measured from seven sensing layers, namely PANI/ZnO, PANI/WO3 (nanopowder), PANI/WO3 (nanowires), PANI/In2O3, PANI/C60, PANI/NCD, and PANI/BaTiO3, and the result was used to train/test five different classification algorithms. In this work, KNN, SVM, RF, DT, and GPC were used to achieve the highest classification rate.
This paragraph and the following paragraph about PCA and LDA follow closely the corresponding content in . PCA is a linear transformation that preserves as much data variance as possible. PCA chooses a matrix T that minimizes the mean squared distance between original data and those reconstructed from reduced data. It has been shown that
where U and Λ are the eigenvector matrix and the diagonal eigenvalues matrix of the data covariance matrix, respectively. PCA has been extensively used for gas sensor applications [28-30].
LDA provides a linear projection of the data with (c – 1) dimensions, by considering the scatter of data within each class and across classes. Projection directions are those that maximize the inter-class separation of the projected data. The LDA transformation matrix is given by
where SW and ΛW are, respectively, the eigenvectors matrix and the diagonal eigenvalues matrix of the within-class scatter W. SB is the eigenvectors matrix of the between-class scatter B. LDA was previously used for gas detection applications [31,32].
KNN is a supervised algorithm that is used for classification and regression, KNN is based on the minimum distance of the unknown sample to the training samples, by selecting the specified number of points (k) that are closest to the unknown sample . Then the unknown sample can be identified by the majority votes.
SVM is an algorithm capable of performing classification and regression. The SVM algorithm enhances the classification function by finding the hyperplane in an N-dimensional space that has the widest margin between training data and class boundaries. Many possible hyperplanes could be chosen, but SVM aims to find a plane with the maximum margin, that is, the maximum distance between data points of different classes in feature space. A linear decision boundary is constructed in form of a hyperplane:
A support vector machine takes the input vectors and outputs a hyperplane that separates different classes. Hyperplanes are decision boundaries that help to classify different classes [34,35]. Samples with an unknown class will be classified by the decision boundary, samples falling on either side of the hyperplane can be attributed to different classes.
DT is a learning algorithm. It is a tree-structured classifier where the classification model is performed by a series of test questions and conditions with finite depth based on the features of input data in a tree structure. After the decision tree has been built, sorting of an unknown sample is simple. It begins with the top node of the tree and goes to the leaf. It undergoes distribution channels of the nodes and it follows to the next node, for which a new condition is subjected to the sample till it reaches the leaf node. The unknown sample is labeled and sorted, and a new and unknown sample is classified [36,37].
RF is an ensemble method for classification and regression tasks that uses multiple models of several DT to achieve a better output classification. The concept of the algorithm to build the structure is to select random samples from the dataset and create a decision tree from each sample and to get prediction results from each decision tree created . The RF consists of a large number of individual decision trees. Each tree votes for a class prediction in the random forest, and the prediction with the most votes becomes the prediction of random forest.
GPC is a supervised learning method and a generalization of the Gaussian distribution of probability, which can be used for advanced non-parametric machine learning algorithms for classification problems . GPC puts a Gaussian prior over a latent function, which is then squashed by a logistic function to obtain the probabilistic classification. In GPC, the posterior of the latent function is not Gaussian . In GPC, for a given dataset, the training data x1,..., xn are chosen with the corresponding class labels y = (y1,..., yn), to predict the class of a test sample:
where Φ denotes the standard normal cumulative distribution function, that is,
Gaussian process classification is not a parametric model. Instead, training is carried out to get hyperparameters that are needed for the covariance function and posterior. The target of GPC is to obtain the distribution of a latent variable corresponding to test sample x*:
where p(f|x1, …, xn, y) is the posterior over the latent variables, and this distribution subsequently will be used to predict the probabilistic prediction:
The classification system was processed by Scikit-learn, which is one of the most popular machine learning libraries of python. Anaconda installer for Python 3.8 was used to run all the libraries and Jupyter Notebooks. This work contains parts from the thesis of J. Kroutil, "Gas sensor array with nanocomposite films", Czech Technical University in Prague, 2019.
This work was supported by the Czech Science Foundation project No. GA22-04533S „Printed heterogeneous gas sensor arrays with enhanced sensitivity and selectivity“, by the grant of CTU No. SGS20/176/OHK3/3T/13, by the project Centre of the Advanced Applied Natural Sciences No. CZ.02.1.01/0.0/0.0/16_019/0000778 supported by the Operation Programme Research, Development and Education co-financed by European Comunity and by Ministry of Education Czech Republic and by the grant CzechNanoLab Research Infrastructure supported by MEYS CR (LM2018110).