## Introduction

Nitrogen dioxide (NO2) in the atmosphere is of great concern due to its adverse effects on human health and the environment1,2,3,4. Short-term exposure to a high concentration of NO2 irritates the human respiratory system, causing respiratory distress symptoms such as coughing, wheezing, and difficulty breathing. Long-term exposure to even tens of ppb-level NO2 can cause asthma, particularly for children and the elderly5. Most recently, the NO2 concentration in the atmosphere was also found to be positively associated with both COVID-19 case-fatality rate and the overall mortality rate, which show an increase of 11.3% and 16.2% per interquartile range increase in NO2 (4.6 ppb), respectively6. NO2 also contributes to environmental problems, such as acid rain, atmospheric haze, nutrient pollution, etc4. As a result, the U.S. Environmental Protection Agency (EPA) and European Environmental Agency (EEA) have specified the maximum annual average concentration of NO2 in outdoor air to be 53 (ref. 7) and 40 ppb8, respectively. Detection of ppb-level NO2 is typically achieved by chemiluminescence9, but chemiluminescence analyzers are expensive and inconvenient for real-time and in-field measurements. Despite extensive research efforts focused on developing low-cost alternatives10,11,12,13,14,15,16,17,18,19,20,21,22, the existing low-cost commercial NO2 sensors still cannot provide reliable ppb-level detection in a real-world setting23,24,25. Therefore, there is a need for inexpensive NO2 sensors capable of rapid and reliable sensitivity in the ppb range.

Metal chalcogenide quantum dot (QD) gels have recently emerged as a group of promising materials for gas sensing because of their small crystallite size (high surface-to-volume ratio), three-dimensional (3-D) mesoporous structure (fast gas diffusion), connected network (facilitated electronic communication), and rich chemistry (easy surface modification)26,27. Moreover, the process of gelation has the added benefit of partially or entirely stripping organic ligands from the particle surface, thereby substantially increasing the number of active surface sites for gas molecules to bind, improving the sensing performance. Recently, we reported the high NO2 sensing performance of a CdS QD gel at room temperature, which demonstrated high selectivity, an ultra-low (measured, not extrapolated) limit of detection (LOD = 11 ppb), a short response time (tres = ~29 s) and recovery time (trec = ~28 s)26. There was, however, one critical limitation for the CdS QD gel sensor: a relatively low response (0.009% per ppb NO2, red square in Fig. 1a). The analysis of 110 state-of-the-art p-type semiconductor NO2 room-temperature gas sensors in the literature (gray dots in Fig. 1a) reveals such trade-off between sensor response and recovery time is very common because a low sensor response is often correlated with weak adsorption of gas analytes on the sensor surface, facilitating the desorption and sensor recovery. Replacing S in the CdS QD gel with Se did not substantially change the performance (purple pentagon in Fig. 1a), possibly because of the chemical and structural similarity between CdS and CdSe. In contrast, replacing Cd with Pb led to a record-high response: 0.08%/ppb for PbS (blue triangle, Fig. 1a) and 0.075%/ppb for PbSe (yellow diamond, Fig. 1a) and low measured LOD (3 ppb), but they suffer from long trec (~300 s for PbS and ~240 s for PbSe). An ideal gas sensor should combine high response and short recovery time (purple star in Fig. 1a).

Maximizing response while minimizing recovery time requires fine-tuning of the NO2 binding on the sensing surface. One possible strategy is to use two different metals (i.e., form bimetallic materials) to generate sites with different binding energetics from the monometallic surfaces. This strategy has been widely adopted in the field of catalysis, which also requires an optimal binding of adsorbates to achieve high catalytic performance28,29,30,31,32,33,34,35,36,37. Partial cation exchange is a facile and powerful synthetic method for preparing bimetallic chalcogenide nanoparticles38,39,40,41,42,43,44,45,46,47. During partial cation exchange reactions, only a fraction of the cations in the nanoparticles are replaced by cations in the solution phase. The extent of partial cation exchange can be precisely controlled by the cation concentration and reaction time. In principle, partial cation exchange reactions of metal chalcogenide QD gels are also feasible but have not been extensively studied48,49,50,51.

Here, we show the bimetallic PbxCd1−xSe QD gels with only atomically dispersed Pb sites result in the ideal combination of high response and short recovery time, leading to a high-performance room-temperature p-type semiconductor NO2 gas sensor with a combination of ultra-low LOD (3 ppb), high sensitivity (0.06%/ppb), short tres (~28 s), and trec (~60 s). Density functional theory (DFT) calculations suggest that the high performance of the PbxCd1−xSe QD gel is caused by the unique tuning effects of atomically dispersed Pb ionic sites on NO2 binding at their neighboring Cd sites.

## Results

### Synthesis of PbxCd1−xSe QD gels

Based on prior work demonstrating (1) slow gelation kinetics for cubic polymorphs (i.e., PbSe) relative to hexagonal polymorphs, and (2) facilitated cation exchange on ligand-stripped surfaces52,53, our strategy for targeting PbxCd1−xSe QD gels involves initial synthesis of hexagonal (wurtzite) CdSe, subsequent gelation (induced by ligand stripping), and ultimately ion-exchange of Cd2+ for Pb2+as illustrated in Fig. 1b. First, nearly monodisperse thiolate-capped CdSe QDs with sizes of 3.0 ± 0.3 nm were prepared according to a modified hot-injection method followed by ligand exchange (Fig. 1c, d and Supplementary Fig. 1a)54. Next, CdSe QDs were crosslinked by electro-oxidative removal of the protecting thiolate ligands (as disulfides) in conjunction with the electro-oxidative formation of di-selenide linkages between CdSe QDs to form a macroscopic 3-D connected pore-matter CdSe QD gel26. The synthesized CdSe QD gel exhibits a mesoporous network comprising CdSe building blocks with the same size (3.0 ± 0.4 nm) as the starting QDs (Fig. 1e, f and Supplementary Fig. 1b). The lattice fringes of the CdSe QD gel can be assigned to different planes of hexagonal CdSe (Fig. 1f), indicating that the gel is polycrystalline and its QD building blocks are randomly oriented. Finally, PbxCd1−xSe QD gels were synthesized via a cation exchange process wherein x is controlled by the concentration of Pb(NO3)2 in the exchange solution48,51: a greater Pb(NO3)2 concentration leads to more Pb incorporation in the PbxCd1−xSe QD gels. The experimentally measured Pb concentration was determined by X-ray photoelectron spectroscopy (XPS) and inductively coupled plasma mass spectrometry (ICP-MS) (Supplementary Table 1). As x increases from 0 to 1.0, the color of the PbxCd1−xSe QD gels gradually changed from orange to black (Supplementary Fig. 2).

### Structural characterization and modeling of PbxCd1−xSe QD gels

Scanning transmission electron microscopic (STEM) images of PbxCd1−xSe QD gels with x ≤ 0.17 show similar crystallite sizes (~3 nm) as the original CdSe QD gel (Fig. 1g, h and Supplementary Fig. 1c–f). However, as Pb content increases beyond this point, the crystallite size in the gel increases, reaching 8.4 ± 1.1 nm for complete exchange (x = 1, Supplementary Fig. 1g and Supplementary Fig. 3). This ripening may be due to structural disruption from the rapid cation exchange between Cd2+ and Pb2+ under forcing conditions created by high Pb2+ concentrations. This can potentially be remedied by slowing the kinetics, e.g., by adjusting the solvent (playing off differences in solvation energy for Cd2+ and Pb2+) and/or using a lower ionic concentration of the exchanging ion. For the present study, we selected to focus on PbxCd1−xSe QD gels with x ≤ 0.40 to minimize potential contributions from morphological changes on the observed sensing performance.

The porosity of PbxCd1−xSe QD gels was analyzed by nitrogen physisorption after supercritical drying to produce aerogels (Supplementary Fig. 4), which produced type-IV isotherms, characteristic of a mesoporous material (Fig. 1i). The surface areas of PbxCd1−xSe QD aerogels are similar to that of the native CdSe QD aerogel based on the Brunauer–Emmett–Teller (BET) model55 (177–205 m2/g for PbxCd1−xSe vs 209 m2/g for CdSe in Supplementary Table 2). Figure 1j illustrates the pore-size distributions for PbxCd1−xSe and CdSe QD aerogels, obtained by fitting the desorption branch of the isotherms to the Barrett–Joyner−Halenda model56. The average pore diameters and cumulative pore volumes for PbxCd1−xSe QD aerogels were calculated to be 17.9–22.5 nm and 0.8–1.5 cm3/g, respectively, similar to values for the CdSe QD aerogels (22.3 nm and 1.3 cm3/g, respectively).

The atomic structure of the PbxCd1−xSe QD gels was further characterized by high-angle annular dark-field scanning transmission electron microscopy (HAADF-STEM), energy-dispersive X-ray spectroscopy (EDS) elemental mapping, powder X-ray diffraction (PXRD), XPS, and X-ray absorption spectroscopy (XAS). For all PbxCd1−xSe QD gels, the HAADF-STEM images show atomic sites with a higher contrast (marked by yellow circles in Fig. 2a–d, left), which could be assigned to atomically dispersed Pb cation sites due to the Z-contrast in HAADF-STEM. The contrast of Pb (Z = 82) vs Cd (Z = 48) cations is clearly seen in the intensity profiles (Fig. 2e) integrated from the marked area 1 and 2 of Pb0.17Cd0.83Se QD gel (Fig. 2c). Moreover, the number density of Pb ionic sites increase with the increasing Pb content in the gel. Note that Pb is only seen as atomically dispersed ionic sites in the gels with low Pb contents, such as x = 0.04 and 0.09. For PbxCd1−xSe QD gels with x ≥ 0.17, nanometer-sized high-contrast regions were also observed in HAADF-STEM (Fig. 2f and Supplementary Fig. 5f). The fast Fourier transform (FFT) patterns from these regions were indexed to the cubic PbSe phase. The EDS mapping results also confirmed the structural transition from a uniform dispersion of Pb atomic sites on the CdSe surface at low Pb contents (Fig. 2a, b, right and Supplementary Fig. 6a, b) to the phase separation of PbSe and CdSe at high Pb contents (Fig. 2c, d, right, and Supplementary Fig. 6c, d).

The PXRD patterns of PbxCd1−xSe QD gels in Fig. 3a are consistent with the microscopy data, showing phase segregation of PbSe with increasing Pb content. At x ≤ 0.17, only the characteristic peaks of hexagonal CdSe (PDF 00-008-0459, wurtzite) were present, whereas for x > 0.17, the characteristic peaks of cubic PbSe (PDF 00-006-0354, rock salt) appear. Note that even though the cubic phase PbSe was observed in the STEM images of Pb0.17Cd0.83Se QD gel, its PXRD peaks were not found, likely because their signals were below the detection limit of the XRD instrument.

XPS measurements were next performed to examine the chemical states of Pb4f5/2 and Cd3d in PbxCd1−xSe QD gels during the composition-dependent structural transition. The Cd3d peaks did not show any notable differences for all PbxCd1−xSe and CdSe QD gels (Fig. 3b). In contrast, the Pb4f5/2 peak of the PbxCd1−xSe QD gels upshifted from 143.5 eV at x < 0.17 to 143.8 eV at x ≥ 0.17 as a result of the change in the chemical environment of Pb from atomically dispersed Pb ionic sites in a hexagonal CdSe matrix to Pb in the cubic phase PbSe (Supplementary Fig. 7 and Supplementary Table 3)57. Similar XPS peak shifts have been previously reported for other single-atom materials58,59,60. For example, Wu et al.58 found that the Au4f peaks of Au single atoms on a CuO support shifted downward by 0.3 eV relative to those of bulk Au.

XAS measurements were also carried out to further investigate the chemical states and electronic structures of Cd and Pb atoms in the PbxCd1−xSe QD gels. As shown in Supplementary Fig. 8, X-ray absorption near edge structure (XANES) of the Cd K-edge for the PbxCd1−xSe and CdSe QD gels did not show any obvious differences in absorption energy. The first derivative peak positions are CdSe: 26716.7 eV, Pb0.09Cd0.91Se: 26716.4 eV, and Pb0.4Cd0.6Se: 26717.6 eV (note: the step size of 1 eV used in the XANES measurements), in good agreement with the XPS results. The prominent scattering pathway at 2.2 Å in the extended X-ray absorption fine structure (EXAFS) spectra of the Cd K-edge is attributed to the interatomic scattering pathway of Cd–Se (Supplementary Fig. 8). The EXAFS data fitting results in Supplementary Table 4 show a Cd–Se distance of 2.571–2.606 Å with a coordination number of 2.8–3.8 for these three samples (bulk = 4), which is close to the theoretical coordination number for ~3 nm CdSe nanoparticles (the coordination number expected for a 25-Å spherical particle is 2.9–3.8, depending on the exact size and origin of the sphere with respect to the lattice)61. These results suggest a similar chemical environment for Cd in PbxCd1−xSe QD gels. However, because of the X-ray absorption interference between the Se K-edge (12657.8 eV) and the Pb L-edge (13035.2 eV), the XAS signal of the Pb LIII edge was too noisy at the edge region for EXAFS analysis to obtain the coordination environment of Pb in the gel samples (Supplementary Fig. 9a, d). The successive absorption signals at Pb LII and LI edges were also too weak to analyze with confidence (Supplementary Fig. 9b–f).

Taking all the experimental evidence together, we conclude that Pb in PbxCd1−xSe QD gels can exist in two forms: atomically dispersed Pb ionic sites in the hexagonal CdSe matrix and Pb in the cubic phase PbSe. At x < 0.17, Pb ions are only present as atomically dispersed ionic sites, while at x ≥ 0.17, both forms exist.

To understand the structural transition of PbxCd1−xSe QD gels as a function of Pb content, we performed theoretical calculations to construct the thermodynamic convex hull for PbxCd1−xSe. In the calculations, we employed an active machine learning (ML) scheme combined with DFT calculations (Supplementary Figs. 1015) to explore a much larger PbxCd1−xSe configuration space than the conventional DFT approach, which typically considers only a few representative structures due to the high computational cost62,63. Figure 3c shows the thermodynamic convex hull for cubic (green dots) and hexagonal (orange dots) PbxCd1−xSe, where the lowest formation energies among over 50,000 explored configurations at different Pb contents are plotted. The energy of PbxCd1−xSe (Ef) is referenced to that of cubic PbSe and CdSe (EPbSe and ECdSe), $${E}_{{{{\rm{f}}}}}=E-x{E}_{{{{\rm{PbSe}}}}}-(1-x){E}_{{{{\rm{CdSe}}}}}$$. The converged surrogate model has a prediction error < 0.002 eV/f.u. when benchmarked with DFT calculations. As expected, pristine hexagonal CdSe is thermodynamically more stable than its cubic counterpart64. However, the increasing Pb content in the PbxCd1−xSe significantly destabilizes the hexagonal phase, reducing the energy difference between the hexagonal phase and cubic phase. The crossover of the two curves in Fig. 3c suggests the structural transition from hexagonal phase to cubic phase occurs at x = ~0.21, which is in good agreement with our experimental observation.

### NO2 gas-sensing performance

PbxCd1−xSe gel sensors were prepared by drop-casting 10 μL of wet gel (or alcogel as the solvent is methanol) onto a sensor substrate patterned with an interdigitated electrode, followed by drying in air. For regular sensing tests, commercial alumina substrates were used because of their cost-effectiveness. For the homebuilt wireless portable-sensing device tests, silicon-based substrates were fabricated using photolithography to be compatible with the device (Supplementary Figs. 16 and 17). The dried xerogel film exhibits a highly porous surface morphology (Supplementary Fig. 18) and a thickness of ~3.1 μm (Supplementary Fig. 19). The gel film thickness can be varied by controlling the amount of wet gel deposited onto the substrate. Although thinner films are expected to afford higher sensing performance, including higher response and faster response and recovery, the reduced film thickness dramatically increases the sensor resistance, imposing a technical challenge in measuring resistance (Supplementary Fig. 19 and Supplementary Table 5). As a result, we performed all the sensing tests at the film thickness of 3.1 μm. The mesoporous structure of gel was still retained in the xerogel film, although the surface area decreased significantly compared to the aerogel due to partial pore collapse during ambient drying (Supplementary Fig. 20 and Supplementary Table 2). The sensing tests were carried out at room temperature using a homebuilt apparatus26. The sensor response is defined as |RaRg|/Ra, where Ra and Rg are the resistance in the presence of air and target gas, respectively. tres and trec represent the time required when the resistance changes 90% at the exposure and removal stage of the target gas, respectively.

Figure 4a shows the responses of PbxCd1−xSe QD gels (x = 0, 0.003, 0.02, 0.04, 0.09, 0.17, 0.40, and 1.0) to various NO2 concentrations from 3 to 1.32 ppm in air at room temperature. All PbxCd1−xSe and CdSe QD gels exhibit the characteristic behavior of p-type semiconductors, whose resistance decreases upon exposure to NO2 and returns to the initial resistance after the removal of NO2. The contact resistance between QD gel film and electrodes is ~2 orders of magnitude smaller than the gel film’s resistance and, thus, is negligible (Supplementary Fig. 21). The sensor response increases linearly with increasing NO2 concentration for all gel sensors (Fig. 4b). However, the presence of Pb in the gel dramatically improves the sensor response by over 1600% (from 0.004%/ppb for CdSe to 0.065%/ppb for Pb0.4Cd0.6Se, Fig. 4b). The high sensor response has led to a LOD of 3 ppb for PbxCd1−xSe QD gels with x ≥ 0.09 (Supplementary Fig. 22), which more than meets the LOD requirements by EPA (53 ppb)7 and EEA (40 ppb)8 for NO2 sensing. Note that the LODs reported here are all experimentally measured LODs, not calculated LODs using the 3σ rule. More interestingly, the increase in sensor response is not a linear function of the Pb content. For example, the sensor response to 1.32 ppm NO2 has already increased by 1300% as x is slightly changed from 0 to 0.09, whereas it only increases by another 486% when x is further increased to 1.0 (Fig. 4c and Supplementary Table 6). In contrast, trec increases nearly linearly with increasing Pb content and the change in tres is negligible as x is varied from 0 to 1.0 (Fig. 4c and Supplementary Table 6). The different dependences of sensor response and trec on the Pb content in PbxCd1−xSe QD gels have led to an optimal combination of high sensor response (0.06%/ppb) and short trec (~60 s) in Pb0.09Cd0.91Se QD gel sensor. Compared to 110 state-of-the-art room-temperature NO2 gas sensors based on p-type semiconductors in the literature (green lines in Fig. 4d), the Pb0.09Cd0.91Se gel sensor is superior, demonstrating a combination of high sensor response, low LOD, and short tres and trec (Fig. 4d and Supplementary Table 7). Note that the loading of Pb(NO3)2 in a CdSe QD gel matrix without cation exchange (achieved by mixing Pb(NO3)2 with CdSe QD gel in hexane) does not lead to any sensing performance improvement (Supplementary Fig. 23), suggesting the high performance of Pb0.09Cd0.91Se QD gel is a direct result of cation exchange.

Cycling stability and analyte selectivity are essential for the design of practical sensors. We tested the stability of the Pb0.09Cd0.91Se gel sensor by exposing it to 440 ppb NO2 for 560 consecutive exposure/removal cycles. During this 75-h-long stability test, the sensor response only varied by ~10%, and tres and trec stayed constant at 31 ± 3 and 63 ± 10 s (Fig. 4e and Supplementary Fig. 24), suggesting the strong gel adhesion to the substrate and high stability of the gel sensors. The Pb0.09Cd0.91Se gel sensor also exhibited excellent selectivity toward NO2 with at least 3.5 times higher response than sulfur dioxide (electron-withdrawing analyte) and ammonia, hydrogen, carbon monoxide, methanol, ethanol, acetone, and formaldehyde (electron-donating analytes) even when the concentrations of the electron-donating molecules are 75-fold that of NO2 (Fig. 4f).

To further demonstrate the potential real-world applications of the Pb0.09Cd0.91Se QD gel, we built a wireless portable NO2-sensing device using the QD gel (Supplementary Fig. 25) and compared it with a commercial NO2 detector (Manufacturer: Forensics, Part Number: 6S-Z1JF-MOYC) purchased from Amazon. The two devices showed similar tres and trec and provided identical results in the NO2 concentration range of 100–600 ppb, but the commercial devices failed to detect NO2 concentrations lower than 100 ppb, whereas our QD gel sensor responded to NO2 concentrations as low as 10 ppb (Fig. 4g–i, Supplementary Fig. 26, and Supplementary Movie 1). It is worth noting that the Pb and Cd contents by weight in this homebuilt NO2-sensing device are 0.1 and 0.5 ppm, respectively; both are several orders of magnitude lower than the International Standards for Pb (0.1% or 1000 ppm) and Cd (0.01% or 100 ppm) in electrical and electronic devices set by the RoHS (restriction of the use of certain hazardous substances)65.

### NO2 gas-sensing mechanism

According to the structural characterization results in Figs. 2 and 3, Pb in the Pb0.09Cd0.91Se QD gel is present as atomically dispersed Pb ionic sites. To understand the contribution of these ionic Pb sites to the superior NO2-sensing performance, we carried out DFT calculations of the NO2 adsorption energy and the degree of charge transfer on various surface structures of PbxCd1−xSe (Fig. 5a, b and Supplementary Fig. 27), including a hexagonal CdSe (100) surface (A), a hexagonal CdSe (100) surface covered by a monolayer of PbSe (B), a cubic PbSe (100) surface (C), and a hexagonal CdSe (100) surface with atomically dispersed Pb (D1, D2, E1, E2) or two neighboring Pb (F1, F2). The adsorption energy describes how strongly a NO2 molecule binds to a surface; the stronger the adsorption energy, the longer the recovery time. The charge transfer between the adsorbed NO2 and the semiconducting gel sensor dictates the change in electrical resistivity of the semiconductor sensor (or the sensor response)66,67. Thus, to achieve a combination of strong response and short recovery time, a large degree of electron transfer coupled with weak adsorption energy is desired; however, in practice, charge transfer is generally positively correlated with the adsorption energy.

The DFT results in Fig. 5a for various surface structures of PbxCd1−xSe confirm the experimental observation that a strong sensor response is often accompanied by a long recovery time. However, a closer look at these data points shows that, among all surface structures, PbSe surfaces (B and C) have the largest charge transfer and highest adsorption energies, while the hexagonal CdSe surface (A) is the opposite, consistent with the sensing performance of the monometallic PbSe and CdSe QD gels in Fig. 1a. For all bimetallic surfaces, their Cd sites adjacent to Pb show stronger adsorption energies and larger electron transfer than the Cd site on the monometallic CdSe surface (D2, E2, F2 vs A), whereas their Pb sites show weaker adsorption energies and smaller electron transfer than the Pb site on the monometallic PbSe surface (D1, E1, F1 vs B, C). This finding indicates electronic communication between the Pb and Cd sites in these bimetallic surfaces, which has affected NO2 binding and consequently charge transfer on these sites. Interestingly, for bimetallic surfaces with atomically dispersed Pb sites, Cd cations next to a Pb site (D2 and E2) have significantly larger charge transfer with the adsorbate than the Pb neighboring sites (D1 and E1) but share comparable NO2 adsorption energies. This suggests that NO2 can bind either at the Pb or Cd sites on these surfaces, but the sensor response is dominated by NO2 binding at the Cd sites adjacent to Pb due to the more significant charge transfer. In contrast, for bimetallic surfaces where two Pb sites are adjacent to each other, the situation is quite different. Even though the Cd sites (F2) still have significantly larger charge transfer than the Pb sites (F1), the NO2 adsorption energies become notably stronger at the Pb sites than the Cd sites, causing preferential NO2 adsorption at the Pb sites over the Cd ones. Thus, the sensor response is dominated by NO2 binding at the Pb sites with less charge transfer than the Cd sites.

The above findings show that (1) the Cd sites adjacent to Pb cations in PbxCd1−xSe surface lead to the “desired” sites for NO2 adsorption since they provide the largest electronic communication with NO2 under similar adsorption strength to that of Pb sites; and (2) the key function of the atomically dispersed Pb sites is to reduce the competition for NO2 binding between the Cd and Pb sites, allowing the Cd sites to be “functional”. We further analyzed the differential electron density of NO2 adsorption on the Cd sites on the PbxCd1−xSe bimetallic surface to understand the origin of the large charge transfer at these sites. The result in Fig. 5c shows the neighboring Pb site acts as an electron donor, promoting the electron transfer from PbxCd1−xSe to the adsorbed NO2 at the Cd site.

Additionally, we performed a DFT calculation of the adsorption energies and charge transfer for all nine gases tested in the experiment to understand the origin of the selectivity of Pb0.09Cd0.91Se gels toward NO2. We used geometry D2 as the representative structure for Pb0.09Cd0.91Se in this calculation. As shown in Fig. 5d, the charge transfer values have a similar pattern with the sensor responses in Fig. 4f, suggesting that the good selectivity for NO2 results from the remarkable charge transfer from the surface to NO2 (the optimized structure of the most stable adsorption geometries is provided in Supplementary Fig. 28).

## Discussion

In this work, we synthesized bimetallic PbxCd1−xSe QD gels (x = 0, 0.003, 0.02, 0.04, 0.09, 0.17, and 0.40) via a three-step approach consisting of CdSe QD synthesis, electrogelation, and partial cation exchange. All the PbxCd1−xSe QD gels showed similar surface morphology, crystallite size, surface area, and porosity as the precursor CdSe QD gel. The HAADF-STEM, EDX mapping, PXRD, and XPS results reveal that the Pb in the PbxCd1−xSe QD gels can exist in two different forms depending on the Pb content. At low Pb content (x < 0.17), Pb sites are atomically dispersed in the gel. When x further increases (x ≥ 0.17), phase separation of cubic PbSe starts to take place so that atomically dispersed Pb sites and cubic PbSe coexist in the gels up until complete replacement of Cd for Pb (x = 1). Theoretically calculated thermodynamic convex hull using an active ML strategy shows that the bimetallic PbxCd1−xSe hexagonal phase is thermodynamically stable for a Pb content lower than 20%, in good agreement with experimental results.

The NO2 gas-sensing results show a composition-dependent gas-sensing performance of the PbxCd1−xSe QD gels. The optimal combination of strong sensor response and fast recovery is achieved for x = 0.09, where Pb is present only as atomically dispersed metal ions. Compared to 110 state-of-the-art room-temperature NO2 gas sensors based on p-type semiconductors in the literature, the Pb0.09Cd0.91Se QD gel sensor demonstrates high performance with the combination of ultra-low LOD (3 ppb), high response (0.06%/ppb), and short tres (~28 s) and trec (~60 s). The Pb0.09Cd0.91Se gel sensor also exhibits excellent stability concerning the sensor response, tres, and trec, which varies by only ~10% during a 75-h-long stability test. A high selectivity toward NO2 vs eight different common gases is also achieved. Furthermore, we fabricated a wireless portable NO2 device using the Pb0.09Cd0.91Se gel and compared it with a commercial NO2 detector in real time. The results reveal that our NO2-sensing device is highly reliable for detecting ppb levels of NO2. Remarkably, compared to the commercial device, our device works well even in the range of 10–100 ppb, fulfilling the LOD requirements of the EPA (53 ppb) and EEA (40 ppb), suggesting great potential for commercial markets.

The DFT calculation results suggest that it is the Cd sites, rather than the Pb sites, on the bimetallic PbxCd1−xSe QD gel surface that are the adsorption sites responsible for the exceptional NO2-sensing performance because they provide a significantly larger charge transfer but comparable adsorption energy, relative to the Pb sites, addressing the trade-off between the response and recovery time. The atomically dispersed Pb ionic sites are quite different from Pb sites in the PbSe matrix, serving to transfer electron density to adjacent Cd cations, making them better electron donors to NO2 and enhancing the response. Our findings are significant because trade-offs are common barriers in sensing and catalytic performance, and this work shows that bimetallic structures with atomically dispersed metal ion geometries can be a strategy to achieve an optimal balance between adsorbate binding energy and extent of charge transfer, leading to enhanced functionality.

## Methods

### Chemicals and materials

Selenium powder (Se, 99.99%), trioctylphosphine oxide (TOPO, 99%), tetradecylphosphonic acid (TDPA), 1- thioglycolic acid (TGA), tetramethylammonium hydroxide (TMAH), tetrabutylammonium hexafluorophosphate (NBu4PF6, 98%), and Pt foil (0.125–0.135 mm thickness, 99.9%) were purchased from Sigma-Aldrich; cadmium oxide (CdO, 99.99%) and trioctylphosphine (TOP>85%) were purchased from Strem chemicals; lead nitrate (Pb(NO3)2, 99.3%) was purchased from Fisher; all chemicals were of analytical grade and used without further purification.

### Synthesis of CdSe QDs

CdSe QDs were synthesized using a modified hot-injection approach54. A mixture of 0.0508 g (0.4 mmol) CdO, 0.16 g TDPA, and 8.0 g TOPO were heated in a 100 mL Schlenk flask in vacuum at 150 °C for 20 min. Next, the vacuum was removed, and a continuous argon flow was introduced into the flask, followed by increasing the temperature to 330 °C. When the solution became transparent, the temperature was reduced to 150 °C, and a mixture of 0.04 g (0.5 mmol) Se and 4.8 mL TOP solution (mixed in the glovebox, sealed, and dispersed uniformly by ultrasonication) was injected. Subsequently, the system was heated to 250 °C and maintained for 4 h, and then cooled to room temperature naturally. Toluene was added, followed by centrifugation, and the brown precipitate (unreacted CdO) was removed. Methanol was added to the supernatant, followed by centrifugation to produce CdSe QDs as a solid. These dispersion/precipitation steps were repeated twice. For each batch of CdSe QDs (n[Cd2+] = 0.4 mmol), 110 μL TGA (n[Cd2+]:nTGA = 1:4) was dissolved into 15 mL methanol, and its pH value was adjusted to 10 by adding TMAH. The TGA methanol solution was added to the precipitated CdSe QDs and ultra-sonicated for 1 h. The subsequent TGA-capped CdSe QDs were purified by two cycles of precipitation with ethyl acetate/dispersion in methanol. TGA-capped CdSe QDs were stored in the dark.

### Synthesis of CdSe QD gel (electrochemical gelation)

CdSe QD gels were synthesized by an electrogelation method developed by our group26. CdSe QDs were first dispersed into methanol at a concentration of ~36 µM. Nine milliliters of the CdSe QDs solution was mixed with 1 mL of a 0.1 M NBu4PF6 methanol solution (electrolyte). A three-electrode setup with an Ag/AgCl electrode in saturated KCl aqueous solution as reference electrode, a Pt foil (~385 mm2) as the counter electrode, and a Pt foil (~240 mm2) as the working electrode was utilized in the electrogelation. An electrode potential of 1.5 V was applied to the working electrode for 1 h using a CHI 650E potentiostat to drive the electrogelation. Before electrogelation, the Pt foils were electrochemically polished in 0.5 M H2SO4 aqueous solution by running cyclic voltammograms between 1.1 and −0.23 V at a scan rate of 0.1 V/s for 500 cycles, followed by washing with DI water and methanol. After gelation, the CdSe gel was washed with methanol six times and stored in methanol in the dark.

### Synthesis of PbxCd1−xSe QD gel (cation exchange)

PbxCd1−xSe QD gels were synthesized by immersing the CdSe QD wet gel in solutions of Pb(NO3)2. Different amounts of Pb(NO3)2 were dissolved in a mixture of methanol and DI water (Vmethanol/VDI water = 3:1) to obtain Pb(NO3)2 solutions with various concentrations: 3, 6, 12.5, 25, 50, 150, to 750 mM. Two milliliters of Pb(NO3)2 solution was added to 1 mL of CdSe wet gel (n[Cd2+] = 0.05 mmol) to produce the PbxCd1−xSe wet gel. After 10 min, the supernatant was carefully removed by pipette without disturbing the gel. Then, a mixture of methanol and DI water (Vmethanol/VDI water = 3:1) was used to wash the gel. After 10 min, the supernatant was discarded. The purification procedure was repeated ten times and the prepared PbxCd1−xSe QD gels were stored in methanol in the dark

### Preparation of PbxCd1−xSe QD aerogels for nitrogen physisorption

PbxCd1−xSe QD gels were subjected to CO2 critical point drying (CPD) to yield the corresponding aerogels. First, the methanol supernatant was carefully removed using a pipette without disturbing the gel at the bottom, and the same amount of acetone was added to the vial to replace methanol. The above procedure was repeated five times per day for 1 week before CPD. Second, PbxCd1−xSe wet gel immersed in acetone was dried supercritically using an SPI-DRY model CO2 critical point drier equipped with a recirculating water bath (ISOTEMP 10065). The solvent was completely exchanged from acetone to liquid CO2 at 18 °C. The temperature was increased to 37 °C to drive CO2 supercritical. After 30 min, the pressure is slowly released and the resulting PbxCd1−xSe aerogel was stored in the dark.

### Gas sensor fabrication and testing

The sensor substrate is an electrical insulator comprising a sintered alumina plate equipped with interdigitated Pt electrodes (the distance between adjacent electrodes is 0.4 mm)26. Before use, the sensor substrates were cleaned by ultrasonication in DI water and methanol. Ten microliters PbxCd1−xSe wet gel (alcogel) was drop-casted on the sensor substrates and dried under ambient conditions to produce xerogel films.

The gas-sensing testing of PbxCd1−xSe QD gels was performed using a homebuilt apparatus26 composed of five parts: gas tanks providing air and test gases (Airgas Co., Ltd), mass flow controllers for regulating the flow rate of gases (Bronkhorst), a home-made Teflon chamber where the sensor was housed, a data acquisition card for collecting electrical resistance changes in real time (Keysight/Agilent 34972A LXI), and a computer for data storage. Before testing, all the gel sensors were aged in air by flowing synthetic air (21%O2 + 79%N2, Airgas Co. Ltd) for 8 h until the resistance is stable. During the tests, the target gas was mixed with air to obtain the desired concentration of test gas in the air. The total flow rate was maintained at 2000 sccm, and the relative humidity of the chamber was kept at 50%.

### Wireless portable device fabrication and test

The sensor substrates used in the wireless portable device were prepared using a standard photolithography process as illustrated in Supplementary Fig. 16. Briefly, Si wafers with a 500-nm-thick oxide layer were cleaned and baked at 120 °C for 5 min followed by spin coating of the LOR 10B photoresist at 4000 r.p.m. for 45 s, then baked again at 190 °C for 5 min. After cooling, the Shipley photoresist was spin-coated at 4000 r.p.m. for 30 s, and then baked at 115 °C for 2 min. Later, the photoresist film was exposed to 350 nm UV light, broad-band 20 mW/cm2 for 5.5 s. Development was done by rinsing in AZ-726 developer for 25 s. Metal films of 10 nm Cr followed by 200 nm Au were deposited by PVD and lifted off by soaking in PG remover overnight at room temperature. All photolithography steps were carried out at the Lurie Nanofabrication Facility at the University of Michigan. The geometry and dimensions of the sensor electrodes are shown in Supplementary Fig. 17.

The design of the wireless portable device is shown in Supplementary Fig. 25. The readout signal was calculated from the electrical resistance change of the device using the Adafruit Feather 32u4 Bluefruit microcontroller powered with a 3.3 V battery. A voltage divider was used to measure the resistance (Supplementary Fig. 25). The microcontroller converts the voltage (Vin) between the analog input pin (A0) and the ground pin (GND) to a digital value between 0 and 1023, corresponding to voltage values between 0 V and Vc = 3.3 V (the voltage of the power supply). The value of the device resistance (Rdevice) is calculated using Eq. (1).

$${R}_{{{{\rm{device}}}}}={R}_{{{{\rm{ref}}}}}\frac{{V}_{{{{\rm{in}}}}}}{{V}_{{{{\rm{c}}}}}-{V}_{{{{\rm{in}}}}}}$$
(1)

The gas concentration value (Cgas) is calculated from the characteristic graph (Rsensor vs Cgas) using the following formula: $${C}_{{{{\rm{gas}}}}}=A\times {R}_{{{{\rm{device}}}}}+B$$, where A and B are determined experimentally. The measured gas concentration value is displayed on an organic light-emitting diode display connected to the microcontroller. The microcontroller is programmed with a code written using the Arduino development environment and uploaded via USB.

### Characterization and measurements

HAADF-STEM images were taken using a JEOL3100R05 Double Cs Corrected S/TEM operated at 300 kV, with a collection angle of 59–200 mrad. The EDS mapping was carried out on a Thermo Fisher Scientific Talos F200X S/TEM equipped with a Super-X EDS detector. The TEM specimens were prepared by drop-casting wet gel onto carbon-coated 200-mesh Cu grids. The particle size distribution was estimated using Nano Measurer 1.2 software. The crystalline phase was characterized by PXRD using a Bruker D2 Phaser diffractometer. PXRD patterns were analyzed by comparison to the powder diffraction file database of the International Center for Diffraction Data. The chemical state and elementratio were analyzed by X-ray photoelectron spectroscopy (Thermo Fisher Scientific NEXSA UV and X-ray Photoelectron Spectrometer). XPS peaks were fitted using a composite function (30% Lorentzian + 70% Gaussian) and calibrated according to the C1s peak at 284.8 eV via the Avantage software. The elementary ratio of Pb/Cd was also identified by ICP-MS (Agilent 7700x ICP-MS). The surface area and pore size determined from nitrogen physisorption data (Micrometrics ASAP 2020 analyzer) using the BET and Barrett–Joyner–Halenda models. The surface and cross-section morphology of the xerogel film were analyzed by field-emission scanning electron microscopy (JEOL JSM 7600F SEM).

### Theoretical calculations

All calculations were performed via the Vienna Ab Initio simulation package utilizing DFT68,69. Core electrons were described using the projected-augmented wave (PAW) method70. The Kohn–Sham wave functions were expanded on a plane-wave basis with a kinetic energy cutoff of 400 eV to describe the valence electrons. The generalized gradient approximation using the Perdew–Burke–Ernzerhof functional was employed to evaluate the exchange-correlation energy71. The crystal structure in the phase separation section was prepared using (3 × 6 × 3) and (3 × 3 × 3) supercells for the hexagonal and cubic phases, respectively. The Monkhorst–Pack scheme was employed to sample the Brillouin zone using 1 × 1 × 1 k-point grid for geometry optimization72. Geometry was considered optimized when the force on each atom was <0.02 eV/Å.

The CdSe(100) and PbSe(100) surfaces were modeled with a four-layer (3 × 2) hexagonal CdSe(100) supercell and a two-layer (3 × 2) cubic PbSe(100) supercell, respectively. The bottom two layers of CdSe(100) surface and bottom one layer of PbSe(100) surface were kept frozen, while the other layers and adsorbed gas molecules were set free to relax. A vacuum space >15 Å was added to all surface models to ensure no appreciable interaction between periodic images. The Monkhorst–Pack scheme was employed to sample the Brillouin zone using a 3 × 3 × 1 k-point grid for atomic structure optimization and a 7 × 7 × 1 k-point grid for refining electronic structures. Structural optimization was performed until the force on each atom was <0.025 eV/Å. Bader charge analysis was used to decompose the charge density into volumes around atoms73.

### Machine learning

As shown in Supplementary Fig. 10, 47 PbxCd1−xSe cubic supercells (35 for hexagonal, 0 < x < 1) were first generated randomly and used as the initial training database after geometry optimization. An automated ML package, TPOT74, was employed to optimize the ML regression method and hyperparameters for Ef prediction. Based on the prediction of ML surrogate model, the 50000-step Metropolis Monte Carlo (MC) simulation was used to explore the PbxCd1−xSe configuration for the most stable structures at each composition (Supplementary Figs. 11 and  12). These newly searched configurations were then labeled with DFT calculations and added to the training database to refine the ML surrogate model. Such an active learning loop of training-MC-DFT was repeated until the prediction accuracy criteria were met. The last batch of the most stable configurations at each composition was then used to construct the thermodynamic convex hull. Our scheme can be understood as an exploitation dedicated version of the Bayesian optimization (BO). Exhilaratingly, the ML surrogate model exhibited high confidence (cubic: MAE = 0.0028, R2 = 0.96; hexagonal: 0.0014, R2 = 0.97) for predicting the most stable candidate suggested by MC after iterations (Supplementary Figs. 13 and  14). The features were extracted by counting the numbers of different coordination pairs in the metal ion matrix, i.e., the number of Pb or Cd atoms with different numbers of Pb in the first nearest neighbor sphere.