Introduction

Ammonia (NH3) is one of the most essential chemicals in the world and an irreplaceable raw material in global agriculture and industry1,2,3. Meanwhile, NH3 is also a colorless, irritating and corrosive gas with high toxicity4. Long-term exposure to NH3 with a concentration greater than 50 ppm will lead to temporary blindness, pulmonary edema, and even death. Occupational Safety and Health Administration has set a limit of 300 ppm for industrial environments5. Therefore, the detection and sensing of NH3 are of great significance for environmental protection and human health. Currently, the use of metal oxides as the affinity layer is the mainstream in commercial NH3 sensors. However, drawbacks still exist for current detection devices, e.g., low selectivity and high operating temperatures. Therefore, the rational design of advanced materials for NH3 sensing at ambient conditions (e.g., room temperature) with high selectivity is urgently needed.

Metal-organic frameworks (MOFs) possess tailored structures, high porosity, and customizable functionalities are considered to be a promising choice to serve as the affinity layer of gas sensors6,7,8,9. Firstly, the permanent porosity and regular channels of MOFs provide feasibility for fast sensing response and low working temperature. Secondly, the tunable pore microenvironment (e.g., pore shape and size) can adjust the host-guest interaction at the molecular level, which is the potential to offer high selectivity to targeted guest molecules. More importantly, the physical adsorption/desorption with good recyclability will endow MOF-based gas sensors with long-term reliability. Therefore, MOF-based gas sensors have been gaining increasing attention in recent years10,11,12,13. Although significant progress has been made in gas sensing using MOFs, the development of MOFs for NH3 sensing is still in its infancy. Firstly, most MOFs exhibit structural degradation after adsorbing NH3 and low binding affinity to NH3, hindering the application of MOFs as NH3 sensors. Secondly, the mechanism of NH3 sensing is not well understood, mainly due to the lack of appropriate techniques such as adsorption kinetics and molecular simulation. Thirdly, currently reported MOF materials often require additional material doping for sensing (e.g., Cu-BTC@GO14, PANI/UiO-6615), which in turn requires complex fabrication procedures and even high-temperature sensing conditions, complicating the sensor device. Using pure MOF materials for NH3 sensing applications is still very rare and all currently reported examples suffer from expensive ligands which are not readily available (e.g., Cu-HHTP16,17,18 and Cu3HITP219,20), leading to increased operating costs. Hence, it is of great significance to reasonably design cost-efficient and high-performance MOF materials for NH3 sensing at room temperature.

To address the above challenge, we apply the following principles to screen MOF candidates. (i) High structural robustness is required to prohibit the structure collapse in the NH3 environment. (ii) In order to achieve strong NH3 binding capacity, MOFs with open metal sites (OMS) and micropores are preferred; (iii) Low-cost and large-scale preparation of MOFs is a key requirement for industrial applications such as toxic gases and air filters. Thus, we delicately choose two highly robust Hofmann-type MOFs, Ni(pyz)[Ni(CN)4] and Co(pyz)[Ni(CN)4] (termed as NiNi-Pyz and CoNi-Pyz, respectively, Pyz = pyrazine), as the sensing materials for detecting NH3. Although these two materials have been previously reported for application in gas separation21, they have not yet been investigated for sensing application. Their high-performance interdigitated electrode (IDE) sensors have been successfully fabricated and used for NH3 sensing (Fig. 1).

Fig. 1: Sensing material selection and evaluation.
figure 1

Rational selection of stable microporous MOFs for NH3 sensing.

Results

Structural characterization

MNi-Pyz (M = Ni and Co) were prepared through the reaction M(NO3)2·6H2O, pyrazine and K2[Ni(CN)4] in a green synthesis fashion (water/methanol solution, room temperature). The crystal structures of MNi-Pyz were confirmed by powder X-ray diffraction (PXRD) pattern, which was consistent with that of the simulated structure, indicating the high phase purity (Supplementary Fig. 1). In MNi-Pyz, the [Ni(CN)4]2- inorganic ligands serving as 4-connected planar building blocks can connect with M2+ nodes to form 2D layers which are further linked by pyrazine ligands to generate the 3D network. There are one-dimensional (1D) square channels along the a-axis direction. The M2+ ions with unsaturated metal sites are uniformly arranged on the walls of 1D channels (Fig. 2). The riched open metal sites and ultramicro-sized pores make MNi-Pyz a good candidate to capture gas molecules such as NH3.

Fig. 2: Structure diagram of MNi-Pyz.
figure 2

The open metal position of metal M2+ is shown in cyan, the carbon atom is grey, the nitrogen atom is blue, and the hydrogen atom is white.

It was found that MNi-Pyz exhibited excellent structural stability. Their crystallinity and porosity were well maintained even after boiling water, RH = 85%, alkaline (pH = 13), or acid solution (pH = 1) treatment for one day (Supplementary Figs. 1, 2). N2 sorption isotherms at 77 K showed typical type I reversible isotherms, indicative of the microporosity of the MOFs. The Brunauer–Emmett–Teller (BET) surface area of NiNi-Pyz and CoNi-Pyz were 488 and 585 m2·g−1 with the pore size distribution around 7.2 Å and 6.8 Å, respectively (Supplementary Fig. 3). Scanning electron microscopy (SEM) images revealed that the materials have regular morphology and blocky structure, indicating a good crystalline state (Supplementary Fig. 4). The thermal stability of the material was investigated by in-situ thermogravimetric analysis (TGA) (Supplementary Fig. 5). The weight loss at about 120 °C corresponded to the removal of solvent molecules (methanol and water). Furthermore, in-situ variable-temperature PXRD results verified the MOFs could be stable up to 300 °C under air atmosphere (Fig. 3a, b), highlighting their high thermal stability. At present, most MOFs are synthesized via solvothermal reactions. Notably, MNi-Pyz MOFs can be synthesized quickly at room temperature with stirring for 8 min, and can also be prepared on a large scale (>10 g), endowing MNi-Pyz MOFs with industrial application potentials (Supplementary Fig. 6). Overall, the ultramicroporous structure, ultrahigh stability, and scalable synthesis make MNi-Pyz MOFs an ideal platform for gas capture and sensing applications.

Fig. 3: Characterization and adsorption of MNi-Pyz.
figure 3

a, b In-situ variable-temperature powder diffraction pattern of NiNi-Pyz and CoNi-Pyz in air atmosphere. c Adsorption isotherms for NH3 at 298 K. d Five-cycle of NH3 capacities at 298 K even after placing MNi-Pyz in air for a month.

Ammonia adsorption

The adsorption curves can show the affinity behavior of the material for gas molecules, and the low-pressure strong capture ability is the basis of NH3 detection. Subsequently, we explored the NH3 adsorption behavior of MNi-Pyz. (Fig. 3c and Supplementary Fig. 7). It could be seen from the adsorption isotherm at 298 K that the adsorption capacity rose sharply in the low-pressure region, and then a turning point occurred at P/P0 = 0.21 and 0.43 for NiNi-Pyz and CoNi-Pyz, respectively. Thereafter, the adsorption capacity continued to increase and finally reached adsorption saturation, indicating a stepwise adsorption behavior. The high adsorption capacity under low-pressure provided an experimental basis for the subsequent development of NH3 sensors. The NH3 uptakes of NiNi-Pyz and CoNi-Pyz reached 21.5 and 29.1 mmol·g−1 at 298 K and 1 bar, respectively. The difference in adsorption capacity may be due to the larger BET surface area and pore volume of CoNi-Pyz than NiNi-Pyz. To further verify the ability to capture NH3, the materials were placed in air for a month, and then NH3 capture ability for five cycles was conducted (Fig. 3d). The results showed that their maximum uptakes of NH3 were consistent in at least five cycles. We compared with other reported materials for NH3 capture, including MOFs, polymers, inorganic materials, zeolite, molecular sieves, silica gel and other commercial materials (Supplementary Table 1). Notably, the adsorption capacity of MNi-Pyz was significantly higher than that of commercial materials (Amberlyst22, 11.34 mmol·g−1 and 13X zeolites22, 9.3 mmol·g−1) and famous MOFs (Cu(cyhdc)23, 17.5 mmol·g−1 and Cu2Cl2BBTA24, 19.7 mmol·g−1), and only slightly lower than the benchmark MOF (LiCl@MIL-53-(OH)225, 33.9 mmol·g−1). Nevertheless, taking into account the green, cheap raw materials and low energy consumption in the preparation process, MNi-Pyz can easily surpass the current benchmark MOF in terms of cost. The excellent NH3 capture ability of MNi-Pyz MOFs could be due to their special pore microenvironment with enriched open metal sites and strong regional restriction effect for NH3. In the real world, the competitive adsorptions of H2O and NH3 often occur due to the similar molecular properties of H2O and NH3. Adsorbents with high NH3 uptake but relatively low uptake of water are desirable. Therefore, we tested the water vapor adsorption isotherms for MNi-Pyz. When the relative humidity (RH) rises to 60%, the water vapor adsorption capacities of NiNi-Pyz and CoNi-Pyz are 1.16 and 1.88 mmol·g−1, respectively. When the humidity rises to 90% RH, MNi-Pyz still maintains a low water vapor adsorption capacity of 1.7 mmol·g−1 (Supplementary Fig. 8), far below the NH3 adsorption capacity, indicating efficient NH3 sensing performance in the presence of water vapor.

Dynamic test

The rapid adsorption of NH3 is related to the rapid response behavior of the sensing material, we conducted dynamic adsorption tests of NH3 on MNi-Pyz (Fig. 4 and Supplementary Fig. 9). The experimental results showed that NiNi-Pyz reached 80% saturation after 20 s for the first stage of preferential adsorption, and the maximum adsorption rate is as high as 1.67 mmol·(g·s)−1. Similarly, for CoNi-Pyz, the time to reach 80% saturation for NH3 was 50 s, and the maximum adsorption rate is as high as 1.70 mmol·(g·s)−1. These results indicated that both NiNi-Pyz and CoNi-Pyz exhibited fast dynamic adsorption for NH3. Notably, NiNi-Pyz has a higher average adsorption rate than CoNi-Pyz possibly because NiNi-Pyz had a higher density of open metal sites (NiNi-Pyz: 9.29 mmol·cm−3 and CoNi-Pyz: 8.97 mmol·cm−3). The fast adsorption performance in kinetics lays a solid foundation for sensing applications.

Fig. 4: Dynamic test for NiNi-Pyz.
figure 4

a Kinetic adsorption curves. b Preferential stage 1 adsorption curve for NiNi-Pyz to NH3 at 298 K.

Molecular simulation

To better understand the NH3 capture behavior of MNi-Pyz, we conducted Monte Carlo simulations (GCMC) performed to investigate the interactions between materials and NH3. The total adsorption field shows that NH3 is stably bound inside the cavity of MNi-Pyz, due to the gas molecules being subject to the barrier of surrounding ligands (Supplementary Fig. 10). The simulation results show that NiNi-Pyz has three binding sites on NH3 molecules (Fig. 5a). For the binding site I (Fig. 5b and Supplementary Fig. 11a), NH3 molecules are preferentially located in the middle of the two open nickel (II) sites in the NiNi-Pyz square channel, with a distance of 2.709 Å. A sandwich-like binding environment is constructed, which is attributed to the strong interaction between the N atom of NH3 and Ni2+. For the adsorption site II (Fig. 5c and Supplementary Fig. 11b), the hydrogen atom in NH3 can combine with the nitrogen atom of [Ni(CN)4]2− to generate a strong electrostatic attraction, increasing the van der Waals interaction forces between NH3 and ligands. In addition, the N atom of NH3 can achieve conjugation with the large π bond on the pyrazine ring to achieve dual and strong interactions. For site III (Fig. 5d and Supplementary Fig. 11c), firstly, the hydrogen atom in NH3 can interact with C≡N in [Ni(CN)4]2− because of hyperconjugation. More importantly, NH3 molecule itself tends to form dimers26,27,28,29. When further adsorption occurs, NH3 are close to each other due to the effect of orientation force. Finally, hydrogen atoms are inserted into the electronic cloud of nitrogen atoms, and the two NH3 molecules are combined by overlapping orbits to form adsorption site III. For CoNi-Pyz materials, there are four NH3 molecular interaction sites (Supplementary Fig. 12). Similar to NiNi-Pyz, NH3 in site I is preferentially located in the middle of two open cobalt (II) sites in the square channel, showing a lateral binding mode, thus forming a sandwich-like binding environment. For site II, the electrostatic attraction between NH3 molecule and the N atom of [Ni(CN)4]2− and the conjugation with a large π bond on the pyrazine ring realize strong interaction. For site III, when further adsorption occurs, the N atom has a partial negative charge, while the H atom has a partial positive charge. Due to the effect of orientation force, a dimer is formed to act on site III. Besides, CoNi-Pyz has an additional adsorption site IV with a weak force. In this site, NH3 molecules mainly exist in the middle of the pore, which may be due to the larger surface area of CoNi-Pyz, so it can accommodate more NH3 molecules. Furthermore, the interaction energy between NH3 and MNi-Pyz was calculated using the Density functional theory (DFT) method (Supplementary Table 2). For site I with strong adsorption, the energy of NiNi-Pyz is higher than that of CoNi-Pyz, which is consistent with the experimental results (faster adsorption for NiNi-Pyz under low NH3 pressure). The high total adsorption energy also implies that CoNi-Pyz has a higher NH3 capture capacity than NiNi-Pyz. The independent action and mutual cooperation of all binding sites reveal the key points and mechanism of strong NH3 capture and detection performance of MNi-Pyz. Simultaneously, we conducted simulations to analyze the adsorption sites and energies of MNi-Pyz materials towards three common air gases (N2, O2, and H2O), as well as three typical volatile organic compounds (acetone, DMF, and ethanol). The findings demonstrated that MNi-Pyz materials exhibit higher adsorption energy for NH3, and relatively lower binding energy for other gas molecules, which further confirms the specific recognition capability towards NH3 of MNi-Pyz materials (Supplementary Figs. 13, 14).

Fig. 5: GCMC simulated NH3 adsorption field distribution of NiNi-Pyz.
figure 5

a Distribution of total adsorption sites. bd Binding sites for site I, site II and site III, respectively.

Ammonia detection

In order to avoid the toxicity and corrosivity of NH3 to human health, sensing NH3 in low concentrations is of great importance. The adsorption curve and kinetic rapid adsorption in the low-pressure region offer MNi-Pyz high potentials for NH3 sensing. Prior to sensing applications, the stability of MNi-Pyz in NH3 was pre-evaluated. It can be found that the structure of MNi-Pyz remained unchanged when the materials were placed at 100–1000 ppm (1000 ppm is the highest concentration currently used for sensing) after one day (Supplementary Fig. 15). To further verify material stability, we placed MNi-Pyz in an environment containing 1000 ppm NH3 for up to one month, and the materials still maintained their crystalline structures (Supplementary Figs. 16, 17). The excellent structural stability of MNi-Pyz in the presence of NH3 provides a strong guarantee for NH3 sensor applications.

A homemade IDEs setup was used for gas sensing measurements (Supplementary Fig. 18). In this study, MOFs with particle size of ~200 nm (Supplementary Fig. 19) were uniformly coated on the interdigital electrode (Supplementary Fig. 20) and put into a stainless-steel chamber with a total volume of 220 cm3. The chamber was equipped with a device connected to temperature control and a mass flow controller for gas supply. The test results showed that MNi-Pyz sensors had a good linear response in a wide range of 1–1000 ppm at room temperature. According to the root mean square deviation30,31, the NiNi-Pyz sensor detection limit was calculated as 25 ppb (Fig. 6a). NiNi-Pyz achieved rapid response and recovery to NH3, with a response time of about 5 s and recovery time of about 55 s in N2 atmosphere (Fig. 6b). Similarly, for CoNi-Pyz sensor, the NH3 detection limit was 97 ppb, the response time was estimated to be around 20 s and the recovery time was 45 s at N2 atmosphere (Supplementary Fig. 21 and Table 3). Based on the above results, to better understand the sensing performance of MNi-Pyz, we compared the reported MOFs as the main affinity layer for NH3 sensor (Supplementary Table 4). It can be found that the sensing detection limit of MNi-Pyz is only lower than that of the current benchmark, Cu-HHTP 3D films14, but higher than that of classical materials such as Cu-HHTP15, Cu3HITP217, Ni3(HHTP)18, Cu-BHT film32 and NiPc-Ni33. Notably, the sensing response time of MNi-Pyz surpasses all reported MOF materials. On a wider scale, compared to other excellent NH3-sensing electrical signal materials reported so far (Supplementary Table 5), MNi-Pyz sensing performance is better than that of famous materials such as PEDOT34, MoS2/Co3O435, MoS2 thin fIlms36, 2D Ti3C2Tx37 et al.

Fig. 6: Sensing performance for NH3.
figure 6

a Detection of NH3 in different ranges of ppm concentrations (1–1000 ppm) using NiNi-Pyz sensor. Insets: Linear response in the corresponding range with error bars depicted. Data show means ± SD (n =  5 replicates). b Response–recovery time curves of NiNi-Pyz sensor. c Performance of five cycles at 1–1000 ppm of NiNi-Pyz sensor. d Stability of NH3 detection for NiNi-Pyz at 20, 115, 225 and 1000 ppm. Data show means ± SD (n = 5 replicates).

Additionally, one of the most important evaluation parameters of the sensor includes stability and reproducibility. In this regard, we conducted a cyclic stability test on MNi-Pyz of 1 ~ 1000 ppm NH3 at 298 K (Fig. 6c and Supplementary Fig. 22a). Through the experiment, it proved that MNi-Pyz could conduct at least five times of NH3 cycle detection, with stable and uniform detection levels and excellent stability. Further, we conducted a two-month cycle test on the sensor under the conditions of 20, 115, 225, and 1000 ppm NH3 (Fig. 6d and Supplementary Fig. 22b). The test results further verify the high stability and repeatability of MNi-Pyz sensors in different cycle ranges. Subsequently, we tested the cross-sensitivity of the MNi-Pyz sensor to 13 potential interfering gases, such as volatile organic gases commonly found in the air and some reducing gases, to ensure the selectivity of the sensor38,39,40,41. Figure 7 showed MNi-Pyz sensors had selectivity >10 (S = Response (NH3)-Response(N2)/Response(N2)) towards interference gases, indicating their excellent selectivity. Furthermore, to verify the practicality of the sensor, we explored the sensor signal in a real air atmosphere (RT = 298 K, RH ≈ 35–55%). From Supplementary Figs. 2324, it can be seen that the sensor signal in an air environment is slightly lower than that in a nitrogen environment. Meaningfully, it still has good cyclic stability and excellent selectivity, which can be further used in the real environment.

Fig. 7: Specific sensing evaluation.
figure 7

Response toward NH3 and interfering gases for a NiNi-Pyz. b CoNi-Pyz.

To assess the impact of humidity on sensor performance, we conducted experiments to analyze the NH3 sensing behavior of the MNi-Pyz sensor under varying relative humidity (RH) conditions of 12, 35, 75, and 90% (Supplementary Figs. 25, 26). Our findings demonstrated that when the relative humidity remains below 40%, the response value remained unaffected by humidity, exhibiting a consistent sensing performance of over 80%. These results align with previously reported findings in the literature31,42,43,44,45. As humidity levels rose, the affinity for H2O molecules increased, intensifying the competitive adsorption between H2O and NH3. Additionally, elevated humidity levels promoted the formation of a water film on the sensor surface, which altered the interface characteristics between the sensor and the gas. Consequently, this change in interface characteristics weakened the interaction between the sensor and the target gas, resulting in reduced sensitivity46,47,48. Subsequently, we tested the cyclic sensing performance of the sensor at 100, 225, and 500 ppm NH3 at 35% RH over two-month test period, indicating the high stability of the sensor (Supplementary Fig. 27). It is worth noting that most commercial sensors must use water adsorbents before use to ensure the stability of the sensing signal. Rationally speaking, MNi-Pyz materials have demonstrated high potential for practical NH3 sensing applications.

In summary, two Hoffmann-type MOFs, Ni(pyz)[Ni(CN)4] and Co(pyz)[Ni(CN)4], were rationally applied as the sensing materials for detecting NH3. Due to the high density, ultra microporous structure, and strong regional limitations of OMS, the static adsorption capacity of MNi-Pyz for NH3 reached 29.1 mmol·g−1 at 298 K and 1 bar, which was more than three times the capacity of industrial standard zeolites (13X Zeolite) and only lower than the current benchmark MOF (LiCl@MIL-53-(OH)2). The adsorption kinetics showed that the materials reached adsorption saturation at low concentration within 20 s, and the maximum adsorption rate was as high as 1.67 mmol·(g·s)−1, demonstrating the rapid NH3 capture performance. Additionally, GCMC simulation calculations indicated there were three priority adsorption sites for NH3 with unsaturated metal sites as the primary adsorption sites. Furthermore, the assembled IDE device was used as an NH3 sensor, capable of detecting NH3 in a low concentration range of 1–1000 ppm. These sensors exhibited a low detection limit of 25 ppb and a fast response time of 5 s at room temperature, exhibiting the fastest response speed among all reported electrical signal sensing materials at room temperature. Excellently, the sensor can be recovered by simply purging nitrogen at room temperature, and the response signal can stably output for at least two months at room temperature. In addition, MNi-Pyz-sensors exhibited excellent selectivity towards NH3 in the presence of 13 other potential interfering gases. Prominently, this work provides important guidance for the design and manufacture of high-performance sensors operating at room temperature.

Methods

General

Unless otherwise stated, all materials were commercially available and used without further purification. Ni(NO3)2·6H2O, Co(NO3)2·6H2O and K2[Ni(CN)4] were purchased from Aladdin (98% purity), pyrazine was purchased from Macklin (98% purity).

Synthesis of MNi-Pyz

The synthesis method of MNi-Pyz is fine-tuned on the basis of literature reports49. M(NO3)2·6H2O (Ni: 0.872 g, Co: 0.873 g, 3 mmol) was dissolved in a mixture of methanol (15 mL) and deionized water (15 mL). Pyrazine (0.240 g, 3 mmol) was dissolved in a mixture of methanol (15 mL) and deionized water (15 mL). When they were completely dissolved, the two solutions were combined and stirred. Subsequently, K2[Ni(CN)4] (0.723 g, 3 mmol) was dissolved in deionized water (5 mL), and dropped into the above mixture with constant stirring. After 8 min, the reactant was centrifuged to obtain the corresponding purple and pink powder samples for NiNi-Pyz and CoNi-Pyz, respectively. The materials were washed twice with deionized water and methanol, and then dried in a vacuum drying oven until use.

Characterization and test analysis

X-ray powder diffraction

In this experiment, Rigaku Altima IV powder diffractometer from Japanese Neo Confucianism was used for relevant tests. The diffractometer parameters were set as follows: 40 kV, 40 mA, CuK α 1,2 λ = 1.5418 Å. The measurement parameters included scanning speed 5 (o) min−1, scanning step 0.02 (o) and scanning range 5 (o)–40 (o). For Temperature-dependent PXRD, the measured parameter included a scan speed of 5 ° min−1, a step size of 0.02 (°) and a scan range of 2θ from 5 (°) to 40 (°).

77K N2 adsorption-desorption experiment

The specific surface area and pore size of materials are usually characterized by N2 adsorption-desorption at 77 K. The test was measured using ASAP 2020 adsorption equipment, BET and DFT model were used to evaluate the specific surface area and pore size. The specific experimental method was as follows: approximately 100 mg of MNi-Pyz samples were placed on the activation station at 150 °C for 10 h, and then transferred to the analysis port for analysis.

SEM analysis

A Hitachi SU3500 SEM instrument was used for acquiring particle morphology images using a 30 kV energy source under a vacuum

Thermogravimetric analysis

TGA was conducted on Netzsch STA449F3 thermal analyzer from room temperature to 800 °C (5 K·min−1) in air atmosphere using crucible.

Stability tests of MNi-Pyz

For solvent stability, as-synthesized samples, about 20 mg for each batch, were immersed in 10 mL of an aqueous solution of pH = 1 (HCl), pH = 13 (NaOH), and boiled water for one day, respectively. Further, prepare saturated KCl (RH = 85%) solution, put the saturated solution and the vial containing MNi-Pyz into a large beaker, seal the beaker with a preservative film and place it at room temperature. The treated MNi-Pyz samples were washed with methanol several times and dried at room temperature before PXRD measurements.

For NH3 stability, calculate the volume of the seal pipe, put MNi-Pyz into the seal pipe, extract and empty the gas inside. Then, according to the definition of parts per million (ppm) a certain volume proportion of NH3 is injected into the sealed pipe, sealed tightly, and placed at room temperature to study their gas stability.

NH3 adsorption isotherm

In this experiment, we used the BSD-PMC1 adsorption instrument of Beishide Instrument Company. The specific method is as follows: using MNi-Pyz (150–250 mg) to test the single component gas adsorption curve, the test temperatures are 273 K and 298 K.

Dynamic test

The time-dependent adsorption curves of MNi-Pyz on NH3 were measured on the BSD-PMC adsorption instrument. About 50 mg of NiNi-Pyz and CoNi-Pyz were first loaded to the sample chamber and activated at 150 °C under high vacuum for 8 h. After cooling to a specific temperature, 1 bar of NH3 is introduced into the chamber. With the progress of material adsorption, the NH3 pressure change every second is recorded, so as to judge the mass of the sample loaded with gas molecules. As the completion of NH3 consumption in the chamber, after the instrument is balanced for a period of time, a certain amount of gas will be automatically introduced for continuous test recording.

Molecular simulation

In order to better understand the adsorption behavior of MNi-Pyz on NH3, Grand Canonical Monte Carlo (GCMC) simulation was carried out on Materials Studio 2019 version. Considering the rigidity of the frame, the forcite module was used to optimize the geometry of MNi-Pyz and NH3. Under the condition of ultra-fine mass, the universal force field (UFF) is used to model it to reach the minimum energy. The partial charge of atoms in the frame is determined by QEq method, detailed structural information can be found in Supplementary Data 1. The simulations were carried out at 298 K, adopting the locate task, Metropolis method in Sorption module and the universal force field (UFF). The Coulomb potential and Leonard Jones 6–12 (LJ) potential are used to calculate the interaction energy between hydrocarbon molecules and frameworks. The cut-off radius of LJ potential is selected as 12.5°, and the long-range electrostatic interaction is treated by Ewald & Group summation method. The load step and balance step are 1 × 105, and the production step is 1 × 106. The calculation formula of the binding energy between the skeleton and gas molecule is: ΔE = E(MOF) + E(gas)-E(MOF + gas).

Gas sensing device and method

Use self-built equipment to test the sensing signal. The gas sensor test by using HIOKI LCR-3536 full-automatic measurement system, and the clamp is L2000-four terminal Kelvin clamp. To reduce the disturbance of noise, insert the noise filter into the power line during testing. Before each test, perform open circuit compensation and short circuit compensation on the instrument, ranging from 4 Hz to 8 MHz, to reduce testing errors and select LCR for measurement mode. The measurement frequency is set to 8 kHz, the test signal level V is set to 5 V, the limit value is adjusted to OFF; select internal trigger mode, set the range to AuTo (1 kΩ~1 MΩ), Low Z selects OFF mode, measurement speed is MED, and the average number of times is three; trigger delay of 0.000 s; DC bias setting OFF, DC adjustment function setting On, JUDGE SYN setting ON.

Preparation of sensors: First, ultrasonic clean the interdigital electrode with deionized water, ethanol and acetone successively for 10 min, and then dry it with nitrogen. The prepared MNi-Pyz is uniformly dispersed in methanol solution with a concentration of about 5 mg·mL−1. After, about 200 µL suspension droplets were applied to the electrode and dried naturally in air to form a film. Then the coating sensor is placed in the self-made testing room, and the material is connected to the LCR instrument with a clamp to detect the change of electrical signal, the sensor unit is installed on the sensor equipment through two probes. Before the test, the sample is first activated under vacuum at 80 °C for 2 h (this activation process only needs to be done once before the first use of the sensor), then the test chamber is purged with pure nitrogen to remove the substances left in the chamber until the baseline is balanced. The subsequent material activation steps can be achieved only by blowing with pure nitrogen gas. When the chamber is filled with nitrogen atmosphere, the chamber exhaust valve is closed to keep it in a closed environment, and then a certain volume of NH3 is injected through a micro syringe to test the NH3 sensing performance. To control the tested gas/steam concentration, we calculated the required gas volume in detail according to the definition of the fixed volume of the chamber (220 cm³), ppm (parts per million concentration) and the Antoine equation50,51,52,53. For Antoine formula, the constants A, B and C for the measured gases are given in Supplementary Table 6. The formula is as follows:

$${{{{\mathrm{lg}}}}}P=A-B/(t+C)$$
(1)

where P is the vapor pressure of the substance in mmHg; t is the temperature in °C. Equation (1) applies to most compounds, while for some other substances that require only the values of the constants B and C, the Eq. (2) can be used to calculate.

$${{{{\mathrm{lg}}}}}P=-\!52.23B/(t+C)$$
(2)

The temperature is maintained at 298 K through the temperature console during the test. After the test is completed, precise gas sensing measurement can be achieved by simply blowing nitrogen gas for regeneration. The gas sensing response is defined by Eq. (3):

$$S=({R}_{a}-{R}_{0})/{R}_{0}=\Delta R/{R}_{0}$$
(3)

where R0 and Ra represent the electrical impedance of the sensing material under nitrogen atmosphere and target gas respectively. Response and recovery times are marked as the time to reach 90% of the total signal change.

LOD calculation

The theoretical limits of detection (LOD) were calculated using reported protocols30,54. First, the root mean squared (rms) value — representing the noise-based deviation in ∆R/R0 — was calculated using the baseline trace before exposure to analyte. We took 600–1000 consecutive points (N) and fit the data to a polynomial. We then calculated sum of squared residuals (SSR) from Eq. (4). The root-mean-square deviation (RMS) was then calculated by Eq. (5). Then plotted concentration of analyte versus response (∆R/R0) after a specific exposure time and isolated the range of values wherein this relationship was linear. Linear regression provided an equation of best-fit (slope = m). With these values, we extrapolated the theoretical LOD from Eq. (6).

$${SSR}={\sum ({y}_{i}-y)}^{2}$$
(4)
$${RMS}={({SSR}/N)}^{1/2}$$
(5)
$${LOD}={3\times {RMS}{\cdot }m}^{-1}$$
(6)

where, where yi is measured ∆R/R0 and y is the value calculated from the polynomial fit.