# Speeding up NV Center Measurements with Real-time Control

August 21, 2023 by Bruno Küng

## Introduction

Real-time feedback control can often speed up quantum experiments, increase fidelity, or enable new methods. One example is adaptive sensing and characterization, which uses feedback to minimize the number of measurements needed to estimate a given quantity. Our customers in the group of Prof. Cristian Bonato at Heriot-Watt University (Edinburgh, Scotland) have recently demonstrated this method on an NV-center based spin qubit [1] and achieved an increase in speed by up to an order of magnitude compared to non-adaptive approaches in the estimation of qubit decoherence timescales. In this blog post, Dr. Muhammad Junaid Arshad, Dr. Christiaan Bekker and Dr. Ben Haylock share insights into the practical realization with the Zurich Instruments HDAWG Arbitrary Waveform Generator.

Figure 1: Schematic of the adaptive decoherence estimation protocol. The HDAWG is used to manipulate the NV center spin state. The spin state is optically measured with an avalanche photodiode (APD). The photon count rate is used by the microcontroller to estimate the value of the decoherence timescale and to calculate the optimal probing time τ for the next measurement.

The procedure illustrated in Figure 1 is based on Bayesian inference, where the probability distribution for the parameter(s) of interest, for example p(T2) for the decoherence timescale T2, is updated after each measurement outcome mi  through Bayes' rule:

$$p(T_2|m_i,...,m0) \propto p(m_i|T_2)p(T_2|m_{i-1},...,m_0)$$

The probability p(mi |T2), known as the likelihood, describes the probability to detect a measurement outcome mi given a value T2 for the decoherence timescale, which decays as:

$$p(m_i=0|T_2) \propto 1-e^{-(\tau/T_2)^\beta}$$

After each measurement, the probability distribution is used to compute the best experimental setting (in this case the probing time τ for the next measurement). This can be done in several ways. Here, the researchers chose to harness the Cramer-Rao bound and maximize Fisher information, a quantity that describes how strongly a probability distribution depends on a given parameter.
The use of fast real-time adaptation of experimental settings is a promising technique for the efficient characterization of quantum systems and their dynamics [3], with applications ranging from quantum sensing to the characterization of quantum devices. For example, adaptive techniques can be used to speed up the measurements of magnetic fields using a single electron spin as a tiny quantum sensor [4-6].

Figure 2: Schematic of the optical, microwave, and electronics hardware in the experimental setup. The inset shows the histogram of photon arrival times with the the NV center prepared in either one of two spin states.

## Setup Description

In the experimental setup shown in Figure 2, a microcontroller (AdWin Pro II, Jaeger Messtechniek GmbH) stores the probability distributions, applies Bayes' rule based on the measurement outcome, and computes the optimal probing time τ. The microcontroller then feeds the value for the optimal probing time to the HDAWG through its DIO port, signalling that a new value is available through a DIO bit. The HDAWG reads the value and builds the pulse sequence accordingly, consisting of two π/2 pulses separated by the time τ. The generated signal is upconverted to the microwave frequency resonant with the electron spin transition, then amplified and sent to the sample.
The NV center spin is read out optically by exciting it with a green laser pulse and detecting the emitted photoluminescence. One of the two spin eigenstates can get trapped in a dark metastable state under optical illumination, resulting in a lower photoluminescence intensity that enables a spin-dependent brightness. Single-shot readout is not available in room-temperature experiments, so we need to repeat the experiment R times: the signal consists of the number r of photons detected by the microcontroller counter in R repetitions [2]. More details on the experimental setup can be found in the Appendix of the manuscript [1].

## Real-time Communication

Interaction between the Zurich Instruments HDAWG and the microcontroller is accomplished through the 32-bit DIO connection. For the HDAWG, the first three 8-bit bus are configured as inputs, and the fourth is set as output. The first bus is used by the microcontroller to flag when it is updating parameter values, and when they are ready for the HDAWG to use, as well as applying Boolean settings to the sequence (e.g. use a π pulse? True/False). The second and third buses are each used to communicate a value which the HDAWG interprets as an experimental setting (e.g. microwave pulse length or delay between laser pulses). The last bus is used by the HDAWG to signal when it is running a sequence or waiting for the microcontroller to update the value for the next measurement run.

Fig. 3: Flow chart representing the control flow of the adaptive experiments.

## Sequence Programming

A typical sequence starts with a section to initialize experimental constants and waves. Once initialization is complete, the sequence enters a do-while loop and signals that it is ready to proceed to measurement.

do {
setDIO(1<<AWG_ready_pin);

The HDAWG then waits for the microcontroller to indicate that it is ready to communicate the parameters for the measurement using waitDIOTrigger(), and captures these values with getDIO():

waitDIOTrigger();
var dio = getDIO();

These are then interpreted according to the measurement performed. For example, in the case of a Ramsey measurement [1], the input parameter given by the microcontroller encodes the delay between the two π/2 microwave pulses:

// get the value of the delay length (parameter we are trying to sweep with ADwin)
wait(10);
var t1_delay = (dio>>ADwin_para) & 0xFF;

Once the value is defined, it is used as a delay within the pulse sequence through a playZero() instruction, with a scaling factor implemented to convert the 8-bit value into the correct waveform length. This allows the delay to be completely arbitrary up until runtime:

setTrigger(AOM_channel);
wait(Cycles_rect);
setTrigger(0);

repeat(n_pulses)
{
playZero(Samples_wait_after_pulse);
resetOscPhase();
setSinePhase(0, 0);
setSinePhase(1, 90+IQ_phase_correction);

playZero(Sample_wait_between_mw_pulses);
waitWave();

playZero(Samples_wait_after_pulse);
waitWave();
}

Within the code, switching between different counting channels for the microcontroller is achieved using Marker channels (i.e. setTrigger() in the example above). Once the desired number of pulse sequences have been played, the HDAWG signals to the microcontroller that it is done:

// Send DIO finished to ADwin
setDIO(1<<AWG_done_pin);

wait(Cycles_sequence_wait);
} while (True)

The sequence processor then returns to the beginning of the do-while loop, to await parameters for the next measurement sequence from the microcontroller. The way the sequence is set up means the HDAWG does not need to know how the parameters for each measurement are determined (e.g. through a parameter sweep or adaptive Bayesian update protocol), nor how many measurement sequences are required. Once the desired set of measurements is complete, the microcontroller signals to the LabOne Python API to stop the HDAWG sequence. Similarly, the microcontroller does not need to know the pulse sequence of the measurement, but simply how to update the expected value of the decoherence rate under study, given the signal counts measured.

The handover protocol used in this sequence means that fast synchronization is not required between the HDAWG and the micro-controller. When one instrument is busy, it will turn off its 'ready' indication and continue with its process until it needs input from the other instrument. When this point is reached, it enters a waiting loop and turns on its 'ready' indication. This allows the other instrument to initiate its process, using the new information sent, until it can deliver feedback information. As there is no transient signal, the handover proceeds smoothly between the instruments, and each part of the process is initiated as soon as the information required is ready.

## Conclusion

The HDAWG is capable of tuning pulse sequence parameters, such as delay times and pulse phases, in real time. This capability, combined with real-time optimization algorithms, can unlock new opportunities in implementing more efficient protocols for quantum experiments. To explore what is possible in your use case for real-time control, please get in touch with us, and let’s talk!

## References

1. Muhammad Junaid Arshad, Christiaan Bekker, Ben Haylock, Krzysztof Skrzypczak, Daniel White, Benjamin Griffiths, Joe Gore, Gavin W. Morley, Patrick Salter, Jason Smith, Inbar Zohar, Amit Finkler, Yoann Altmann, Erik M. Gauger, Cristian Bonato, “Online adaptive estimation of decoherence timescales for a single qubit”, arXiv:2210.06103 (2023)
2. Hossein T. Dinani, Dominic W. Berry, Raul Gonzalez, Jeronimo R. Maze, Cristian Bonato, “Bayesian estimation for quantum sensing in the absence of single-shot detection”, Physical Review B 99, 125413 (2019)
3. Valentin Gebhart, Raffaele Santagati, Antonio Andrea Gentile, Erik M. Gauger, David Craig, Natalia Ares, Leonardo Banchi, Florian Marquardt, Luca Pezze', Cristian Bonato, “Learning Quantum Systems”, Nature Reviews Physics 5, 141 (2023)
4. Cristian Bonato, Machiel S Blok, Hossein T Dinani, Dominic W Berry, Matthew L Markham, Daniel J Twitchen, Ronald Hanson, “Optimized quantum sensing with a single electron spin using real-time adaptive measurements”, Nature Nanotechnology 11, 247 (2016)
5. R Santagati, AA Gentile, S Knauer, S Schmitt, S Paesani, C Granade, N Wiebe, C Osterkamp, LP McGuinness, J Wang, MG Thompson, JG Rarity, F Jelezko, A Laing, “Magnetic-Field Learning Using a Single Electronic Spin in Diamond with One-Photon Readout at Room Temperature”, Physical Review X 9, 021019 (2019)
6. Timo Joas, Simon Schmitt, Raffaele Santagati, Antonio Andrea Gentile, Cristian Bonato, Anthony Laing, Liam P McGuinness, Fedor Jelezko, “Online adaptive quantum characterization of a nuclear spin”, npj Quantum Information 7, 56 (2021)