Comparison of Optical Ammonia-Sensing Properties of Conducting Polymer Complexes with Polysulfonic Acids

: Thin ﬁlms of conducting polymer complexes with polysulfonic acids of various structures were electrochemically deposited onto transparent FTO electrodes. The behavior of the polymer-based optical ammonia vapor sensors in response to various concentrations of ammonia vapors, ranging from 5 to 135 ppm, was investigated, including the response time and response amplitude. It was found that the nature of the conducting polymers (poly (3,4-ethylenedioxythiophene), polypyrrole, polyaniline), as well as the structure of the polyacids, affected the sensing performance of the obtained complexes.


Introduction
Conducting polymers (CPs) are actively used as sensitive materials in gas sensors [1][2][3][4]. Sensors based on CP thin films have good mechanical properties and environmental stability, as well as high sensitivity to gases at room temperature [1][2][3][4]. Moreover, they can be easily synthesized through chemical or electrochemical polymerization of the monomers. Generally, the rapid reaction to various gases is caused by changes in the degree of CP oxidation, which is influenced by chemical oxidation/reduction. This effect leads to an immediate change in the conductivity and optical absorbance.
Sensing of ammonia gas, as one of the most widespread industrial pollutants, is of permanent interest to scientists in the field. The majority of ammonia sensors based on CP films operate via a chemiresistive transducing mechanism [1,2,[5][6][7]. However, optical sensors can provide high sensitivity [8][9][10], fast response and simple regeneration [9], while their response is less influenced by electromagnetic interference, humidity and temperature [1,[8][9][10][11][12]. Changes in the UV-visible-NIR spectra reflect the changes in electronic structure of CP upon exposure to ammonia gas. A thin film deposited on glass (or ITO glass) is suitable for the manufacture of an optical sensor, since spectral changes can be easily recorded using commercial spectrometers [1] or detected using single-wavelength optoelectronic pairs. Another advantage is the ability to transmit an analytical signal without distortion over long distances [1,12,13]. Despite the advantages described above, only a few studied have focused on the creation of CP-based optical ammonia sensors [8][9][10][11][12][13][14].
In the majority of studies devoted to CP-based ammonia sensors, the CPs were produced by chemical oxidative polymerization. Only in a few studies [3, [13][14][15][16] were the sensing layers produced by electrodeposition, which makes it possible to obtain uniform films without residues of oxidants. With this method, the films can be deposited on metal, glass substrates with a transparent conductive layer (indium tin oxide (ITO) or fluorinated tin oxide (FTO)) and interdigitated microelectrodes. The films' thickness and morphology can be controlled by varying the electrosynthesis parameters (potential, current, charge spent for the synthesis, temperature, pH, etc.). Surface morphology and internal spatial structure of CP films can be additionally controlled by introducing various polyelectrolytes into their structure [17][18][19][20][21]. The use of sulfonated polyelectrolytes during CP electrosynthesis leads to changes in their structure and properties (optical, electrochemical, spectroelectrochemical and morphological [16,[22][23][24][25][26][27][28]). Also, important features of polyacids, as far as the stability of CP sensor characteristics is concerned, include the following: (1) they are not as volatile as HCl; and (2) their remnants inside the CP film after evaporation of the solvent are not as chemically aggressive as H 2 SO 4 or HClO 4 . To the best of our knowledge, the use of CP films electrodeposited in the presence of polysulfonic acids as gas sensors has never been considered. Earlier [16] polypyrrole complexes with different polyelectrolytes were first tested for optical ammonia sensing with a range of concentrations from 25 to 529 ppm.
In this work, we have reduced this range down to 5 ppm and performed a comparative study of the ammonia-sensing properties of interpolymer complexes of the most wellknown CPs: polyaniline (PANI), polypyrrole (PPy) and poly(3,4-ethylenedioxythiophene) (PEDOT). Since PANI can be obtained only in acidic solutions, for adequate comparison we only investigated CP complexes with the acid form of polyelectrolytes. CP complexes with polysulfonic acids of different structures and chain flexibilities were electrodeposited on transparent FTO electrodes. The effects of the structure and flexibility of polyacids and of the nature of the CP on the mechanism of interaction between CP complexes and ammonia were considered.

Synthesis of Sensor Films
The electropolymerization of EDOT, pyrrole and aniline was carried out in the presence of the following polysulfonic acids ( Figure 1): flexible-chain poly-2-acrylamido-2methyl-1-propanesulfonic acid (PAMPSA) and poly(styrene-4-sulfonic) acid (PSSA); semirigid-chain poly-(4,4 -(2,2 -disulfoacid)-diphenylen-iso-phthalamide) (i-PASA); and rigidchain poly-(4,4 -(2,2 -disulfoacid)-diphenylen-tere-phthalamide) (t-PASA). Laboratorysynthesized Na+-salts of i-PASA and t-PASA [29] (MW 40 000) and PSSNa (Aldrich, MW 1,000,000, 25% aqueous solution) were converted into H + -forms using an ion-exchange column. Then, along with PAMPSA (Aldrich, MW 2,000,000, 15% aqueous solution) they were purified via dialysis (cellulose membrane ZelluTrans MWCO 8000-, Roth) against deionized water for 3 days. The polyacids solutions were diluted by deionized water to the desired concentration and stirred for one day before use to provide homogenous mixing. The monomers were added into the polyacids' solutions by intensive stirring for 2 h. can be controlled by varying the electrosynthesis parameters (potential, current, charge spent for the synthesis, temperature, pH, etc.). Surface morphology and internal spatial structure of CP films can be additionally controlled by introducing various polyelectrolytes into their structure [17][18][19][20][21]. The use of sulfonated polyelectrolytes during CP electrosynthesis leads to changes in their structure and properties (optical, electrochemical, spectroelectrochemical and morphological [16,[22][23][24][25][26][27][28]). Also, important features of polyacids, as far as the stability of CP sensor characteristics is concerned, include the following: (1) they are not as volatile as HCl; and (2) their remnants inside the CP film after evaporation of the solvent are not as chemically aggressive as H2SO4 or HClO4. To the best of our knowledge, the use of CP films electrodeposited in the presence of polysulfonic acids as gas sensors has never been considered. Earlier [16] polypyrrole complexes with different polyelectrolytes were first tested for optical ammonia sensing with a range of concentrations from 25 to 529 ppm. In this work, we have reduced this range down to 5 ppm and performed a comparative study of the ammonia-sensing properties of interpolymer complexes of the most wellknown CPs: polyaniline (PANI), polypyrrole (PPy) and poly(3,4-ethylenedioxythiophene) (PEDOT). Since PANI can be obtained only in acidic solutions, for adequate comparison we only investigated CP complexes with the acid form of polyelectrolytes. CP complexes with polysulfonic acids of different structures and chain flexibilities were electrodeposited on transparent FTO electrodes. The effects of the structure and flexibility of polyacids and of the nature of the CP on the mechanism of interaction between CP complexes and ammonia were considered.

Synthesis of Sensor Films
The electropolymerization of EDOT, pyrrole and aniline was carried out in the presence of the following polysulfonic acids ( Figure 1): flexible-chain poly-2-acrylamido-2methyl-1-propanesulfonic acid (PAMPSA) and poly(styrene-4-sulfonic) acid (PSSA); semi-rigid-chain poly-(4,4′-(2,2′-disulfoacid)-diphenylen-iso-phthalamide) (i-PASA); and rigid-chain poly-(4,4′-(2,2′-disulfoacid)-diphenylen-tere-phthalamide) (t-PASA). Laboratory-synthesized Na+-salts of i-PASA and t-PASA [29] (МW 40 000) and PSSNa (Aldrich, MW 1,000,000, 25% aqueous solution) were converted into H + -forms using an ion-exchange column. Then, along with PAMPSA (Aldrich, MW 2,000,000, 15% aqueous solution) they were purified via dialysis (cellulose membrane ZelluTrans MWCO 8000-, Roth) against deionized water for 3 days. The polyacids solutions were diluted by deionized water to the desired concentration and stirred for one day before use to provide homogenous mixing. The monomers were added into the polyacids' solutions by intensive stirring for 2 h. The conditions of electrosynthesis have been described in [23] for PEDOT, in [16,22] for PPy and in [24,25] for PANI. All syntheses were performed in the galvanostatic regime on glass substrates (8 × 40 mm) covered with a transparent conducting layer of SnO2:F (FTO) with a sheet resistance of ca. 7 ohm/square. A platinum foil was used as a counter  The conditions of electrosynthesis have been described in [23] for PEDOT, in [16,22] for PPy and in [24,25] for PANI. All syntheses were performed in the galvanostatic regime on glass substrates (8 × 40 mm) covered with a transparent conducting layer of SnO 2 :F (FTO) with a sheet resistance of ca. 7 ohm/square. A platinum foil was used as a counter electrode and a saturated silver-silver chloride electrode (Ag/AgCl/KClsat) as a reference electrode. The concentrations of EDOT and pyrrole were 10 mM and that of aniline was 25 mM. The ratio of the concentrations of the monomer and sulfoacid groups was always kept as 0.5 mol to 1 g equivalent of the sulfoacid groups. The current densities were 50 µA/cm 2 for PEDOT, 100 µA/cm 2 for PPy and 20 µA/cm 2 for PANI. The surface area for all films was 2.0 cm 2 . All the samples were thoroughly rinsed with deionized water after electrosynthesis and dried in air. The charge spent for the synthesis of CP films was 50 mC/cm 2 . The thickness of CP polyacid films depending on the polyacid used were (nm): 150-250 (PANI), 200-300 (PEDOT) and 120-220 (PPy). The thicknesses of the films were measured with a MII-4 microinterferometer (LOMO, Russia).

Sensing Experiments and Instrumentation
The ammonia-sensing properties of CP films were studied as described in [16]. The films, electrodeposited on transparent FTO substrates, were placed in a closed 5 cm spectrophotometric quartz cell, filled with ammonia vapors in equilibrium (at 22-25 • C) with a 5 mm layer of the aqueous solutions of different NH 3 concentrations prepared through dilution of the 30% solution (Chimmed (Russia), analytical grade). The concentrations of ammonia in air (ppm) were calculated using an interpolated calibration curve based on the values for NH 3 partial pressure over ammonia aqueous solutions presented in [30]. UV-visible NIR (350-1000 nm) absorption spectra of CP films electrodeposited on FTO in air and exposed to the ammonia were registered using the AvaSpec 2048 spectrophotometer. The spectrum recording time was 2 s.
In general, the usability of a particular material as a sensor is determined by its sensitivity (detection limit) and response time, the concentration dependence of the response amplitude and the reversibility of changes in the measured parameter. In our case, this was the absorbance at the chosen wavelength(s) specific for each CP. Another criterion to choose these wavelengths is that they should be close to the standard wavelength of one of the light-emitting diodes, which can be used in optical pair detectors in practice instead of a spectrophotometer. The sensor response amplitude (∆A) was calculated as: where A NH 3 vap is the value of absorbance when the sample is exposed to NH 3 and A air is the value of absorbance when the sample is exposed to air. The sensitivity in our case was determined as the minimum concentration of analyte causing a reproducible response amplitude of at least 2%. However, such low response amplitudes were observed only for CP complexes exhibiting the worst sensing performances at the minimum (5 ppm) content of ammonia used in this study. The popular approach to determine the response time (t r ) using the results of response curve fitting (for example, by single or double exponents [31], Bessel's polynomial [32] or the reaction-diffusion model [33], etc.) is very useful if one compares the operation characteristics of a sensor based on a single polymer with varying thicknesses or morphologies, or with varying content of some additives (for example, carbon nanotubes). In our case, it was found that, due to the presence of polyelectrolytes in the acid form, a proton transporting network was formed in the bulk of the CP/PE films [16]. As a result, the shapes of the sensing responses of the CP complexes with the acid or salt forms of PEs were drastically different and could not be fitted with similar mathematic equations. Moreover, we compared the sensing responses of CPs with different sensing mechanisms, which also could not be fitted with similar equations. In order to obtain comparable results, we used another popular approach involving 90% of the response amplitude [2,[8][9][10]13,14,16].
The measurement time in all cases was the same as the exposition time and equaled 800 s, which was considered as the maximum reasonable duration for practical application.
The diffusion coefficient (D) was calculated in accordance with Fick's second law [34]. For gas sorption occurring through one surface of the film, this equation is transformed into: where M t is the amount of the sorbed or desorbed substance at the time t, M k is the equilibrium amount of the sorbed substance and l is the film thickness. This formula can be transformed to calculate the diffusion coefficient based on the time dependences of the optical absorption of the films during the sorption of ammonia: where A 0 and A k are the optical absorbance at characteristic wavelengths in the initial and final moments of sensing, respectively and, A t is the optical absorbance at a characteristic wavelength at time t. The atomic force microscopic (AFM) images of CP films were recorded by using an Enviroscope with a Nanoscope V controller (all by Bruker) in tapping mode. The roughness of CP films was averaged from five different parts of three films.
Regeneration of the CP films after exposition to ammonia vapors by resistive heating of the FTO layer was tested. A current of 0.1 A was applied to the conducting layer of 8 × 40 mm, which caused heating of the layer up to~75 • C. Figure 2 shows the characteristic evolution of the optical absorption spectra of CP complexes with polyacids exposed to 52 ppm NH 3 .

Spectral Changes in CP Films during Exposition to Ammonia
In the case of PEDOT films, absorption growth in the region of 450-550 nm, corresponding to the reduced form of PEDOT [23,35], and a decrease of absorption in the region of 700-850 nm, corresponding to polarons [23,35], were observed ( Figure 2a,b). Since NH 3 is an electron-donating molecule and PEDOT is not a pH-active CP, exposure of the PEDOT film to ammonia vapors led to an increase in the number of reduced fragments in the polymer chain [36,37]. In the case of the PEDOT complexes with flexible-chain polyacids, the optical changes were, in general, less noticeable but more pronounced in the range of 450-550 nm ( Figure 2b). Therefore, for best comparison in the case of PEDOT, we studied the response transients at 500 nm (Figure 3a).
In the case of PPy (Figure 2c), the growth of absorption in the region around 420 nm (reduced form) and the decrease of absorption in the range greater than 800 nm (polarons), which corresponds to PPy reduction [38] or deprotonation [38,39], can be simultaneously seen. Two mechanisms for the interaction of ammonia with PPy have been proposed, based on electron transfer from ammonia to PPy [15] and proton transfer from PPy to ammonia [15,38]. A combination of these two mechanisms is also possible [38]. Since more noticeable changes in the absorption were observed in the NIR region, in the case of PPy we studied response transients at 850 nm ( Figure 3b).
The changes of absorption in the PANI films are presented in Figure 2d. The decrease of absorption in the region around 800 nm, which is related to localized polarons, and at about 420 nm, which is related to the radical cations [40], can be seen. Simultaneously, the growth of absorption in the range of 550-650 nm, corresponding to the deprotonated form of PANI [9,40,41], can be observed. Such changes in the optical absorption spectra indicate the transition of PANI from a salt to a base form. Mutual transitions in the electronic structure of PANI were confirmed by the presence of two isobestic points. When PANI interacts with ammonia, the ammonia molecule takes up a proton from PANI, resulting in the energetically more favorable NH 4 + : PANI-H + + NH 3 → PANI + NH 4 + [10]. This leads to the dedoping (deprotonation) of PANI [9,10,42]. Due to fact that the changes in the range of 550-650 nm were more reproducible and more noticeable, we chose the wavelength of 600 nm to study the optical response transients of PANI films.
The changes of absorption in the PANI films are presented in Figure 2d. The decrease of absorption in the region around 800 nm, which is related to localized polarons, and at about 420 nm, which is related to the radical cations [40], can be seen. Simultaneously, the growth of absorption in the range of 550-650 nm, corresponding to the deprotonated form of PANI [9,40,41], can be observed. Such changes in the optical absorption spectra indicate the transition of PANI from a salt to a base form. Mutual transitions in the electronic structure of PANI were confirmed by the presence of two isobestic points. When PANI interacts with ammonia, the ammonia molecule takes up a proton from PANI, resulting in the energetically more favorable NH4 + : PANI-H + + NH3 → PANI + NH4 + [10]. This leads to the dedoping (deprotonation) of PANI [9,10,42]. Due to fact that the changes in the range of 550-650 nm were more reproducible and more noticeable, we chose the wavelength of 600 nm to study the optical response transients of PANI films. PANI-PAMPSA (d) exposed to 52 ppm NH3. Up (down) arrows indicate simultaneous growth (reduction) of absorbance at characteristic wavelengths during an 800 s exposure to ammonia vapor.

Sensing Properties
One can see in Figure 3a,b that the PEDOT and PPy complexes with rigid-chain polyacids demonstrated higher optical responses than their complexes with flexible-chain polyacids. In contrast, in the case of PANI (Figure 3c), the complex with flexible-chain PAMPSA had the highest response. PANI complexes with rigid-chain polyacids have slightly lower responses. Despite the very similar structures of i-PASA and t-PASA PANI-PAMPSA (d) exposed to 52 ppm NH 3 . Up (down) arrows indicate simultaneous growth (reduction) of absorbance at characteristic wavelengths during an 800 s exposure to ammonia vapor.

Sensing Properties
One can see in Figure 3a,b that the PEDOT and PPy complexes with rigid-chain polyacids demonstrated higher optical responses than their complexes with flexible-chain polyacids. In contrast, in the case of PANI (Figure 3c), the complex with flexible-chain PAMPSA had the highest response. PANI complexes with rigid-chain polyacids have slightly lower responses. Despite the very similar structures of i-PASA and t-PASA (Figure 1), PANIt-PASA film demonstrated a certain induction period (the longest response time). It is interesting that the complexes of all the CPs with the popular polymeric dopant PSSA demonstrated the lowest response amplitudes. Figure 4 shows the dependences of the maximum response amplitude (∆A) at the characteristic wavelengths on the concentration of ammonia in air for the films of CP complexes with various polyacids. Nonlinear dependences were observed for all CP complexes with increased gradients at low concentrations (<52 ppm), whereas most of the dependences were saturated at higher ammonia concentrations.
Very similar shapes of optical response dependences on ammonia concentrations were observed in [10][11][12] and for chemiresistive response in [5,37]. In [5], nonlinear behavior in the range of 5-50 ppm was related to the adsorption of NH 3 vapor molecules on the surface of the PPy film. At the increased (50-200 ppm) concentrations of NH 3 , suggesting a decreasing number of active adsorption sites, a decrease in the slope of the response concentration dependence was observed. In [37], it was supposed that, at the concentrations higher than 20 ppm, PEDOT films were saturated with NH 3 . The authors of [11] suggested the combined influence of the adsorption/diffusion/desorption of ammonia in the PANI layer on the sensing performance. Comparison of the responses of the best CP complexes exposed to 52 ppm NH3 (d). Figure 4 shows the dependences of the maximum response amplitude (∆A) at the characteristic wavelengths on the concentration of ammonia in air for the films of CP complexes with various polyacids. Nonlinear dependences were observed for all CP complexes with increased gradients at low concentrations (<52 ppm), whereas most of the dependences were saturated at higher ammonia concentrations.
Very similar shapes of optical response dependences on ammonia concentrations were observed in [10][11][12] and for chemiresistive response in [5,37]. In [5], nonlinear behavior in the range of 5-50 ppm was related to the adsorption of NH3 vapor molecules on the surface of the PPy film. At the increased (50-200 ppm) concentrations of NH3, suggesting a decreasing number of active adsorption sites, a decrease in the slope of the response concentration dependence was observed. In [37], it was supposed that, at the concentrations higher than 20 ppm, PEDOT films were saturated with NH3. The authors of [11] suggested the combined influence of the adsorption/diffusion/desorption of ammonia in the PANI layer on the sensing performance.
For PPy and PEDOT (Figure 4a,b), the saturation of ammonia sorption appeared after 52 ppm. In the case of PANI (Figure 4c, except for PANI-PSSA complex), the growth of ∆A continued up to higher ammonia concentrations (135 ppm), yet with lower slope. This may have been connected with the different mechanisms (reduction or deprotonation) of interaction of different CPs with NH3.
To summarize, it can be clearly seen from Figures 3b and 4b that PPy complexes demonstrated poor ∆A and longer response times as compared to PEDOT and PANI films. PEDOT complexes had the highest ∆A in the range of ammonia concentrations less and PANI (c) films prepared in 1-PAMPSA, 2-PSSA, 3-i-PASA and 4-t-PASA exposed to 52 ppm NH 3 . Comparison of the responses of the best CP complexes exposed to 52 ppm NH 3 (d).
For PPy and PEDOT (Figure 4a,b), the saturation of ammonia sorption appeared after 52 ppm. In the case of PANI (Figure 4c, except for PANI-PSSA complex), the growth of ∆A continued up to higher ammonia concentrations (135 ppm), yet with lower slope. This may have been connected with the different mechanisms (reduction or deprotonation) of interaction of different CPs with NH 3 .
To summarize, it can be clearly seen from Figures 3b and 4b that PPy complexes demonstrated poor ∆A and longer response times as compared to PEDOT and PANI films. PEDOT complexes had the highest ∆A in the range of ammonia concentrations less than 52 ppm, while PANI complexes (except for PANI-PSSA) demonstrated reliable NH 3 detection in the widest range of concentrations up to 135 ppm with the shortest response time ( Table 1).
The second important parameter was the response time, which depends on the diffusion coefficient of the analyte in the sensor material. Using the time dependences of the change in the optical absorption at the chosen wavelengths, the value of the ammonia diffusion coefficient can be calculated from Equation (3). Figure 5 shows the dependences of (A t − A 0 )/ (A k − A 0 ) on t 0.5 . D 0.5 was found from the slope of these dependences in the linear fragments indicated in the figure. The deviation of the graph from linearity at shorter and longer times indicates the deviation of ammonia diffusion from Fick's second law. As a rule, this is associated with relaxation processes accompanying the diffusion of sorbate in the polymer, which manifest themselves in the changes in the polymer conformation or structure due to deprotonation and/or reduction of CPs upon interaction with ammonia.  The second important parameter was the response time, which depends on the diffusion coefficient of the analyte in the sensor material. Using the time dependences of the change in the optical absorption at the chosen wavelengths, the value of the ammonia diffusion coefficient can be calculated from Equation (3). Figure 5 shows the dependences of (At − A0)/ (Ak − A0) on t 0.5 . D 0.5 was found from the slope of these dependences in the linear fragments indicated in the figure. The deviation of the graph from linearity at shorter and longer times indicates the deviation of ammonia diffusion from Fick's second law. As a rule, this is associated with relaxation processes accompanying the diffusion of sorbate in the polymer, which manifest themselves in the changes in the polymer conformation or structure due to deprotonation and/or reduction of CPs upon interaction with ammonia. According to the World Health Organization, the workplace exposure limit for ammonia in the air (8 h TWA reference period) is 25 ppm [43]. Therefore, we compared the sensing properties (response amplitude, response time, diffusion coefficient) of the complexes of PEDOT, PPy and PANI at this ammonia concentration threshold (Table 1).
It can be seen that the films of the PANI-PAMPSA and PANI-t-PASA complexes were characterized by the highest diffusion coefficients. As expected, all PPy complexes had the lowest diffusion coefficients and the longest response times. On the other hand, PEDOT complexes had long response times very similar to those of PPy, but with higher ∆A and diffusion coefficients. The latter were closer to the values for PANI complexes but the response of PANI films was significantly faster. Therefore, it can be concluded that not only ammonia diffusion but also the interaction mechanism of CPs with NH 3 affect the sensing properties.
The chemiresistive sensors based on CPs have, in general, shorter response times than the optical sensors: PEDOT-10 s at 100 ppm, PPy-15-20 s at 20 ppm, PANI-30 s at 25 ppm [2]. However, an adequate comparison of this parameter with the values obtained in the present study is difficult due to the differences in the thicknesses, detection ranges and response-linearity ranges used in different studies. Also, one should not forget that most of the cited results were obtained for CPs doped with low-molecular acids or salts, which may be evaporated or leached (for example, by dew) from the films, resulting in unstable sensing characteristics. This is not the case for the polyelectrolyte-doped CPs described in this study. According to the World Health Organization, the workplace exposure limit for ammonia in the air (8 h TWA reference period) is 25 ppm [43]. Therefore, we compared the sensing properties (response amplitude, response time, diffusion coefficient) of the complexes of PEDOT, PPy and PANI at this ammonia concentration threshold (Table 1).
It can be seen that the films of the PANI-PAMPSA and PANI-t-PASA complexes were characterized by the highest diffusion coefficients. As expected, all PPy complexes had the lowest diffusion coefficients and the longest response times. On the other hand, PE-DOT complexes had long response times very similar to those of PPy, but with higher ∆A and diffusion coefficients. The latter were closer to the values for PANI complexes but the response of PANI films was significantly faster. Therefore, it can be concluded that not only ammonia diffusion but also the interaction mechanism of CPs with NH3 affect the sensing properties.

Morphology of CP Films
In a great number of studies, the morphology or surface structure of CPs is denoted as the crucial factor affecting the sensor performance [2,8,10,33,44,45]. High roughness can enhance sensor response by providing high surface-to-volume ratios to enhance the diffusion of NH 3 molecules and increase the surface contacting the gas molecules [10]. In [10,44,45], it was suggested that the globular nanostructured layers demonstrate larger responses than nanofiber-based ones. The smaller diameters of globules provide higher specific surface areas for gas sorption [8,33].
In our work, PEDOT complexes with flexible-chain polyacids had filament-like structures (Figure 6a,b). In contrast, the surfaces of PEDOT with rigid-chain polyacids consisted of isolated globules with small dimensions (especially t-PASA) (Figure 6d). This correlates with their higher response amplitude. All PPy complexes had globular morphologies. The size of the globules was lower in the case of PPy complexes with rigid-chain polyacids (Figure 6g,h) and they had a higher response. So, in the case of CPs preferentially interacting with ammonia through the reduction mechanism, the morphology plays an important role in sensing. In the case of PANI, no such correlation was observed. It can be seen that the PANI complex with PAMPSA had a filament-like structure (Figure 6i) with large dimensions for its elements and high roughness ( Table 1). This film demonstrated the best sensing properties. At the same time, the PANI with another flexible-chain polyacid, PSSA (Figure 6j), consisted of small globules, had low roughness and demonstrated the worst response. PANI complexes with rigid-chain polyacids demonstrated good responses comparable with PANI-PAMPSA, but they had a different morphology. The surface of PANI-i-PASA (Figure 6k) consisted of isolated globules that were larger than those for PANI-PSSA, whereas PANI-t-PASA had a filament-like structure (Figure 6l). Therefore, for CPs interacting with ammonia through a combined reduction and deprotonation mechanism, the morphology was not very significant for the ammonia-sensing performance. Proton transport by hopping via sulfonic sites inside the film, which is discussed below, seemed to be more important.

Specific Features of Sensing Properties of CP Polyacid Films
Some interesting features of the sensing properties of PPy complexes with polyelectrolytes in the acid or salt forms were found in [16]. The first feature is that the protons in the films of PPy polyacid complexes can easily migrate via the sulfonic acid sites to the film surface, where they can react with ammonia molecules, resulting in a more rapid sensing response of PPy polyacid films as compared to PPy polysalt ones. In these conditions, the film is deprotonated more deeply and the spectral changes occur both in the surface areas and in the bulk of the film. A similar mechanism was found to be responsible for the more intensive and rapid sensing response of PANI polyacid complexes in this work.
Since the conductivity of CP depends on the degree of oxidation, the reducing effect of ammonia vapors can cause the propagation of the reduction front from the film surface to its bulk. Similar phenomena may have affected the ammonia-sensing properties of PEDOT polyacid complexes in this work.
Another important feature is the possible neutralization of a part of the ammonia molecules by excessive protons of polyacids. The acceleration of the sensing response of PPy polyacid films after their treatment in CaCl 2 was shown in [16]. This treatment leads to cross-linking of the polyacid matrix [46] by strong ionic bonds of Ca 2+ ions, with two sulfogroups belonging to adjacent polyacid chains. This results in effective replacement of excessive protons. In this study, this experiment was also repeated for PEDOT and PANI films. As expected, in the case of PEDOT complexes no changes in ∆A and response time were observed due to the purely reductive mechanism of their interaction with ammonia, and some reduction of ∆A was even observed (Figure 7a). The sensing responses of CaCl 2 -treated PANI films to NH 3 are presented in Figure 7b,c. A higher response amplitude (about 1.5-2 times) in the case of CaCl 2 -treated PANI-PAMPSA and PANI-t-PASA films can be seen. The relative decrease in the response time was more obvious for the PANI-t-PASA complex (1.3 times). Thus, in the absence of an excess of protons, especially on the film surface, most of the ammonia molecules react with protonated PANI (similarly to PPy). In the case of PPy, the neutralization of excessive protons only influenced the response time [16]. So, the deprotonation of the PPy surface occurs at an early stage and then the amplitude of PPy response is largely determined by its reduction. In the case of PANI, the growth of the response amplitude of the complexes, both with the rigid-and flexible-chain polyacids, and the decrease of the response time of the PANI-t-PASA film can be seen. Short and straight molecules of t-PASA are probably not excessively trapped in the film during the synthesis and have more accessible protonated sulfoacid groups on the film surface, which may neutralize ammonia at the initial stage. Accordingly, the sulfoacid groups of rigid-chain t-PASA are more accessible for treatment with CaCl 2 , which results in a more significant increase in the response amplitude and decrease in the response time for PANI-t-PASA films. and PANI-PAMPSA (c) 1-as prepared, 2-treated in 10% CaCl2, exposed to 52 ppm NH3.
In [2], it was noted that PANI seems to be a more suitable material for the detection of NH3 and it frequently possessed higher responses than other conducting polymers [3]. The fast process of PANI deprotonation [41] and the developed surface structure with high porosity lead to its good sensing properties. We assumed that the structural changes during reduction of CP comprise a slower process than deprotonation, particularly if there is a possibility of proton transport from the bulk of the film. As a result, PEDOT has a longer response time. Due to the fact that PPy has a lower range of optical changes during reduction/oxidation [22] than PEDOT [23] and, during protonation/deprotonation [39], than PANI [41], it demonstrates lower ∆A. However, it is not only the nature of CPs that influences sensor performance.
The flexibility and structure of polyacid chains play important roles in the formation of the bulk structure of CPs. The PANI complex with PSSA had possibly the worst sensing properties among the PANI complexes due to its having the lowest roughness (Table 1). Moreover, it has been shown by XPS analysis that the PANI-PSSA complex has a lower PANI-PAMPSA (c) 1-as prepared, 2-treated in 10% CaCl 2 , exposed to 52 ppm NH 3 .
In [2], it was noted that PANI seems to be a more suitable material for the detection of NH 3 and it frequently possessed higher responses than other conducting polymers [3]. The fast process of PANI deprotonation [41] and the developed surface structure with high porosity lead to its good sensing properties. We assumed that the structural changes during reduction of CP comprise a slower process than deprotonation, particularly if there is a possibility of proton transport from the bulk of the film. As a result, PEDOT has a longer response time. Due to the fact that PPy has a lower range of optical changes during reduction/oxidation [22] than PEDOT [23] and, during protonation/deprotonation [39], than PANI [41], it demonstrates lower ∆A. However, it is not only the nature of CPs that influences sensor performance.
The flexibility and structure of polyacid chains play important roles in the formation of the bulk structure of CPs. The PANI complex with PSSA had possibly the worst sensing properties among the PANI complexes due to its having the lowest roughness (Table 1). Moreover, it has been shown by XPS analysis that the PANI-PSSA complex has a lower doping level (the ratio between changed nitrogen atoms and the total amount of nitrogen) [26]. Therefore, it has a lower amount of changed nitrogen atoms capable of donating protons to ammonia.
It has been shown that PEDOT [23] and PPy [22] films obtained in the presence of more rigid-chain amide-containing polyacids are characterized by low doping levels and retarded formation of bipolaronic fragments. Therefore, the reduction of PEDOT and PPy under the influence of ammonia proceeds preferentially through a single transition from the first oxidized state (polaronic) to the reduced state. For this reason, PEDOT and PPy complexes with rigid-chain polyacids have a higher ∆A than the complexes with flexible chain polyacids, in which formation of the second oxidized state (bipolaronic) is more probable.

Regeneration
CP gas sensors based on conductivity measurement can only be partly regenerated by passing air or nitrogen gas through the sensor to remove the ammonia adsorbed on the surface [10]. However, there is no information about complete regeneration of PEDOT films. It was shown in [38] that PPy cannot be completely regenerated after exposure to NH 3 . The authors of [10] reported the presence of trapped NH 3 molecules in the layers of PANI that were not completely desorbed during the regeneration process.
An effective method for regenerating a sensor, in which the sensor is heated up to 120 • C, was proposed in [42]. Regeneration via treatment with a dilute hydrochloric acid solution at room temperature has been used for an optical ammonia sensor based on PANI [9,10] but it is not convenient from a practical point of view.
In our opinion, thermal treatment via resistive heating of the conducting layer (FTO or ITO) on which the CP films are deposited is the most suitable method for regeneration of optical ammonia sensors. The process of regeneration of the PANI-PAMPSA film is presented in Figure 8. PANI film regeneration in air (a) for 25 min led to a 50% restoration of its spectrum. It was restored almost completely after a day in air. Resistive heating of the conductive, optically transparent, FTO layer (b) up to~75 • C removed ammonia from the film at a higher rate. It can be clearly seen that~70% of the response amplitude of the PANI film was regenerated in 15 min.

Regeneration
CP gas sensors based on conductivity measurement can only be partly regenerated by passing air or nitrogen gas through the sensor to remove the ammonia adsorbed on the surface [10]. However, there is no information about complete regeneration of PEDOT films. It was shown in [38] that PPy cannot be completely regenerated after exposure to NH3. The authors of [10] reported the presence of trapped NH3 molecules in the layers of PANI that were not completely desorbed during the regeneration process.
An effective method for regenerating a sensor, in which the sensor is heated up to 120 °C, was proposed in [42]. Regeneration via treatment with a dilute hydrochloric acid solution at room temperature has been used for an optical ammonia sensor based on PANI [9,10] but it is not convenient from a practical point of view.
In our opinion, thermal treatment via resistive heating of the conducting layer (FTO or ITO) on which the CP films are deposited is the most suitable method for regeneration of optical ammonia sensors. The process of regeneration of the PANI-PAMPSA film is presented in Figure 8. PANI film regeneration in air (a) for 25 min led to a 50% restoration of its spectrum. It was restored almost completely after a day in air. Resistive heating of the conductive, optically transparent, FTO layer (b) up to ~75 °C removed ammonia from the film at a higher rate. It can be clearly seen that ~70% of the response amplitude of the PANI film was regenerated in 15 min.
(a) (b) Figure 8. The response of PANI-PAMPSA film exposed to 52 ppm of ammonia and its regeneration in air (a) and via resistive heating of the FTO layer (b).

Conclusions
In this article, we first presented a comparative study of the optical sensing properties of conducting polymer (PEDOT, polypyrrole, polyaniline) complexes with polysulfonic acids of different structures and chain flexibilities. A range of ammonia vapor concentrations from 5 to 135 ppm was studied.
It was shown that the response amplitude, response time and ammonia diffusion coefficient were dependent on the dominant mechanism of interaction (reduction and/or