Coherent control of NV$^-$ centers in diamond in a quantum teaching lab

The room temperature compatibility of the negatively-charged nitrogen-vacancy (NV$^-$) in diamond makes it the ideal quantum system for a university teaching lab. Here, we describe a low-cost experimental setup for coherent control experiments on the electronic spin state of the NV$^-$ center. We implement spin-relaxation measurements, optically-detected magnetic resonance, Rabi oscillations, and dynamical decoupling sequences on an ensemble of NV$^-$ centers. The relatively short times required to perform each of these experiments (<10 minutes) demonstrate the feasibility of the setup in a teaching lab. Learning outcomes include basic understanding of quantum spin systems, magnetic resonance, the rotating frame, Bloch spheres, and pulse sequence development.


I. INTRODUCTION
The arrival of the second quantum revolution -technologies that exploit coherent quantum phenomenon, such as quantum computation, quantum communication, and quantum sensors -has elevated quantum physics from fundamental research to an applied science [1]. A thorough understanding of quantum mechanics is not only desirable but quite often demanded of university graduates entering the job market in this field. Theoretical skills are easily taught with pen and paper, by deriving analytical solutions, or with a few lines of computer code running numerical simulations, but real hands-on experience in manipulating a quantum system is, unfortunately, much more difficult to convey. This is partly due to the sensitivity of quantum systems to environmental disturbances that often demands operation at cryogenic temperatures or inside vacuum chambers, and partly due to the high cost of specialized equipment.
The NV − center in diamond is an especially advantageous quantum system for a teaching lab as its electron spins can be initialized, controlled, and read out at room temperature in ambient atmosphere [2], strongly reducing the complexity of the experimental apparatus. Hence it has previously been recommended for teaching lab setups for magnetic resonance and magnetometry [3], and is even available as a commercial system [4]. However, coherent control of the electronic spin state has not been demonstrated in a convenient and cost-effective fashion.
Here, we describe a teaching lab setup that allows students to learn about fundamental concepts of quantum mechanics by coherently controlling the electronic spin state of the NV − center in diamond. In fact, students can adapt and design their own control sequences and experiments. The presented setup is robust to its environmental conditions, such that it can even be operated in broad daylight on a normal desk, and does not require the carefully controlled environment of a research labo-ratory. Finally, the setup can be assembled for a total cost of less than USD 20k. This paper is organized as follows: In the proceeding section (Section II) we will give an overview of the learning outcomes that can be conveyed with these experiments. In Section III we will give a short introduction to the NV − center in diamond, explaining how initialization, control, and readout of the electronic spin states is achieved. Section IV provides a detailed description of the experimental setup. More specifically, Subsection IV A describes the diamond sample we use, Subsection IV B describes the optical part of the setup, Subsection IV C describes the equipment required for delivery of a microwave (MW) field, and Subsection IV D describes the signal detection scheme using a lock-in amplifier in combination with digital pulse sequences. Finally, Section V describes the various experiments that can be conducted with this setup, with special attention to the quantum mechanical concepts that these experiments convey.

II. LEARNING OUTCOMES
At UNSW Sydney, the experiments described below have been incorporated into a course targeted at the 4thyear undergraduate level. At the time of writing, we have thus far run the course for 1 semester where students have been able to successfully perform all experiments, and demonstrate the learning outcomes. A total of 9 students were enrolled in that semester, and were divided into groups of 2-3. Each group had 2 hours per week to perform the experiments, for 4 weeks in total. Due to the number of groups, two identical setups were built and were operated simultaneously during the lab times. During the course of the labs, it was essential for students to demonstrate links between experimental results, and both quantitative and qualitative understanding of quantum theory. More specifically, these labs encourage students to achieve the following: 1. Understand the NV − center structure, the spin initialization and readout procedure, and the spectral features.
2. Incrementally develop pulse sequences with increasing complexity, i.e. starting from purely optical spin-dynamics for T 1 measurements, to complex dynamical decoupling sequences for T 2 measurements.
3. Understand the rotating frame, magnetic resonance, two-axes control, and be able to follow the spin orientations along the Bloch sphere during pulse sequences.
4. Understand the incremental steps required to implement dynamical decoupling pulse sequences, such as finding a spin transition in the spectrum, performing Rabi oscillations, and calibrating πpulse lengths. Due to the short experimental run times, students can often perform all experiments in a single 2-hour lab once they have obtained the expertise.
Concepts demonstrated with these experiments are transferable to other quantum systems [5], like electron spin qubits confined to donors or quantum dots [6,7], nuclear spin qubits [8], superconducting qubits [9], atoms in ion traps [10], and magnetic resonance imaging (MRI) [11]. Literature that is readily available on these systems frequently benchmarks quantum devices using the same methods as described below. Performing such experiments has, up until now, often only been available to research students in an expensive research lab.

III. THE NV − CENTER IN DIAMOND
The NV − center in diamond consists of a substitutional nitrogen atom adjacent to a vacant lattice site, as schematically shown in Figure 1(a). It can exist along 4 different crystallographic orientations ( [111], [111], [111], and [111]), which are in principle equivalent, but lead to different alignments of their NV − center axes with respect to an externally applied static or oscillating magnetic field.
The static Hamiltonian of the NV − center ground state, neglecting any interactions with nuclear spins or spin-strain interactions, and assuming that the NV − -axis is oriented along the z-direction, is given by: where D = 2.87 GHz is the zero-field splitting of the ground state, γ e = 28 GHz/T is the electron gyromagnetic ratio, B 0 is the magnetic field applied along an arbitrary direction u, and S x,y,z,u are the spin matrices for  1. (a) Atomic structure of the NV center in diamond with a substitutional nitrogen atom (red) adjacent to a vacant lattice site (transparent). The depicted NV center is oriented along the [111] lattice direction, however due to the tetrahedral structure of the crystal lattice, the NV center axis can also be oriented along the [111], [111], and [111]  S = 1 along the x,y,z-axes and the u-direction [12]. In this paper, we will treat H 0 in units of frequency, as this is more relevant for experiments. In order to achieve magnetic spin resonance and coherent control, we need an oscillating magnetic field B 1 that induces transitions between the spin sub-levels. For example, a resonant B 1 field enables us to controllably rotate the ground state spin states from |0 g to |±1 g and back (termed Rabi oscillations). This field is usually created at the position of the NV − centers using a MW signal generator and an antenna (discussed further in Section IV). We include the oscillating magnetic field in the Hamiltonian as a time-dependent term given by: where B 1 is the magnitude of the oscillating magnetic field at frequency ν 1 applied along an arbitrary direction v, and S v is the spin matrix along the v-direction. Due to the exact way the sample is mounted in the setup, there can be an angle between the static magnetic field B 0 , the oscillating magnetic field B 1 , and the direction in which the crystal field acts (defined as the z-direction in Equation 1), as for example indicated in Fig. 4(d). In fact, due to the 4 possible orientations of the NV − center axis in the tetrahedral crystal, NV − s with different orientations will, intrinsically, have different Zeeman splittings and Rabi frequencies.
The energy levels and transitions of the ground, excited and singlet states of the NV − center within the diamond bandgap are depicted in Figure 1  at ν D = 2.87 GHz higher energy than the |0 g state due to the zero-field splitting D. Green laser light at λ = 520 nm or λ = 532 nm can excite the NV − electrons from the ground state |g into the continuum of orbital and vibrational excited states (upper blue shaded region) above the excited state |e (referred to as offresonant excitation), from which they rapidly relax into |e . From there the electrons can decay radiatively, either directly to |g by emitting a photon at λ ZPL = 637 nm into the zero-phonon-line (ZPL), or by simultaneously emitting a phonon and a photon of longer wavelength into the phonon-sideband (PSB). In either case, there is a high probability that the spin state of the electron will remain unchanged during this optical cycling, due to spin-conservation. Alternatively, the NV − electrons can decay non-radiatively via the singlet state |s . Decay from |e to |s is favoured by the |±1 e states compared to the |0 e state (as indicated by the thicker arrow), and decay from |s to |g favours the |0 g spin orientation of |g . Overall, these transition rules have 2 effects: 1. Electrons cycling between the |0 g and |0 e states emit ∼ 30% more photons than those cycling between the |±1 g and |±1 e states. This provides a readout mechanism for the ensemble electronic spin state. 2. With continuous laser excitation, electrons cycling between |±1 g and |±1 e states will over time populate the |0 g state. The electrons can therefore be spin-initialized into the |0 g state [2].

IV. EQUIPMENT
In this section we provide details about the experimental setup. All optical and electrical components were purchased off-the-shelf, while the printed circuit boards for the antenna [see Fig. 2(c)] and the laser current driver (more information in Appendix B) can be commercially manufactured (Gerber files on request). While the diamond samples used for these experiments are not commercially available, the company element six offers diamond samples in their online shop that work without any sample processing. A detailed list of all parts with part numbers and recent prices can be found in Appendix A.

A. Diamond sample
The diamond sample is a single crystal Type 1b highpressure, high-temperature (HPHT) diamond, electronirradiated with a density of 10 18 /cm 2 , and annealed at 900 • C for 2 hours. The top facet is oriented perpendicular to the [111] direction. All experiments measure the photoluminescence (PL) from a large ensemble of NV − centers with all four possible orientations. An unprocessed chemically-vapour-deposited (CVD) diamond sample (available from element six ) is also sufficient for the experiments described herein and will contain a measurable number of NV − centers. The electron irradiation significantly increases the PL intensity but reduces the coherence times which can be a limiting factor for some more advanced measurement protocols.

B. Optical setup
The setup was designed with the goal of keeping the optical components to a minimum while ensuring ease of alignment. This way, the setup can be easily incorporated onto a small optical breadboard (Thorlabs MB3045/M) for portability, and fully covered with an enclosure (Thorlabs XE25C7/M) to constrain laser scattering.
A schematic of the optics part of our setup is shown in Figure 2(b). We use a single mode, fiber-coupled 520 nm green laser diode (Thorlabs LP520-SF15) as our excitation source. The beam is first collimated using an aspheric lens (Thorlabs C280TMD-A), and then reflected off a 550 nm long-pass dichroic mirror (Thorlabs DMLP550) and onto a microscope objective (Olympus MS Plan 50x/0.80NA). The objective lens focuses the laser to a focal spot of ∼ 1 μm on the diamond sample, which results in an excitation volume over which B 0 and B 1 field are both relatively constant. The diamond sample is mounted on a 3-axis translation stage (Thorlabs MBT616D/M). Between the objective lens and the diamond sample, we place a printed circuit board (PCB) MW antenna to create the strong oscillating magnetic field (B 1 field) for spin control. The antenna structure includes a 1 mm diameter hole, through which both the excitation laser, and the PL emission from the diamond sample can pass. The design of the antenna is discussed in more detail in Section IV C.
The PL signal from the diamond sample is transmitted through the dichroic mirror and into the detection part of our setup. Here, a flip-mirror (Thorlabs PF10-03-P01 on Thorlabs TRF90/M) allows the signal to follow one of two paths: 1. Through an achromatic doublet (Thorlabs AC254-125-A) onto a CMOS camera (Thorlabs DCC1545M) that allows for alignment of the sample and focusing of the laser using the 3-axis stage. A 600 nm long pass filter (Thorlabs FEL0600) and a 900 nm short pass filter (Thorlabs FES0900) can be added here to view the PL signal instead of residual laser light. 2. Via two silver-coated mirrors (Thorlabs PF10-03-P01) on separate kinematic mounts (Thorlabs KM100) and through an aspheric lens (Thorlabs C260TMD-B) into a 50 μm multi-mode fiber (Thorlabs M42L01) that guides the light to a photodiode (Thorlabs DET025AFC/M) for detection. A 600 nm long pass filter (Thorlabs FEL0600) and 900 nm short pass filter (Thorlabs FES0900) are placed in this path to ensure that only the NV − PL is detected.

C. Microwave setup
A block diagram of the electronics part of our setup is shown in Figure 2(a). The block labeled 'Microwave Source & Amp' is discussed in this section. First, a PC communicates with the MW source (SignalCore SC800) to set the MW frequency between 0-6 GHz. The MW signal is fed into an I/Q modulator (Texas Instruments TRF370417EVM). The 'I', or 'in-phase', input of the modulator controls the amplitude of a MW signal that has the same phase as the input MW signal. The 'Q', or 'quadrature', input controls the amplitude of a MW signal that is 90 • phase shifted. The output of the modulator is the sum of these signals. For our experiments, it is sufficient to restrict the I and Q inputs to high/low signals (TTL high or low), which enable or disable the I and Q signal components. The modulator's output is therefore either a signal that is in-phase with the input MW signal (I high, Q low), 90 • out phase (I low, Q high), or 45 • out of phase (I high, Q high). The modulator's output is then amplified by a MW amplifier (ZQL-2700MLNW+) to a MW power of +24 dBm (251 mW), and transmitted to the PCB antenna [shown in Figure 2(c)] with via a coaxial cable with SMA connectors on both ends.
The antenna is designed to produce the oscillating magnetic field B 1 at the position of the NV − centers. Figure 2(c) shows our antenna design with all geometrical parameters, adapted from Ref. [13]. The antenna was designed and simulated in-house using Eagle CAD and CST MW Studio, respectively, and manufactured commercially by the PCB manufacturer Seeed Studio. The antenna geometry is referred to as a loop-gap resonator, where the 'loop' in our case is a through hole, near which we can have a strong oscillating B 1 field in the direction perpendicular to the plane of the PCB as shown in Figure 2(d). This hole also allows for both the excitation laser and the PL of the diamond sample to pass through the PCB.
Simulations indicate that the antenna has a resonance at 2.57 GHz, given by the S 11 -dip shown by the blue curve in Figure 2(e). In the manufactured PCB, we measure the resonant S 11 -dip to be at ∼2.49 GHz (red curve), which agrees well with our simulated value. The simulations also indicate that with a MW power of +24 dBm (251 mW), the antenna produces a maximum oscillating magnetic field of B 1 = 306 μT (black curve), which would result in an electron spin Rabi frequency of Ω R = 1 2 γ e B 1 ≈ 4.3 MHz [14]. The diamond sample is placed as close to the top layer [ Figure 2(c)] of the PCB as possible (using tape as adhesive), and we align the excitation laser's focal spot to the center of the hole, where we can expect the greatest homogeneity of B 1 in magnitude ( ∇B 1 = 0.13 μT/μm at +24 dBm of excitation power).

D. Pulsing sequences and lock-in detection
As discussed in Section III, the NV − center emits ∼ 30% more photons when decaying from the |0 e states compared to the |±1 e states. Under experimental conditions, where we collect emission from the four different NV − orientations simultaneously, and spin control of the ensemble is far from ideal, the contrast of the spin signal is limited to a few percent. It is possible to extract the spin signal by using a power-stabilized laser source and sufficient averaging. However, to achieve a more robust implementation for a teaching lab, we employ a lock-in amplifier.
The operation of a phase-sensitive lock-in amplifier is well-known, and described in Ref. [15]. Given a reference frequency, the lock-in amplifier will make a phase sensitive measurement of signals present exactly at that frequency, with a bandwidth as narrow as 0.01 Hz (selectable). If the signal of choice can be modulated at the reference frequency, the lock-in amplifier can extract it with a good signal-to-noise ratio (SNR) from large background signals at other frequencies. For example, in an experiment where laser excitation provides a PL signal from an ensemble of NV − centers, and a resonant MW source drives the spin from the |0 g state to the |±1 g states, the spin signal can be extracted with a lock-in amplifier when the MW field is amplitude or frequency modulated at the reference frequency, while any DC signal is rejected.
The experiments are clocked and triggered by a Pulse Blaster ESR Pro 250 pulse pattern generator, that can be programmed to generate TTL pulse sequences on up to 24 channels. For the experiments described here, we require 4 channels: • 'CH0' provides the reference frequency to a phase sensitive lock-in amplifier (Ametek 5210 or alternatively Stanford Research Systems SR830).
• 'CH1' pulse-modulates the 520 nm laser diode via an in-house designed high-speed current source (discussed in Appendix B).
• 'CH2' provides the I input for the I/Q modulator (discussed in Section IV C).
• 'CH3' provides the Q input for the I/Q modulator.
We perform our experiments by programming pulse sequences onto the 4 channels, keeping in mind that we only modulate the signals at the lock-in reference frequency that we are interested in detecting (except for the T 1 measurements in Section V A). Each experiment below has a specific pulse sequence associated with it. The software programming of each pulse sequence is done on a PC using Matlab, and the pulse blaster is configured to generate the corresponding TTL pulses via USB serial interface.

A. Spin initialization and readout -T1 measurement
At room temperature, without any laser, MW excitation, or external magnetic fields, the NV − spins are completely depolarized and the spin states are equally populated, as described by a Boltzmann distribution for a two-level system with a 2.87 GHz level splitting at 300 K. Thus, all experiments discussed in this paper will start with spin initialisation via an optical pulse as described above. As discussed in Section III, electrons decaying via the |s state will be initialized into the |0 g state with a high probability. Hence, continuous 520 nm laser excitation, and therefore repeated optical cycling of the dynamics discussed in Section III, will result in the ensemble being initialized into the |0 g state.
Readout of the NV − spin states at the end of the experiment relies on the same process. A laser pulse is used to excite the NV − centers to the |e state. As relaxation via the |s state is more likely for the |±1 e state than for the |0 e state, the |0 e state will result in a larger number of photons being detected at the wavelengths of the ZPL and PSB.
The spin T 1 decay time gives an idea of how long the spins remain in the prepared state, before longitudinal relaxation into a Boltzmann-distributed population occurs. Note, that a T 1 experiment measures the spin decay time only, and is not sensitive to any dephasing of the system. There are two methods to measure the spin T 1 decay time: 1. By initializing the spins into the |0 g state using a laser pulse, leaving them to relax for a time τ delay , and then measuring the resultant spin population with a second laser pulse. This is a fairly simple measurement that requires no MW control and works at zero B 0 magnetic field. Furthermore, it results in a signal from all members of the ensemble, irrespective of the orientation of the NV − axes. 2. By additionally using a resonant MW pulse to coherently invert the spin population before the decay period τ delay . At non-zero B 0 field, this method allows the selection of a specific spin transition and measurement of its corresponding T 1 time. However, due to the different orientations of the NV − center axes with respect to the B 0 and B 1 fields (see also Section III), a MW pulse will not be resonant with all the defects or lead to non-perfect inversion, producing a partial initialization of the spin ensemble and resulting in a smaller signal.
We choose the first method for the teaching labs. This method results in a stronger signal, and allows the introduction of spin initialization and readout independent of the concept of MW spin control. Figure 3(a) describes the pulse sequence to implement the all-optical T 1 measurement. CH0 sets the reference signal for the lock-in amplifier, while CH1 defines the laser pulse sequence. There are two initialization laser pulses in the sequence [denoted 'i' in Figure 3(a)], one at the beginning of each half-cycle. As they are separated by a π-phase shift with respect to the lock-in reference (CH0), the lock-in detection will cancel out this signal under the condition that τ ref T 1 . The second initialization pulse is followed by a readout laser pulse (denoted 'r') of the same length, after a variable delay τ delay . The signal caused by the readout pulse is dependent on the T 1 process, however since this laser pulse is only present in the second half-cycle of the reference, the readout pulse will additionally result in the detection of a PL signal that is independent of T 1 (i.e. a background signal). In Figure 3(b), we show the corresponding measurement. The signal decreases from 0.391 mV to 0.374 mV with a time constant of T 1 = 1.64 ± 0.25 ms. The 4.3% change in signal corresponds to the spin decay from the |0 g state to the Boltzmann-distributed population. The 0.374 mV offset originates from the spin-independent PL signal caused by the readout pulse being present in only one of the two half-cycles.

B. Optically detected magnetic resonance and Zeeman effect
As discussed in Section III, an oscillating magnetic field B 1 can be used to controllably rotate the NV − groundstate electronic spin. To demonstrate this, we employ another channel of the Pulse Blaster (denoted 'CH2') to pulse-modulate the output of the MW source and create a sequence of oscillating B 1 pulses, as shown in Figure 4(a) (see also Sections IV C and IV D for details of the setup). We start by measuring the spin transition spectrum of the NV − center ensemble in zero magnetic field. As before, an initial laser pulse is used to initialize the NV − into the |0 state. A subsequent MW pulse of fixed length τ mw ( T * 2 ) then attempts to rotate the spins. When the MW frequency is equal to the |0 g ←→ |±1 g transition frequency, we rotate the spins about the +X axis [16]. The next laser pulse will serve as the readout pulse. This procedure is referred to as optically detected magnetic resonance (ODMR), as the optical signal is reduced in magnitude when the spins are rotated from the |0 g state into the |±1 g state. Using a lock-in amplifier, the resonance condition will result in a large, positive magnitude reading, which represents the absolute value of the change in signal under resonance. Out of resonance the MW pulses have no effect on the lock-in magnitude. Figure 4(b) shows the zero magnetic field ODMR spectrum. The main peak is centered at D = 2.87 GHz, with a spin-strain splitting E = 7 MHz which lifts the degeneracy of the |0 g ←→ |±1 g transition. Additionally, the side peaks visible are a result of hyperfine interaction (A = 128 MHz) of the subset of NV − spins that are also coupled to a nearest neighbor C 13 nucleus. The side peaks are ∼ 3.3% of the center peak intensity, which corresponds to the probability of finding a C 13 nucleus next to an NV − site.  . For long free precession times, the ensemble enters a mixed state, as can be seen from the convergence of the two spin signals to a common value. The solid lines are fits to an exponential decay. Measurement time is ∼4 minutes for each scan.

C. Rabi oscillations
The term "Rabi oscillations" refers to the driven evolution of a two-level system that manifests as the circular movement of the system's state vector around the Bloch sphere [5]. Successful demonstration of Rabi oscillations means that we have achieved coherent control -an important step in demonstrating the viability of any quantum system (see also Section II). Figure 4(d) shows a detailed ODMR spectrum of the |0 g ←→ |−1 g transition for B C 0 . For this particular field, we have roughly aligned the magnetic field from the permanent magnet such that its direction is parallel to one of the three [111], [111], [111] NV − center axes, and from matching the spectrum in Figure 4(c) to theory, we can extract B 0 = 14.2 mT with an angle of 13.6 • to the best-aligned NV − axis (see Figure 4(d) inset). Furthermore, the position of the permanent magnet was adjusted such that the |0 g ←→ |−1 g ODMR transition frequency coincides with the resonance frequency of the PCB antenna (see Section IV C). This way, we subject our NV − spins to the largest B 1 field and hence achieve the fastest Rabi oscillation frequencies [17].
To observe Rabi oscillations, we set the driving frequency ν mw to be in resonance with the ODMR transition frequency ν ODMR = 2.49 GHz, and vary the MW pulse length τ mw while recording the lock-in signal. We observe oscillations in the spin signal as a function of pulse length, as shown in Figure 4(e), indicating coherent rotations of the spin around the Bloch sphere. As we have selected only one of the 8 visible transitions in Figure 4(c), we are only coherently driving NV − centers of a single axis orientation and only from the |0 g to the |−1 g state. The oscillations can be fitted to an exponentially decaying sinusoid: where A is the Rabi oscillation amplitude, B is a linear term included due to an observed increase in signal with increasing τ mw (possibly due to heating of the sample due at long τ mw ), C is an offset, Ω R = 2.69 ± 0.02 MHz is the Rabi frequency, φ = −1.24 ± 0.09 is the phase-offset (− π for ideal Rabi oscillations), and T Rabi 2 = 1.12 ± 0.14 μs is the driven coherence time of the spin [18,19]. The T Rabi 2 coherence time describes how long the |0 g ←→ |−1 g transition in the ensemble can be driven before the ensemble dephases into a mixed-state. This is due to both the inhomogeneity of the B 1 field over the region of the sample in focus, and the inhomogeneous broadening of resonance frequencies over the NV − centers being measured.
From the Rabi oscillations, we can calibrate the exact π/2-and π-pulse lengths as τ π/2 = 72 ns and τ π = 144 ns. These pulse times will be important for the experiments in the following section (Section V D), where we construct dynamical decoupling pulse sequences out of π/2-and πpulses.

D. Coherence times and dynamical decoupling
In the next experiment we measure the coherence time T 2 of the NV − centers. T 2 is the time over which a welldefined phase relation between a quantum state and a reference clock can be preserved, before noise and coupling to the environment randomize it. Thus, it is especially interesting to investigate the coherence time of quantum systems at room temperature, where the large amount of thermal energy leads to a particularly noisy environment. T 2 is also one of the key metrics for comparing different quantum systems, however, as there are different definitions of T 2 , it important to use the same metric when comparing different quantum systems. One such coherence time was already determined in Figure 4(e) and is the coherence time of the system while it is driven (T Rabi 2 ). In the following experiments we look at the coherence time during free precession of the spins using different dynamical decoupling sequences.
Dynamical decoupling methods make use of refocusing pulses, as in the Hahn-echo sequence [20] [see also Figure 5(a)], to refocus the phases of spins that precess at slightly different rates. Here, one differentiates between inhomogeneous dephasing where the transition frequencies of individual NV − centers are shifted due to their local environments, e.g. due to static inhomogeneities in the sample itself or in the applied B 0 magnetic field, and homogeneous dephasing where the transition frequencies of all NV − centers are broadened by similar amounts, e.g. due to dynamic noise or the finite lifetime of the quantum state. Sequences consisting of refocusing pulses are very good at refocusing static shifts in transition frequencies -a single refocusing pulse (as in the Hahn echo) is sufficient to decouple the quantum system from static noise [20]. Noise of finite frequencies is refocused as long as its frequency is much lower, or much higher than the refocusing pulse repetition frequency, which can be best understood in the filter function formalism as described in Refs. [21,22]. In fact, changing the pulse repetition frequency changes the frequency spectrum the spin remains sensitive to, which allows conducting detailed investiga-tions of the noise spectrum [22][23][24][25].
In Figure 5(a) we show the pulse sequence used to measure the Hahn echo coherence time T Hahn 2 , while the Bloch spheres at the bottom of the panel give an indication of the spin orientations at specific points of the sequence. A first X π/2 -pulse rotates the spin to the +Y direction on the Bloch sphere. The spins are left to freely precess for a time τ delay , before a X π -pulse rotates them to the -Y direction. Any phase that they might have accumulated with respect to the rotating frame until then (as indicated by the coloured arrows) will be unwound in the second free precession time τ delay , before a final X π/2 -pulse rotates them to the +Z direction for readout. We present the corresponding experimental data in Figure 5(b). Here, τ delay is increased until any phase relation is randomized and the spin signal saturates, indicating a completely mixed state. The spin refocusing pulse can be applied along either the +X (Hahn echo) or +Y axis (using IQ modulation as described in Section IV C), with the system entering into the same mixed-state in either case as shown in Figure 5(b). We fit the data to an exponential decay and extract a coherence time of Instead of a single refocusing pulse, multiple such refocusing pulses can be applied to further extend the spin coherence time. However, performing multiple refocusing pulses about the +X axis leads to an accumulation of pulse errors. Hence, refocusing pulses about the +Y axis -known as Carr-Purcell-Meiboom-Gill (CPMG) spinecho pulse sequence [26,27] -are more advantageous. For the CPMG pulse sequence shown in Figure 6(a), N CPMG is the total number of Y π -pulses, and t = N CPMG τ delay is the total free precession time of the NV − spin. The CPMG pulse sequence acts as a bandpass filter -increasing the number of refocusing pulses for a fixed τ delay sharpens the filter, whereas decreasing the time τ delay between refocusing pulses has the effect of shifting the center of the filter to higher frequency. The bandpass center frequency is given by π τ delay [22].
In Figure 6(b), we plot the result of CPMG sequences with an increasing number of refocusing pulses N CPMG . For the same total free precession time, a larger N CPMG implies a shorter τ delay , and hence a larger center frequency of the CPMG filter function [28]. The normalized lock-in signal as a function of total free precession time can be fitted to We plot the extracted T CPMG 2 in Figure 6(c) and observe a clear correlation between T CPMG 2 (N CPMG ) and N CPMG , suggesting that the noise spectral density of the NV − electron's environment reduces towards higher frequencies. T CPMG 2 (N CPMG ) = B(N CPMG ) α with α = 0.77 ± 0.13, which is within the bounds experimentally determined in Ref. [28] for a CVD grown diamond with a large NV − density (∼ 10 16 cm −3 ).

VI. CONCLUSION
We have presented a cost-effective experimental setup that is suitable for demonstrating coherent spin control concepts in an undergraduate teaching laboratory environment. The experiments rely on optically-detected magnetic resonance of NV − centers at room temperature and require minimal optics and electronics components. Students will develop an intuitive feeling for quantum spin physics, gain first-hand experience in controlling a quantum system, and have the freedom to develop unique pulse sequences and observe the results in realtime. The use of a high-density NV − diamond sample provides a large signal, making the measurements insensitive to misalignment of the optics and exposure to high ambient light levels -as desirable for an undergraduate lab setup.