Introduction

The past decade has seen a revolution in high-resolution diffraction-limited microscale and wide field-of-view magnetometry based on optically detected magnetic resonance (ODMR) imaging of Nitrogen Vacancy (NV) defect centers in diamond1,2,3,4,5,6. These room-temperature ultra-sensitive diamond NV magnetometers7,8,9,10 have enabled a new class of magnetic field microscopy, for example—probing magnetic particles in living cells3,11, imaging fluid-like current flow in graphene6,12, microscopy of novel quantum materials13 and rapidly evolving other applications14,15,16,17. In diamond NV-based widefield magnetic field (WMF) imaging, red photo-luminescence (PL) emitted from a microscale volume of NV centers is collected and imaged on to a conventional scientific CMOS or CCD camera. Microwave (MW) resonant frequencies applied to NV centers create changes in NV fluorescence and the precise estimation or tracking of these resonant MW frequencies yields a 2D microscale magnetic field map. The changes in magnetic field experienced by small microscopic volumes of NVs in the diamond crystal get mapped to corresponding pixels on the camera pixel array. However, magnetic field images acquired by this method have remained temporally static in nature, demanding few to several minutes of acquisition time for each image frame4,6,11. Inherently low NV ensemble resonance contrast and division of informative NV light onto thousands to millions of pixels significantly decrease per-pixel signal-to-noise ratio (SNR) and consequently the magnetic field sensitivity. NV imaging frame rate for DC to low-frequency magnetometry is fundamentally limited by the NV’s optical re-polarization rate i.e. \(\sim 1\) MHz. However, practical SNR bounds have limited imaging frame rates to primarily static magnetic field maps. Development of high-spatially-resolved and high-frame-rate imaging capabilities will enable new applications of NV centers to investigate processes like vortex dynamics in superconductors18, estimating fluctuating magnetic fields from quantum materials13, magnetic nano-particle motion in living cells11,19 and imaging mammalian action potential associated magnetic fields20,21,22,23.

Detection of weak signals embedded in noise hinges on smart techniques such as the lock-in amplification method, wherein a near-DC or slowly varying signal, mainly submerged in 1/f noise, can be periodically modulated and filtered from a narrow band while the noise spanning a large bandwidth can be eliminated leading to significant improvement in signal-to-noise ratio. Pico-Newton scale resolution in atomic force microscopy24 and high sensitivity magnetometry in SQUIDs and atomic magnetometers25 are testament to this detection methodology. With the advent of lock-in cameras26, parallel per-pixel lock-in detection of optical light can be performed over many pixels. In contrast to conventional cameras, the lock-in cameras require synchronized external triggers to perform light integration over specific time windows for each pixel. Intensity measured during these externally timed windows can be used to subtract DC components and estimate the frequency content of the optical signal. With these high frame rate lock-in cameras, new improvements have been observed in techniques where light can be frequency or phase modulated, e.g., deep tissue optical coherence tomography (OCT)27 and ultrasound-modulated OCT28 and other avenues29,30. NV’s emitted light can be frequency modulated by microwave control of NV resonance31. Frequency modulated optically detected magnetic resonance (fm-ODMR) schemes for NVs have been used for real-time single point (SP) bulk magnetometry20,22,32,33,34, where total emitted NV light is collected onto a single photodetector and also for boosting DC-magnetic field sensitivity. A prior work on camera review35 has also suggested potential application of high-frame rate lock-in camera to perform real-time NV imaging.

In this work, we demonstrate a novel per-pixel lock-in detection protocol that enables dynamic millisecond scale magnetic field imaging in wide-field using NV centers in diamond. The paper describes a procedure for synchronizing camera frames of a commercial lock-in camera (Heliotis Helicam C336) with NV microwave modulation to obtain fm-ODMR across thousands of pixels. Post calibration of noise statistics and magnetic field sensitivity across different pixels, we measured a median \({731}\,{\mathrm{{nT}}/\sqrt{\mathrm{{Hz}}}}\) sensitivity per pixel. To demonstrate spatially and temporally resolved magnetometry, we perform imaging of microscale magnetic fields produced by current flow in two different samples fabricated using e-beam lithography: first, a 10 \({\upmu }\mathrm{{m}}\) track width gold (Au) microwire with a \({90}^{\circ }\) bend and second, a square-spiral planar microcoil of 10 \({\upmu }\mathrm{{m}}\) track width and full dimensions of 100 \({\upmu }\mathrm{{m}} \times {125}\, {\upmu }\mathrm{{m}}\). We show dynamic widefield magnetic field images obtained by probing periodically varying current flow in the above samples at near 1 Hz, 20 Hz and 50 Hz magnetic field variations. Multi-pixel fluorescence time traces, scaled to magnetic field values by NV resonance parameters, show expected magnetic field tracking. These sub-second temporal magnetic field images are enabled by fast NV imaging frame rates of 50–200 frames per s (fps). To further demonstrate a general application of temporally varying magnetic fields, we show millisecond-scale magnetic field images of current flow in the microcoil from an arbitrary current waveform of varying amplitude and rapid inversion of current direction where the entire event duration is \(\approx\)150 ms. We discuss the coupling of imaging frame rates and per-pixel SNR to the NV’s modulation frequency and the number of signal averaging cycles. Our experimental results demonstrate that frequency-locked widefield imaging of NV emitted light enables dynamic widefield magnetic field imaging at frame rates ranging from 50 to 200 fps. Recent work towards dynamic NV widefield imaging37,38, employ more advanced microwave pulse sequences based on double quantum protocols to significantly reduce heterogeneity in resonant frequencies across imaging field of view which enables high sensitivity magnetic field imaging. In contrast, our results demonstrate high imaging frame rates with a relatively simpler protocol with the application of single resonant MW frequency and could be potentially relevant for a wide variety of NV based imaging applications and can be further improved with spatial homogeneity of resonant frequencies across the field of view. The scope of the work demonstrated in this paper is not limited to just imaging single crystalline diamonds, but can also be extended to perform improved temporal imaging of nanodiamonds in cellular environments39,40,41.

Experimental methods

Magnetic resonance in nitrogen vacancy defects in diamond

Negatively charged Nitrogen Vacancy defect centers are point localized Nitrogen substitution of Carbon atoms in the diamond lattice with an adjacent vacancy and an overall negative charge. Due to the unique electronic properties of these vacancies9, they are sensitive to external environment changes like, magnetic field, electric field, strain and temperature. The ground state is a spin-triplet with \(m_{s}=0\) and a doubly degenerate \(m_{s}=+1\) and \(m_{s}=-1\) in the absence of magnetic field with a zero field splitting of 2.87  GHz. The degeneracy of \(m_{s}=+1\) and \(m_{s} = -1\) is lifted by Zeeman splitting in the presence of an external magnetic field. Transitions to the excited state are spin conserved, however, the relaxation from excited triplet state take two paths - a radiative spin conserving path and a non-radiative decay via intersystem crossing (ISCs). The radiative decay produces broadband red photo-luminescence with the zero-phonon line centered at 637 nm. The non-radiative ISCs are highly spin-selective towards the \(m_s=0\) spin sublevel. Therefore, continuous optical excitation leads to electron spin polarization. Neglecting the hyperfine interaction between the nuclear spin of the nitrogen atom and the NV’s electronic spin, the ground state NV Hamiltonian is given by

$$\begin{aligned} H=h D S_{z}^{2}+h E\left( S_{x}^{2}-S_{y}^{2}\right) +g \mu _{B} B \cdot S, \end{aligned}$$
(1)

where, h is the Planck’s constant, D is the zero-field splitting, \(\mu _B\) is the Bohr magneton, g is the gyromagnetic ratio, E is the applied electric field and the last term corresponds to the Zeeman term, with B, the externally applied magnetic field. \(S_x, S_y, S_z\) correspond to the Pauli matrices for a spin-1 system. In the weak-field regime where \(\mathrm {B}_{\perp } \ll \mathrm {B}_{\Vert }\), the electron spin resonance frequencies are given by

$$\begin{aligned} \nu _{\pm }\left( B_{N V}\right) =D \pm \sqrt{\left( \frac{g \mu _{B}}{h} B_{N V}\right) ^{2}+E^{2}} \end{aligned}$$
(2)

where, \(B_{NV}\) is the component of the applied field parallel to the NV axis. For cases where applied bias field is high enough to neglect the E term, the electron spin resonance frequencies vary linearly with the applied magnetic field. Such a regime is ideal for sensitive magnetometry with diamond NV centers.

Experimental setup

Figure 1a is an illustration of the experimental setup used to perform diamond NV magnetometry. A non-resonant green light excitation at 532 nm (Sprout Laser) is used to illuminate NV centers via a \(100\times\) objective (Olympus, MPLFLN series). The excitation beam is focused on the back focal plane of the objective to obtain \(\sim {200}\,{\upmu }\mathrm{{m}}\) diameter spot size on the NV layer. Optical power impinging the objective back aperture is \(\sim {1.5}\) W. We use an isotopically pure diamond crystal (procured from Element Six) of lateral dimensions \({4.5{\hbox { mm}} \times 4.5}\,\mathrm{{mm}}\) and 500 \({\upmu }\mathrm{{m}}\) thick with a thin 1 \({\upmu }\mathrm{{m}}\) \({\hbox {NV}}^-\) implanted layer of 1–2 ppm \({\mathrm{{NV}}^-}\) concentration. The diamond crystal has {100} front facet and \(\langle 110\rangle\) edge orientation. The emitted light from NV centers is collected via the same objective, filtered to select the red light (above 567 nm) and reject green excitation light at 532 nm using a notch stop filter (SEMROCK NF03-532E-25). The collected light is focused onto a widefield lock-in camera (Heliotis Helicam C3) to perform widefield magnetometry. The diamond sample is mounted on a microwave loop PCB, and associated microwave electronics are used to deliver amplified microwave frequencies in the range \(\sim {2.5}\) to 3.2 GHz. The applied microwave frequencies follow frequency shift keying waveforms with square-wave envelopes. The camera imaging frames are synchronized with the microwave modulation with specific pulse sequences generated by a high-speed TTL pulse generator card (SpinCore PulseBlaster ESR-PRO 500 MHz). Samarium-Cobalt (Sm–Co) ring magnets are used for applying a bias magnetic field and have not been shown in the experimental schematic. Two microscale conductive samples, a \(\sim {10}\, {\upmu }\mathrm{{m}}\) track-width microwire and a \(\sim {10}\, {\upmu }\mathrm{{m}}\) track width planar spiral microcoil was fabricated on two independent silicon substrates. Sample patterning was done using e-beam lithography followed by 100 nm thick deposition of Ti/Au. Typical resistances of these structures were found to be \(\sim \,{400}\,{\Omega }\). These samples are mounted on a custom PCB and wire-bonded to supply the drive voltage. The entire assembly was then glued with Loctite (cyanoacrylate glue) to the diamond crystal. Due to the back focal plane focusing, the \(100\times\) objective used in this work suffered a damage in the center of the imaging field of view (FOV) because of high optical intensity localized in a very small area. Consequently, a small number of pixels in the FOV center have zero or minimal ODMR response and can be observed as a small blank hole in all magnetometry related images (for example see Fig. 3a and Fig. 4c,f,g). Experiment control and data analysis were performed from custom written codes in MATLAB42. Figure editing and assembly used Adobe Illustrator software43.

Figure 1
figure 1

Schematic of the experimental setup and protocol for data acquisition: (a) Schematic describing the experimental setup for single photodiode diamond NV magnetometry (SP) or widefield per pixel lock-in diamond nitrogen-vacancy magnetometry (WM) (b) Illustration explaining generation of frequency modulated NV emitted red light by applying frequency shift key type microwave resonant frequencies. The applied microwave resonant frequencies shuttle between \(\omega\) and \(\omega -\omega _{dev}\) in sync with square wave waveform of frequency \(\omega _{mod}\). When the microwave frequencies are resonant, the emitted NV red light is frequency modulated at \(\omega _{mod}\) (c) Pulse protocol to control and synchronize the demodulation of internal camera frames with modulation frequency of optical signal to obtain lock-in in-phase (I) and quadrature (Q) images. A green laser illumination at 532-nm is continuously on and frequency shift key microwave (MW) waveform with modulation \(\omega _{mod}\) is applied. Lock-in camera external trigger pulses, controlling internal frame acquisition timings, are provided at \(2\omega _{mod}\), synced with MW modulation, where they define 4 quarters for light integration \(S_{1} S_{2} S_{3} S_{4}\). These four quarters of light integration allow in-phase (\(S_{1}-S_{3}\)) and quadrature (\(S_{2}-S_{4}\)) estimation of optical signal and are averaged over N cycles to give single pair of In-phase image and Quadrature Image (IQ Frame).

NV frequency modulation and synchronization of lock-in camera

The generation of modulated NV light with frequency \(\omega _{mod}\) in the fm-ODMR protocol is shown via the schematic shown in Fig. 1b. In a frequency shift keying waveform, two microwave frequencies \(\omega\) and \(\omega -\delta \omega\) are delivered via the MW resonator, where they shuttle between each other with the square wave waveform of frequency \(\omega _{mod}\). For each MW frequency, the NV fluorescence settles to a steady-state value, given by the NV’s resonance curve at the applied MW frequency. To measure the amplitude of modulated NV PL, we perform lock-in detection of the collected light at reference frequency \(\omega _{mod}\). For the rest of the article, by referring to the ’modulation frequency’ of NVs, we also mean the ’reference frequency’ of the lock-in camera.

To synchronize the applied MW waveform with the camera’s internal frames, an external reference signal of \(2\omega _{mod}\), carefully synced to MW modulation reference at \(\omega _{mod}\), is provided to the camera’s external trigger input, see Fig. 1c. This TTL signal, of twice the modulation frequency, defines the four quarter periods of the sensor light integration whose values are denoted by \(S_{1}, S_{2}, S_{3}, S_{4}\). The in-phase signal is \(S_{1}-S_{3}\) and the quadrature signal \(S_{2}-S_{4}\). Additionally, as shown in the schematic Fig. 1c, each cycle of demodulation is internally averaged N times to provide a pair of 2D images containing in-phase (I) and quadrature (Q) values for each pixel. Therefore, to get a single 2D IQ image, the total time is \((1/\omega _{mod})*cyc\), which sets the imaging frame rate. Further, since the NV signal scales with \(\omega _{mod}\) different imaging frame rates have different SNR as discussed later. The lock-in camera is limited to frame rates of 3.2 kHz and a maximum 250 kHz signal demodulation.

Results

Optically detected magnetic resonance of multiple pixels

Optically detected resonance spectrum of an ensemble of NV centers corresponding to each pixel on the Helicam C3 Array is shown in Fig. 2a. A 2D array of camera pixels have been concatenated into a 1D vector of pixels and their lock-in ODMR response across multiple microwave excitation frequencies have been color-coded. Three randomly selected pixel’s individual ODMR traces have been shown in Fig. 2b. For each pixel, the NV response curve can be described by a Lorentzian function,

$$\begin{aligned} f(\omega )=A\left[ 1-\frac{C}{ \left[ 1+\left( \frac{\omega -\omega _{0}}{\Gamma }\right) ^2\right] }\right] , \end{aligned}$$
(3)

where \(A,C,\Gamma ,\omega ,\omega _{0}\) denote baseline PL, contrast, the linewidth of resonance, applied MW frequency, and resonant MW frequency of the NV center respectively.The lock-in signal is proportional to the derivative of the NV ODMR response curve given in Eq. (3). The derivative of the response curve with an added baseline term was used to fit the lock-in ODMR response, with examples shown in Fig. 2c,d. To highlight the importance of NV modulation frequency and frame averaging, two examples of ODMR traces (Fig. 2c,d acquired at different NV modulation time periods (\({160} \,{\upmu }\mathrm{{s}}\) and 120 \({\upmu }\mathrm{{s}}\)) and single frame averaging times (19.52 ms and 9.84 ms, respectively) are shown.The slope at the zero-crossing point of the fm-ODMR response curve along with the noise floor are critical factors that determine the magnetic field sensitivity of individual pixels. In agreement with previous studies31, we observe reduced zero-crossing slope at higher modulation frequency due to reduced NV interaction time with the resonant microwave frequencies, oscillating between \(\omega\) and \(\omega -\omega _{dev}\). The camera pixel readout noise grows with square root of number of the demodulation cycles (HelicamC3 datasheet). This factor introduces a trade-off between the NV response signal and the noise floor with different parameters. Further, the imaging frame rate is dependent on the ratio between modulation frequency to averaging cycles (see Methods, HelicamC3 synchronization), and hence is coupled to the SNR of the NV’s ODMR response.

Figure 2
figure 2

Frequency modulated optically detected magnetic resonance spectrum (ODMR) of multiple pixels: (a) A 2D array of \({300 \times 300}\) pixels have been concatenated into a 1D array of pixels and their magnetic resonance responses have been color coded. We observe 8 NV resonant frequencies across multiple pixels, with each resonance feature further split into 2 peaks due to N15 hyperfine transitions. (b) Three randomly chosen pixels are used to demonstrate individual pixel ODMR response. The baseline of the pixels, centered at 0, has been shifted to represent them in the same plot. (c) Example pixel ODMR response data recorded at 160\(\,{\upmu }\mathrm{{s}}\) modulation time period and 19.52 ms single frame averaging time. Each red dot represents data at a single microwave frequency and the black curve represent non-linear Lorentzian-derivative curve fit (d) Example pixel ODMR response data recorded at \({120},{\upmu }\mathrm{{s}}\) modulation time period and 9.84 ms single frame averaging time. Each red dot represents data at a single microwave frequency and the black curve represents non-linear Lorentzian-derivative curve-fit. Reduced ODMR zero-crossing slope can be observed at faster modulation frequencies.

Magnetic Field sensitivity and static imaging

As evident from the two example ODMR traces at different acquisition rates, the noise statistics and fm-ODMR signal of pixels can vary significantly with varying image acquisition parameters. Typically, the sensitivity of a sensor is defined by the ratio of uncertainty in the measurement to the maximum slope point, i.e. the point of operation of the sensor where the smallest perturbation in the input creates a maximal change in the output of the sensor. Specifically, for fm-ODMR the slope is maximum at the zero-crossing of the lock-in output, also corresponding to the resonant frequency of NV centers. Therefore, the magnetic field sensitivity is defined as:

$$\begin{aligned} \eta =\frac{\sigma \sqrt{\tau }}{\left. \frac{d V_{\text{ lock } }}{d f}\right| _{V_{\text{ lock } }=0, f=\omega _{\text{ res } }}} \end{aligned}$$
(4)

where \(\sigma\) is the standard deviation of measurement (voltage for lock-in amplifier or arbitrary units for camera) and \(\tau\) is the measurement time of the signal and f is the frequency. The denominator denotes the slope at the resonant frequency \(\omega _{res}\).

To acquire the \(\sigma\) for individual pixels, sixty imaging frames were acquired and the mean and standard deviation of each pixel’s intensity were recorded. Example noise spectrum of WMF pixels as a function of lock-in modulation frequencies have been shown in Supplementary Fig. 1b,c along with a typical 1/f noise spectrum of a single-photodiode (SP) lockin measurement (Supplementary Fig. 1a). The WMF \(\sigma\) spectrum for most pixels remained approximately flat, as compared to the SP \(\sigma\) spectrum, between modulation frequencies of 3–100 kHz, with mean value of 1.95 units (out of 10-bit 1024 point scale) for all pixels in Supplementary Fig. 1c. Since the minimum possible camera modulation frequency is 2.2 kHz, most of the low-frequency noise is eliminated in the WMF noise spectrum. For WMF imaging experiments \(\tau =(1/\omega _{mod})*n_{cyc}\), where \(n_{cyc}\) is the number of frame averaging cycle. To measure the zero-crossing slope an ODMR spectrum is measured with a frequency resolution of (100 kHz). The slope at zero-crossing for each pixel is then obtained by non-linear curve fitting and the corresponding 2D sensitivity map is shown in Fig. 3a, depicting a spatial variation of pixel sensitivity by evaluating Eq. (4) for each pixel. The pixel response mimics the excitation profile. As expected, pixels with high response, fall within the central region of the FOV and pixels with low or no response, fall towards the outer periphery of the NVs PL intensity profile. The distribution of per-pixel sensitivity is shown in Fig.3b where a median pixel sensitivity of \({731}\,{\mathrm{{nT}}/\sqrt{{\text {Hz}}}}\) is observed. Only pixels with sensitivity more than \({3}\,{{\upmu }\mathrm{{T}}/\sqrt{\mathrm{{Hz}}}}\) have been considered due to the low ODMR response at the outer periphery of the beam. Additionally, before the curve fitting for each pixel, a selection threshold was applied to select pixels with a minimum threshold level of fm-ODMR response and only the responding pixels were further analyzed. The responding pixels are defined as pixels satisfying the following two criteria sequentially (see “Supplementary notes”, per-pixel raw data processing)—(1) the signal level of the fm-ODMR of the pixel lies above a set threshold. (see Supplementary Fig. 3a,b). (2) For all pixels satisfying criteria 1, non-linear curve fitting is performed to generate a resonant frequency map. To select high-SNR pixels out of full 300 × 300 pixels of the sensor, a manually inspected square pixel range is selected based on the continuity and smoothness of the 2D resonant frequency map. Supplementary Fig. 3c shows an example of responding and non-responding pixels.

Figure 3
figure 3

Per-pixel sensitivity: (a) measured 2D map of sensitivity of all responsive pixels. Due to the Gaussian nature of the beam spot, the SNR drops in the outer periphery of the field-of-view (FOV). Pixels with sensitivity better than 3 \({\upmu }T/\sqrt{\mathrm{{Hz}}}\) have been included. Some pixels at the center of FOV are non-responsive due to a damage in the objective. (b) Histogram of sensitivity of all responding pixels, with median sensitivity of \({731}\,{\mathrm{{nT}}/\sqrt{\mathrm{{Hz}}}}\).

Equation 4 shows that the sensitivity of pixels is a function of measurement time, where both pixel noise \(\sigma\) and NV zero-crossing slope vary with the modulation (lock-in) frequency. Median per-pixel sensitivity of \({731}\,{\mathrm{{nT}}/\sqrt{\mathrm{{Hz}}}}\) was observed at modulation time periods 160 \({\upmu }\mathrm{{s}}\) (6.25 kHz modulation frequency) and 30 demodulation cycles. This acquisition is equivalent to 4.8 ms averaging time per frame (208 fps). Additional measurements of per-pixel sensitivity with variable measurement time have been shown in Supplementary Fig. 2 including a Supplementary note on ’Sensitivity versus measurement time’.

Spatial and temporal resolutions are inherently coupled in diamond NV microscopy. We verify magnetic field image formation with static acquisition (5–10 min) for two microscale samples, one 10 \({\upmu }\mathrm{{m}}\) track width microwire and one spiral microcoil of 10 \({\upmu }\mathrm{{m}}\) track width and overall dimensions of \(100\,{\upmu }\mathrm{{m}} \times 125\,{\upmu }\mathrm{{m}}\), as described earlier in methods. The two sample images are shown in Fig. 4a,d. Magnetic field images, projected onto a single NV axis, of these samples were formed by 100 kHz step size sampling of the NV resonance, non-linear parameter fits for individual pixels and subsequent determination of a map of resonant frequencies for 2D array of pixels. The resonant frequency maps of these samples were acquired for both DC current on and off and subtracted to probe sample magnetic field dependent on linear shifts in the resonant frequencies. Single NV axis magnetic field images of these samples (Fig. 4c microwire and Fig. 4f,g microcoil) were in agreement with simulated magnetic field images obtained using COMSOL Multiphysics, ( Fig. 4b microwire and Fig. 4e microcoil for expected simulated field images) at an estimated standoff of \(\sim\) 13 \({\upmu }\mathrm{{m}}\) for the microwire and \(\sim\)14 \({\upmu }\mathrm{{m}}\) for the microcoil.

Figure 4
figure 4

Static magnetic field images of the microwire and the microcoil sample: (a) color microscope image of the U shaped microwire sample. Microwire track width is 10 \({\upmu }\mathrm{{m}}\). Scale Bar 200 \({\upmu }\mathrm{{m}}\). Inset shows the \({90}^{\circ }\) bend feature which has been imaged. (b) Simulation of single NV-axis magnetic field map of the \({90}^{\circ }\) bend feature of the microwire, at a standoff 13 \({\upmu }\mathrm{{m}}\) and current 2.4 mA. Scale bar 40 \({\upmu }\mathrm{{m}}\). Black square indicates the approximate NV magnetic field imaging field of view location. (c) Experimentally measured magnetic field image of the microwire with 2.4 mA current flow, about the same NV axis as shown in simulation. Scale bar 27 \({\upmu }\mathrm{{m}}\). (d) Color microscope image of the microcoil sample with metal track width 10 \({\upmu }\mathrm{{m}}\) and overall dimensions \(100\,{\upmu }\mathrm{{m}} \times 125\,{\upmu }\mathrm{{m}}\). Scale bar 50 \({\upmu }\mathrm{{m}}\). (e) Simulation of the single NV-axis magnetic field map of the microcoil, at standoff 14 \({\upmu }\mathrm{{m}}\) and \({500}\,{\upmu }\mathrm{{A}}\) current flow. Sample geometry, translucent gray lines, has been scaled to simulation field image and overlaid for easy comprehension of the current flow path. Scale Bar 40 \({\upmu }\mathrm{{m}}\). (f) Experimentally obtained single axis magnetic field image of the microcoil for positive direction \({500}\,{\upmu }\mathrm{{A}}\) current flow, about the same NV axis as shown in simulation. Scale Bar 34 \({\upmu }\mathrm{{m}}\). (g) Experimentally obtained single axis magnetic field image of the microcoil for negative direction \({500}\,{\upmu }\mathrm{{A}}\) current flow, about the same NV axis as shown in simulation. Scale Bar 34 \({\upmu }\mathrm{{m}}\).

The \(\mathbf{B }_{NV}\) field is measured by resonant frequency shifts on either side of a reference bias field resonant frequency. Therefore, on inverting the current direction in the sample we observed an inverted contrast in the magnetic field image of the microcoil sample as shown in Fig. 4f for arbitrarily defined positive current and Fig. 4g for negative current, which further affirms that the magnetic field images obtained are from the microscale current flow in the sample. Additionally, static acquisition allows for quantification of the field of view, the spatial resolution of the imaging setup and the effective magnification. The imaging field of view, with sufficient NV resonance SNR, is \(\sim {150\,{\upmu }\mathrm{{m}} \times 150\,{\upmu }\mathrm{{m}}}\) (Fig. 3) and is limited by the excitation beam spot size on the NV layer and the total optical power of the Gaussian excitation 532 nm beam in our experimental setup (with \(\sim\)1.5 W entering the objective back aperture). We estimated the spatial resolution to be 1.7 \({\upmu }\mathrm{{m}}\) per camera pixel (see Supplementary note for pixel resolution estimation method) during microcoil measurements and 1.33 \({\upmu }\mathrm{{m}}\) per camera pixel during microwire measurements. Spatial resolution slightly differs in the two measurements due to minor differences in positioning of a focusing plano-convex lens in the red emitted light collection path to incorporate a larger field of view for the microcoil. Consequently, corresponding effective magnifications were 30X for microwire measurements and \(23.5\times\) for microcoil measurements in our widefield microscope. While we acquire only single NV axis magnetic field static and dynamic images in this study, we show that the microcoil sample’s vector magnetic field can be reliably reconstructed (Supplementary Fig. 4) from single NV axis magnetic field images by well established Fourier reconstruction methods4,44.

Additionally, the magnetic field spatial resolution is currently limited by the sample to NV layer standoff of \(\sim\) 13 \({\upmu }\mathrm{{m}}\), due to a thin layer of glue between the microcoil/microwire sample and the diamond crystal surface. The standoff can be minimized by fabricating samples on diamond or improving sample mounting to slightly press the diamond on the sample to reduce standoff. However, the per-pixel resolution of the setup of \(\sim\) 1.33 \({\upmu }\mathrm{{m}}\), is independent of the standoff and can be improved to diffraction limit by increasing the net magnification of the red light collection optics, like replacing the current 75 mm tube lens by 180 mm lens to gain \({2.4}\times\) in per-pixel resolution and reach diffraction limit. However, the field of view (FOV) is expected to reduce at higher magnification and this configuration is potentially more suited for smaller magnetic field features.

Dynamic widefield magnetic imaging

In this section we describe the acquisition of millisecond scale widefield magnetic field images. To perform real-time imaging, the applied microwave frequency is fixed to a specific NV resonant frequency along one NV axis. An externally applied magnetic field causes a linear shift in pixel intensity, proportional to the zero-crossing NV slope. Therefore, tracking the pixel intensities, scaled by the slope, gives a measure of the external magnetic field fluctuation along the chosen NV axis corresponding to each pixel. The time-dependent magnetic field can be estimated from

$$\begin{aligned} B(t)=\frac{v(t)-v_{o}}{\left. \frac{d V_{\text{ lock } }}{d f}\right| _{V_{\text{ lock } }=0, f=\omega _{\text{ res } }}}\gamma \end{aligned}$$
(5)

where v(t) is the lock-in pixel intensity, \(v_{o}\) is a fixed offset baseline of the pixel and \(\gamma =\) \({28}\,{\mathrm{{kHz}} {\upmu }\mathrm{{T}}^{-1}}\) is the gyromagnetic ratio. The zero-crossing slope scale factor is independently determined corresponding to each pixel in the imaging window. Individual pixels are heterogeneous in their resonant frequencies due to small deviation arising from local crystal strain, non-uniform bias magnetic field and temperature in the excitation volume of the diamond sample. Therefore, we choose to select the median resonant frequency from the distribution of resonant frequencies in the imaging window for widefield magnetic field tracking.

We demonstrate temporal magnetic field imaging examples for both samples, the microwire and the microcoil, at different magnetic field variations and imaging frame rates. The current flow in these samples are controlled by an arbitrary waveform analog voltage generator (NIDAQ PCIe-6363, Analog output) and the applied voltage waveform is triggered in synchronization with camera frame acquisition (see Fig. 1). A low peak current level of 500 \({{\upmu }\mathrm{{A}}}\) was chosen for temporal field imaging demonstration of both samples to keep peak magnetic field values below \(\sim\) \({6}\,{{\upmu }\mathrm{{T}}}\) in the entire FOV, at the given sample-standoff (see “Static imaging” section and Fig. 4).

Microwire imaging, 1.26 Hz sample field variation, 78 fps NV acquisition Dynamic magnetic field imaging was performed on the microwire sample, where acquisition rate of magnetic field frames was set to 78 fps and a 1.26 Hz periodic square bipolar voltage waveform was applied to the microwire (see Fig. 5a). A peak current of \({500}\,{{\upmu }\mathrm{{A}}}\) produced peak magnetic field around \({5}\,{{\upmu }\mathrm{{T}}}\) in the imaging FOV. Fig. 5b shows example single magnetic field frames (iterations \(n=15\)) at selected time-points demonstrating temporally varying, alternating field magnetic image contrast due to periodic changes in current polarity. Few example pixels P1–P4 (see Fig. 5c) have been selected to show full temporal response of these individual pixels. Single-iteration time traces (Fig. 5c, faded gray traces from all \(n=15\) iteration) and mean time traces (\(n=15\), Fig. 5c, black solid traces) of individual pixels track applied magnetic field waveform. Fourier spectra of these pixel time traces are observed to contain peaks at odd harmonics of applied magnetic field variation 1.26 Hz as expected. Example pixels P2 and P4 were selected at perpendicular locations to the current path near pixels P1 and P3. Therefore, we observe P2 and P4 time traces are \(\sim\) \({90}^{\circ }\) phase shifted to P1 and P3 time traces, inline with expected spatial magnetic field profile of the microwire. To the best of our knowledge this demonstrates the first real-time tracking of microscale magnetic fields which faithfully reconstructs the frequency and phase of the applied field. The video file of this imaging dataset has been provided in the “Supplementary section”.

Figure 5
figure 5

Temporal imaging of 1.26 Hz magnetic field variation at 78 frames per second of the \({90}^{\circ }\) bend feature of the microwire sample: (a) Applied current waveform (blue line) to the microwire sample. Black vertical lines mark example timepoints at which single magnetic field frames have been shown. Only few initial example periodic cycles of the applied current waveform have been shown. (b) Magnetic field frames at single time-points (averaged \(n=15\) iterations) showing alternating field image contrast with reversal in current direction. No voltage applied for a baseline time of 0.5 s, first frame selected from baseline window. A periodic square wave voltage waveform of alternating polarity was applied after the baseline time, at 1.26 Hz periodicity and peak current \({500}\,{{\upmu }\mathrm{{A}}}\). Exact magnetic field frame time-points have been shown on top of each image. Scale bar 27 \({\upmu }\mathrm{{m}}\) (c) Full temporal time traces of example pixels showing magnetic field tracking in time. Location of example pixels, labelled as P1 to P4 in the field of view have been shown in the magnetic field images. For each pixel, magnetic field traces versus time show tracking of applied the magnetic field, with faded gray lines as single iteration traces and solid black lines showing mean (\(n=15\)) magnetic field traces for the given pixel. Amplitude spectral density of single-pixel field traces are shown on the left, where pixel Fourier spectra are in blue and applied voltage Fourier spectra has been shown in gray. Applied voltage spectral density is scaled to a constant to compare spectral content with pixel Fourier spectra. Since pixels track magnetic field, peaks in the pixel Fourier spectra matches with peaks in the Fourier spectrum of the applied voltage, with peaks occurring at magnetic field variation 1.26 Hz and it’s odd harmonics.

Microcoil imaging, 17.98 Hz sample field variation, 78 fps NV acquisition Dynamic magnetic field imaging was performed on the planar microcoil sample, where the NV acquisition rate was set to 78 fps and a 17.98 Hz periodic square voltage waveform was applied to the microcoil. Results of microcoil imaging (see Fig. 6a–c) have been similarly organized as discussed in the microwire temporal imaging text. Microscale magnetic field profiles of the microcoil are spatially resolved in single sub-second magnetic field frames (Fig. 6b, 12 ms per frame, \(n=15\)). Magnetic field time traces of example pixels have been shown in Fig. 6c and example pixel locations on the microcoil images have been marked in Fig. 6c. Fourier spectra of these pixels show peak at the frequency of applied 17.98 Hz periodic magnetic field waveform. These results demonstrate resolving spatially intricate field profiles, in this case multiple current flow paths separated by \(\sim\)\({\upmu }\mathrm{{m}}\), at millisecond scale snapshots of magnetic field images. The video file of this imaging dataset has been provided in the “Supplementary section”.

Figure 6
figure 6

Temporal imaging of 17.9 Hz magnetic field variation at 78 frames per second of the microcoil sample: (a) Applied current waveform (blue line) to the microcoil sample. Black vertical lines mark example timepoints at which single magnetic field frames have been shown. Only few initial example periodic cycles of the applied current waveform have been shown. (b) Magnetic field frames at single time points (averaged \(n=15\) iterations) showing alternating field image contrast with reversal in current direction. No voltage applied for a baseline time of 0.5 s, first frame selected from baseline window. A periodic square wave voltage waveform of alternating polarity was applied after the baseline time, at 17.9 Hz periodicity and peak current \({500}\,{\upmu }\mathrm{{A}}\). Exact magnetic field frame time points have been shown on top of each image. Scale bar 34 \({\upmu }\mathrm{{m}}\) (c) Full temporal time traces of example pixels showing magnetic field tracking in time. Location of example pixels, labelled P1–P4 in the field of view have been shown in the magnetic field images. For each pixel, magnetic field traces versus time show tracking of applied the magnetic field, with faded gray lines as single iteration traces and solid black lines showing mean (\(n=15\)) magnetic field traces for the pixel. Amplitude spectral density of single-pixel field traces are shown on the left, where pixel Fourier spectra are in blue and applied voltage Fourier spectra has been shown in gray. Applied voltage spectral density is scaled to a constant to compare spectral content with pixel Fourier spectra. Since pixels track magnetic field, the prominent peak in the pixel Fourier spectra matches with the peak in the Fourier spectrum of the applied voltage, both occurring at magnetic field variation 17.9 Hz.

Temporal imaging data for the microcoil at similar magnetic field variation 18.9 Hz but higher NV acquisition rate of 208 fps has been shown in the supplementary section (Supplementary Fig. 5). Microcoil magnetic field features are spatially-resolved with reduced SNR and the first odd harmonic of 18.9 Hz field variation is also observed in the Fourier spectra of individual pixel responses. A higher magnetic field variation 41.52 Hz applied to the microcoil at 208fps acquisition rate is also shown (Supplementary Fig. 6). Additionally, for completeness, we show dynamics in the microwire sample at similar magnetic field variations (16.3 Hz) and 78fps NV acquisition rate. Supplementary Fig. 7 shows spatially resolved magnetic field images of the microwire and expected magnetic field tracking in individual pixel responses.

Figure 7
figure 7

Temporal imaging of an arbitrary millisecond scale magnetic field variation at 208 frames per second of the microcoil sample: (a) applied current profile to the microcoil sample. The main waveform signature lasts for less than 150 ms. Vertical blue lines indicates time-points where single magnetic field image frames have been shown further. (b) Example magnetic field frames at selected time-points (averaged \(n=15\) iterations) have been shown. Magnetic field images are Gaussian-smoothened with 4.5\(\sigma\) filter. The applied current profile is reflected in the series of spatially resolved magnetic field images of the microcoil. Magnetic field image at 413 ms is observed to faithfully capture the fast inversion of current polarity. Scale bar 34 \({\upmu }\mathrm{{m}}\).

Arbitrary waveform dynamics Here, we show millisecond scale widefield magnetometry for a generalized arbitrary waveform signal (Fig. 7a) with a rapid inversion of current polarity and where the total fluctuation event lasts less than 150ms. Fourier spectrum of this applied waveform contains energy in frequencies upto 100 Hz. Therefore, to sufficiently sample the magnetic field profile, number of demodulation cycles were reduced to get NV acquisition rate of 208fps. Fig. 7b shows selected single magnetic field frames (4.8 ms NV acquisition time per frame, \(n=15\) iterations) that show expected microcoil field temporal profile in response to the applied waveform. Notably, field frame at 413 ms captures the point of near-zero magnetic field profile when the current rapidly switches polarity within \(\sim\)30 ms. Since magnitude of the peak negative current is higher than the peak positive current, microcoil features are more prominent in field frame at 427 ms as compared to field frame at 394 ms. Magnetic field images for this case have been Guassian-smoothened with \(4.5\sigma\) filter to remove additional noise in temporal images incorporated at higher imaging frame rates. The video file of this imaging dataset has been provided in the “Supplementary section”.

Further, we observed high frequency noise in lock-in camera pixel response which can be reduced by the use of appropriate filtering techniques like Bayesian filtering to further enhance imaging SNR. To the best of our knowledge, the acquired single-axis widefield magnetic field images constitute a novel demonstration of real-time millisecond scale widefield magnetic field microscopy. Improved temporal resolution is primarily enabled by pixel noise-rejection at higher lock-in frequencies, high imaging frame rates offered by the lock-in camera and ability to synchronize modulation of NV emitted light with lock-in camera frame integration timings. At high imaging frame rates, the SNR is primarily limited by the NV’s emitted fluorescence rate from the diamond sample, and not by the lock-in camera demodulation rates. Therefore, the temporal imaging enhancement demonstrated in this work is expected to improve at least one-two fold with optimized optical and microwave excitation power of the NV ensemble and further, by the use state-of-art ion-irradiated high density nitrogen vacancy diamond samples.

Imaging speed and sensitivity trade-off: Finally, we discuss the interplay of four key parameters of WMF imaging method, namely, the imaging frame rate I, the mean per-pixel sensitivity \(\eta\), the NV modulation frequency \(\omega _{mod}\) and the number of frame averaging cycles \(n_{cyc}\). A phenomenological understanding of the coupling of parameters will be useful in deciding the trade-off. To maximize the imaging frame rate I \(\propto \omega _{mod}/n_{cyc}\), we need to modulate NVs faster (increase \(\omega _{mod}\)) and average for lesser number of internal frames (decrease \(n_{cyc}\)). Increasing \(\omega _{mod}\) leads to a decrease in the zero-crossing NV slope but the noise, \(\sigma\), remains mostly constant. Therefore, \(\eta\) will drop at higher \(\omega _{mod}\), keeping \(n_{cyc}\) same. Increasing the \(n_cyc\) has more interesting effects on \(\eta\), since the camera readout noise \(\sigma\) increases with more \(n_{cyc}\) but the NV signal strength also improves. Therefore, a multi-parameter optimization is required for understanding the trade-offs and zone of best performance for the sensor for a given specific application.

In summary, we have developed a novel widefield magnetic field microscope capable of probing dynamically varying microscale magnetic field features at tunable imaging frame rates of 50–200 frames per s. Millisecond to sub-second magnetic field images have been demonstrated for a planar microcoil sample with detailed microscale features, consisting of multiple current flow paths separated by \(\sim\)\({\upmu }\mathrm{{m}}\), current flow track width 10 \({\upmu }\mathrm{{m}}\) and multiple \({90}^{\circ }\) turns in the current flow path. While maintaining microscale spatial resolution, individual pixels in the imaging FOV have been shown to track applied magnetic fields in time with correct amplitude and phase for both periodic current waveforms and short 150 ms arbitrary current waveform. Frequency spectrum of individual pixels reveal near exact match to the frequency spectrum of applied periodic current waveforms. Further, the NV imaging speed enhancements have been shown for small magnetic fields, typically less than \(\sim\)\({{\upmu }\mathrm{{T}}}\) in the entire FOV. Therefore, to the best of our knowledge, the widefield per-pixel lock-in method proposed here marks significant improvement over conventional ODMR imaging, where few to several minutes of averaging time is required to obtain a single magnetic field image of similar microscale spatial resolution.

Conclusion and outlook

In this work, we have developed and demonstrated an experimental technique to perform real-time widefield magnetic field imaging using diamond NV centers in diamond. Per-pixel SNR is significantly enhanced using lock-in detection techniques implemented on a commercial lock-in camera which allows simultaneous demodulation of multiple pixels. While previous diamond NV based magnetometers have shown acquisition rate of several minutes per frame, to the best of our knowledge, we demonstrate for the first time, spatio-temporal magnetic field imaging at timescale around 1–40 Hz at imaging speed of 50–200 fps. There are two distinct sources of SNR enhancement in our imaging technique. First, each pixel acts like an effective narrow-band detector in the lock-in detection mode rejecting high levels of noise. Second, the lock-in camera, unlike conventional CMOS cameras, efficiently utilizes its full well capacity (FWC) to only record small levels of frequency-modulated NV resonance fluorescence and the large background NV fluorescence due to low NV-ODMR contrast is cancelled as DC signal across lock-in integration quadrants (see Fig. 1c) of each pixel. Such on-pixel level mechanism, unique to the lock-in camera, allows per-pixel SNR improvements by factor of \(1/\sqrt{2C}\) (when either in-phase or quadrature frames are used, C is contrast) over a conventional camera of similar FWC35. The fm-ODMR protocol used in this demonstration is easy to implement, demanding only frequency modulated NV-PL and microsecond digital pulses that control camera frame demodulation. We expect temporal imaging SNR and imaging FOV shown in our work to significantly improve with increase in optical excitation of NV centers and with application of state-of-art higher NV density diamond crystals. Additionally, the spatio-temporal resolution is expected to improve in future with the use of higher NV concentration diamond samples and improved coherence time. We emphasize that while we operate the camera at demodulation of 6.25–8.33 kHz and imaging frame rates of \(\sim\) 50–200 fps, the demonstration is primarily limited by the low NV fluorescence and not by maximum achievable lock-in modulation rates (possible up to 250 kHz) and imaging frame rates (maximum possible 3200 fps) for the camera used here. Other lock-in cameras45,46 are expected to offer similar high frame rate advantages.

We envision that in the near-future this work might aid in development of microscale volume magnetic field imaging techniques to functionally probe mammalian neuronal dynamics23. Further, widefield per-pixel lock-in detection can be easily employed in other existing diamond NV based imaging modalities, like in-vivo nanoscale thermometry40,41 using fluorescent nanodiamonds (FNDs), to gain significant enhancement in SNR and temporal resolution. Potential application of the current technique to real-time nanoscale thermometry involves optimization of the current method for frequency-modulated zero-field NV resonance tracking. Additionally, NV T1 relaxometry protocol can be synchronized with the per-pixel demodulation (Fig. 1c) to achieve dynamic imaging speed in microscale in-vivo free radical measurements with FNDs47. Further, the dynamic magnetic microscopy results in this work suggests extension of NV microscopy as a tool to characterize of novel Magnetic Nanotweezers (MNTs) for advanced spatio-temporal bio-manipulation48, wherein the MNTs response time varies from hours to microseconds scale.

We are aware of a similar independent preprint submission by Webb et al.49 where the authors demonstrate an application of widefield lock-in detection to enhance imaging speed of diamond NV magnetometry. Both our work and their work, with differences in experimental implementation, show that widefield lock-in detection enables sub-second magnetic field microscopy using NV defect centers in diamond, in contrast to conventional static diamond NV magnetic field microscopy.