Introduction

The continually escalating demand for energy and the persuasive issue of environmental pollution are driving forces underlying utilization of gas sensors in various sectors, encompassing the healthcare, environmental monitoring, smart homes, and wearable devices1,2. Consequently, the gas sensor market emerges as one of the largest segments in the sensor technology market, and is projected to scale up to US $1.34 billion as 2027 approaches3. Among the toxic gases released into the atmosphere, ammonia (NH3) stands out due to its extensive industrial implications and its hazardous effects on health4. NH3, a colorless, pungent, corrosive, and water-soluble gas, is primarily utilized in the production of nitrogen-based fertilizers, accounting for around 80% of its global usage5. NH3 can be very readily traced in human ecosystem, such as in pharmaceuticals, refrigeration, explosives manufacturing, and cleaning products, along with its applications in food processing and petrochemical industries. However, prolonged exposure to even low concentrations of NH3 can cause severe health problems, including respiratory issues, eye and skin irritation, and in extreme cases, lung damage or death2. Due to these risks, stringent guidelines have been set by health organizations, limiting long-term exposure to 25 ppm and short-term exposure to 35 ppm6. Thereby, this necessitates the development of reliable, sensitive, and selective NH3 gas sensors owing to critical importance for ensuring occupational safety and environmental monitoring. Furthermore, in today’s landscape, characterized by the proliferation of the Internet of Things and advances in human-machine interactions, there is a pressing need for high-performance intelligent gas sensors with minimal power consumption, especially for the development of artificial neural networks7.

In this regard, the research enthusiasts have been keenly working onto fabrication of NH3 sensors, essentially based upon, conductive polymeric moieties8, metal-organic frameworks (MOFs)9 along with semiconductor metal oxides10 owing to their advantageous set of attributes inclusive of economic viability, high sensitivity, ease of fabrication, flexibility, tunable electronic behavior and enhanced surface area11. However, the metal oxide sensor technology lacks selectivity in complex environments, and it operates at high temperatures, also the conducting polymers are susceptible to degradation over time, compromising reliability, and MOFs lack scalability, limiting their overall performance12,13. Also, humidity and adsorbed oxygen in ambient air can significantly affect sensor performance. Further, these sensor types are challenged by low sensing responses when exposed to high relative humidity (RH). As a result, the presence of water molecules disrupts the interaction between the target gas and the sensing material, thereby diminishing the overall sensing response14.

To overcome the aforementioned limitations, two-dimensional (2D) layered materials have become a hotspot in the field of materials science owing to their physical and chemical properties15,16. The recent advances in 2D materials have introduced transition metal dichalcogenides like MoS2, WS2, WSe2, and MoSe2 as promising candidates for NH3 sensors operating in highly humid environments17,18,19. These materials possess significant band gaps, endowing them with unique tunable layer-dependent electronic, optical, thermal, and physicochemical properties. Furthermore, their inherently large surface-to-volume ratio and high charge carrier mobility make them suitable sensing materials for sensor applications. MoSe2 is one such highly promising TMD concerning to NH3 detection. MoSe2 possesses unique layer-dependent electronic and optical properties, along with a high surface area and abundant active sites for gas adsorption, making it suitable for sensor applications20,21. However, pristine MoSe2 may encounter challenges of sluggish response, low conductivity, a large sensor baseline drift, and inferior sensing performance under high humidity conditions22. Therefore, an effective and high-performance gas sensing system with good selectivity, the ability to simultaneously measure and discriminate multiple gases, and minimal baseline drift should be developed.

In this regard, Zhao et al. fabricated a ternary system for ammonia sensing based upon Ti3C2Tx@SnS2@PANI, exhibiting a response and recovery time of 226 s and 273 s, respectively23. Wen et al. also fabricated a (PANI:PSS)/Ti3C2Tx ternary system operating at room temperature with response time of 276 s and recovery time of 388 s24. Akin to these studies, Wang et al. devised a hierarchical 0D/1D/2D Au/PANI/WS2 ternary nanocomposite NH3 sensor that remarked response and recovery time of 24 s and 26 s, respectively25. These hybrid heterostructures, however, encounter the challenge of augmented response and recovery time. In this regard, the integration of MoSe2 with other functional 2D-materials could further enhance the sensor dynamics26.

The incorporation of conducting polymers like polyaniline (PANI) with MoSe2 could significantly enhance gas sensing performance by providing additional adsorption sites, improving charge transfer, and enhancing the sensitivity. PANI has been widely adopted owing to its advantageous aspects, such as economic viability, enhanced chemical stability, and excellent electrical conductivity27. Furthermore, the integration of Ti3C2Tx, a family of 2D-transition metal carbides and nitrides, into MoSe2/PANI composites introduces remarkable electrical conductivity, mechanical flexibility, and high surface area, further improving the sensor’s response under high humidity conditions. Ti3C2Tx also exhibits hydrophilic properties, which help in mitigating humidity-related interferences, thereby enhancing the selectivity and stability of the sensor28.

In this context, this study explores the potential of MoSe2/PANI and MoSe2/PANI/Ti3C2Tx composites for the development of highly selective and sensitive NH3 sensors capable of operating at room temperature with rapid recovery and response times. The synergistic effects of combining MoSe2, PANI, and Ti3C2Tx yield superior sensing properties, including enhanced sensitivity, faster response times, and long-term stability. The MoSe2/PANI/Ti3C2Tx composite exhibited an impressive response time of 4.7 s, along with 18.4 s as the recovery time. These peculiar results and advancements pave the path for more reliable and scalable NH3 detection technologies operating at room temperature, addressing critical needs in industrial safety, environmental monitoring, and medical diagnostics.

Results

Structural assessment

The crystallographic structure and proper phase formation of the synthesized MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx nanocomposites were analyzed using an X-ray diffractometer, which was deployed by Cu-Kα radiation of wavelength λ = 1.5418 Å. Fig. 1a demonstrates the XRD pattern of MoSe2 nanoflowers, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx nanocomposites within a range of 5–80°. The XRD pattern of Ti3C2Tx displays a distinct (002) peak at 9°, (006) peak at 18° and (110) peak at 61.2°, which signifies the successful removal of aluminum from the Ti3AlC2 phase and the formation of a well-ordered layered Ti3C2Tx structure (see Supplementary Fig. S3a). The diffraction pattern observed in the XRD spectrum of MoSe2 indicates a hexagonal crystal structure along with the JCPDS no. 29–0914. The XRD pattern of MoSe2 mainly shows the four peaks, which correspond to the (002), (100), (103) and (110) planes with low intensity29. These low-intensity peaks indicate the stacking defects in the crystal lattice due to the layered nature of the material. The XRD pattern of MoSe2/PANI shows the overlapping of MoSe2 and PANI peaks.

Fig. 1: Structural, chemical, electrochemical, and surface textural properties of MoSe2-based composites.
figure 1

a XRD spectra, b Raman spectra, c Nyquist plots and df BET analysis for the synthesized MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx sensor.

A peak broadening is also observed with the introduction of PANI, suggesting a smaller crystalline size. The presence of Ti3C2Tx in MoSe2/PANI/Ti3C2Tx nanocomposite is confirmed by the prominent peak at 9° and the presence of MoSe2/PANI peaks, indicating the successful formation of MoSe2/PANI/Ti3C2Tx nanocomposite. No additional impurity peaks were found in the spectrum, suggesting that the nanocomposite is of high purity. Also, the broadening and shifting of the peaks are observed, which can be attributed to the alterations in lattice parameters and the strain occurring between the bonds.

Raman spectroscopy

Raman spectroscopy serves as an indispensable analytical tool for investigating the structural and electronic characteristics of the MoSe2 (MOS), MoSe2/PANI (MOSP), MoSe2/PANI/Ti3C2Tx (MOSPM), as shown in Fig. 1b. The distinctive Raman peak of MoSe2, notably the A1g (~238.9 cm−1), E1g (~171.3 cm−1) and E2g (~238.9 cm−1) vibrational modes, offer critical insights into its vibrational dynamics30. In the composite material, the shifts in characteristics peak signify the charge transfer and strain effects resulting from the interactions with PANI and Ti3C2Tx. The incorporation of PANI into MoSe2 introduces distinct Raman bands within the 1140–1600 cm−1 range, corresponding to the specific molecular vibrations. These include the C-N stretching mode around 1177.5 cm−1, the quinoid ring vibrations near 1464 cm−1 and benzenoid ring vibrations at 1583.2 cm−1. The emergence of these spectral features provides clear evidence of the incorporation of PANI and its electronic interactions with MoSe2. Moreover, the Raman spectrum of MoSe2/PANI/Ti3C2Tx composite exhibits a D-band at 1321 cm−1 and a G-band at 1591 cm−1, which strongly confirms the successful incorporation of Ti3C2Tx into the structure31. The integration of Ti3C2Tx induces notable modifications in the Raman spectrum, manifesting as variations in peak intensity that signify robust interfacial interactions and enhanced charge transfer dynamics32. These synergistic effects contribute to a substantial improvement in the material’s electronic conductivity and sensing performance, thereby rendering an exceptional sensing towards NH3 gas.

Nyquist plots

An impedance analysis was performed to gain deeper insights into the electrical conductivity of MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx. The Nyquist plots of all the fabricated sensors depict that, with the incorporation of PANI and Ti3C2Tx in MoSe2, the composites exhibit a smaller semicircular diameter as illustrated in Fig. 1c, signifying enhanced charge transfer efficiency and accompanied by lower resistance.

BET analysis

A nitrogen sorption isotherm analysis was conducted to determine the surface properties, pore size and pore volume of the synthesized nanoparticles, which are the crucial characteristics for a prospective sensor, as illustrated in Fig. 1d–f. The MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx nanocomposites exhibit a wide range of pore sizes and an H3-type hysteresis loop. According to IUPAC, they are categorized as type II isotherm, which indicates the presence of a mesoporous structure33. The pore volume of MoSe2/PANI and MoSe2/PANI/Ti3C2Tx increases by three-fold and seven-fold, reaching 0.093 cm3/g and 0.217 cm3/g compared to 0.031 cm3/g for MoSe2. Additionally, the average pore width grows from 0.17 to 5.52 Å, indicating the highly porous structure of the synthesized MoSe2/PANI/Ti3C2Tx was determined to be 56.84 and 127.89 m2/g, which is about four and nine times larger than that of MoSe2, which has a surface area of 14.21 m2/g. The increased surface area offers more active sites, enhancing gas adsorption and promoting reactions during synthesis, resulting in a faster response and higher selectivity.

Morphological analysis

The morphological and structural features of the MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx nanocomposites were evaluated by Field emission scanning electron microscopy (FESEM) images. Figure 2 demonstrates the FESEM images of MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx nanocomposites at two different magnifications. Fig. 2a signifies the FESEM images of MoSe2, which reveal a distinct and intricate flower-like morphology. These nanoflowers typically exhibit a hierarchical structure with numerous petals composed of nanosheets and are well aligned, contributing to a flower-like appearance. Figure 2b articulates the FESEM images of MoSe2/PANI composite, it has been observed that the nanoflowers of MoSe2 are completely embedded within PANI matrix. The images clearly show that the grains are well-connected, which suggests that MoSe2 and PANI possess strong interactions and form conductive pathways for the transmission of electrons34. Figure Supplementary S3b indicates the images of pristine Ti3C2Tx. The images reveal the layered sheets like morphology, consisting of thin flakes, confirming the successful etching and exfoliation of aluminum layers from the Ti3AlC2 phase. Additionally, the layered morphology provides a higher surface-to-volume ratio and enhanced active sites for gas interaction. In the MoSe2/PANI/Ti3C2Tx composite, the materials are combined together, leading to the dispersion of MoSe2 and PANI within and on the surface of the exfoliated nanosheets, as shown in Fig. 2c. The presence of Ti3C2Tx likely provides nucleation sites, thereby hindering crystal growth and accommodating strain, which illustrates lattice distortion. This interaction enhances porosity and increases the surface-to-volume ratio. Additionally, it generates some extra voids, which contribute to the enhanced NH3 detection. The EDAX pattern, along with the FESEM images, validated the elemental composition, indicating the successful formation of MoSe2/PANI/Ti3C2Tx nanocomposite. Moreover, to validate the film’s uniformity and thickness, a cross-sectional FESEM analysis was performed. As illustrated in Supplementary Fig. S4, the image clearly shows that the film exhibits a compact and uniform structure with an average thickness of 751 nm. This observation confirms consistent deposition and supports the structural integrity of the fabricated sensing layer.

Fig. 2: Morphological analysis of MoSe2-based composites.
figure 2

SEM images of a MoSe2, b MoSe2/PANI and c MoSe2/PANI/Ti3C2Tx along with their elemental mapping.

High-resolution transmission electron microscopy (HR-TEM) was employed to examine the morphology of the MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx nanocomposites. The resulting TEM images display a well-integrated hybrid framework, confirming the successful formation of the ternary composite. Figure 3a clearly indicates the floral morphology of MoSe2. The observed interlayer spacing of 0.64 and 0.27 nm corresponds to the (002) and (100) planes of hexagonal MoSe2. These nanosheets serve as active sites for gas adsorption, thereby improving the sensitivity. Figure 3b demonstrates the HR-TEM images of the MoSe2/PANI composite, revealing that the MoSe2 nanoflowers are thoroughly encapsulated within the PANI matrix. The 0.35 nm interplanar spacing corresponds to the PANI matrix. The PANI improves the chemical stability of the material and also contributes to enhanced electron transport upon gas exposure. Furthermore, the layered nature of Ti3C2Tx, with a d-spacing of ~0.98 nm, in MoSe2/PANI/Ti3C2Tx (see Fig. 3c), facilitates efficient charge transport and provides a high surface area beneficial for gas adsorption.

Fig. 3: HRTEM analysis of MoSe2-based composites.
figure 3

HR-TEM images of a MoSe2, b MoSe2/PANI and c MoSe2/PANI/Ti3C2Tx.

XPS analysis

To gain insights into the elemental composition, the chemical and oxidation states of the synthesized samples were analyzed by XPS measurements35. The XPS spectra of MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx were demonstrated in Supplementary Figs. S5, S6, and Fig. 4. The XPS spectra display distinct peaks corresponding to Mo, Se, N, O, C, Ti and F, confirming the co-existence of MoSe2, PANI and Ti3C2Tx in the synthesized nanoparticles. The high-resolution spectra of Mo 3d in pure MoSe2 and both the MoSe2/PANI and MoSe2/PANI/Ti3C2Tx composite exhibit prominent peaks at 232.4 ± 0.2 eV and 233.1 ± 0.2 eV and 235.7 ± 0.2 eV and 237. 2 ± 0.2 eV belonging to the Mo 3d5/2 and Mo 3d3/2 orbitals, respectively, as demonstrated in Supplementary Figs. S5a, 6a and Fig. 4a. Two prominent peaks of Se 3d3/2 and Se 3d5/2 were observed at the binding energies of 54.2 eV ± 0.5 eV and 55.2 eV ± 0.5 eV, respectively, in the spectrum of Se 3d state as shown in Supplementary Figs. S5b, 6b and Fig. 4b. Additionally, a SeOx peak was observed at 58.8 ± 0.6 eV, which can be attributed to the interaction of Se with oxygen present in the environment. The peak shifts observed in the composites can be ascribed to an elevation in the concentration of oxygen vacancy during the incorporation of PANI and Ti3C2Tx.

Fig. 4: XPS analysis of MoSe2/PANI/Ti3C2Tx composite.
figure 4

XPS spectra of MoSe2/PANI/Ti3C2Tx composite with peak deconvolution of a Mo 3d, b Se 3d, c N 1s, d O 1s, e Ti 2p, f F 1s and g C 1s.

This suggests the enhanced electron movement, which inhibits the recombination of electrons and holes within the composite, thereby enhancing the gas sensor’s performance. The XPS spectrum of N 1s as shown in Supplementary Fig. S6c and Fig. 4c, reveals three distinct peaks at binding energies of 398.5 ± 0.4 eV, 399.8 ± 0.3 eV and 401.5 ± 0.1 eV which corresponds to the protonated amine in the polaron state (-NH2+-), positively charged imine in the bipolaron state (=NH+-) and benzenoid amine (-NH-) respectively, signifying the successful polymerization of aniline36. The O 1s spectra of MoSe2/PANI and MoSe2/PANI/Ti3C2Tx can be deconvoluted into three peaks at 530.7 ± 0.3 eV, 531.5 ± 0.2 eV and 532.9 ± 0.1 eV, which correspond to lattice oxygen, oxygen vacancies and chemisorbed oxygen, respectively, as demonstrated in Supplementary Fig. S6d and Fig. 4d.

Upon binding with Ti3C2Tx, there is a gradual transformation of oxygen species on the surface, resulting in the increase of oxygen vacancies and chemisorbed oxygen by 12.5% and 5.25%, respectively. The upsurge in sensor efficacy can be correlated to a surplus of oxygen vacancies on the material’s surface, which results from rapid oxidation kinetics37. The spectrum of Ti 2p for MoSe2/PANI/Ti3C2Tx can be convoluted into two dominant peaks i.e., Ti 2p3/2 and Ti 2p1/2 as depicted in Fig. 4e. The Ti 2p3/2 peak incorporates four binding energies at 454.7 eV, 455.3 eV, 456.4 eV and 458.2 eV, which are associated with Ti2+, Ti3+, Ti4+ and C-Ti-Fx, respectively. Likewise, the Ti 2p1/2 endures two binding energies at 460.1 and 461.9 eV, which belong to the Ti2+ and Ti3+ states. The F1s spectrum is also influenced by overlapping Ti-F and Al-F peaks at 685.1 eV and 686.7 eV as depicted in Fig. 4f. The XPS spectrum of C1s for MoSe2/PANI and MoSe2/PANI/Ti3C2Tx are depicted in Supplementary Fig. S6e and Fig. 4g. The three peaks are observed in the spectrum at 283.7 ± 0.4 eV, 284.9 ± 0.3 eV and 286.1 ± 0.4 eV are associated with C-C, C-O and O-C=C interaction, respectively. In comparison to the C1s spectrum of MoSe2/PANI peak shift was observed, suggesting electron transfer between the components. In the MoSe2/PANI/Ti3C2Tx composite, peak positions shifted owing to the formation of numerous composite interfaces between Ti3C2Tx and MoSe2/PANI. This interaction facilitates electron migration from Ti3C2Tx to MoSe2/PANI, leading to an increase in electron density within the MoSe2/PANI. As a result, the elevated electron density propels carrier concentration, which strengthens the NH3 sensing performance.

Sensing performance

To comprehensively evaluate the physical properties of the synthesized sensors, we performed current-voltage (IV) analysis for all the specimens. The corresponding I-V characteristics are illustrated in Supplementary Fig. S7a–c, providing insights into their electrical behavior. The figures reveal that the sensor MoSe2 exhibits non-ohmic behavior, while with the incorporation of PANI in it, the sensor exhibits an ohmic behavior and with the incorporation of Ti3C2Tx in MoSe2/PANI, the sensor MoSe2/PANI/Ti3C2Tx showed an ideal ohmic behavior across the bias voltage range of −2 to +2 V, with an almost imperceptible current observed at V = 0 V. Thus, the incorporation of PANI and Ti3C2Tx into MoSe2 significantly enhances their electrical conductivity, thereby facilitating improved charge transport mechanism during sensing operations. The linear IV characteristic indicates a high-quality interface between the IDE and the sensing material, characterized by minimal energy barriers or depletion regions, thereby facilitating efficient and unimpeded charge transport38.

The gas sensing performance of fabricated sensors based on MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx was examined upon the exposure of 1000 ppm NH3 gas under the controlled conditions at a room temperature of 28 °C. The sensor response was evaluated by utilizing Eq. (7). Initially, the variation of PANI concentration in MoSe2/PANI and Ti3C2Tx concentration in MoSe2/PANI/Ti3C2Tx was also examined, as demonstrated in Fig. 5a, b, which does not follow a consistent pattern. At lower concentrations, the addition of PANI and Ti3C2Tx improves both the sensing properties and electrical conductivity up to a certain limit. This increment in conductive properties and large surface of PANI and Ti3C2Tx enhance the absorption of a significant number of NH3 molecules. However, beyond that threshold, increasing the PANI and Ti3C2Tx concentration in both MoSe2/PANI and MoSe2/PANI/Ti3C2Tx alleviates the results and causes adverse effects on the sensing parameters. Conversely, the reduction in sensor response for 6 wt% of PANI in MoSe2/PANI and 16 wt% of Ti3C2Tx in MoSe2/PANI/Ti3C2Tx can be attributed to the possibility that while the conductivity may improve, an excess of PANI and Ti3C2Tx content could cause agglomeration. This, in turn, diminishes the effective surface area and active sites, ultimately leading to a decline in the sensor’s performance.

Fig. 5: Resistance response of MoSe2/PANI/Ti3C2Tx composites with varying PANI and Ti3C2Tx content under target gas exposure.
figure 5

Response curve at various (a) PANI and b Ti3C2Tx concentration in MoSe2/PANI and MoSe2/PANI/Ti3C2Tx composites, respectively.

Among all the concentrations, the composite with 12% Ti3C2Tx exhibited the most effective sensing response. This optimal response can be attributed to the uniform distribution of Ti3C2Tx within the matrix, which enhances electron mobility, active surface area, and gas adsorption properties. At 12%, the Ti3C2Tx content was sufficient for enabling rapid charge transfer during NH3 gas exposure. Increasing the Ti3C2Tx loading to 16% likely caused aggregation, which decreased the number of available active sites and effective surface area and hindered gas diffusion. Furthermore, the 12% concentration facilitated the most effective interfacial synergy among MoSe2, PANI, and Ti3C2Tx, leading to efficient charge separation and enhanced sensor performance. Therefore, the superior sensing behavior observed at 12% Ti3C2Tx can be attributed to the optimal combination of structural, electrical, and interfacial properties. Following this, further sensing was exclusively carried out on the MoSe2/PANI and MoSe2/PANI/Ti3C2Tx sensors, composed of 4 wt% and 12 wt% of Ti3C2Tx, respectively.

The resistance vs time characteristics of MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx sensors (Fig. 6a) offers a comprehensive understanding of the change in resistance over time when exposed to 1000 ppm of NH3 gas at room temperature, as demonstrated in Fig. 6b–d. From Fig. 6c, d, it was observed that with the introduction of PANI in MoSe2, the sensing performance improved, and it was further enhanced with the incorporation of Ti3C2Tx in the MoSe2/PANI composite. The sensor shows a significant reduction in resistance when exposed to NH3, indicating a n-type sensor behavior. When exposed to NH3, indicating a n-type sensor behavior. When exposed to air, the sensor quickly returns to its original baseline resistance, demonstrating its impressive reversibility. When a n-type sensor comes in contact with the ammonia gas, the resistance decreases due to the interaction of NH3 gas and charge carriers. Ammonia is a reducing gas that donates electrons, increasing the concentration of negative charge carriers on the surface of the sensor. This enhanced electron availability lowers the overall resistance, facilitating improved conductivity and making the sensor more responsive towards ammonia detection. At first, the response of pristine MoSe2 was determined to be 77.53 times. However, with the introduction of PANI, this value increased to 534.39 times, demonstrating the enhanced response and recovery time. Additionally, when MoSe2/PANI composite was compounded with Ti3C2Tx, the sensor exhibited a remarkable response of 6481.1 times, with a response time of 4.7 s and a recovery time of 18.4 s as compared to the previous results mentioned in Table 1. The comparative performance of all three sensors has been demonstrated in Fig. 6e. The establishment of a heterojunction significantly enhances the sensor’s conductivity and accelerates the charge transfer kinetics during interaction with NH3 gas. This increase in electrical conductivity translates to an elevated sensor response. Furthermore, the heterojunction effectively mitigates the recombination rate of charge carriers during gas interactions, resulting in improved conductivity and overall sensor performance. Additionally, the incorporation of PANI and Ti3C2Tx not only enhances the specific surface area of the sensor but also increases the number of active sites available for interaction. A key factor contributing to the improved sensing capabilities is the formation of conductive bridge, characterized by their high porosity and specific surface area.

Fig. 6: Gas sensing performance of MoSe2-based composites toward target gas.
figure 6

a MoSe2/PANI/Ti3C2Tx based fabricated ammonia sensor, response/recovery curves of b MoSe2, c MoSe2/PANI d MoSe2/PANI/Ti3C2Tx, e comparative performance of all three sensor at 1000 ppm along with the repeatability curve of f MoSe2, g MoSe2/PANI h MoSe2/PANI/Ti3C2Tx and i sensor response at various ppm.

Table 1 A comparative overview of composites fabricated for NH3 sensing

To investigate the repeatability of all three fabricated sensors, the response curves were obtained across four consecutive cycles as depicted in Fig. 6f–h. Notably, there were no significant discrepancies in the response and recovery curves, demonstrating outstanding repeatability and full recoverability of the sensor. Simultaneously, the developed MoSe2/PANI/Ti3C2Tx sensor underwent experimental evaluation at a concentration of NH3 reaching up to 1 ppm, as illustrated in Fig. 6i.

To gain deeper insights into the gas sensing mechanism and develop a highly sensitive NH3 sensor, FDTD simulation was employed based on the Crowell-size model and the drift-diffusion-Poisson equation at the materials interface. This approach helped us to understand the electric potential distribution relative to PANI and Ti3C2Tx introduction. Our hypothesis suggests that ammonia interacts primarily with the material surface, as demonstrated in Fig. 7a. When the sensor surfaces are exposed to NH3, electron transfer occurs more from the MoSe2/PANI/Ti3C2Tx surface to the ammonia molecules. This electron transfer is vital for room-temperature gas sensing, particularly within the heterojunction structure when Ti3C2Tx is incorporated. The interaction between MoSe2, PANI and Ti3C2Tx generates a notable built-in potential, reducing the depletion region width and improving electron mobility within the composite. Additionally, the enhanced electric potential at the interface increases the electrostatic forces within the composite, with Ti3C2Tx acting as both a catalyst and a charge reservoir. The simulation results closely aligned with the experimental data, indicating that Ti3C2Tx introduction minimizes the depletion region and maximizes the synergistic effects, leading to enhanced ammonia sensing performance. Fig. 7b illustrates the concentration response fitting curves for MoSe2/PANI and MoSe2/PANI/Ti3C2Tx. Notably, the sensor demonstrates exceptional linearity in their response to varying concentrations of NH3, with sensitivity of 67.5, highlighting its enhanced capability for detecting modest amount of NH339,40. The fabricated sensor (MoSe2/PANI/Ti3C2Tx) demonstrates an impressive detection capability, with a detection limit as low as 0.6 ppm, as demonstrated in Fig. 7c. The sensor’s response to varying concentrations shows an excellent correlation, achieving a curve fit with an R2 value of 0.99. The sensor’s response and recovery time at 1000 ppm NH3 gas concentration in four cycles are depicted in Fig. 7d. The relative standard deviation is calculated to be 2.88% for the response time and 1.86% for the recovery time. Another critical aspect of gas sensors is their selectivity. As illustrated in Fig. 7e, the response of MoSe2/PANI/Ti3C2Tx sensor was examined for several tampering gases, including ethylamine (EA), dimethylamine (DMA), triethylamine (TEA), ethanol, methanol, NO2, formaldehyde, CO2, methane, acetone and ethanol. It was observed that the sensor exhibited the highest sensitivity in detecting NH3 gas. The exceptional selectivity for NH3 can be attributed to several factors. Initially, the reversible protonation and deprotonation capabilities, along with the heightened reactivity of PANI towards NH3, facilitate robust sensing interactions between NH3 molecules and protons41,42. Additionally, the Ti3C2Tx sheets allow the adsorption of various termination groups43. XPS analysis reveals that the formation of MoSe2/PANI/Ti3C2Tx composite enhances the amount of oxygen vacancies on the Ti3C2Tx surface, thereby promoting more effective interactions with NH343,44. This is further evidenced by the more negative adsorption energy of NH3 compared to other gases, signifying a stronger affinity of NH3 for the Ti3C2Tx surface45.

Fig. 7: Sensing characteristics and performance evaluation of MoSe2/PANI/Ti3C2Tx-based gas sensors.
figure 7

a FDTD simulation based electric potential for MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx based sensor, b response fitting curve of MoSe2/PANI/Ti3C2Tx at various ammonia concentration, c LOD, d response/recovery time at 1000 ppm in 4 cycles, e selectivity of the sensor, stability of f baseline resistance of the sensor, g sensor response towards ammonia gas and h optimization of sensor response at different PANI and Ti3C2Tx concentration.

Furthermore, we conducted a detailed cross-sensitivity investigation by exposing the device to binary gas mixtures of NH346 with each interferent DMA, TEA, EA and CO2 (carbon dioxide) were tested in three volume ratios: 1:1, 2:1, and 1:2, keeping the total gas concentration constant at 1000 ppm, as shown in Supplementary Fig. S8. For example, in the 1:1 NH3–DMA mixture, both gases were introduced at 500 ppm. In the 2:1 ratio, NH3 was maintained at 667 ppm and the interferent at 333 ppm, while in the 1:2 ratio, NH3 was 333 ppm and the interferent was 667 ppm. This approach allowed a quantitative evaluation of NH3 dominance or suppression under varying competition levels. In the 1:1 NH3-DMA mixture, the sensor response slightly decreased compared to pure NH3 of the same partial pressure, while it was nearly similar to the sensor response with NH3 at 500 ppm, indicating moderate competition for adsorption sites. The 2:1 mixture showed a response very close to that of pure NH3 (667 ppm), suggesting that higher NH3 content suppresses DMA interference. However, in the 1:2 ratio, the response dropped further, implying that excess DMA partially inhibits NH3 adsorption due to steric effects or site competition. A similar trend was observed for TEA, though the interference was slightly stronger due to TEA’s bulkier structure and higher volatility. In 1:1 and 1:2 mixtures, the response was reduced a bit compared to pure NH3, indicating a mild masking effect. Yet, even in 2:1 mixtures, NH3 remained the dominant contributor to the overall signal, as reflected by the direction and magnitude of the response. Among the tested amines, EA exhibited the most significant interference effect. Across all three tested ratios, the sensor response showed noticeable deviation from the expected NH3-dominant behavior, indicating reduced selectivity. In the 1:1 and 1:2 mixtures, the response could not be clearly attributed to NH3 alone, as EA appeared to contribute substantially to the overall signal, suggesting a comparable interaction strength with the sensing surface. Even in the 2:1 mixture, where NH3 was in excess, the response was moderately suppressed relative to pure NH3, implying that EA competes effectively for active sites. This behavior suggests a relatively higher surface affinity of EA compared to DMA and TEA, potentially due to its smaller molecular size and favorable adsorption dynamics. Unlike the amines, CO2 is an oxidizing gas and produces an opposite sensing response, namely, an increase in sensor resistance due to electron withdrawal from the n-type sensing material. In the 1:1 NH3-CO2 mixture, the response curve showed a net decrease in resistance, confirming that NH3 dominates the interaction. The 2:1 mixture resulted in a stronger negative signal, while in the 1:2 case, a partial cancellation of responses occurred, leading slightly positive curve during recovery cycle, followed by a delayed NH3-dominated response. These competitive dynamics highlights the potential of our sensor to distinguish between reductive and oxidative analytes.

Moreover, Fig. 7f, g represents the stability of the sensor baseline resistance for 15 and a long-term stability measurement of MoSe2/PANI/Ti3C2Tx sensor’s response towards NH3 gas for 90 days. Despite the high resistance, the sensor exhibits excellent signal stability, as evidenced by the low standard deviation (2.6%) in baseline measurements over time. This stability is attributed to the uniform and continuous film morphology, which minimizes contact resistance fluctuations and ambient noise pickup. The sensor maintained a nearly steady response throughout 90 days across repeated measurements, showing only slight fluctuations without any significant decline. This consistent behavior reflects its strong durability and long-term stability. The uniformity in sensor performance emphasizes its structural integrity, measurement accuracy, and reliability, reinforcing its suitability for delivering consistent results in real-world conditions47. The optimization of sensor response at different PANI and Ti3C2Tx concentrations was demonstrated in Fig. 7h.

Consequently, the MoSe2/PANI/Ti3C2Tx sensor exhibits a remarkable sensor response to NH3 in comparison to other gases. To assess its practical applicability, the sensing performance of MoSe2/PANI/Ti3C2Tx-based sensor was examined in a humid environment, allowing for an evaluation of its sensing capabilities under ambient conditions46. Figure 8a depicts the response/recovery curve of the sensor in a RH range of 10–90%. It was observed that the sensor demonstrated remarkable sensitivity, maintaining high performance even at a RH level of 90%. A small reduction in sensor response can be attributed to the interference caused by gas molecules interacting with the water vapors7. The minimal variation in the baseline resistance observed across this range reflects the influence of humidity and was extracted from the transient response curves recorded during NH3 exposure (refer to the inset in Fig. 8a). The initial resistance begins to decrease as the humidity increases; this is because the H2O molecule in the environment is absorbed on the sensing material. The H2O molecule itself and the H3O+ ions generated by its ionization have a re-doping effect on Ti3C2Tx, which improves the conductivity of sensor. Meanwhile, PANI re-doping effect also increases the number of positively charged nitrogen-containing groups in the PANI chain, providing more adsorbing sites of NH3 sensing, which is beneficial to perform in high-humid conditions48. Furthermore, the sensor response at various ppm levels ranging from 500 to 1 ppm under various humidity levels has been determined and illustrated in Fig. 8b. Furthermore, the response/recovery curves of the sensor at 50% RH and 90% RH over 500–1 ppm have been demonstrated in Fig. 8c, d. Notably, both the sensor response and baseline resistance showed only minor fluctuations throughout the RH range, indicating the sensor’s excellent tolerance to humidity variations. For a more precise assessment of humidity dependence, the response ratio (R90% RH/R10% RH) at 500 ppm NH3 and the baseline resistance ratio (B90% RH/B10% RH) at 1000 ppm NH3 were calculated. These values were found to be 0.4 and 0.87, respectively, confirming that the sensor maintains consistent performance even under high humidity conditions.

Fig. 8: Effect of relative humidity (RH) and reproducibility of MoSe2/PANI/Ti3C2Tx gas sensors.
figure 8

a Sensing performance and variation in baseline resistance, b response of the sensor over 10–90% RH, sensor performance at various ppm for c 50% RH, d 90%RH, e response/recovery times and f response for four reproducible MoSe2/PANI/Ti3C2Tx sensors.

To evaluate the consistency of our fabrication process and ensure the reliability of the MoSe2/PANI/Ti3C2Tx sensor response, we performed sensor-to-sensor reproducibility tests using four independently fabricated devices under identical experimental conditions. Each sensor was exposed to a concentration of 1000 ppm NH3 gas, and its individual sensing responses were recorded, as illustrated in Supplementary Fig. S9. The results demonstrated that all four devices responded consistently, with only slight differences observed among them. The response and recovery times, key parameters indicating sensor dynamics, were found to be very close in value, showing only negligible variation, which is highlighted in Fig. 8e. Additionally, the sensor exhibited an excellent response of nearly 6481.1 with a relative standard deviation of 0.39% as depicted in Fig. 8f. These consistent results show that the sensor performance is highly reproducible from device to device, reflecting the reliability of our synthesis and assembly approach.

Gas sensing mechanism

The gas sensing mechanism and energy band structure of MoSe2/PANI/Ti3C2Tx composite were demonstrated in Fig. 9 to support the gas sensing properties. The sensing properties rely on adsorption, oxidation and desorption process that takes place at the interface between gas molecules and the sensing material. The structural and morphological examinations demonstrate the uniform deposition of PANI over MoSe2 and on the surface of Ti3C2Tx. This configuration provides a large surface area and more active sites, advantageous for the adsorption of gas molecules, as depicted in Fig. 9. The sensing properties suggest that MoSe2 exhibits n-type behavior, primarily facilitating electron transfer following its chemical interaction with NH3 at the MoSe2/PANI interface. The interfacial energy gap profiles of Ti3C2Tx and MoSe2 with their work function of 3.9 eV and 4.3 eV, respectively, have been demonstrated in Fig. 1013,49.

Fig. 9
figure 9

Schematic demonstration of NH3 sensing by MoSe2/PANI/Ti3C2Tx-based sensor.

Fig. 10: Charge transport analysis and gas interaction analysis in MoSe2-based composites.
figure 10

a EPR spectra of all the sensors, b in-situ Nyquist plot from 0 to 1000 ppm NH3 gas, c NAP-XPS of O1s, d Raman spectra and f GCMS in the presence of NH3 gas.

In the emergence of MoSe2/PANI/Ti3C2Tx composite, the comparatively lower work function of MoSe2 (4.3 eV) facilitates electron transfer from the higher work function of PANI (4.78 eV), resulting in the establishment of a balanced Fermi level50. This electron transfer causes band bending, which leads to the creation of a Schottky barrier at the MoSe2/PANI interface. The band gap of MoSe2 was measured using the Tauc plot and found to be 1.1 eV (see Supplementary Fig. S10). Consequently, the diffusion and drift of electrons generate a depletion layer at this interface.

$${O}_{2}\left({gas}\right)\,\to \,{O}_{2}\left({ads}\right)$$
(1)
$${O}_{2}\left({ads}\right)+\,{e}^{-}\to {O}_{2}^{-}({ads})$$
(2)

The adsorption of molecular oxygen \({O}_{2}^{-}\)(ads) extracts electrons from the interface of MoSe2/PANI, leading to the formation of an electron depletion layer alongside a hole accumulation layer at this interface. The presence of negative charges on the surface of MoSe2/PANI promotes further oxygen adsorption, thereby expanding the depletion region at the MoSe2/PANI interface and a substantial increase in active sites is formed in close proximity to the sensor surface as illustrated in air atmosphere (Fig. 9).

Upon the introduction of ammonia species into the gas sensing system, the molecules efficiently diffuse and engage in interactions with the oxygen species present on the sensor’s surface, this interaction can be described by Eq. 351,52. During this phenomenon, the conduction band regains the electron captured previously via oxygen molecules. This release reduces the thickness of the depletion layer, which in turn lowers down the sensor’s resistance38. In a gaseous atmosphere, variation in resistance illustrates the material’s sensing behavior, aligning well with the response of the n-type sensor towards reducing gas.

$$4{{NH}}_{3}\left({gas}\right)+\,5{O}_{2}^{-}\left({ads}\right)\to \,4{NO}+\,6{H}_{2}O+\,5{e}^{-}$$
(3)

As a result, the development of MoSe2/PANI/Ti3C2Tx composite, comprising of a highly conductive and large surface area creates abundant active sites for gas molecules and promotes efficient charge carrier transport during the sensing process, thus enhancing the sensing performance. Furthermore, PANI plays a key role in protecting the MoSe2 and Ti3C2Tx surfaces from oxidation, preserving their surface and electrical properties. The negative charge present in the MoSe2/PANI interface enhances its interaction with NH3, enhancing its sensitivity to the gas. Consequently, the combined effect of MoSe2, PANI and Ti3C2Tx results in the formation of a stable nanocomposite that promotes stronger interaction with NH3, enabling faster adsorption and desorption of the gas molecules.

Oxygen vacancies play a critical role in influencing the gas-sensing properties of synthesized materials. They enhance sensing performance by creating additional adsorption sites and modulating the electronic structure of the material, thereby facilitating more efficient interaction with target gases53. The EPR spectroscopy was employed to investigate the presence of oxygen vacancies in all sensors. As shown in the EPR spectra, resonance peaks characteristic of oxygen vacancies (g = 2.0457) are discernible as demonstrated in Fig. 10a. Among the three samples, the MoSe2/PANI/Ti3C2Tx exhibits the most pronounced resonance signal, suggesting that it possesses the highest concentration of oxygen vacancies, which was also confirmed by the XPS results. The presence of oxygen vacancies, acting as electron donors, can enhance the electron concentration, facilitating a greater interaction between oxygen molecules and electrons. This interaction leads to an increased generation of surface-adsorbed oxygen.

Furthermore, for the sensor response to be initiated, the adsorption of NH3 molecules must occur, altering the electrical conductivity of the MoSe2/PANI/Ti3C2Tx composite. This phenomenon has been validated through in-situ Nyquist plots conducted at room temperature under varying concentrations of ammonia gas, which serves as a robust analytical approach for investigating the electrochemical properties of the material, providing valuable insights into the interaction dynamics between the sensor and ammonia gas molecules. Upon exposure to ammonia, the adsorption of NH3 molecules on the surface of the MoSe2/PANI/Ti3C2Tx composite substantially modifies its impedance characteristics. This is attributed to the electron-donating properties of ammonia, which leads to a reduction in resistance, evident as a diminished semicircular diameter by varying ammonia concentration from 0 to 1000 ppm, as shown in the Nyquist plots (Fig. 10b). The dynamic behavior observed in the Nyquist plot is ascribed to the synergistic properties of MoSe2, PANI and Ti3C2Tx. The exceptional conductivity of Ti3C2Tx, coupled with PANI’s superior electron transport properties and the layered structure of MoSe2 enriched with active sites, collectively enhances the rapid and efficient adsorption of gas molecules.

Additionally, to gain deeper insight into the role of oxygen in the NH3 gas sensing process, in situ XPS was conducted at RT. This analysis provides a detailed understanding of surface chemistry and electronic interactions occurring during NH3 sensing. Due to the involvement of chemically adsorbed oxygen in the gas adsorption process, the content of Oc is essential in enhancing the sensing performance. Fig. 10c demonstrates the O1 spectra with and without NH3 exposure. The XPS spectra of O1s exhibited a slight variation in intensity with a slight shift in peak positions after exposure to NH3. However, a notable reduction in the proportion of surface-adsorbed oxygen ions was observed at RT, decreasing from 22.1 to 14.6% following NH3 exposure, which strongly indicates the significant interaction between NH3 molecules and the adsorbed oxygen on the MoSe2/PANI/Ti3C2Tx54.

Raman spectroscopy was utilized to elucidate the charge transfer process that induces resistance fluctuations upon exposure to NH3 gas. Fig. 10d illustrates Raman spectra before and after getting exposed to 1000 ppm NH3. A noticeable red shift in the peak position, accompanied with a broadening of peak, is distinctly observed. The spectral shift of Δ = 6.73 cm−1 and Δ = 7.05 cm−1 is predominantly driven by charge transfer phenomena arising from the adsorption of NH3 molecules on the MoSe2/PANI/Ti3C2Tx surface. The strong interaction between the gas molecules and the sensing material induces substantial modulation in carrier concentration, which is further validated by the decrease in resistance. This charge transfer mechanism unequivocally confirms the variation in carrier concentration upon gas exposure, underscoring the sensor’s remarkable sensitivity to NH3 detection30.

Additionally, gas chromatography-mass spectrometry (GC-MS) was utilized to analyze the oxidation reactions of NH3 as described by Eq. 3. These reactions play a crucial role in generating sensor signals. The GC-MS was performed to validate these equations by detecting the gaseous components during the reactions. Upon exposure of the sensor to NH3, the gaseous products were generated and subsequently analyzed. The results after oxygen adsorption are demonstrated in Fig. 10e, along with the corresponding mass spectra of the detected gases. Notably, no significant peaks corresponding to H2O were observed in the GC-MS analysis due to its low molecular weight. The findings confirmed the formation of NO and CO2 as the primary products of NH3 oxidation.

Application implementation

The MoSe2/PANI/Ti3C2Tx sensor demonstrates immense potential across multiple domains, including environmental monitoring, healthcare diagnostics, and food safety, as demonstrated in Fig. 11a. In environmental applications, it serves as an efficient tool for detecting ammonia emissions from poultry farms, where waste by-products, such as manure and litter contribute significantly to air pollution.

Fig. 11: Real-world deployment of MoSe2/PANI/Ti3C2Tx-based gas sensors.
figure 11

a Schematic of NH3 detection via IOT based signal detection in various applications, b schematic of the practical utility prototype with (c) data captured on mobile device, d response/recovery curve of tomato in 3rd week to 5th week, e demonstration of clinical evaluation with the breathing-type sensor device, f real time monitoring of NH3 level in unhealthy (CKD patient) and healthy individual and g response/recovery curve of the CKD patient in an interval of 15 days undergoing multiple hemodialysis.

Likewise, in sewage treatment facilities, the sensor plays a critical role in monitoring NH3 levels arising from nitrogenous decomposition and protein metabolism, ensuring optimal process efficiency and environmental compliance. In the medical field, the sensor offers to diagnose diseases like chronic kidney disease (CKD), uremia and hyperammonemia by detecting ammonia levels in exhaled breath.

Therefore, ammonia levels serve as a critical parameter for assessing the freshness and quality of perishable food items. The regular and precise measurements of ammonia concentration enable the timely detection of spoilage, ensuring food safety and reducing waste in supply chains. For leveraging the exceptional sensing capabilities of the MoSe2/PANI/Ti3C2Tx sensor, a wireless prototype for detecting NH3 gases has been meticulously designed. The developed system comprises a sealed chamber containing tomatoes integrated with a MoSe2/PANI/Ti3C2Tx-based sensor, as shown in Fig. 11b. An indigenously designed monitoring unit was attached to the chamber and wirelessly connected to a mobile device via Wi-Fi, enabling real-time detection of NH3 levels in the stored vegetables. The chamber was maintained at RT, and the ammonia level was monitored from 3rd to 5th week to assess spoilage progression as illustrated in Fig. 11c. Additionally, the measurements were obtained from the Keithley 2450 source meter as shown in Fig. 11d, confirming a progressive increase in NH3 levels, indicating the onset of spoilage after 3rd week.

Furthermore, clinical trials were made on both patients with CKD and healthy individuals to evaluate the sensor’s potential for CKD monitoring. The previous studies have established that CKD patients exhibit elevated ammonia levels in their breath, which are significantly reduced following hemodialysis55. As illustrated in Fig. 11e, the clinical tests performed using the developed sensor successfully detected and recorded real-time ammonia levels on mobile devices. Figure 11f demonstrates real-time ammonia levels present in healthy and unhealthy individuals. The ammonia level in an individual undergoing multiple hemodialysis, was measured at an interval of 15 days as shown in Fig. 11g. The data reveal a significant reduction in NH3 levels after hemodialysis, indicating the progressive detoxification of the body. This decline suggests a gradual physiological improvement, signifying the patient’s transition toward a healthier state over the course of treatment.

Discussion

In this study, a novel ternary composite of MoSe2/PANI/Ti3C2Tx was synthesized and systematically examined for its effectiveness in ammonia sensing. The sensing response reveals that the 4 wt% of PANI and 12 wt% of Ti3C2Tx in the MoSe2/PANI/Ti3C2Tx composition show superior response. The sensor demonstrated an exceptional response value of 6481.1 at a concentration of 1000 ppm NH3, exhibiting an ultra-fast response of 4.7 s and recovery of 18.4 s under ambient conditions. Furthermore, it attained a remarkably low detection limit of 0.6 ppm while exhibiting exceptional cross-selectivity and long-term operational stability. The superior sensing performance of the composite is ascribed to its tailored surface characteristics and highly efficient charge transport dynamics. Additionally, FDTD simulations elucidated the interaction of NH3 molecules with the sensor surface, corroborating the enhancement in gas sensing performance, which was further confirmed by in-situ EPR, GC-MS and NAP-XPS. The MoSe2/PANI/Ti3C2Tx composite sensor emerges as a highly promising candidate for ammonia detection, exhibiting exceptional sensitivity, rapid response kinetics and outstanding operational stability, making it a robust and efficient NH3 sensor and expanding its applications in poultry farm, hospital, sewage treatment and various real-world applications.

Methods

Synthesis of MoSe2

A single-step hydrothermal technique was utilized to synthesize the MoSe2, as demonstrated in Supplementary Fig. S1. To synthesize MoSe2, sustaining floral morphology, 0.0160 moles of sodium molybdate (Na2MoO4.2H2O, Thomas Baker, purity-98%) was dissolved in 40 mL of de-ionized water and 60 mL of ethanol, and 0.0318 moles of selenium powder (Se, Thomas Baker, purity-98%) was dissolved in 50 mL of hydrazine hydrate. Following that, both solutions were allowed to be stirred at 600 rpm for 30 min at 40 °C. Afterwards, both solutions were mixed thoroughly to make a homogeneous mixture at 600 rpm for 1 h at 70 °C. The suspension containing MoSe2 salts was subsequently transferred into an autoclave for 24 h at 200 °C. After the formation of precipitates, they were subjected to purification through centrifugation at 7000 rpm, followed by multiple washings with deionized water to ensure thorough cleansing. Finally, the obtained precipitates were subjected to vacuum drying at 80 °C for 24 h. Subsequently, they were finely ground using a mortar and pestle to produce MoSe2 nanoflowers.

During the synthesis of MoSe2, selenium reacts with hydrazine hydrate (N2H4) to yield selenium ions (Se2−) as demonstrated by Eq. 14,56

$$5{N}_{2}{H}_{4}+\,2{Se}\to \,{N}_{2}+4{N}_{2}{H}_{5}+\,2{{Se}}^{{2}^{-}}$$
(4)

When the solution has been mixed with sodium molybdate (Na2MoO4), hydrazine hydrate reduces MoO42− anions into Mo4+ cations as illustrated by Eq. 5

$$2{Mo}{O}_{4}^{2-}+\,2{N}_{2}{H}_{2}+4{H}_{2}O\to \,2{{Mo}}^{4+}+2{N}_{2}+\,12{{OH}}^{-}$$
(5)

The interaction between Se2− and Mo4+ results in the formation of MoSe2, as depicted by Eq. 6

$${{Mo}}^{4+}+\,2{{Se}}^{2-}\to \,{{MoSe}}_{2}$$
(6)

Synthesis of MoSe2/PANI

The MoSe2/PANI composite was prepared through in situ oxidative polymerization of aniline on hydrothermally synthesized MoSe2, with ammonium persulphate (APS) serving as an oxidizing agent as demonstrated in Supplementary Fig. S1. The synthesized MoSe2 was subjected to ultrasonication in 30 mL of deionised water for 2 h at room temperature (28 °C). Simultaneously, an independent solution was formulated by combining 2 mL of aniline, 5 mL of HCl and 32 mL of deionised water under constant stirring, followed by refrigeration of 3 h. The refrigerated mixture was then combined with the ultrasonicated MoSe2 solution. This resulting suspension was stirred in an ice bath maintained at 0 °C. Finally, 25 mL of APS (0.2 M) was added, and the suspension was stirred continuously for 3 h. The obtained solution underwent filtration, followed by thorough rinsing of the residue with deionized water and ethanol to ensure purity. The resulting precipitates were subsequently dried in a vacuum oven at 50 °C for 5 h. Afterward, the dried material was finely ground using a mortar and pestle, ultimately yielding the MoSe2/PANI composite.

Synthesis of MoSe2/PANI/Ti3C2Tx

The fabrication of the innovative MoSe2/PANI/Ti3C2Tx composite involves a two-step process. Initially, Ti3C2Tx is synthesized by selectively removing the aluminum layer from Ti3AlC2 (Max phase) using HF as the etching agent. The process began by mixing Ti3AlC2 with HF acid in a Teflon beaker and allowing it to stir for 24 h. Subsequently, the mixture underwent multiple washes with deionized water until the pH stabilized within the range of 5–6. The purified material was then subjected to vacuum drying at 80 °C for 24 h to eliminate residual moisture.

The next stage involves the synthesis of MoSe2/PANI/Ti3C2Tx through in situ-oxidative polymerization of aniline. Initially, 1 mL of aniline, 3 mL of HCl and 16 mL of deionized water were mixed together under continuous stirring for 1 h and followed by refrigeration for 3 h. Meanwhile, 1 g each of MoSe2 and Ti3C2Tx was dissolved in 30 mL of deionised water separately and allowed to ultrasonicate the solution of MoSe2 and Ti3C2Tx and allowed to stir for 1 h to obtain a homogeneous mixture in an ice bath maintained at 0 °C. Afterwards, 12 mL of APS possessing 0.2 M molarity was added as an oxidizing agent, and the suspension was subjected to continuous stirring for 3 h at 0 °C. The color of the solution progressively transitioned from black to deep green, indicating the successful synthesis of the MoSe2/PANI/Ti3C2Tx heterostructure. The subsequent process used in MoSe2/PANI/Ti3C2Tx preparation is similar to the process followed for MoSe2/PANI synthesis.

Characterization

To investigate the proper phase formation of the synthesized nanoparticles, X-ray diffraction (XRD) analysis was conducted over a 2θ range of 5–80° using Cu-Kα radiation. The structural and morphological characteristics, including interfacial features, were examined through FESEM and HR-TEM, supplemented by elemental mapping for a detailed compositional analysis. The optical and electronic properties were investigated using UV-visible spectroscopy and dielectric measurements. The Brunauer–Emmett–Teller method was employed to determine the materials’ specific surface area and pore volume. Additionally, X-ray photoelectron spectroscopy was utilized to assess the elemental composition and oxidation states of the synthesized samples. Electron resonance was performed to determine the free radicals and vacancies present in the material. Raman spectroscopy was employed to gain deep insights into the charge transfer mechanism. Furthermore, in situ techniques, such as GC-MS and NAP-XPS were employed to investigate the oxidation reactions of NH3 and the role of oxygen.

Sensor fabrication

A wide range of efficacious techniques was employed for nanoparticle deposition in both monolayer and multilayer colloidal crystal processes. We went with the spin coating technique for fabricating colloidal-based single-layered sensors since it provided ease of fabrication, affordability and versatility. To begin, the electrode surfaces Supplementary Fig. S2 underwent sterilization using ethanol, followed by a drying process at 60 °C for 1 h. After dispersing 2 mg of synthesized MoSe2, MoSe2/PANI and MoSe2/PANI/Ti3C2Tx in 150 μL of deionised water, the resultant suspension was then spin-coated onto interdigitated electrodes (IDE) at 4500 rpm for 1 min. Afterwards, it was dried for 30 min at 80 °C. The electrodes were then used to detect NH3 gas.

Gas sensing setup

A well-structured experimental setup provides significant insights into the field of gas sensing. Figure 12 depicts the experimental sensing setup employed in this study, featuring a durable design to ensure precise and reliable measurements. The experimental arrangement consists of a custom-fabricated airtight stainless-steel chamber with an internal volume of ~2 L. The chamber was integrated with a digital gas delivery and humidity control system to ensure stable, reproducible testing conditions. Ammonia (NH3) was sourced from a certified gas cylinder (1000 ppm in dry air, National Gas Agency) and diluted to target concentrations ranging from 1 to 1000 ppm via dynamic mixing with synthetic dry or humidified air. High-precision mass flow controllers (Alicat Scientific, 0.1–1000 sccm range) were employed to modulate gas concentrations accurately by adjusting the relative flow rates of NH3 and carrier gas. The total flow rate during sensing was maintained at 200 sccm unless otherwise specified, ensuring uniform laminar flow conditions and reproducible analyte exposure.

Fig. 12
figure 12

Representation of gas sensing set-up.

Humidity control was achieved using a humidifier: one air stream was passed through a water bubbler to generate saturated humid air; RH levels from 10 to 90% were achieved inside the test chamber. Real-time RH was continuously monitored using a calibrated digital hygrometer (Vaisala HM70), with the sensing head placed in close proximity to the sensor to ensure accurate local humidity readings. For selectivity evaluation, the sensor was exposed to various interfering gases at a fixed concentration of 1000 ppm under identical experimental conditions. Prior to gas exposure, the device was stabilized under ambient air flow for 5 min. Gas response was calculated using the expression:

$${Response}(R)=\,\frac{{R}_{o}}{{R}_{g}}$$
(7)

Upon NH3 exposure, the sensor exhibited a consistent decrease in resistance, indicative of n-type semiconducting behavior. This response is attributed to the electron-donating nature of NH3, which enhances the charge carrier density in the conduction band of the sensing material. All electrical measurements were carried out at room temperature (28 °C) and atmospheric pressure using a Keithley 2450 source meter under a constant DC bias of 1 V. Each measurement was repeated to confirm reproducibility.