Introduction

In conventional electron paramagnetic resonance (EPR) spectrometers, the energy transfer from the spins to the cavity at a Purcell enhanced rate plays an essential role and requires the spins to be resonant with the cavity. A conventional EPR spectrometer relies on energy exchange (transverse) coupling, where the spins and the detector should be resonant. In particular, in a leaky cavity limit, the spins mainly emit photons to the measurement chain at the Purcell enhanced relaxation rate1, and the detector absorbs the photon energy as a signal. Recently, sensitive EPR spectrometers based on a superconducting resonator have been realized2,3,4,5, with a measurement chain that uses a quantum-limited amplifier (Josephson parametric amplifier). The sensitivity of these spectrometers ranges from 65 to 104 spins·Hz−1/2, and the sensing volume shrinks down to 10−12λ3 (200 fL). On the other hand, it is also possible to observe the EPR phenomenon without a cavity, and magnetization detection6 is one such example. A superconducting quantum interference device (SQUID) shows excellent characteristics for detecting the magnetic flux. Recently, it was demonstrated that the size of a SQUID loop can shrink to micrometer7,8,9 or even down to nanometer10 scale for magnetometry in materials sciences. By combining such micro-SQUIDs and an on-chip microwave waveguide, local EPR spectroscopy is also realized11 and the sensitivity of 1.5 × 104 spins·Hz−1/2 is reported12. Magnetically induced force detection13 has recently been demonstrated to achieve high spatial resolution, and sensitivity reaches a level of single-electron spin detection with a long time signal integration to enhance the signal-to-noise ratio. In these cases, energy transfer between spins and the detector is suppressed due to the large detuning; thus, the signal is detected without significant disturbance to the spin system.

Magnetic field sensors using an artificial atom (a superconducting flux qubit14) have been recently demonstrated15,16. The superconducting flux qubit has two distinct states corresponding to clockwise and anticlockwise circulating currents Ip. Such current states can be strongly coupled with magnetic fields induced by the spins. The magnetic coupling causes the resonance frequency of the flux qubit to shift, thus enabling EPR spectroscopy with little disturbance to the spin system. The interaction strength induced by the persistent current states is much larger17,18,19 than that of the resonator-based systems2,3,4,5,20,21. This interaction also has a smaller spin-to-device distance dependence than a spin–spin interaction, which enables us to prove distant spins with high sensitivity. Thus, the superconducting flux qubit must be suitable for the detection of a small number of spins.

In this paper, we demonstrate sensitive local EPR spectroscopy using a superconducting flux qubit. The target spin system is directly attached to the flux–qubit chip to increase the interaction strength between them. Before performing EPR spectroscopy, temperature and in-plane field dependence of the magnetization signal from the spin system (Er3+:Y2SiO5) is measured to show that the flux qubit works as a sensor for the real spin system. Here, the anisotropic g-factor tensor of Er3+:Y2SiO5 is utilized to convert the in-plane magnetic field into the perpendicular magnetization, because the flux qubit is only sensitive to the perpendicular field and the operating flux of the flux qubit must be fixed around half-flux quanta. Then, EPR spectroscopy is performed for the nitrogen vacancy (NV) centers in diamond under various in-plane magnetic fields. We successfully derive the material parameters (g-factor and zero-field splitting) from the two-dimensional spectrum. The sensitivity of the spectrometer is estimated to be ~400 spins·Hz−1/2 by evaluating the transfer function from the number of spins to the response of the flux qubit and measuring the actual system noise. Sub-picoliter detection volume (~50 fL) can be achieved, due to the micrometer-scale loop size of the flux qubit. Currently, we just measure a spectrum of the flux qubit. By using pulse operations on the flux qubit, we should be able to improve the sensitivity further.

Results

The principle of EPR spectroscopy

We use a flux qubit to measure the magnetization of the spin (Fig. 1a, b). The resonance frequency of the flux qubit \(f_{\mathrm{q}} = \sqrt {\varepsilon ({\mathrm{\Phi }})^2 + {\mathrm{\Delta }}^2}\) is sensitive to the magnetic flux penetrating the flux qubit loop Φ, where ε(Φ) := 2Ip(Φ − Φ0/2)/h is the frequency detuning, Φ0 is the magnetic flux quanta, h is Planck’s constant, and Δ is the energy gap of the flux qubit. Now, spectroscopy of the flux qubit is performed by applying excitation and read-out pulses to the device (Fig. 1c), where the energy state of the flux qubit is read out by a SQUID using a switching method22 with 1000 repetitions. The magnetic interaction between the spins and the flux qubit is realized by attaching the spin ensemble directly to the flux–qubit chip (Fig. 1a, b). An additional magnetic flux ΔΦ is generated by the attached spin ensemble, which in turn shifts the spectrum of the flux qubit. Thus, when the working flux Φ is fixed, the spin polarization is detected as a resonance frequency shift Δfq (Fig. 1d). To perform EPR spectroscopy, we apply a continuous spin excitation signal, in addition to the microwave pulse for the flux qubit through a microwave (MW) line (Fig. 1c).

Fig. 1
figure 1

Experimental setup for magnetic resonance spectroscopy using a superconducting flux qubit. a Experimental setup. The spin ensemble is directly attached to the flux–qubit chip. The energy state of the flux qubit is read out by the superconducting quantum interference device (SQUID). The spin ensemble and the flux qubit are excited through the microwave (MW) line. In-plane (B||, magenta arrow) and perpendicular (B, blue arrow) magnetic fields are applied by superconducting magnets to polarize the spin ensemble and to control the flux qubit. b Optical microscope image of the flux–qubit chip with an Er3+:Y2SiO5 crystal. The area shown in the image is fully covered with the crystal. In addition to the circuit pattern, an overlayed pattern (blue–red–blue, from bottom left to top right) appears. This is caused by optical interference between the chip and the crystal surface. The device has two microwave lines, but only the left microwave line is used for the experiment to excite the spins near the qubit. Scale bar: 50 μm. c Pulse sequence used for the experiment. SQUID read-out pulses and qubit excitation pulses are used for the spectroscopy of the flux qubit. In addition to these pulses, a continuous microwave excitation signal is applied to the same MW line to excite the spin ensemble. d Energy spectrum of the flux qubit. The resonance frequency is controlled by the magnetic flux penetrating the qubit loop. For a fixed working point (turquoise dashed line), the external magnetic flux ΔΦ generated by the spin ensemble is detected from the change in the qubit resonance frequency Δfq

Spin detection

Before performing EPR spectroscopy, we first characterize the flux qubit as a detector of magnetization from the spin ensemble (effective spin one-half system in an Er3+:Y2SiO5 crystal in this case, see Supplementary Note 1 for details). By controlling the sample temperature T and applying the in-plane magnetic field |B||| by the superconducting magnet, we can control the spin-polarization ratio. The signal Δfq can be used to calibrate the qubit-based magnetometer. Although we mainly apply an in-plane magnetic field to the sample \(({|{{\bf{B}}_{||}}|\gg|{{\bf{B}}_\bot }|})\), the spin ensemble generates the perpendicular magnetization due to the anisotropic g-factor of the electron spins in the Er3+:Y2SiO5 crystal12,23,24. In Fig. 2a, we plot the temperature dependence of the flux–qubit spectrum under an in-plane magnetic field of 4 mT. As the temperature increases, the flux–qubit spectrum shifts to the positive flux side. In Fig. 2b, we summarize the in-plane magnetic field and temperature dependence of the flux–qubit's spectrum shift. The linear fit reproduces the experimental results well. Although the entire magnetic field dependence is expected to be complicated due to the 7/2 nuclear spin of erbium atoms, our numerical simulation well reproduces the linear increase in the magnetization of our experimental setup, as shown in Supplementary Note 2 and Supplementary Fig. 1. It is worth mentioning that the slope of this linear fitting contains information about an effective g-factor and the number of measured spins. If an in-plane magnetic field large enough to saturate the electron-spin polarization is applied, we can derive both parameters independently. In general, we might detect the spins of the flux–qubit chip, such as a silicon substrate, aluminum film, or their interfaces. However, we can distinguish them from erbium spins by the g-factor when we observe the EPR spectrum. Actually, our EPR spectrum shows specific g-factors for erbium impurities in a Y2SiO5 crystal, as shown in Supplementary Note 3 and Supplementary Fig. 2.

Fig. 2
figure 2

Detection of spin polarization with an Er3+:Y2SiO5 sample. a Temperature dependence of the qubit spectrum under a 4-mT in-plane magnetic field. Open symbols are experimental data and solid lines are the fitting. The error bars are standard errors of fittings to derive the peak positions of the flux–qubit spectrum. b Magnetic flux detected by the shift of the qubit spectrum as a function of temperature and in-plane magnetic field. Open symbols are experimental data and solid lines are the linear fitting. The error bars (smaller than the symbol sizes) are standard errors of flux–qubit frequency estimation converted into a magnetic flux unit

EPR spectroscopy

Next, we performed an EPR experiment by exciting the spin ensemble using a microwave oscillating field. For this experiment, the NV centers in diamond are employed as the characterized spin ensemble. The 2.88-GHz zero-field splitting in the spin one NV center ensures a large spin-polarization ratio even in a small magnetic field regime. The EPR spectrum, obtained under a 5.8-mT in-plane magnetic field with our continuous microwave spin excitation, is shown in Fig. 3a. For this experiment, the in-plane magnetic field is applied along the [100] direction of the diamond crystal. The flux qubit used for this experiment has an energy gap Δ < 2 GHz and persistent current Ip ~ 309 nA, respectively. The bare resonance frequency of the flux qubit (~7 GHz) is detuned far from the expected resonance frequency of the NV centers (~3 GHz) by tuning the perpendicular magnetic field, |B|. We observed that the frequency of the flux qubit decreases when we drive the spin with a frequency of ~2.8 or ~3.0 GHz. Although an NV center has four possible orientation axes, every NV center is affected by the same amount of Zeeman splitting when the in-plane magnetic field is applied along the [100] direction. So the two observed resonances correspond to the transitions from the ground to the first and second excited states (see Fig. 3b inset). We also observe a tiny splitting in each EPR peak, and this originates from a small misalignment (~3°) of the magnetic field. The different amplitudes of the two peaks are explained by considering the energy relaxation between three levels (see Supplementary Note 4 and Supplementary Figs. 3 and 4). We attribute the asymmetric lineshape of the resonance that we observed to the long energy-relaxation time of the NV centers at a low temperature25,26. To obtain further insight into the EPR peaks, we perform EPR spectroscopy in various magnetic fields (Fig. 3c). In Fig. 3b (blue triangles and magenta circles), we plot the magnetic field |B||| dependence of the EPR frequency. These experimental points are fitted with the transition frequency of the NV center calculated from the energy eigenvalues of the following spin Hamiltonian27:

$$\hat H_{\mathrm{s}} = g_{\mathrm{e}}\mu _{\mathrm{B}}{\bf{B}} \cdot \widehat {\bf{S}} + hD\hat S_{\mathrm{z}}^2 + hE\left( {\hat S_{\mathrm{y}}^2 - \hat S_{\mathrm{x}}^2} \right),$$
(1)

where ge is the Landé g-factor, μB is the Bohr magneton, B := B|| + B is the magnetic field, \(\widehat {\bf{S}} = (\hat S_{\mathrm{x}},\hat S_{\mathrm{y}},\hat S_{\mathrm{z}})\) is the spin one operator, D is the zero-field splitting, and E is the strain. Here, we assume a strain term of 5 MHz19. From the fitting constants, we derive ge and D values of 1.996 ± 0.013 and 2.88071 ± 0.00087 GHz, respectively. This result deviates slightly from the value reported in the literature27 due to the magnetic field distortion near the superconductor caused by the Meissner effect.

Fig. 3
figure 3

Electron paramagnetic resonance (EPR) spectroscopy. a Results of EPR spectroscopy for nitrogen vacancy (NV) centers in diamond under a 5.8-mT in-plane magnetic field. The qubit excitation frequency is converted into the corresponding magnetic flux. For the spectroscopy, the temperature is fixed at 20 mK to maximize the spin-polarization ratio. b EPR peak frequency as a function of the in-plane magnetic field. The magenta circles (blue triangles) correspond to the transitions from the ground state to the first (second) excited state. The error bars (smaller than the symbol sizes) are standard errors of fittings to derive EPR peak positions. The solid lines are the fitting curve calculated from the spin Hamiltonian. Inset: energy-level structure of the NV center in diamond. c EPR spectrum in several magnetic fields. The higher frequency peak in the 5.8-mT curve (purple) has a smaller frequency shift due to the limitation of the dynamic range of the spectrometer

Discussion

The sensing volume of this spectrometer is estimated from the loop area and the effective thickness of the spin ensemble. The loop area is the designed parameter of 47.2 μm2. Our effective thickness is defined as a typical length scale, in which the spin and the flux qubit interact strongly. The interaction strength can be calculated numerically, and the effective thickness is defined as ~1 μm from the calculated results for a flux qubit with a similar size to ours17. By multiplying these values, the sensing volume is estimated to be ~50 fL (5 × 10−17 m3). This value corresponds to a magnetic sensing volume of ~10−14λ3, where λ is the wavelength of the irradiated microwave, and two orders of magnitude smaller than that obtained with an EPR spectrometer using a superconducting resonator3,5.

We can also estimate the minimum detectable number of spins per unit time (see the Methods section for details). For this purpose, we plot the measured noise in the switching probability as a function of the number of repetitions Nrep to obtain one experimental point (Fig. 4a). The noise does not follow the theoretical \(1{\mathrm{/}}\sqrt {N_{{\mathrm{rep}}}}\) scaling in the Nrep 2000 region, possibly due to the slow drift of the system, including flux noise from the environment or superconducting magnets and mechanical vibration from the dry dilution refrigerator. We use the noise for Nrep = 5000, which corresponds to integration for 1 s, to estimate the sensitivity per unit time in a real experimental environment. By setting the working point of our flux qubit at the steepest point of the Lorentzian resonance peak, we obtain the best sensitivity (Fig. 4b), and the noise in the switching probability is converted into frequency noise. Furthermore, we need to convert this noise to the corresponding number of spins using the experimental parameters. The frequency noise can be converted into flux noise using the slope of the flux–qubit spectrum (Fig. 1d), where the flux noise is converted into a fluctuation in spin number using the generated flux per spin. This value is derived from our previous experiment using SQUID magnetometry28. By combining these values, the sensitivity is estimated to be 530 ± 320 spins·Hz−1/2 [see Eq. (10) in the Methods section].

Fig. 4
figure 4

Estimation of sensitivity. a Noise in the switching probability as a function of the number of repetitions. The error bars (smaller than the symbol sizes) are standard errors obtained by the jackknife method. The solid line is the calculated \(1{\mathrm{/}}\sqrt {N_{{\mathrm{rep}}}}\) dependence. The arrow indicates the experimental data used to estimate the sensitivity. b Conversion from switching probability noise to frequency noise. The most sensitive working point is indicated by the magenta dashed line

To check this approach, we can also estimate the sensitivity using the following Hamiltonian, which represents the interaction between a single spin and a flux qubit:

$$\hat H = h\left( {\frac{{f_{\mathrm{q}}}}{2} + {\bf{g}} \cdot \widehat {\bf{S}}} \right)\hat \sigma _{\mathrm{z}} + \hat H_{\mathrm{s}},$$
(2)

where g = (gx, gy, gz) denotes the interaction strength between a spin and a flux qubit (see the Methods section). Because the zero-field splitting is much larger than the Zeeman energy in our experiment, the expectation values of \({\bf{g}} \cdot \widehat {\bf{S}}\) for the ground and the first and the second excited states are well approximated by 0, −gz, and gz, respectively. Thus, the frequency shift per single spin is 2gz. Here, gz is estimated to be 4.4 kHz by simple electromagnetic calculation using the Biot–Savart law18. Combining this value with the frequency noise, the sensitivity is estimated to be 300 ± 180 spins·Hz−1/2 [which is consistent with our original estimation, see Eq. (11) in the Methods section]. Such sensitivity is comparable with that of a resonator-based EPR spectrometer with a quantum-limited measurement chain3. It is worth mentioning that the spin number here corresponds to the number of flipped spins as defined in other experiments2,3.

In summary, we have demonstrated a highly sensitive micrometer-scale EPR spectroscopy using a superconducting flux qubit. We estimate the sensitivity and the sensing volume of the spectrometer to be ~400 spins·Hz−1/2 and ~50 fL, respectively. The inferred sensitivity is comparable with that of EPR spectrometers using a superconducting resonator with a quantum-limited amplifier, while the magnetic sensing volume is two orders of magnitude smaller than that of a resonator-based spectrometer3,5. A magnetic interaction between the qubit and the spin ensemble is realized without resonance between them, which is a completely different detection principle from that of the standard EPR spectrometer using transverse coupling. As long as the change in the magnetization occurs, our local magnetic resonance scheme is applicable to any spin species, including nuclear magnetic resonance. In addition, it is possible to further reduce the sensing volume toward the realization of the nanoscale spectroscopy, because the size of the flux–qubit loop is not limited by the wavelength. Toward the detection of a single-electron spin, a sensitivity improvement of three orders of magnitude is also possible by using a flux qubit with a narrower linewidth29,30, by repeating the qubit measurement within a short period using a Josephson bifurcation amplifier31 or with the dispersive read-out method32, and utilizing the quantumness of the qubit fully (e.g., Ramsey interference or quantum entanglement), as discussed in the quantum sensing field33,34,35,36.

Methods

Experimental setup

Magnetic flux generated by a spin ensemble is detected by a superconducting flux qubit with a loop area of 47.2 μm2, which is similar to the devices used in our previous experiments18,37,38. The qubit chip is fabricated using electron-beam lithography and e-beam deposition of the aluminum film. The Al/AlOx/Al Josephson junctions in the qubit and SQUID are fabricated using Dolan bridge technique39. We used two spin ensembles for the experiment: a 10-ppm erbium-doped Y2SiO5 single crystal (Scientific Materials, Inc.) is used for spin-polarization detection and NV centers in type Ib diamond (1.1 × 1018 cm−3) are used for EPR spectroscopy. These crystals are attached to the qubit chip directly under a microscope inspection. To minimize the distance between them, we pay attention for an optical interference fringe to appear. The fringe indicates that the distance between the crystal and the chip is on the order of the wavelength of visible light. The in-plane magnetic field (B||) up to 6 mT is applied to the sample to polarize the spin ensemble. A Helmholtz-like pair of superconducting magnets are used to generate a homogeneous field. A small perpendicular magnetic field (B) of the order of a few tens μT (~Φ0/2) is also applied by a single superconducting magnet. To convert the magnetic current for the perpendicular field magnet into the magnetic flux unit, we use the periodicity of the critical current of a SQUID40 and the area ratio between the SQUID and flux qubit. Here, the perpendicular field is small enough to allow us to neglect the effect to the additional polarization of the spin ensemble as it is much smaller than the in-plane field. B|| and B are parallel to the D1 and D2 axes of the Er3+:Y2SiO5 crystal, respectively. The in-plane magnetic field B|| is oriented parallel to the [100] axis of the diamond crystal. For the spectroscopy of the qubit and spin ensemble, a two-tone microwave signal is applied to the sample through an on-chip microwave line. The microwave line is placed near the edge of the flux qubit (Fig. 1b). This means that the spins near the flux–qubit edge (that is close to the microwave line) can be excited very efficiently. On the other hand, the spins on the other edge (that is far from the microwave line) cannot be excited. This asymmetric spin excitation allows us to detect the in-plane magnetization induced by the spin after the microwave driving. The qubit state is read out by a SQUID using a switching method and averaged over 1000 times. The read-out pulse shape has two steps, as shown in Fig. 1c41. The first step height is tuned near the averaged switching current of the SQUID. In this case, the SQUID changes its state (dissipative or non-dissipative) depending on the magnetic flux (the circulating current) from the qubit corresponding to the qubit state. The second step is added to increase the signal-to-noise ratio by integrating the signal. We repeat the measurement with a period of 200 μs to reduce the number of quasiparticles after switching. All the measurements are performed in a dilution refrigerator, whose base temperature is lower than 20 mK. We control the temperature of the refrigerator by a heater. After changing the temperature, we wait for a long enough time to thermalize the spin system.

Definition of the noise in the switching probability

The qubit state is read out by a SQUID with a switching method, whose outcome is 0 or 1. The average value of repeated read-out data is defined as a switching probability. This switching probability has an inherent fluctuation due to its probabilistic nature. We define the fluctuation as a noise in the switching probability. To derive the noise (or fluctuation) in the switching probability experimentally, we record many single SQUID read-out data. Then, the dataset is separated into bins of size Nrep. We can calculate an average value of the data at each bin. From these calculated average values at the bins, we can calculate the standard deviation, which we call the noise in the switching probability.

Derivation of the system Hamiltonian in a far detuned regime

A single spin and flux–qubit coupling system is described by the following Hamiltonian:

$$\hat H = \frac{{h\varepsilon }}{2}\hat s_3 + \frac{{h\Delta }}{2}\hat s_1 + h{\bf{g}} \cdot \widehat {\bf{S}}\hat s_3 + \hat H_{\mathrm{s}},$$
(3)

where \(\hat s_i\) is the Pauli matrix for the flux qubit, g = (gx, gy, gz) is the coupling strength between a spin and a flux qubit, \(\widehat {\bf{S}}\) is the spin operator vector associated with the spin, and \(\hat H_{\mathrm{s}}\) is the spin Hamiltonian for the spin. The axis dependence of g is attributed to the direction of the magnetic field generated by the flux qubit. Here, we define the z axis as the quantization axis of the spin. By diagonalizing the flux–qubit term, we obtain the following Hamiltonian:

$$\hat H = \frac{{hf_{\mathrm{q}}}}{2}\hat \sigma _3 + h{\bf{g}} \cdot \widehat {\bf{S}}\left( {\hat \sigma _3\,{\mathrm{cos}}\, \theta + \hat \sigma _1\,{\mathrm{sin}}\,\theta } \right) + \hat H_{\mathrm{s}},$$
(4)

where θ is the mixing angle defined by tan θ = Δ/ε. Because we operate the flux qubit far from the optimal point (\(\left| \varepsilon \right| \gg {\mathrm{\Delta }}\), sin θ ~0), we can safely neglect the transverse coupling term:

$$\hat H = h\left( {\frac{{f_{\mathrm{q}}}}{2} + {\bf{g}} \cdot \widehat {\bf{S}}} \right)\hat \sigma _3 + \hat H_{\mathrm{s}}.$$
(5)

Thus, the resonance frequency of the flux qubit is modified by \({\bf{g}} \cdot \widehat {\bf{S}}\) due to the interaction with a single spin. In our EPR spectroscopy technique, we detect the difference between the qubit frequencies with or without spin resonance. Without spin resonance, the qubit frequency is shifted due to the polarization of the spin. On the other hand, the qubit frequency stays on the bare frequency when the spins resonate with the microwave, because time-averaged polarization is zero, thanks to the rotation of the spin vector.

Estimation of the spin sensitivity

To derive the spin sensitivity Nmin from the experiment, the signal-to-noise ratio and the corresponding number of spins Nspin are usually used:

$$N_{{\mathrm{min}}} = \frac{{N_{{\mathrm{spin}}}}}{{A^{{\mathrm{signal}}}{\mathrm{/}}A^{{\mathrm{noise}}}}},$$
(6)

where the denominator is the signal-to-noise ratio of the spectrometer output A. However, we use the following mathematically equivalent equation instead:

$$N_{{\mathrm{min}}} = \frac{{{\mathrm{\Delta }}f_{\mathrm{q}}^{{\mathrm{noise}}}}}{{{\mathrm{\Delta }}f_{\mathrm{q}}^{{\mathrm{signal}}}{\mathrm{/}}N_{{\mathrm{spin}}}}},$$
(7)

where the spectrometer signal output A is replaced by the explicit quantity (frequency shift of the flux qubit Δfq). The denominator can be derived as one quantity, thanks to magnetic flux detection, as we will explain later.

To estimate the sensitivity quantitatively from the experiment, we need to derive the frequency noise \({\mathrm{\Delta }}f_{\mathrm{q}}^{{\mathrm{noise}}}\) from the noise in the switching probability \(P_{\mathrm{e}}^{{\mathrm{noise}}}\), because it is the most fundamental measured noise in our experiments. For this purpose, we use a transfer function between the switching probability Pe and the microwave frequency applying to the flux qubit \(f_{\mathrm{q}}^{{\mathrm{ex}}}\): \(\partial P_{\mathrm{e}}{\mathrm{/}}\partial f_{\mathrm{q}}^{{\mathrm{ex}}}\). Here, we assume a Lorentzian lineshape for \(P_{\mathrm{e}}(f_{\mathrm{q}}^{{\mathrm{ex}}})\):

$$P_{\mathrm{e}}(f_{\mathrm{q}}^{{\mathrm{ex}}}) = V\frac{{\gamma _{\mathrm{q}}^2}}{{(f_{\mathrm{q}}^{{\mathrm{ex}}} - f_{\mathrm{q}})^2 + \gamma _{\mathrm{q}}^2}},$$
(8)

where V is the visibility of the readout, and γq is the linewidth of the flux qubit (see Fig. 4b). We can easily derive the parameters V, fq, and γq from the experiment. To maximize the sensitivity, the excitation frequency \(f_{\mathrm{q}}^{{\mathrm{ex}}}\) is set at the steepest point of the \(P_{\mathrm{e}}(f_{\mathrm{q}}^{{\mathrm{ex}}})\) curve. This condition is satisfied when \(| {f_{\mathrm{q}}^{{\mathrm{ex}}} - f_{\mathrm{q}}} | = \gamma _{\mathrm{q}}{\mathrm{/}}\sqrt 3\) and the resulting slope \(| {\partial P_{\mathrm{e}}{\mathrm{/}}\partial f_{\mathrm{q}}^{{\mathrm{ex}}}} |\) is \(3\sqrt 3 V{\mathrm{/}}8\gamma _{\mathrm{q}}\).

We can estimate the sensitivity from the magnetometry of the spin system because it gives the conversion factor between the number of spins and the generated flux. In this case, we can convert Eq. (7) using a transfer function:

$$\frac{{{\mathrm{\Delta }}f_{\mathrm{q}}^{{\mathrm{signal}}}}}{{N_{{\mathrm{spin}}}}} = \frac{{\partial f_{\mathrm{q}}}}{{\partial \Phi }}\frac{{{\mathrm{\Phi }}_{{\mathrm{spin}}}}}{{N_{{\mathrm{spin}}}}},$$
(9)

where ∂fq/∂Φ = 2Ip/h corresponds to the persistent current of the flux qubit Ip and Φspin/Nspin is the magnetic flux generated by a spin, which is derived from a SQUID magnetometry28. As a result, the following equation can be used to estimate the sensitivity from the magnetometry:

$$N_{{\mathrm{min}}} = \frac{{8h\gamma _{\mathrm{q}}}}{{3\sqrt 3 V}}\frac{{P_{\mathrm{e}}^{{\mathrm{noise}}}}}{{2I_{\mathrm{p}}{\mathrm{\Phi }}_{{\mathrm{spin}}}{\mathrm{/}}N_{{\mathrm{spin}}}}}.$$
(10)

We can also estimate the sensitivity using the relationship between the number of spins and the frequency shift of the flux qubit (see Supplementary Note 5) as follows:

$$N_{{\mathrm{min}}} = \frac{{8h\gamma _{\mathrm{q}}}}{{3\sqrt 3 V}}\frac{{P_{\mathrm{e}}^{{\mathrm{noise}}}}}{{g_{\mathrm{e}}\mu _{\mathrm{B}}\left| {{\bf{B}}_{\mathrm{q}}({\bf{x}})} \right|_{{\mathrm{ave}}}}},$$
(11)

where geμB|Bq(x)|ave is the averaged coupling strength between the spin and the flux qubit. The averaged coupling strength for our setup is estimated from the system geometry and the Biot–Savart law18 as geμB|Bq(x)|ave = hgz = h × 4.4 kHz.

In this article, we estimate the sensitivity by using Eqs. (10) and (11).