Electron spin control of optically levitated nanodiamonds in vacuum

Electron spins of diamond nitrogen-vacancy (NV) centres are important quantum resources for nanoscale sensing and quantum information. Combining NV spins with levitated optomechanical resonators will provide a hybrid quantum system for novel applications. Here we optically levitate a nanodiamond and demonstrate electron spin control of its built-in NV centres in low vacuum. We observe that the strength of electron spin resonance (ESR) is enhanced when the air pressure is reduced. To better understand this system, we investigate the effects of trap power and measure the absolute internal temperature of levitated nanodiamonds with ESR after calibration of the strain effect. We also observe that oxygen and helium gases have different effects on both the photoluminescence and the ESR contrast of nanodiamond NV centres, indicating potential applications of NV centres in oxygen gas sensing. Our results pave the way towards a levitated spin–optomechanical system for studying macroscopic quantum mechanics.

W ith electron spin states accessible by visible lasers and microwave radiation 1-3 , diamond nitrogen-vacancy (NV) centres have broad applications in quantum information [4][5][6] and nanoscale sensing of magnetic field 7-9 , temperature 10,11 , and beyond 12,13 . Combining such NV spin systems with mechanical resonators 14,15 will provide a hybrid system with versatile functions 16 . Recently, several authors proposed to levitate a nanodiamond with a built-in NV centre in vacuum as a novel hybrid spin-optomechanical system for creating large quantum superposition states 17,18 , testing quantum wavefunction collapse models [17][18][19] and quantum gravity 20 . A levitated nanodiamond will also be an ultrasensitive torque detector 21 and mass spectrometer at room temperature 22 . These proposals are inspired by recent progresses in optomechanics of levitated pure dielectric (mainly silica) particles [23][24][25][26][27][28][29][30] , which show optical levitation in vacuum can isolate the mechanical motion of a dielectric particle from the environment to improve the mechanical quality factor.
Nanodiamonds have been optically trapped in liquid 31,32 , atmospheric air 33 and low vacuum 21,34,35 . Recently, the electron spin resonance (ESR) of optically levitated nanodiamonds has been demonstrated in atmospheric air 34 . The angular trapping and torsional vibration of an optically levitated nanodiamond have also been observed, which are important for controlling the orientations of NV spins 21 . The next key step towards realizing these ambitious proposals 17,18,20,22 is to control the NV electron spin of a levitated nanodiamond in a vacuum environment, which has not been demonstrated before.
Here we demonstrate the electron spin control and direct temperature measurement of NV centres in an optically levitated nanodiamond in low vacuum. Our work is enabled by using a 1,550-nm trapping laser. We find that the 1,550-nm laser is more benign to the photoluminescence of NV centres than a 1,064-nm trapping laser 34 . One would usually expect that the ESR signal of an optically levitated nanodiamond in vacuum to be weaker than that in atmospheric air due to laser heating in vacuum 36 . To our surprise, the ESR contrast of an optically levitated nanodiamond is enhanced in a vacuum environment. We attribute this ESR enhancement to the reduction of low-quality negatively charged NV À centres near the surface due to the reduction of oxygen surface termination [37][38][39][40] , and a moderate increase of the temperature that quenches low-quality surface NV À centres 41 without significantly affecting high-quality NV À centres at the centre of the nanodiamond 36 . We also observe that oxygen (O 2 ) and helium (He) gases have different effects on the photoluminescence and ESR contrast of nanodiamond NV centres. These observed effects are reversible, indicating that nanodiamond NV centres can be used for oxygen gas sensing 13 . To better understand this system, we investigate the effects of trapping laser on ESR and measure the absolute temperature of levitated nanodiamonds in vacuum with ESR 10,36 after calibration of the strain effect 13 . The ability to remotely measure the internal temperature of a levitated nanodiamond will have applications in investigating non-equilibrium thermodynamics 25,42,43 .

Results
Optical levitation of nanodiamonds. In our experiment, a nanodiamond with a diameter about 100 nm is optically trapped inside a vacuum chamber (Fig. 1). We first launch a mixture of commercial nanodiamonds and water to the trapping region with an ultrasonic nebulizer. The water microdroplets evaporate and a nanodiamond will be captured by a tightly focused 500 mW, 1,550 nm laser beam after waiting for a few minutes (see Methods). After a nanodiamond is captured, we evacuate the air in the chamber by a turbomolecular pump. A trapped nanodiamond will eventually be lost when the air pressure is below a critical value, which is a few torr for commercial nanodiamonds that we used (see Methods).
Effects of trapping laser on ESR. For an optically levitated nanodiamond, one needs to consider effects of the trapping laser while studying its NV centres. We investigate this effect by measuring the fluorescence spectra and ESR spectra at different trapping powers (Fig. 2). We excite the trapped nanodiamond with a 532-nm laser and collect its fluorescent signal by a spectrometer with an electron multiplying charge-coupled device (EMCCD) camera with a single-photon sensitivity. To study the ESR, we excite the electron spin states by microwave radiation delivered by a coplanar waveguide antenna (see Methods). The normalized fluorescence signal I PL of the ESR spectrum is the ratio of total fluorescence count with and without the microwave excitation. The resonance peaks of electron spin transition occur at the microwave frequencies of minimum I PL . The ESR contrast is defined as 1 À I PL . As shown in Fig. 2a,b, both the fluorescent signal and the ESR contrast decrease when the trapping power increases. To understand these phenomena, we need to consider two primary effects associated with the trapping laser: heating 44 and photo-induced ionization when a 532-nm laser is also present 45 .  Figure 1 | Schematic of the experiment. (a) A nanodiamond (blue sphere) is trapped inside the vacuum chamber using optical tweezers formed by a 1,550-nm laser (magenta beam) and an objective lens. The position detector monitors its centre-of-mass motion. The NV centres are optically excited by a 532-nm laser (green beam) guided by a beam splitter and a long-pass dichroic mirror. The fluorescent signal (orange beam) of the NV centres is detected by a spectrometer with an EMCCD camera. Electron spins are controlled by microwaves delivered by an antenna. Magenta, green and orange arrows illustrate the directions of light beams. (b) Energy levels of a NV À centre. Solid arrows represent radiative transitions while dashed arrows represent nonradiative transitions. 3 A 2 , 1 E, 1 A 1 and 3 E denote electronic states of the NV centre, and m s ¼ 0, ± 1 denote the spin states of 3 A 2 . (c) Molecular structure of a NV centre in a nanodiamond (the blue sphere in a indicated by the arrow). Carbon atoms are shown in grey spheres (labelled C), the lattice vacancy is labelled by a white cube (labelled V) and the nitrogen atom is labelled by a white sphere (labelled N). Each nanodiamond has about 500 NV centres.
Since the absorption of the trapping laser increases temperature, a higher trapping power leads to a higher temperature of the nanodiamond (Fig. 2c). The visible fluorescent signal comes from the radiative decay transition 3 E -3 A 2 . There is also a competing process that the excited state 3 E may relax to the ground state 3 A 2 through nonradiative process with metastable states 1 E and 1 A 1 (Fig. 1b). Because a high temperature enhances the nonradiative decay 36 , it weakens the visible fluorescence strength (Fig. 2a).
Besides heating, the 1,550-nm trapping laser can cause photoinduced ionization of NV À to NV 0 when the 532-nm laser is on [45][46][47][48] . As shown in Fig. 1b, the 532-nm laser excites the NV centres from the ground state 3 A 2 to the excited state 3 E. Since the separation between the excited state and the conduction band is 0.67 eV (corresponding to a vacuum wavelength of 1,880 nm) 45 , the 1,550-nm trapping beam can excite electrons from the excited state 3 E to the conduction band and consequently ionize NV À to NV 0 . Because high trapping power increases the ionization rate from NV À to NV 0 , the fluorescence signal from NV À will be reduced as seen in Fig. 2a. Similar effects have been observed for laser wavelength 1,064 nm and below 33,[44][45][46][47][48][49] . We note that the 1,550-nm laser is better than a 1,064-nm laser for the nanodiamond NV centres. More than 70% of bare nanodiamonds trapped by a 1,550-nm laser show a strong fluorescence signal, while only a few percent of bare nanodiamonds (even though each nanodiamond contains about 500 NV centres on average) and 10-20% silica-coated nanodiamonds trapped by a 1,064-nm laser produce photoluminescence 33,34 . The ionization not only reduces the fluorescence strength, but also lessens the ESR contrast. When the recombination of NV 0 to NV À occurs 45 , the probability of NV 0 ending up in |m s ¼ 0i state will be 1/3. Thus the ionization due to trapping laser will reduce the overall population of m s ¼ 0 (ref. 50) and reduces the ESR contrast.
ESR in vacuum. Since nanodiamond temperature increases in vacuum, the ESR spectrum shifts to the left as shown in Fig. 3a. From atmospheric pressure to 31 torr, the diamond temperature can rise from 300 K to above 450 K (Fig. 3b). When the mean free path of gas molecules is larger than the size of the nanodiamond, the cooling due to the surrounding gas is proportional to the pressure. So the increase of the temperature of the nanodiamond is inversely proportional to the pressure: DT / 1=P gas Each ESR scan takes about 30 min to achieve a high signal-to-noise ratio. These ESR spectra are taken with the nanodiamond marked as blue circles in c, which has a small temperature change. (c) At the initial trapping power of 500 mW, the internal temperature of the nanodiamond ranges between 300 and 400 K depending on individual nanodiamonds. When the trapping power reduces, the internal temperature of the nanodiamond approaches the room temperature (296 K). Temperatures are extracted from the double Gaussian fits of the ESR spectra, and the error bars of temperatures are obtained from the standard errors of the fitted parameters from the ESR spectra. Each marker shape represents a different nanodiamond. Data are acquired at atmospheric pressure. a.u., arbitrary unit. (see Methods), as shown by the solid curves in Fig. 3b. When the temperature rises in vacuum, one would expect the ESR contrast to decrease. Counter intuitively, the data show that the ESR contrasts of levitated nanodiamonds increase by more than a factor of 2 when the pressure is decreased from atmospheric pressure to 31 torr (Fig. 3a,c). This important phenomenon has not been observed before since the ESR of a levitated nanodiamond has not been studied in a vacuum environment before our work. The latest relevant work reported the ESR of a levitated nanodiamond in atmospheric air 34 , but not in vacuum. Using a 1,550-nm trapping laser instead of a 1,064-nm laser as in ref. 34, we observe more than 70% of nanodiamonds in the optical trap are fluorescent, which is crucial for our investigation of ESR in vacuum.
To verify that the increase in ESR contrast is a reversible process instead of a permanent change of the nanodiamond, we performed an experiment in which the chamber was first pumped from atmospheric pressure to 74 torr, and then brought back to atmospheric pressure. The contrast at the later atmospheric pressure is slightly higher than the initial atmospheric pressure (red square markers in Fig. 3c), but significantly smaller than the ESR contrast at low pressure. The slight increase of the ESR contrast at the later atmospheric pressure can be explained by the purification of the nanodiamond after exposed to vacuum 51,52 . However, the main change of the ESR contrast is reversible. If the nanodiamond is permanently changed, one would expect the nanodiamond to maintain a high ESR contrast when the pressure is brought back to atmospheric level from 74 torr, which is opposite to the measured data. So there is no significant change of the nanodiamond after exposed to low vacuum. Therefore, the reduction of surrounding and absorbed air molecules is the primary source of the ESR enhancement.
ESR in different gases. To further understand the effects of the surrounding gas on levitated nanodiamond NV centres, we changed the surrounding gas between oxygen and helium repeatedly while a nanodiamond was levitated continuously for many hours. As shown in Fig. 4, we first took the data set no. 1 in oxygen. We then changed the gas in the chamber to helium and took the data set no. 2. At last, we changed the gas back to oxygen and took the data set no. 3. The filled helium or oxygen gas in the chamber has a purity larger than 99%, achieved by repeatedly evacuating and filling the chamber several times with a desired gas. The data set no. 1 and data set no. 3 are essentially the same (Fig. 4), showing the observed effects are reversible and the temporal drift of our system in several hours is negligible.
Our results demonstrate that oxygen and helium gases have different effects on both the ESR contrast and the fluorescence strength of levitated nanodiamond NV centres (Fig. 4). The ESR contrast of nanodiamond NV centres in helium is about 25% higher than that in oxygen (Fig. 4b), while the fluorescence strength in helium is about 30% lower than that in oxygen near atmospheric pressure (Fig. 4c). When the pressure decreases, the ESR contrast increases while the fluorescence signal decreases in both helium and oxygen. The different effects of oxygen and helium on the ESR contrast and fluorescence cannot be explained by their temperature difference, for example, the fluorescence strength in helium is lower than that in oxygen even through the temperature in helium is lower (the thermal conductivity of helium is higher). In general, the fluorescence strength should increase when the temperature decreases (Fig. 4a,c) 36,41 .
The observed phenomena in Fig. 4 can be explained by the reduction of low-quality negatively charged NV À centres near the surface due to the reduction of oxygen surface termination [37][38][39][40] , and a moderate increase of the temperature that quenches low-quality surface NV À centres 41 without significantly affecting high-quality NV À centres at the centre of the nanodiamond 36 . Comparing with NV centres far away from the surface 36 , NV centres near the surface have stronger non-radioactive decays, and thus a lower ESR contrast and stronger temperature dependence 41 . It has been observed that the fluorescence of NV centres in 20-30-nm-diameter nanodiamonds decreased by 10-40% when the temperature increased from 300 to 400 K (ref. 41), accompanying by a decrease of the lifetime of the excited state due to non-radioactive decay. In contrast, the fluorescence of a NV centre inside a bulk diamond only decreases by a few percent when the temperature is increased from 300 to 450 K (ref. 36). In our experiment, the trapped nanodiamond has about 500 NV centres and a diameter of about 100 nm. When the pressure decreases, the fluorescence of low-quality surface NV centres are suppressed at an increased temperature (Fig. 4c). To roughly estimate the thickness of the surface shell where the fluorescence of NV centres is quenched, we assume that NV centres are uniformly distributed in the nanodiamond and the fluorescence signal C inner of a levitated nanodiamond in low vacuum comes from NV centres within the inner core of radius r inner . The r inner can be estimated by comparing C inner to the fluorescence count C atm at atmospheric pressure: C inner =C atm % r 3 inner =r 3 , where r is the radius of the nanodiamond. So r À r inner is approximately the thickness of the surface shell. The thickness of the surface shell is estimated to be about 10-15 nm for the levitated nanodiamond at 100 torr (Fig. 4c). Because the high-quality NV centres at the centre of the 100-nm nanodiamond are largely unaffected by the temperature increase while the low-quality NV centres near the surface are quenched, the overall ESR contrast increases due to the average effect of 500 NV centres (high-quality and low-quality) as shown in Fig. 4b. Moreover, a large fraction of NV centres in a nanodiamond are in NV 0 charge state 39,53 , which have low fluorescence signal and no ESR near 2.8 GHz. The oxygen termination allows more NV centres in NV À charge state. Thus the fluorescence strength increases when the levitated nanodiamond is surrounded by oxygen (Fig. 4c). However, the NV À centres enabled by oxygen termination are near the surface and have low contrast. So the ESR contrast decreases in oxygen, as shown in Fig. 4b.
While oxygen has been used for permanent surface termination 37-40 , here we report that this can also happen in air near room temperature and is reversible. Because the effects are reversible, nanodiamond NV centres can be used for oxygen gas sensing repeatedly. Using the fluorescence signal in helium gases as the background correction for the thermal effect, the count difference in oxygen and helium gases exhibits roughly linear dependence on the pressure. Although the total fluorescence counts (Fig. 4c) show a nonlinear scaling, the difference between the counts in oxygen and helium gases (Fig. 4d) trends to be proportional to the pressure in the range of our data. As a firstorder approximation, we fit the data with a line (dashed line in Fig. 4d). We found our current un-optimized imaging setup can detect about 100 photon torr À 1 s À 1 . When the oxygen pressure is very large, we expect the signal to deviate from the linear fit because the maximum signal will be limited by the number of NV centres in the nanodiamond. For future applications in oxygen gas sensing, we can simply put nanodiamonds on a substrate instead of using optical levitation. Oxygen gas sensors are extensively used to monitor the oxygen concentration in exhaust gases of internal combustion engines in automobiles, and in medical instruments such as anaesthesia monitors and respirators. The most common oxygen gas sensor is the zirconia sensor 54,55 , which is an electrochemical fuel cell that consumes some oxygen to generate a voltage output depending on the concentration of the oxygen, and only works effectively after being heated up. Comparing with zirconia oxygen sensors, the nanodiamond oxygen sensors do not consume oxygen and do not need to be heated up in order to work. Nanodiamond sensors will also be much smaller. Multiple nanodiamonds can be used to improve the sensitivity. An area of 5 mm Â 5 mm can have thousands of nanodiamonds.

Discussion
In this paper, we optically levitate a nanodiamond and demonstrate electron spin control of its built-in NV centres in low vacuum and different gases. We observed that the ESR contrast of NV centres increases when the air pressure decreases. We also observe that oxygen and helium gases have different effects on both the photoluminescence and the ESR contrast of nanodiamond NV centres. While more detailed studies are required to fully understand this phenomenon, our observation suggests a potential application of nanodiamond NV centres for oxygen gas sensing. The increase of ESR contrast in low vacuum can improve the sensitivity of other NV centre devices such as nanodiamond magnetic/electric field sensors where the NV centres are near the diamond surfaces. We also study the effects of trapping laser and measure the absolute internal temperature of the levitated nanodiamond in vacuum to better understand this system. The results show that the internal temperature of an optically levitated nanodiamond increases significantly in low vacuum. This is because the commercial nanodiamonds used in this work are not pure and have large optical absorption. Better nanodiamond samples with negligible absorption 56 at the trapping wavelength are required to be optically trapped in high vacuum.

Methods
Experimental setup. A mixture of nanodiamonds (Adamas ND-NV-100 nm-COOH) and water at density about 30 mg ml À 1 is launched into a vacuum chamber using a Mabis ultrasonic nebulizer for optical trapping. A nanodiamond is captured and trapped by a 1,550-nm laser beam at the focus of a numerical aperture ¼ 0.85 infrared objective lens (Fig. 1a). The position detector monitors 25 the centre-of-mass motion of the nanodiamond using the trapping beam after exiting the vacuum chamber. The NV centres are optically excited by a 532-nm laser beam guided by a beam splitter and a 950-nm long pass dichroic mirror. The fluorescence signal of the NV centres are detected by an Andor spectrometer and a Newton EMCCD camera. The electron spin of NV centres are controlled using a microwave antenna 31 at a distance of 0.5 mm from the nanodiamond. The gas pressure inside the vacuum chamber is measured by an absolute piezo sensor for pressures above 10 torr, and a micropirani sensor for lower pressures.
Optical levitation of a nanodiamond in low vacuum. To verify the trapped nanodiamond (Fig. 5a) has NV centres, we excite the particle with a 532-nm green laser beam and analyse the fluorescence signal using a spectrometer with an EMCCD (Fig. 1a). One unique signature of NV À centre is the zero phonon line (ZPL) around 637 nm due to the 1.94 eV transition between the 3 A 2 ground state and the 3 E excited state as depicted in Fig. 1b (refs 10,45). At room temperature, the visible fluorescence spectrum covers from 600 to 800 nm due to thermal phonon broadening. In Fig. 5b, the fluorescence spectrum indicates a ZPL at 640 nm. This small shift of ZPL from 637 nm is because of temperature effect 3,11,57 . We observe that the visible fluorescent strength of levitated NV centres decreases and the ZPL becomes weaker in vacuum (Fig. 5b). When the air pressure decreases, the nanodiamond temperature rises because the cooling rate from air molecules reduces while the heating from the trapping laser remains the same.
Besides optical properties of NV À centres, we also monitor the centre-of-mass motion (CMM) of a trapped nanodiamond using the x axis position detector 25 . At atmospheric pressure, Brownian motion due to collisions with air molecules predominates the harmonics oscillation due to the trapping potential. In low vacuum, the harmonic motion dominates. As a result, a resonant peak (E100 kHz) appears in the spectrum of power spectral density (PSD) of the CMM at low pressure (Fig. 5c). Fitting the PSD data to theory (equation (1)) reveals useful information about the optomechanics system 58 , including trapping frequency O 0 and viscous damping factor due to air molecules G 0 . The trapping frequency O 0 /2p is about 100 kHz and viscosity damping coefficient G 0 /2p goes from about 500 kHz at atmospheric pressure to about 40 kHz at 31 torr. From the fitting parameter G 0 /2p, the hydrodynamic diameter of nanodiamond, 2r ¼ 94 ± 7 nm (equation (2)), remains constant for over 30 min (Fig. 5d). This result is consistent with the manufacturer specification size of 100 nm. In fact, we observed that a single nanodiamond remains in the trap for more than 200 h at atmospheric pressure and in low vacuum. A trapped nanodiamond will be lost, however, when the air pressure is below a critical value. Figure 5f shows a nanodiamond is lost when the pressure is reduced to 9 torr. We also observed some nanodiamonds trapped at slightly lower pressures.
Particle loss mechanism. Combining the fluorescence signal and CMM motion together provides an insight into the loss mechanism of levitated nanodiamonds in vacuum. As shown in Fig. 5e, a levitated nanodiamond is lost after being held at 31 torr for 17 min. The total count of the fluorescence signal first decreases gradually and then drops rapidly within the last 60 s before the nanodiamond is lost (Fig. 5e). Based on the fluorescence signal alone, one might conclude that the nanodiamond is gradually burned in residual air in the vacuum chamber. However, the viscous damping factor G 0 /2p, which is related to the particle size (equation (2)) is fairly constant at 31 torr. So the size of the nanodiamond does not change significantly before it is lost. This is consistent with the internal temperature of the nanodiamond measured by the ESR which will be discussed later. For the nanodiamond shown in (Fig. 5e), its internal temperature is about 450 K (177°C). According to a former investigation, the size-reduction speed of nanodiamond due to air oxidization at atmospheric pressure is about 1 nm h À 1 at 770 K. At 450 K, the size reduction of a nanodiamond should be negligible, especially because the oxygen pressure is low in low vacuum. So the loss of a trapped nanodiamond is unlikely due to oxidization, instead it might relate to the Brownian motion due to the rising temperature of the nanodiamond. When the temperature of the nanodiamond increases, the effective temperature of surrounding gases increases 42 . Since the mean squared displacement of the Brownian motion, hx 2 i, is proportional to effective temperature of surrounding gases, the particle will explore a larger volume and be more likely to escape from the trapping region. The loss of levitated nanodiamond in an optical trap is similar to Kramer's escape rate problem describing the escape rate of a particle from a potential barrier, R escape / 1 G0 e À Eb=ðkBTÞ (ref. 59), where G 0 is the viscous damping factor, E b is the potential barrier, k B is Boltzmann's constant, and T is the nanodiamond temperature. The escape rate increases with increasing temperature of the particle. A larger vibration amplitude can lead to a decrease of the fluorescence signal when the nanodiamond randomly walks away the trapping region (overlapping with the focus of the visible imaging system). Though, more studies are required to further clarify the loss mechanism.
CMM motion calibration. When the nanodiamond is at the thermal equilibrium, the PSD of nanodiamond CMM is given by ref. 60.
Here S 0 ¼ 2k B T/m, T is the air temperature, m is the nanodiamond mass, G 0 is the viscous damping factor due to the air, O x is the trapping frequency in the x axis and o is the observation frequency. Fitting the CMM power spectral density data in Fig. 5c to equation (1), one can extract three fitting parameters S 0 , G 0 and O x . In general, the fit works best when the o x is comparable to or larger than G 0 (that is, when pressure is below 300 torr). The trapping frequency depends on the laser trapping power. Since the refractive index of air is 1.0027, similar to vacuum, the trapping potential in air should be essentially the same as in vacuum. The trapping frequency O x does not change much from 300 to 10 torr according to the data. Therefore, the trapping frequency is presumably constant.
Particle-size calculation. Since it is difficult (and not important) to know the exact shape and size of the nanodiamond (which can be irregular), we estimate its hydrodynamic size from the viscous damping factor as refs 27,61.
where Z is the dynamic viscosity coefficient of the air, r is the hydrodynamic radius of the nanodiamond, Kn ¼ s/r is the Knudsen number with s being the mean free path of air molecules and c K ¼ 0:31Kn=ð0:785 þ 1:152Kn þ Kn 2 Þ. The mean free path is linearly dependent on the viscosity as ref. 61.
Here P is the pressure and m air is the mass of air molecule. In 1866, Maxwell demonstrated that the viscosity of air remains constant from atmospheric pressure down to a few Torr 62 . At atmospheric pressure, the nanodiamond in Fig. 5d (E300 K) is presumably in thermal equilibrium with air molecules. The temperature dependence of the viscosity can be calculated using Sutherland's formula 63 , which yields ZE18.52 Â 10 À 6 (Pa s) and sE67 nm at room temperature (296 K). The viscous damping factor is G 0 E500 kHz obtained from the power spectral density fit of Fig. 5c with equation (1). Solving for r in equation (2), we obtain the nanodiamond diameter of 94 ± 7 nm while monitoring the particle size for over 30 min (Fig. 5d). At low vacuum, the nanodiamond is not in thermal equilibrium with the surrounding gas due to its high internal temperature, so equation (2) is not suitable to calculate the particle size.
ESR technique. The ESR experiments were conducted using an optically detected magnetic resonance technique 3,64 . We employed a similar microwave antenna design and the microwave lock-in technique described in ref. 31. To obtain the ESR signal, the electron spin states are excited j m s ¼ 0i $ jm s ¼ AE 1i by microwave pulses. For a given frequency, the antenna delivers a sequence of 500 ms alternative on/off microwave pulses to control the electron spin of NV centres. When the microwave pulse is on, the NV ground spin state |m s ¼ 0i is excited to |m s ¼ ±1i, and vice versa. At the same time, the visible fluorescence spectrum of the diamond is acquired using the spectrometer (Fig. 1a). Since the visible fluorescence signal of |m s ¼ ± 1i is weaker than the |m s ¼ 0i state, there is a dip in the plot of the normalized I PL when ESR happens. The normalized fluorescence signal I PL is the ratio of total fluorescence counts with and without microwave excitation, where the resonance peaks occur at the frequencies of minimum I PL .
Nanodiamond temperature. The zero-field Hamiltonian of NV centre is written as ref. 8.
Here D is the energy splitting between spin ground state |m s ¼ 0i and |m s ¼ ± 1i, and E is the splitting between |m s ¼ ±1i due to the broken axial symmetry of the NV centre caused by the strain effect 3,65 . This Hamiltonian results in a double peak resonance spectrum as seen in Fig. 2b where D is centre of the double peaks, and E is the separation between two resonance peaks. The parameter E is different for each unique NV centre. Overall we observe a separation 2EB10 MHz which is consistent with early measurements in bulk diamond 3,10 . Since the ambient magnetic field was measured to be 600 mG using a commercial magnetometer, the separation between two resonance peaks is mainly contributed by the zero-field  (1)). (d) The hydrodynamic diameter of a trapped nanodiamond calculated from the measured viscosity damping G 0 (equation (2)). (e) The viscous damping factor G 0 and total fluorescence count of a levitated nanodiamond at 31 torr. The nanodiamond is lost at the right side of this figure. The G 0 is fairly constant, suggesting there is no change in the particle size before its loss. The same nanodiamond is used in b-f. Total fluorescence count of an optically trapped nanodiamond when the chamber is pumped to vacuum. The nanodiamond is lost at 9 torr. a.u., arbitrary unit.
parameter E. The zero-field splitting parameter D depends on temperature as in ref. 36.
here a 0 ¼ 2.8697 GHz, a 1 ¼ 9.7 Â 10 À 5 GHz K À 1 , a 2 ¼ À 3.7 Â 10 À 7 GHz K À 2 , a 3 ¼ 1.7 Â 10 À 10 GHz K À 3 , D pressure ¼ 1.5 kHz bar À 1 is the pressure-dependence shift 66 and D strain is the internal strain effect depending on the particle. From atmospheric pressure to 1 torr, the shift due to pressure is about 1.5 kHz, equivalent to changing the nanodiamond temperature by 20 mK, which is negligible compared with the thermal shift. Each individual nanodiamond has a different internal strain D strain about a few MHz (ref. 49). This could lead to an uncertainty of tens of kelvins in measuring the absolute temperature if D strain is neglected. As shown in Fig. 2c, the temperature of each nanodiamond increases linearly with the trapping power (within the range of measured data), although of the slope of each line is different. We can use this linear dependence relation to determine the internal strain of each trapped nanodiamond. One can solve for temperatures T from D(T) in equation (5) using the parameters D obtained from the double Gaussian fit of ESR spectra 10,31 . Since we know the internal temperature of the nanodiamond is at room temperature (296 K) when there is no trapping laser, the linear fit in Fig. 2c should intersect the vertical axis at 296 K when the laser power is zero. From this known temperature at the limit of zero trapping power, we determine the internal strain D strain of each individual nanodiamond.
The levitated nanodiamond in a gas or low vacuum is cooled from the collisions with surrounding gas molecules. In the molecular regime, the cooling rate is proportional to the gas pressure. Therefore, the temperature of the nanodiamond depends on the pressure of the surrounding gas approximately as with T 0 being the room temperature, and a being a coefficient that depends on the properties of the particle and surrounding gas, and the laser power. This simple equation fits well with our experimental results shown in Figs 3b and 4a.
Data availability. The data that support the findings of this study are available from the corresponding author upon request.