1 Introduction

Conducting polymers have considerably gained more notice toward the humidity-sensing applications in present era owing due to their high conductivity nature, cost effective, easy processing and high stability [1]. Among the huge variety of conducting polymers, polyaniline (PANI) has emerged as the most promising one since of its diverse properties like relatively cheap monomer, simple preparation, and high yield on polymerization, environmental stability and unique processability for device fabrication. Moreover, polyaniline has also been used in diverse applications such as light emitting diodes [2], rechargeable batteries [3] and photovoltaic cells [4]. Though, the problems with these conducting polymers are their low processing ability, poor chemical stability and mechanical strength [5]. To overcome these drawbacks, different types of materials have been inserted in the PANI. For example, polymer/inorganic composite were used because of their high polarization ability attributed to the difference in chemical and physical structure. Recently, researchers have worked on synthesis of TiO2/PANI nanocomposites to improve the conducting properties of these materials. Nano-TiO2 also has outstanding physical and chemical properties, and it has been used in coating, sensor, solar cell gas sensor, optoelectronic and photocatalyst applications [6,7,8,9].

Even though, many researchers have paid much attention to TiO2/PANI nanocomposites as a gas sensing material. But, among these only few papers dealt with TiO2/PANI as a humidity sensing material. Su et al. [10] have reported that humidity sensors based on TiO2 nanoparticles/polypyrrole composite thin films. The developed sensors showed higher sensitivity and better linearity (Y = − 0.0306X + 6.84; R2 = 0.9491), smaller hysteresis, faster response (40 s) and recovery time (20 s). Kotresh et al. [11] have also prepared TiO2/PANI nanocomposites by chemical polymerization of aniline. The prepared composite’s sensor exhibited high response to humidity at room temperature and was found to be 84.21%. The response and recovery time was found to be 60 and 100 s respectively at 95% RH. Attempt to further improvement in the humidity sensing behavior of these nanocomposites, here, we report the TiO2/PANI thin films by sol–gel spin coating technique. To the best of the author’s knowledge this is the first preliminary report about electrical and humidity sensing performance of TiO2/PANI nanocomposites thin films prepared by simple and facial spin coating method.

2 Experimental procedure

2.1 Synthesis of polyaniline

Polyaniline was prepared by polymerization of aniline by chemical oxidative polymerization method. In a typical synthesis, 25 ml of HCl and 2 ml of aniline were mixed with the 100 ml beaker with constant stirring at 0 °C. 2.45 g of (NH4)2S2O8 (ammonium per oxydisulphate) in 25 ml and 1M HCl was suddenly added into the above solution. During this polymerization reaction the temperature was maintained at 0 °C for 5 h. the obtained precipitate was filtered and carefully washed with HCl followed by water. Then the product was dried at 60 °C in vacuum for 24 h. This forms polyaniline polymer.

2.2 Synthesis of TiO2 nanoparticles

Nanocrystalline TiO2 is synthesized by the sol–gel method using titanium isopropoxide as a source of Ti. 1:10 ratio of titanium isopropoxide and ethanol was mixed under strong magnetic stirring. 1 N NaOH (precipitate agent) solution was added drop wise to attain the pH value reaches to 9.0. The pH of sol was 4.0 before adding of NaOH. Then the sol was stirred vigorously at temperature 60 °C for 2 h, which leads to the formation of white powder which was sintered at 600 °C for 2 h in ambient atmosphere to improve the crystalline nature.

2.3 Synthesis of TiO2/PANI nanocomposites films

The TiO2/PANI nanocomposite films were synthesized by spin coating technique. TiO2/PANI nanocomposite was prepared by using adding of TiO2 nanoparticles and PANI in smooth agate mortar and pestle. The nanocomposite powder was put in m-cresol and stirred for 12 h to get casting solution. Thin films were prepared on glass substrates by spin coating method at 3000 rpm for 30 s and dried on hot plate at 1000 °C for 10 min. The silver paste strips of 1 mm wide and 1 cm apart from each other were made on films for contacts. Pure TiO2 thin films were prepared by a same manner without use of PANI.

2.4 Characterization techniques

The X-ray diffraction pattern of each sample was analyzed by X-ray diffractometer with CuKα source radiation of wavelength of 1.5406 Å and operating at 35 kV and 30 mA. Morphology and particle size of the prepared nanoparticles was studied employing Field emission scanning electron microscope (JEOL-JSM-6390) operated at 15 kV. The elemental analysis of the samples was analyzed by EDS spectra (JEOL Model JED-2300). Fourier transform infrared (FTIR) spectroscopy (Model: Perkin Elmer 100) of TiO2, PANI and PANI:TiO2 composites was studied in the frequency range of 400–4000 cm−1. UV–Vis spectra of the samples, which were dispersed in deionized water under ultrasonic action, were recorded on a Simandzu—100 UV–Vis spectrophotometer. The resistivity measurements were made on thin films using four probe techniques at room temperature.

3 Results and discussion

3.1 XRD analysis

Figure 1 shows the XRD pattern of pure PANI, TiO2 and TiO2/PANI nanocomposite thin films. The XRD pattern of pristine PANI (Fig. 1a) shows some broad peaks corresponding to (100) and (110) planes, which is good accordance with the standard value [JCPDS No. 53-1718]. Figure 1b, c shows the XRD pattern of pure TiO2 and TiO2/PANI respectively. It can be seen that both are showed sharp and well defined peaks, which indicates that crystallinity of the samples. All the diffraction peaks could be indexed to tetragonal structure with mixed phases of anatase and rutile and the calculated lattice parameters (a = 3.6983 Å and c = 9.4823 Å) were good in agreement with the standard JCPDS data (card no. 78-1285). Compared to TiO2, the TiO2/PANI diffraction peaks were exhibited broadening and decreasing the intensity, this suggest that the presence of poorly crystalline PANI and the reduction of volume fraction of TiO2 sequentially weakens diffraction peaks of TiO2 in the composites. Moreover, the grain growth of pristine TiO2 was suppressed due to the scattering from PANI chains at interplanar spacing. When PANI chains are adsorbed on the surface of TiO2 nanoparticles, due to the restrictive effect of TiO2 nanoparticles crystallinity of PANI is compromised. The average grain size of was calculated by using Scherrer’s formula [12] and it was found to be 32 and 25 nm for pristine TiO2 and TiO2/PANI nanocomposite films respectively.

Fig. 1
figure 1

XRD pattern of a PANI, b TiO2, c TiO2/PANI composite films

3.2 FESEM–EDS analysis

The surface morphology of thin films was determined by field emission scanning electron microscopy (FESEM). Figure 2a–c shows the FESEM images of PANI, TiO2 and TiO2/PANI thin films respectively. The pure PANI showed uniform distribution with smooth surface (Fig. 2a). The TiO2 films exhibited large number of nanoparticles with less agglomeration was observed on the films surface. In case of PANI/TiO2 composite film, the composite particles are highly dispersed with agglomeration with an interlocking arrangement of granular particles (Fig. 2c). This suggests that the most of TiO2 nanoparticles were coated with PANI during polymerization process. The composite is highly microporous and is able to increase the liquid–solid interfacial area [13]. Further to confirm the composition and element present in the films, we have carried out EDS analysis. Figure 2d shows the EDX spectra of the TiO2/PANI, which is also performed in order to confirm the incorporation of the TiO2-nanoparticles in the PANI matrix.

Fig. 2
figure 2

FESEM images of a PANI, b TiO2, c TiO2/PANI composite film, d EDS analysis of TiO2/PANI composite films

3.3 UV–Vis absorption spectra analysis

Figure 3a–c shows the UV–Vis absorbance spectra of PANI, TiO2 and TiO2/PANI composite thin films respectively. It can be seen that the optical absorption was found to be 300, 310 and 330 nm for PANI, TiO2 and TiO2/PANI composite thin films respectively. This could be attributed to the π–π* and polaron–π* transition in the conducting PANI [14]. It was clear evident that the absorption edge was shifted towards the longer wavelength side for TiO2 and TiO2/PANI nanocomposite films. This is probably due to coordinate complex formation between TiO2 nanoparticles and PANI chains [15]. The optical band gap Eg can be determined from the absorption coefficient, α calculated as a function of incident photon energy hʋ and is expressed by the relation [16]:

$$\alpha {\text{h}}\upsilon ={\text{B }}{({\text{h}}\upsilon -{{\text{E}}_{\text{g}}})^{\text{m}}}$$

where α is the absorption coefficient, h is the Planck’s constant, ν is the frequency of incident light, Eg is the energy band gap of material and m is the factor governing the direct/indirect, etc. The optical band gap of PANI is 3.45 eV which is obtained from the extrapolation of the linear part of the plot (αhʋ)2 versus hʋ (αhʋ)2 equals 0. Similarly, the band gap was found as 3.32 and 3.21 eV for PANI/TiO2 and TiO2 composite thin films respectively. Generally, the narrowing the band gap is more suitable for to enhance the humidity sensing properties. Though the density of H3O+ is low and the transfer of carriers is difficult, the charge carriers would bring about electrons accumulation and bend the energy-band at the grain surface, leading to a decreased resistance. Moreover, a narrow band-gap would be more favorable for generation of excited carriers and an increase in conductivity.

Fig. 3
figure 3

a UV-Vis absorption spectra, b band gap determination plot for PANI, TiO2 and TiO2/PANI composite films respectively

3.4 FTIR analysis

Fourier transform infrared (FTIR) spectroscopy is a technique that provides information about the chemical bonding or molecular structure of materials. Figure 4 shows the FTIR spectra of PANI, TiO2 and TiO2/PANI composite thin films respectively. The FTIR spectrum of pure TiO2 (Fig. 4) shows two strong absorption bands appeared at 676 and 525 cm−1 which are the corresponds to TiO2 vibration band [17]. The broad vibrations band appeared at 3434 cm−1 is ascribed to the O–H group vibration of water molecules [18, 19]. The bands at 1566 and 1469 cm−1 corresponded to quinoid and benzenoid structure of PANI, respectively. These peaks were further shifted to 1278 and 1267 cm−1 for PANI/TiO2 nanocomopsite thin films. The vibrations bands at 1486 and 1560 cm−1 are attributed to the vibration and stretching mode of pyrrole ring. The FTIR spectra reveal the presence of Ti–O–Ti vibrational peak and characteristic vibrational peaks of PANI indicating the interaction of TiO2 particles in PANI matrix. Thus, the resulting properties of PANI and colloidal TiO2 materials were demonstrated to be suitable for electrical and optoelectronic applications.

Fig. 4
figure 4

FTIR spectra of PANI, TiO2 and TiO2/PANI composite films respectively

3.5 Electrical investigation

Electrical investigation is one of the most significant studies of a conducting polymer, particularly to explore their use in electrical devices. An attempt was made to measure d.c conductivity measurements. The thin films and ohmic contacts were made by silver paste. Figure 5 shows the variation of electrical resistance as a function of temperature for pure TiO2 and TiO2/PANI nanocomposite films respectively. In both cases it was observed that the drastic decrease in resistance or increase in conductance with increase of temperature. Compared to pure TiO2, the TiO2/PANI composites showed high conductivity nature. This is probably due to the increase of efficiency of charge transfer between TiO2 and polymer chains with increase in temperature. In addition that, the dramatic enhancement in conductivity arises for TiO2/PANI is due to electrons from polar O2− terminated TiO2 nanoparticle surfaces are transferred to PANI chains, resulting in their reduction in the resistance. In our composite exhibits the structure of TiO2 surrounded by the PANI coating, which could lead to substantial reduction in the contact resistance and promote the charge transfer when compared with the composite of TiO2 nanoparticles buried inside PANI matrix. Furthermore, the p–n junctions established at the interface between TiO2 and PANI coating results in a depletion layer and enhancing the electrical properties. The “Preliminary” test obtained from the electrical measurements confirms that this type of film sensor would be a promising potential application in gas sensor applications. Hence, theses films were further tested for humidity sensor measurements.

Fig. 5
figure 5

Temperature dependent resistivity measurement for TiO2 and TiO2/PANI composite films

3.6 Humidity sensor studies

3.6.1 Humidity sensor setup

The humidity sensor set up was fabricated by Murali Babu et al. [20] and the detailed set up was described in the previous reported literature [21]. The controlled humidity chamber is used to create humidity inside the chamber, relative humidity (RH) measured by hygrometer and resistance of sensing element observed by four probe LCR bridge. Then, interdigitated silver electrodes were printed on it and it was then placed in a specially designed glass chamber. The humidity levels are varied from 10 to 90% RH. The percentage of humidity was measured by using standard hygrometer. The percentage of sensitivity for detection of humidity is defined as [22]:

$$S=\frac{{R{H_2} - R{H_1}}}{{R{H_1}}} \times 100$$

where RH2 is the resistivity of the sample for humidity at level 2 (highest RH level) and RH1 is the resistivity of the sample for humidity at level 1 (lowest RH level).

3.6.2 Humidity sensor measurements

Figure 6 shows the change in resistance as a function of relative humidity (RH 15–95%) for pure TiO2 and TiO2/PANI nanocomposite films. It was noted that resistance of the films was linearly decreases with increase of relative humidity varied from RH 10 to 90% for both films. In lower humidity level (15–40%) the change in the electrical resistance is slow owing to the lower adsorption limit (LAL), whereas at higher humidity, composites absorb more vapor from a long conduction path, hence change in resistance decreases suddenly. The detailed resistance and sensitivity values were showed in Table 1. Figure 7 shows the sensitivity of TiO2 and TiO2/PANI nanocomposite films as a function of relative humidity. The sensitivity is measured from RH 10 to 90%. It is found that the sensitivity increases with increase in relative humidity. The TiO2/PANI composite sensor showed better sensitivity and more stability than compared with pure TiO2 in long range of RH %. In practical point of view, response and recovery time is most important characteristics in the humidity sensor measurements. The response time defined here as the time it takes for the resistance of the sensor to decrease to 90% of the minimum resistance when relative humidity is introduced in the chamber. The recovery time is the time required for 95% increment in resistance when relative humidity is turned off [23]. Figure 8 shows the response and recovery time of pure TiO2 and TiO2/PANI composites respectively. The response and recovery time found to be 20 and 15 s respectively for TiO2/PANI films. Similarly, the TiO2 films response time is 55 s and recovery time is 40 s. To examine the sensor stability and reproducibility the composite films for use as a sensor, and evaluated the sensing response at 55% RH and at 90% RH after every 15 days for 3 month was studied. The corresponding profile was presented in the Fig. 9. The sensor showed nearly the same results; only little (~ 2%) was decrease in sensitivity was observed. Hence it was concluded that it can be practically feasible to utilize it in a high performance sensor device.

Fig. 6
figure 6

Change in resistance as a function of relative humidity (RH 15–95%) for pure TiO2 and TiO2/PANI nanocomposite films

Table 1 The humidity sensor parameters of TiO2 and PANI/TiO2 composites respectively
Fig. 7
figure 7

Sensitivity of TiO2 and TiO2/PANI nanocomposite films as a function of relative humidity

Fig. 8
figure 8

The response and recovery time of pure TiO2 and TiO2/PANI composites respectively

Fig. 9
figure 9

Sensor stability and reproducibility of TiO2 and TiO2/PANI nanocomposite films

The detailed humidity sensing mechanism and schematic representation was depicted in Fig. 10. Generally, the water vapor is more crucial to enhancing humidity sensing performance of the semiconducting oxide materials. First, the chemiabsorbed water in the crystalline grains of activated surface, which is formed (two hydroxyl ions per water molecule) from hydroxyl groups due to the dissociative mechanism. The presence of water molecules with metal surface possesses high charge carrier density and strong electrostatic fields, thus providing mobile protons and to form a first layer. As a second stage, after chemical completion of the first layer, successive water vapour layers are physically adsorbed (physisorption) on the first formed hydroxyl layer and load to form the physisorbed hydroxyl multilayer. During this process, the water vapour continues to increase in the surface, an extra layer forms on the first physisorbed layer. The continuous process make more and more layers, which results in the large number of water molecules is physisorbed on the necks and PANI/TiO2 flat surfaces. Therefore increasing the conductivity with the presence of relative humidity can be due to a water protonation and polarons conduction mechanism on the composite surface.

Fig. 10
figure 10

Humidity sensing mechanism of TiO2 and TiO2/PANI nanocomposite films

4 Conclusions

Thin films of pure and polyaniline/TiO2 composites were prepared by cost effective sol–gel spin coating technique followed by post annealing process. XRD investigation shows the formation of mixed anatase and rutile phases of TiO2. The FESEM study of the PANI–TiO2 composite film revealed uniform distribution of TiO2 particles in the PANI matrix. Moreover, the grown growth of pure TiO2 was reduced by the PANI matrix. The polyaniline has positive influence on the optical and electrical properties, which is confirmed through UV and electrical studies. The developed TiO2/PANI composite sensor showed high performance humidity sensing properties such as high sensitivity fast response (20 s) and recovery time (15 s) with more stability and reproducibility. All these results show that the composite has the positive potential applications in efficient humidity sensing and gas sensor device operable at room temperature besides being easily prepared and cost effective.