Lock in Amp Redpitaya PDF
Lock in Amp Redpitaya PDF
Lock in Amp Redpitaya PDF
amplifier
Cite as: Rev. Sci. Instrum. 90, 094701 (2019); https://doi.org/10.1063/1.5083797
Submitted: 30 November 2018 . Accepted: 19 August 2019 . Published Online: 10 September 2019
A scalable arbitrary waveform generator for atomic physics experiments based on field-
programmable gate array technology
Review of Scientific Instruments 90, 043101 (2019); https://doi.org/10.1063/1.5051124
© 2019 Author(s).
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
AFFILIATIONS
1
Department of Physics, University of Warwick, Coventry CV4 7AL, United Kingdom
2
Diamond Science and Technology Centre for Doctoral Training, University of Warwick, Gibbet Hill Road, Coventry CV4 7AL,
United Kingdom
a)
Email: [email protected]
b)
Email: [email protected]
ABSTRACT
We present characterization
√ of a lock-in amplifier based on a field programmable gate array capable of demodulation at up to 50 MHz. The
system exhibits 90 nV/ Hz of input noise at an optimum demodulation frequency of 500 kHz. The passband has a full-width half-maximum
of 2.6 kHz for modulation frequencies above 100 kHz. Our code is open source and operates on a commercially available platform.
© 2019 Author(s). All article content, except where otherwise noted, is licensed under a Creative Commons Attribution (CC BY) license
(http://creativecommons.org/licenses/by/4.0/). https://doi.org/10.1063/1.5083797., s
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-1
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
We demonstrate that this device shares many capabilities with more in Fig. 1. Signals received by the ADCs are passed to the processing
expensive alternatives such as a sweepable internal signal genera- blocks where they are multiplied by the reference signal [which is
tor, single or dual input/output modes, wave form control, and the generated internally by direct digital synthesis (DDS)] and filtered
ability to increase the number of available inputs and outputs by using a single pole infinite impulse response (IIR) filter. The result-
interfacing across multiple STEMlab units. ing output is written to the SBC’s random access memory (RAM)
Comparison is made with the Zurich Instruments HF2LI LIA, via the FPGA’s memory interface block. This data is then written to
which is specified for operation up to 50 MHz demodulation fre- a ramdisk file also contained within the STEMlab’s RAM, alleviat-
quency.30 While an extensive software application is provided with ing high read/write workloads which were observed to cause critical
the HF2LI, the open source nature and readily available software and failures of the SD card. The data are also passed to the on-board
hardware of the LIA presented here allow for an attractive option digital-to-analog converters (DACs) along with the reference signal
where cost is a consideration. Research into low-cost FPGA based that is used to modulate the desired signal. This reference can be
LIAs has produced a number of alternatives,25 including high res- extracted via the DAC output for external use.
olution designs operating at up to 6 MHz demodulation,31,32 and Data retrieval from the STEMlab to a host computer can be
simulations have been presented for a high frequency LIA based on achieved via the DACs that are provided with SubMiniature version
the Red Pitaya STEMlab.33 Typically, FPGA LIAs have been devel- A (SMA) connections for output to an oscilloscope. These DACs
oped with specific experimental objectives.13,14,34 The STEMlab is have 14-bit resolution combined with 125 MS/s data rate. Non-
the basis for a range of related measurement instrumentation from offset, digital amplification of up to 2000 times the raw output is
PyRPL, including an LIA.35–37 A low cost FPGA-based LIA has also available. However, noise introduced by the DACs makes the out-
been developed which operates at a low demodulation frequency,38 put undesirable in cases where small changes in signal intensity are
and FPGA-based LIAs have been compared with analog devices in to be detected. Alternatively, data may be transferred to a host per-
terms of signal accuracy.39 However, we believe that this article is sonal computer (PC) via file transfer from the STEMlab’s RAM. This
the first to characterize a high frequency, open source LIA. The open produces low noise data but can only be performed on the entirety
source code may lead to a range of future uses in research, education, of the LIA’s allocated storage space of approximately 65 megabytes
and industry. (MB). While this process may last for tens of seconds, all data
(X, Y, R, and ϕ) for both output channels are received simultane-
II. METHODS ously. Further limitations include the inability to operate using an
external lock-in reference, cross talk that can occur between the two
A. Hardware and software input channels and no facility for subtraction of channels (e.g., A-B).
The FPGA system design and implementation was performed Due to the programmable nature of the STEMlab, end users are able
using software provided by the manufacturer of the FPGA, Xilinx. A to implement their own data transfer methods, which may be shown
simplified version of the design circuitry block diagram can be seen to alleviate some or all of these limitations.
FIG. 1. Simplified schematic of the circuitry layout on the Red Pitaya lock-in amplifier FPGA. Signals (solid green arrows) are received at channel processing, where they
are multiplied by a reference signal generated in the direct digital synthesis (DDS) block, which takes time data (dashed brown arrows) from the timer and distributes it as a
reference. After multiplication, data are passed through a single pole infinite impulse response (IIR) filter, currently limited to single order. Filtered data (solid blue arrows) are
then passed to the memory allocation block and subsequently to the digital to analog converters (DACs) and are converted to analog data (solid red arrows) and passed out
to the user or saved to the SBC RAM where they can be accessed via Ethernet (dashed red arrow). The reference signal is extracted from the DACs in analog form (dashed
blue arrow). Operating parameters and modes are set by the user (dashed green arrows) via the command line interface (CLI) that communicates with the mode control
block on the FPGA.
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-2
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
B. Characterization methodology
Data were extracted from both LIAs via Ethernet connection.
In the case of the RePLIA aboard the STEMlab, this avoided noise
from its DACs which were found to increase noise by up to three
orders of magnitude.
Noise for both LIAs during operation was measured at various
demodulation frequencies with no input signal present and with a
constant amplitude signal produced with an Agilent N5172B EXG
vector signal generator. Similarly, noise was measured while varying
the time constant of the LIAs with the demodulation frequency fixed
at the value determined to be the least noisy by the previous method.
As with the input noise, these data are presented after a fast Fourier
transform (FFT).
Passbands for each LIA at various demodulation frequencies
were obtained by applying a constant amplitude signal at the spec-
ified demodulation frequency. This signal was then combined with
a sweep between the minimum and maximum frequencies passing
through the demodulation frequency, with a sweep time of 10 s.
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-3
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-4
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
ACKNOWLEDGMENTS
We thank Ben Breeze and Matt Dale for assistance and advice.
This research was funded by Bruker Biospin and the Engineer-
ing and Physical Sciences Research Council (EPSRC) via Grant
No. EP/L015315/1, and G. W. Morley was supported by the Royal
Society.
0.001 10 100
0.01 1 100
IV. CONCLUSIONS 0.1 0.1 10
The RePLIA performs lock-in amplification 0.5 2 × 10− 2 1
√ at frequencies up
to 50 MHz, with an input noise level of 90 nV/ Hz. The respective 1 1 × 10− 2 1
figures from√the Zurich Instruments HF2LI (50 MHz demodulation 10 1 × 10− 3 1
with 5 nV/ Hz input noise) show that the FPGA LIA detailed in 100 1 × 10− 4 0.1
this article is an open source alternative.
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-5
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
the STEMlab, although this sample rate may ultimately affect the
accuracy of resultant signals. When obtaining data via the DAC out-
puts, collection has been performed by a Pico Technology Picoscope
4424 digital oscilloscope. The Picoscope and DAC outputs were also
used when determining the time constants for the RePLIA. Data
extracted via the RePLIA’s Ethernet port were converted to milli-
volt values by dividing the actual numerical value by 2.1 × 106 , a
conversion factor that was determined by comparing the Ethernet
values with the corresponding values produced at the DACs with no
DAC multiplication applied.
The Zurich Instruments HF2LI was operated according to the
instructions laid out in section 3.5 of the HF2 User Manual,30 using
the parameters in Table I.
FIG. 6. (a) FFT of 10 kHz demodulation data taken from the RePLIA’s DAC outputs, FIG. 7. FFTs of RePLIA input noise at varying DAC multiplier settings (a) with
demonstrating significantly greater noise than the data taken from the Ethernet extremes only plotted for clarity (b). (c) The signal to noise ratio at the RePLIA’s
output. (b) Output signal to noise ratio from the DAC outputs improves dramati- digital-to-analog outputs increases with a larger DAC multiplier. However, even
cally with demodulation frequency throughout lower frequency ranges due to the small signals can lead to saturation of these outputs. Data are obtained at 500 kHz
increased signal. demodulation frequency and a 10 ms time constant.
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-6
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
FIG. 8. The effect of the time constant setting on the resulting passband. An 80
kHz sweep over 10 s through the demodulation frequency of 500 kHz at varying
time constants results in distortion of the passband. Longer time constants result
in fringes in the unwanted frequency regions, and shorter time constants result in
excessive acceptance of unwanted frequencies. For 500 kHz, a time constant of
1 ms was chosen as a suitable compromise. The small section of the sweep FIG. 9. Low frequency (1–10 kHz) FFTs of RePLIA input noise from (a) 1 s, (b)
output shown above shows only the part of the passband affected by the time 10 s, and (c) 100 s of DAC data. Frequency-specific spikes are common at a low
constant. demodulation frequency.
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-7
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-8
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
APPENDIX B: HARDWARE AND SOFTWARE NOTES Cross talk between input channels results in a signal 0.3% of the
Largely, the RePLIA is limited by the factors introduced by input signal amplitude reflected in the secondary input. The output
the STEMlab’s hardware and software. The maximum sample rate voltage range is limited by the board to ±1 V.
of the demodulated signal corresponds to the output sample rate of Figure 13 represents the same data as Fig. 2 in the main
the STEMlab (125 MS/s) when using the DAC outputs. However, text, but as plain FFTs of noise data as opposed to noise spectral
this sampling rate is limited instead by the network connection when density.
extracting data via the Ethernet adapter. The RePLIA has been used for magnetometry using an ensem-
Mathematical operations such as Aout = Ain − Bin have not been ble of nitrogen vacancy centers in diamond. We intend to apply this
implemented at the current time, although this is entirely plausible technique to magnetocardiography, where it would be preferable to
by adding such functionality within the FPGA code. use approximately 200 sensors, requiring 100 dual channel lock-in
Power consumption for the RePLIA is 4 W when idle and <6 W amplifiers.42
during lock-in operation.
REFERENCES
1
J. Leis, P. Martin, and D. Buttsworth, “Simplified digital lock-in amplifier
algorithm,” Electron. Lett. 48, 259–261 (2012).
2
L. C. Caplan and R. Stern, “An inexpensive lock-in amplifier,” Rev. Sci. Instrum.
42, 689–695 (1971).
3
W. C. Michels and N. L. Curtis, “A pentode lock-in amplifier of high frequency
selectivity,” Rev. Sci. Instrum. 12, 444 (1941).
4
X. Wang, “Sensitive digital lock-in amplifier using a personal computer,” Rev.
Sci. Instrum. 61, 1999–2001 (1990).
5
P.-A. Probst and A. Jaquier, “Multiple-channel digital lock-in amplifier with ppm
resolution,” Rev. Sci. Instrum. 65, 747 (1998).
6
M. Hofmann, R. Bierl, and T. Rueck, “Implementation of a dual-phase lock-
in amplifier on a TMS320C5515 digital signal processor,” in 5th European DSP
Education and Research Conference (EDERC) (IEEE, 2012), pp. 20–24.
7
M. Osvaldo Sonnaillon and F. J. Bonetto, “A low-cost, high-performance, digital
signal processor-based lock-in amplifier capable of measuring multiple frequency
sweeps simultaneously,” Rev. Sci. Instrum. 76, 024703 (2005).
8
G. Macias-Bobadilla, J. Rodríguez-Reséndiz, G. Mota-Valtierra, G. Soto-
Zarazúa, M. Méndez-Loyola, and M. Garduno-Aparicio, “Dual-phase lock-in
amplifier based on FPGA for low-frequencies experiments,” Sensors 16, 379
(2016).
9
G. C. Giaconia, G. Greco, L. Mistretta, and R. Rizzo, “Exploring FPGA-
based lock-in techniques for brain monitoring applications,” Electronics 6(1), 18
(2017).
10
S. G. Castillo and K. B. Ozanyan, “Field-programmable data acquisition and
processing channel for optical tomography systems,” Rev. Sci. Instrum. 76, 095109
(2005).
11
A. Moreno-Baez, G. Miramontes-de Leon, C. Sifuentes-Gallardo, E. Garcia-
Dominguez, D. Alaniz-Lumbreras, and J. A. Huerta-Ruelas, “FPGA implemen-
tation of a 16-channel lock-in laser light scattering system,” in IEEE Electronics,
Robotics and Automotive Mechanics Conference (IEEE, 2010), pp. 721–725.
12
A. Patil and R. Saini, “Design and implementation of FPGA based linear
all digital phase-locked loop,” in International Conference on Green Computing
Communication and Electrical Engineering (ICGCCEE) (IEEE, 2014), p. 1.
13
D. Divakar, K. Mahesh, M. M. Varma, and P. Sen, “FPGA-based lock-in
amplifier for measuring the electrical properties of individual cell,” in IEEE
13th Annual International Conference on Nano/Micro Engineered and Molecular
Systems (NEMS) (IEEE, 2018), pp. 1–5.
14
A. Chighine, E. Fisher, D. Wilson, M. Lengden, W. Johnstone, and H. McCann,
“An FPGA-based lock-in detection system to enable chemical species tomogra-
phy using TDLAS,” in IEEE International Conference on Imaging Systems and
Techniques (IST) (IEEE, 2015), pp. 1–5.
15
M. Carminati, G. Gervasoni, M. Sampietro, and G. Ferrari, “Note: Differential
configurations for the mitigation of slow fluctuations limiting the resolution of
FIG. 13. FFTs of noise data from (a) RePLIA at 500 kHz demodulation with a 1 ms digital lock-in amplifiers,” Rev. Sci. Instrum. 87(2), 026102 (2016).
time constant (with 1 s data zero padded) and (b) HF2LI at 1 MHz demodulation 16
M. Meade, Lock-in Amplifiers: Principles and Applications (Peter Peregrinus
and 700 μs time constant, at 1 s (blue), 10 s (red), and 100 s (yellow) collection
Ltd., 1983).
time (output data is R for both channels). (c) Noise spectral density of the RePLIA 17
at the above input parameters with a wider output frequency spectrum than in F. Humayun, R. Khan, S. Saadman, and R. Haque, “Design of a cost-effective
Fig. 2. analog lock-in amplifier using phase sensitive detector,” in International Applied
Computational Electromagnetics Society Symposium (ACES), 2018.
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-9
© Author(s) 2019
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments
18 31
J. H. Scofield, “Frequency-domain description of a lock-in amplifier,” Am. J. G. Gervasoni, M. Carminati, G. Ferrari, M. Sampietro, E. Albisetti, D. Petti,
Phys. 62(2), 129–133 (1994). P. Sharma, and R. Bertacco, “A 12-channel dual-lock-in platform for magneto-
19 resistive DNA detection with PPM resolution,” in IEEE Biomedical Circuits and
P. Horowitz and W. Hill, The Art of Electronics, 2nd ed. (Cambridge University
Press, 1989). Systems Conference (BioCAS) Proceedings (IEEE, 2014), pp. 316–319.
20 32
E. Theocharous, “Absolute linearity characterization of lock-in amplifiers,” G. Gervasoni, M. Carminati, and G. Ferrari, “A general purpose lock-
Appl. Opt. 47(8), 1090–1096 (2008). in amplifier enabling sub-PPM resolution,” Procedia Eng. 168, 1651–1654
21
S. DeVore, A. Gauthier, J. Levy, and C. Singh, “Development and evaluation of (2016).
33
a tutorial to improve students’ understanding of a lock-in amplifier,” Phys. Rev. L. H. Arnaldi, “Implementation of an AXI-compliant lock-in amplifier on the
Phys. Educ. Res. 12(2), 020127 (2016). red pitaya open source instrument,” in IEEE Eight Argentine Symposium and
22
See https://www.thinksrs.com/downloads/pdfs/applicationnotes/AboutLIAs. Conference on Embedded Systems (CASE) (IEEE, 2017), pp. 1–6.
34
pdf for Stanford Research Systems: About Lock-in Amplifiers. Y. Sukekawa, T. Mujiono, and T. Nakamoto, “Two-dimensional digital lock-in
23
See https://www.zhinst.com/sites/default/files/li_primer/zi_whitepaper_ circuit for fluorescent imaging of odor biosensor system,” in New Generation of
principles_of_lock-in_detection.pdf for White paper: Principles of lock-in detec- CAS (NGCAS) (IEEE, 2017), pp. 241–244.
35
tion and the state of the art; accessed August 19, 2019. See https://pyrpl.readthedocs.io/en/latest/gui.html for PyRPL GUI Manual;
24
T. Qian, L. Chen, X. Li, H. Sun, and J. Ni, “A 1.25 Gbps programmable FPGA accessed August 19, 2019.
36
I/O buffer with multi-standard support,” in IEEE 3rd International Conference on See https://ln1985blog.wordpress.com/2016/02/07/adding-voltage-regulators-
Integrated Circuits and Microsystems (ICICM) (IEEE, 2018), pp. 362–365. for-the-redpitaya-output/-stage/ for Adding voltage regulators for the RedPitaya
25
R. Li and H. Dong, “Design of digital lock-in amplifier based on DSP builder,” output stage; accessed August 19, 2019.
37
in IEEE 4th Information Technology and Mechatronics Engineering Conference See https://ln1985blog.wordpress.com/2016/02/07/red-pitaya-dac-performance/
(ITOEC) (IEEE, 2018), pp. 222–227. for Red Pitaya DAC performance; accessed August 19, 2019.
26 38
See https://www.redpitaya.com/f130/STEMlab-board for Red Pitaya STEMlab See https://delacor.com/products/lock-in-amplifier/ for Lock-in amplifier for
Board; accessed September 5, 2018. myrio; accessed August 19, 2019.
27 39
A. Restelli, R. Abbiati, and A. Geraci, “Digital field programmable gate array- J. Vandenbussche, P. Lee, and J. Peuteman, “On the accuracy of digital phase
based lock-in amplifier for high-performance photon counting applications,” Rev. sensitive detectors implemented in FPGA technology,” IEEE Trans. Instrum.
Sci. Instrum. 76(9), 093112 (2005). Meas. 63(8), 1926–1936 (2014).
28 40
See https://www.analog.com/media/en/technical-documentation/data-sheets/ See https://www.zhinst.com/sites/default/files/zi_hf2li_leaflet_web_0.pdf for ZI
21454314fa.pdf for LTC2145CUP-14; accessed August 19, 2019. HF2LI Leaflet; accessed October 02, 2018.
29 41
See https://github.com/WarwickEPR/RePLIA for Warwick EPR Group GitHub C. E. Shannon, “Communication in the presence of noise,” Proc. IRE 37, 10–21
Repository; accessed August 19, 2019. (1949).
30 42
See https://www.zhinst.com/manuals/hf2 for Zurich Instruments. HF2 User M. W. Dale and G. W. Morley, “Medical applications of diamond magnetome-
Manual - LabOne Edition; accessed 2018. try: Commercial viability,” e-print arXiv:1705.01994v1 (2017).
Rev. Sci. Instrum. 90, 094701 (2019); doi: 10.1063/1.5083797 90, 094701-10
© Author(s) 2019