Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Review of ARTICLE scitation.

org/journal/rsi
Scientific Instruments

Compact embedded device for lock-in


measurements and experiment active control
Cite as: Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345
Submitted: 7 November 2018 • Accepted: 1 February 2019 •
Published Online: 19 February 2019

Marcelo Alejandro Luda,1,a) Martin Drechsler,2 Christian Tomás Schmiegelow,2 and Jorge Codnia1

AFFILIATIONS
1
CEILAP, CITEDEF, J. B. de La Salle 4397, 1603 Villa Martelli, Buenos Aires, Argentina
2
Departamento de Física and IFIBA, FCEyN, UBA, Pabellón 1, Ciudad Universitaria, 1428 Buenos Aires, Argentina

a)
mluda@citedef.gob.ar

ABSTRACT
We present a multi-purpose toolkit for digital processing, acquisition, and feedback control designed for physics labs. The kit
provides in a compact device the functionalities of several instruments: function generator, oscilloscope, lock-in amplifier,
proportional-integral-derivative filters, ramp scan generator, and a lock-control. The design combines field-programmable-
gate-array processing and microprocessor programing to get precision, ease of use, and versatility. It can be remotely operated
through the network with different levels of control: from simple off-the-shelf Web graphical user interface to remote script
control or in-device programmed operation. Three example applications are presented in this work on laser spectroscopy and
laser locking experiments. The examples include side-fringe locking, peak locking through lock-in demodulation, and complete
in-device Pound–Drever–Hall modulation and demodulation at 31.25 MHz and advanced acquisition examples like real-time data
streaming for remote storage.
Published under license by AIP Publishing. https://doi.org/10.1063/1.5080345

I. INTRODUCTION popular strategy used for control is the proportional-integral-


derivative (PID) filter. Though it is known not to be the optimal
The demand for stabilization systems in optics, atomic, strategy for all systems, its ease of use and understanding, as
and molecular physics experiments is increasing more and well as its satisfactory results makes it the usual workhorse in
more with time. The realization of high accuracy measure- most practical setups and the one here chosen. Moreover, one
ments relies often on the fine control of several variables at a can combine various PID filters to control multiple inputs and
time in the same experiment: light intensities, emission wave- multiple outputs (MIMO) and add filters and signal processing
length, temperature, modulation depth, mechanical stress, or to any stage, making the uses of PID control a versatile and
position of elements are just some examples of variables that intuitive platform for control.
need to be controlled for that purpose. The advent of fast microprocessor devices and field pro-
The standard approach in control theory for a sta- grammable gate arrays (FPGA) has paved the way to the
bilization and control procedure is a feedback scheme.1 implementation of the digital processing feedback schemes
This is accomplished by measuring certain variables of the in experiment control setups. For example, PID filters were
system-under-control and acting on it with a set of control- implemented on pure-FPGA boards.2 Also pre-processing
parameters. The most common procedure is to measure out- information like phase detectors was also accomplished with
comes, compare them to some preset desired values, and FPGAs.3 A pure microprocessor implementation of the feed-
then act on the system with a chosen strategy to compen- back controller has been showed to be more versatile and less
sate the deviations. The realization of this strategy is the core complex in some simple or slow tasks.4 Most of the expe-
of the control system, and its instrumentation has evolved riences show the need to get a compromise between the
from welded electronics analog circuits to more sophisticated fast and robust FPGA processing and the versatile and easily
and versatile digital processing systems. Probably, the most reprogrammable microprocessor global functions and control.

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-1
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

This way, the FPGA can handle time sensitive functions often spectroscopy scheme, in Sec. III B, using lock-in phase sen-
also in parallel, while the microprocessor provides the user sitive acquisition to lock laser emission frequency to spec-
higher level functions and control in an on-site configurable tral peak maximum. Finally, we present a Pound–Drever–Hall
manner. locking scheme for another ECDL, in Sec. III C. One of the
Embedded devices with FPGAs and microprocessors were goals of this proposal is the lock-in operation at 31 MHz,
successfully used to achieve similar tasks as we show here.5,6 enabling the implementation of the complete lock-in modula-
However they were developed in the framework of propri- tion and demodulation scheme in only one device, something
etary, platform-dependent software that limits the available which has never been reported so far.
tools for developing custom solutions and modifications. An
open-source system and an open-hardware solution have also II. SYSTEM DESIGN
been presented with a servo and loop-back control system in
pure FPGA for an atomic, molecular, and optical (AMO) labora- The toolkit is based on a commercial system on chip
tory.7 Finally, we note that another toolkit with open-source (SOC) device known as Red Pitaya v1.1 (STEMLab 125-14) with
software and based on the same hardware we use has been a Xilinx Zynq 7010 integrated circuit core, which includes
presented in a recent study.8 The project provides similar an FPGA and a dual core ARM Cortex-A9 processor, inte-
hardware features to the ones present in our work. The main grated to peripherals suitable for signal acquisition and gen-
difference is in the control environment graphical user inter- eration (fast ADCs, DACs, DIOs, and communication ports).
face (GUI) which is Python based instead of a web server as we The device operation follows a client-server architecture that
use here. can be thought as a layer structure. The client side is the user
In this work, we present a versatile general purpose front-end running on a client’s own device. The server side
toolkit for system control instrumentation built on a FPGA is the STEMLab device, including the operating system, pro-
and microprocessor embedded device that is ready for sim- grammable electronics, and hardware peripherals. The layers
ple off-the-shelf usage and also for high complex integrated can be controlled on different levels depending on the user’s
schemes of acquisition and control. The hardware is based on requirements. In the following, we describe possible applica-
a Red Pitaya STEMLab 125-149 board, which makes it a com- tion strategies and the layer architecture, both depicted in
pact solution with a credit card size that can be acquired on Fig. 1.
web store. The FPGA and software design is all open-source
and can be accessed through a web repository.10 The toolkit A. User strategy
includes an oscilloscope, a ramp/scan controller, two lock-in We present here three different user strategies with
amplifiers, modulation generators, PID filters, and an overall growing complexity and versatility. Depending on the needs,
control module which includes automatic locking, lock-watch, a user can choose from simple pre-defined working modes
and re-lock. A big difference with previous implementations to modifying instrument cabling or programming complex
is the availability of a lock-in module which works with fre- measurement and feedback routines.
quencies up to 31 MHz. All stages of the high frequency lock-in The “GUI predefined operation” option allows us to per-
are implemented in the Red Pitaya module without the use of form most of the tasks described here from a web browser in
any extra components. We show an example of this feature for the user device. The front-end is part of the client-side and
frequency stabilization of a laser using the Pound-Drever-Hall is built over the HTML+JS page and presents a friendly inter-
technique. face for several instruments’ operation: two lock-in amplifiers,
This device works as a stand-alone device that can be two PID loops with different locking and re-locking routines,
remotely controlled through Ethernet-TCP/IP network con- an on-screen oscilloscope, and cabling between them. These
nection via a web-based interface and is therefore platform allow us to perform a wide variety of measurement and con-
independent. Moreover, one can log into the embedded oper- trol tasks which we describe in detail in Sec. III, with sev-
ating system via SSH protocol and set operation parameters eral examples which include low and high frequency lock-in
through a communication bus to the FPGA, enabling differ- measurements and active stabilization of lasers.
ent types of usage going from predefined easy configuration An even greater versatility can be achieved via the
to low level user-defined programed control. “Programed and remote acquisition and control” option. All
The present report is divided in two parts. In the first the instruments can be remote controlled and data can be
part, we describe the toolkit hardware, software, and usage. acquired through user commands, enabling the possibility of
We describe the user strategy options and the toolkit design incorporating them to algorithms designed by the user in var-
in Sec. II A, the architecture organized in layers in Sec. II B, and ious programming languages. An example code can be found
the usage logic organized in “instruments” in Sec. II C. in the project repository10 for Python and Matlab, including
In the second part, the toolkit is tested in several exam- two channel oscilloscope acquisition, on-demand multichan-
ple applications in an AMO physics laboratory. We show a nel reading of several signal values and instruments’ operation
rubidium absorption spectroscopy scheme in Sec. III A, with by writing control register values.
a Vertical-Cavity Surface-Emitting Laser (VCSEL), using the The user commands are Python scripts executed in the
toolkit for acquisition of transmission signal and for side- Red Pitaya shell that implement the basic procedures for
fringe locking stabilization. Then we use an External Cav- reading and writing RAM addresses’ values linked to FPGA
ity Diode Laser (ECDL) to implement a saturated absorption registers. The remote execution can be performed by any

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-2
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

FIG. 1. Design of the client-server architecture. The toolkit is organized in a layer structured way. The elements are grouped horizontally by site and type. As indicated in
the right-hand-side column, system layers are organized in increasing levels of complexity: welded electronics, programmable electronics, operating system, and front end.
The dashed line separates the client part (end-user device) and the server part (STEMLab device). The horizontal and vertical blue arrows show communication between
elements. There are three possible user strategies indicated by colored columns (red, yellow, and green). The first (red) column follows the Red Pitaya STEMLab original
design philosophy. Here operation is controlled from the graphical user interface (GUI). The next two columns show more advanced operation where the system is remotely
controlled (yellow) or where resident programs do automated acquisition and signal processing (green).

remote-shell tool, using serial communication (microUSB) or B. Layer architecture


Ethernet (RJ45 port). The examples provided online10 use SSH
The system design can be understood in a 4 layer scheme
protocol over a TCP/IP network, being a secure and versatile
(see Fig. 1). The lower three layers are part of the server side
option that can be incorporated to almost any already working
and take place in different parts of STEMLab board hardware.
computer network. Moreover, open-source implementations
The lowest one is the “Welded electronics layer,” which
of SSH protocol are available for all possible operating sys-
provides the connection to digital and analog input/output
tems of the client, enabling the operation from any device or
ports and the access to peripherals, including some analog
programing language.
electronics for signal conditioning. Signals in this layer are
The on-demand read and write procedures are only lim-
ited by network communication delays and microprocessor converted from continuous analog voltage signals on wires to
process priority. The provided examples include combined digital clocked buses of data, suitable for FPGA reading. For
operation of instruments for tasks like ramp/scan configu- this purpose, the board includes two fast Analog to Digital
ration, lock-in acquisition of system response, PID config- Converters (ADCs), associated with in1 and in2 FPGA buses,
uration, and launching a triggered controlled stabilization and two fast Digital to Analog Converters (DACs), associated
scheme. with out1 and out2 FPGA buses, working at 125 MSa/s with
We also provide an API (Application Program Interface) 14 bits of resolution, on the range of ±1 V. ADC inputs can work
for Python to simplify code writing of user designed “resident in the range of ±20 V with hardware jumper configuration.
programs,” running in the server side. This enables the opera- Also, 16 input/output digital pins are included, with a maxi-
tion of instruments with lower latency and enables the design mum refresh rate of 125 MSa/s, on a LVCMOS 3.3 V logic. It
of algorithms for fast decision making, faster multichannel also includes four slow outputs of 0–1.8 V, 1 MSa/s built from
acquisition, and stand-alone working without the client side. low pass filtered PWM (Pulse-Width Modulation) signals and
In this way, data acquisition and instrument commands can be four slow inputs with the same sample rate.
made with a latency of ∼ms order. The “Programmable electronics layer” stores the digi-
The “resident programs” advantages can be exploited to tal electronic FPGA circuits for real-time processing, like fil-
implement different integration strategies of the toolkit in the ters, mixers, and adders, which build up the core of each
lab. For example, acquired data can be pre-processed on the instrument implementation. In this layer, the signal data flow
server-side and stored in the STEMLab device for later user through digital buses that represent signed integer values
retrieval. On the other hand, the raw or the pre-processed of 14 bit resolution. The circuits were designed in the Ver-
data can be streamed to the client side for online monitor- ilog language, synthesized using Xilinx Vivado 2005.2 soft-
ing and storage. The user can choose these or other options, ware and implemented on the Zynq-7010 FPGA chip on
depending on whatever suits the experimental scheme better. the Red Pitaya board. The Xilinx development tools for this
In Subsection III C 1, we report an example of long accu- chip are available for free, so no additional costs are incor-
mulated measurements streamed to the client-side, used for porated on development licenses if the design should be
Allan-deviation calculation. modified. This layer also provides connectivity between the

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-3
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

microprocessor and “Welded electronics layer” through spe- implementing filters and control loops. The base modules
cialized data buses. include function generators, ramp generators, multipliers,
The FPGA design was made with simplicity in mind, to demodulators, low-pass filters, multiplexers, etc.
ease the user understanding of the electronic logic. Also, The control registers can be set and read from the Red
the implementation was made trying to prioritize direct wire Pitaya local shell, from remote software, or from the applica-
processing, reducing the usage of registers in the middle of tion Web GUI. The last one includes user friendly options for
input-output signal flow. This decision was taken because operation, described in more detail in Sec. II D.
each register adds a clock period delay (8 ns) to the data flow. A set of buses and multiplexers allow the interconnec-
Closed-loop control schemes are bandwidth limited by this tion of the different instruments. The buses transport the ADC
delay value.1 The achieved delay for device input-output using input signals and the instruments’ output signals. The multi-
one PID filter was 130 ns, which imposes a theoretical limit to plexers are controlled by the user through register values to
the feedback bandwidth of 3.8 MHz. choose the instruments’ inputs or the DAC output signals. In
The “Operating system layer” stores the back-end logic this way, several instruments can be combined into a system
that controls the operation of the digital circuits. It runs with dedicated purpose, such as lock-in demodulation and PID
a GNU/Linux operating system with a set of RAM memory control for stabilization schemes.
addresses mapped to FPGA registers that are used by the The core design of the instruments is described in this
instruments’ circuits to set their configurations or store data. section, and usage information is documented in the project
The back-end logic reads and writes these registers and makes web page.12
some data conditioning, like conversion from FPGA integer-
raw data to end-user float-voltage data values. This logic is
1. The lock-in amplifiers
implemented in the API (programmed in Python) and also in
the Nginx web server (programmed in a C extension module). Two lock-in amplifiers were implemented to cover differ-
The web server provides the client access and control from ent kinds of applications: a “standard” harmonic lock-in, with a
the user web browser, exchanging data using the JSON stan- frequency range that goes from 3 Hz to 49.6 kHz, and a square
dard format and HTTP/POST protocol. The API is used by the wave lock-in with a wider frequency range, from 30 mHz to
user commands introduced in Sec. II A. 31 MHz.
The “User Front-end” layer is only provided for the “GUI Figure 2 shows the scheme of the FPGA implementation
predefined operation” strategy, and it consists of a dynamic logic of a lock-in demodulation path. The input signal signal_i
web page loaded in the client device. The data acquired in the is multiplied by a local oscillator refi signal that settles the
FPGA layer, and conditioned in the back-end layer, are shown frequency and phase reference and then is filtered by using
here in an intuitive way, as can be seen in Fig. 6. a low pass filter (LPF) with a cut-off frequency of fcuti . The
LPF output out27i is a 27 bit signed int register which is avail-
C. The instruments able for recoding measurements and which can be monitored
via the Web GUI. A bus-trim applied to the register reduces
The functionalities of the toolkit have been organized
it to a 14 bit signal out14i . The selection of the trimmed bits
in logical units called “instruments,” which allow the user to
has the net effect of an amplifier by powers of 2, controlled by
interact with it. Each instrument provides some of the func-
the ampi parameter. This 14 bit signal can then be connected
tionalities of typical laboratory equipment used for acqui-
to either the PIDs, the output DACs, or the oscilloscope input
sition and control. The instruments implemented are the
channels.
following:

1. Two lock-in amplifiers.


2. Two Proportional-Integral-Derivative (PID) controllers.
3. A ramp/scan function generator.
4. A general lock-control helper, with an event monitor and
re-lock routine.
5. An oscilloscope.

Each instrument is composed by a set of HTML controls in


the Web GUI, grouped in panels, and a set of Verilog modules
for the FPGA layer. Instruments 2 and 5 are modified versions
of the open-source applications developed by Red Pitaya com- FIG. 2. Lock-in schematic design. Lock-in demodulation, filtering, and amplification
munity and released with a BSD license.11 Instruments 1, 3, and are performed digitally at the FPGA layer. The 14-bit input is digitally selected
by using a multiplexer with the control parameter signal_sw. The input is then
4 were developed for this work. multiplied with a reference signal refi and filtered with a low pass filter. The order
In the FPGA layer, the instruments are composed by log- of the filter and the cutoff frequency are selected with the parameters orderi and
ical modules whose behavior is controlled and monitored by fcuti . After the filter, the signal has 27 bits and is accessible through the variable
registers. The modules are independent interconnected cir- out27i . Finally the signal is amplified by the factor 2ampi and trimmed to 14 bits
cuits which handle signal acquisition, processing, and gen- to generate the output signal out14i . This process occurs in parallel for 7 different
eration. They also include internal memory which allows reference signals indicated by the letter i and detailed in Table I.

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-4
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

TABLE I. Register name reference for lock-in demodulation paths. The columns represent the control parameters depicted in Fig. 2 with generic names. Each row shows the
actual register names for each demodulation path. The 1–5 paths are part of the harmonic lock-in, and the 6–8 paths are part of the square wave lock-in. Some registers are
shared between several demodulation paths.

i refi Signal equation fcuti name orderi name ampi name out27i name out14i name

1 cos_ref cos(2πft) lpf_F1_tau lpf_F1_order sg_amp1 X Xo


2 sin_ref sin(2πft) lpf_F1_tau lpf_F1_order sg_amp1 Y Yo
3 cos1f cos(2πft − φ) lpf_F1_tau lpf_F1_order sg_amp1 F1 F1o
4 cos2f cos(2π2ft − 2φ) lpf_F2_tau lpf_F2_order sg_amp2 F2 F2o
5 cos3f cos(2π3ft − 3φ) lpf_F3_tau lpf_F3_order sg_amp3 F3 F3o

6 sq_ref sgn(cos(2πf sq t)) lpf_sq_tau lpf_sq_order sg_amp_sq sqX sqXo


7 sq_quad sgn(sin(2πf sq t)) lpf_sq_tau lpf_sq_order sg_amp_sq sqY sqYo
8 sq_phas sgn(cos(2πf sq t − ϕ)) lpf_sq_tau lpf_sq_order sg_amp_sq sqF sqFo

The harmonic lock-in is composed of five demodulation set with a resolution of 16 ns, starting from 32 ns (31.25 MHz)
paths like that depicted in Fig. 2. Each path has its own refi and expanding the possible values up to 68 s. The ϕ phase
signal and bus names, as shown in Table I, which can be used relation is set as an integer factor of 8 ns. Both parameters,
in the application for DAC outputs or oscilloscope visualiza- period and phase, are set by 32 bit unsigned integer reg-
tion. The cos_ref and sin_ref paths have their reference in isters. The maximum frequency is ultimately limited by the
quadrature, so the X and Y outputs provide the full phase and clock period of 8 ns. The lower limit could be increased, if
amplitude information of the signal_i filtered frequency com- needed, by expanding the size of the registers. The multi-
ponent. The other three paths allow setting a fixed phase rela- pliers of these paths are modified to map the binary input
tion with respect to cos_ref and also obtaining information from 0, 1 values to ±1. The sq_ref binary signal is available
about the first (2f) and second (3f) harmonics. The φ param- in one of the fast binary outputs of the extension pins of
eter, which can be configured through the Web GUI phase the STEMLab device, and all the signals can be used on the
phase
control, sets a phase displacement of φ = 2π 2520 . DAC outputs, where they are mapped from the binary values
Each local oscillator signal is made from 2520 signed inte- to ±0.5 V.
ger values proportional to a sine period. They are stored in a The out27 register enables lock-in measurements with a
memory module implemented as various lookup tables. The full resolution of 27 bits and a sensitivity of 59.6 µV. The sen-
reading addresses for the memory modules are set by counter sitivity can be enhanced with pre-amplification, as is shown in
modules, driven by a configurable clock divider that allows us the experience described in Sec. III B.
to change the reading sample rate and, with it, the resulting
2. PID controllers
refi working frequency. The cos_ref, sin_ref, cos2f, and cos3f
signals were designed to satisfy the discrete Fourier orthog- Two PID modules were implemented for use in feed-
onality relations of Eq. (1), which avoid offsets generated by back stabilization schemes. The circuit design is based on
digital rounding, and are important not only for measurement the PID included in the free software applications of the
precision but also useful for reducing instrumentation induced Red Pitaya community.11 They were modified to extend the
instabilities in a feedback stabilization scheme. This condition working parameter range over several orders of magnitude,
is not satisfied if we use signals built from real valued cos func- by incorporating scale registers. The output control was
tions discretized with global criteria applied to all the values enhanced by adding features like output value freezing and
(like using standard integer conversion functions: floor, ceil, integrator memory freezing, useful for re-lock routines (see
or round), Sec. II C 4).
 cos  Both modules have a common error signal as default
2519   input, which can be selected from different input buses, as is
sin 
f[i] · g[i] = 0 for f  g and f, g = 

. (1) shown in Fig. 3. The input can be shifted by a user-controlled
cos2f
i=0
cos3f error_offset value that can be interpreted as a working set-
point. Also, independent input signals for each module can be
The square wave lock-in is composed of three demodula- chosen (not shown in the figure).
tion paths: 6-8 from Table I. Two local oscillators in quadrature Each module implements three filters, proportional, inte-
(sq_ref and sq_quad) allow the acquisition of the complete gral, and derivative, which sums up to build the output signal
quadrature information in the sqX and sqY registers. Also, pidX_out (X = A, B), as it is shown in Fig. 3. The summed result
another oscillator path, sq_phas, with a configurable phase is stored in a register which allows us to freeze the value at
relation is available, with the output value stored in sqF. command.
The square wave signals are built on run-time, switch- The behavior of the three filters depends on the value of
ing a bit that represents the ±1 values. The working frequency three parameters: kp , ki = 1 /τi , and kd = τ d . Two registers allow
f sq is set by defining the semi-period time length, counting the user to control each of them: one 14 bit signed int value
steps of the base FPGA clock. In this way, the period can be changes the parameter linearly, while the second value allows

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-5
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

regression of the last nine step values of the down-sampled


signal.
The parameters kp , τ i , and τ d can be used for predic-
tion of an ideal PID response to an e(t) input signal using
Eq. (3a). Equation (3b) provides a more accurate prediction
of the implemented PID response in clock steps of 8 ns. The
“slope9out” function represents the slope9 submodule out-
put signal that can be simulated by an algorithm following the
procedure described above,
 t
FIG. 3. Proportional, integral, derivative (PID) module. This module is used for 1 d
pidout (t) =kp · e(t) + · e(t′ ) dt′ + τd · e(t), (3a)
feedback/control loops. It produces an output which is a functional of a selectable τi 0 dt
input and configurable parameters. The desired input is selected with a multiplexer n
8 ns 
via the control signal error_sw. Next, the value error_offset (sometimes also called pidout [n + 1] =kp · e[n] + · e[i]
the set-point) is subtracted from the input signal to produce the error signal. The τi
i=0
action of the PID filter is controlled by three submodules as described in the main τ
text. At the output stage, two flow control parameters pidX_enable and pidX_freeze + d · slope9out(e[n, . . . , n − 9 · 2nd + 1]). (3b)
8 ns
allow enabling/disabling (zeroing) or freezing the output. There are two indepen-
dent PID modules running in parallel labeled A and B. Alternatively different inputs
can be selected for each PID but is not included in this graphic (see the main text).
3. Ramp function generator for scanning
A triangle wave-shape generator was implemented which
us to change the order of magnitude of the parameter, working is useful to control two parameters at the same time. This
as a scale control. For example, the kp parameter is controlled module outputs two synchronized signals called ramp_A and
by the pidX_kp register value, and by the scale factor set by ramp_B.
the register pidX_PSR, which allows us to choose one of the The behavior of ramp_A is controlled by setting the
predefined values for np in Eq. (2a). The same logic is applied range and the time base. The triangle wave-shape is gen-
to control ki and kd using pidX_ki, pidX_kd and pidX_ISR, erated by increasing/decreasing the output by 1 int at
pidX_DSR, respectively, as is shown in Eqs. (2b) and (2c), each time step T until it reaches one of the limits and
then changing the slope sign (see Fig. 4). The registers
pidX_kp
kp = with np = {0, 3, 6, 10, 12}, (2a) ramp_hig_lim and ramp_low_lim control the top and bottom
2np limits. The register ramp_step sets the time step with the rule
2ni · 8 ns T = ramp_step · 8 ns. The behavior of ramp_B is linked to the
τi = with ni = {0, 3, 6, 10, 13, 16, 20, 23, 26, 30},
pidX_ki first one: it is generated by multiplying ramp_A by the factor
(2b) ramp_B_factor/4096.
2nd · 8 ns 60 The chosen control parameters allow the user to set
τd = · with nd = {0, 3, 6, 10, 13, 16}. (2c)
pidX_kd 64 the ramp by its slope and limits. This is important since an
acquired signal waveform may change with sweeping speed.
The linear coefficient register lets the user have fine con- These changes are a natural consequence of bandwidth lim-
trol over the PID parameters, while the power of two factor, its present in all physical systems. By maintaining a con-
implemented efficiently through shift registers, expand the stant slope, changing the range does not affect the measured
parameter scope over several orders of magnitude. This dual
scale allows controlling systems with time constants ranging
from a few µs to many seconds.
The derivative module of the PIDs was completely rewrit-
ten to avoid high frequency noise amplification. The new
design ensures that spikes and frequency components whose
characteristic times are below the order of magnitude settled
by the nd value will not induce undesired perturbations that
can make the feedback scheme unstable. The implemented
design includes a down-sampling procedure and a slope cal-
culation sub-module, called slope9. The PID input signal is
down-sampled taking the mean value of 2nd consecutive data
samples, so the processed signal that feeds the slope9 sub-
module has a ladder shape with a Td = 9 · 2nd · 8ns step time
length. The net effect of this procedure is similar to the appli- FIG. 4. Output of the ramp function generator as a function of clock tick. The
cation of a low pass filter with a time constant of Td before triangle-wave output ramp_A signal is controlled by the following parameters:
the derivative calculation. The slope9 submodule calculates ramp_hig_lim, ramp_low_lim, ramp_step, as shown in the figure and described
the signal derivative by taking the slope of a linear square least in the main text. The clock runs with a period of 8 ns.

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-6
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

waveforms. This design has been proven to be helpful when procedure was inspired on a recent study7 and consists on
using the ramp instrument for optical spectroscopy. freezing the PIDs and starting a ramp scan increasing the scan
The ramp generator has extra functionality: it can be limits on a two factor in each half period. If during scanning
started and stopped at any time with the ramp_enable reg- the system reaches a lock condition, the submodule stops the
ister, it can be reset to the ramp_A = 0 value with the scan and turns on the PIDs again. If the lock condition is never
ramp_reset register, and its starting slope sign can be set with met, the submodule will continue increasing the scan ampli-
the ramp_direction register. Also, as will be discussed later, tude until it makes a semi-period sweep with the longest width
the lock-control module can take control of the start/stop (1 V ≡ 8192 int) and then will stop ramp.
command and the ramp limits for locking and re-locking Finally, a submodule which carries out a Step Response
procedures. Measurement allows the user to evaluate the system response
to an abrupt change in the control value. This information can
4. Lock-control then be used to calibrate the parameters of the PID modules.
A device meant for locking to a given error signal
requires switching between different behaviors: scanning, 5. Oscilloscope
locking, re-locking on events, etc. Changing from one state The oscilloscope instrument is a modified version of
to the other requires timed interaction between the previ- Scope Application from Free Software Red Pitaya developers
ous modules. This interaction is handled by the lock-control community.11 It is composed of two memory arrays with a
module. Figure 5 shows the schematic inter-cabling of the length of 16 384 for storing 14 bit signed int values, modules for
modules. triggering, decimation control, and anti-aliasing filters, and it
A typical example of this behavior is what we call Trigger allows us to make acquisitions on the FPGA clock sample rate
Lock. Here the system switches from a scan-mode, where one (125 MSa/s). Here we extended the functionality of the basic
can see the error signal by sweeping the control parameter, to oscilloscope to allow the display of various internal and exter-
a lock-mode where the scan is turned off and the PIDs are nal signals. These include the ADC inputs (in1, in2), instrument
turned on to stabilize the error signal. That is, on a trigger outputs (PIDs and ramp), important link buses (error, ctrl_A,
event, the ramp’s outputs are frozen and the PID’s outputs are ctrl_B), and all the lock-in path outputs and local oscillators.
enabled. The trigger can be set to a given value of the ramp With this extension, the oscilloscope is useful not only for
period (time trigger), a given value of the signal (level trigger), external data acquisition but also for internal data flow and
or the fulfillment of both conditions (level + time trigger). processing inspection, essential for debugging and tuning the
The values for these triggers can be selected graphically on parameters of each module.
the oscilloscope screen or manually. Alternatively one could Also, some acquisition options were added. We included
set lock-control parameters using user defined algorithms to the possibility to disable the anti-aliasing FPGA module fil-
automatically scan a signal and lock to given peak. ter and to incorporate more triggers from useful signals. The
The module also provides a Re-lock routine which tries external trigger is extended for the user selectable event list,
to automatically re-lock on eligible events. This submodule including out-of-lock, triggered lock-start, ramp_A at limit
will consider that the system is out-of-lock when the abso- reach, and lock-in oscillator period start. Also, some web GUI
lute value of the error signal exceeds a set value or when one options were added, like an R-φ (absolute and phase) run-
of the inputs (in1, in2, in1 − in2, or any lock-in demodulated time calculation option for lock-in X, Y and sqX, sqY visu-
signals) drops below a set threshold. When any of these con- alization and switch between volts and int units. By default,
ditions is met the re-locking routine is started. The re-locking the acquired curve values are expressed in volts, using the
ADC/DAC conversion factor (signed 14 bits int resolution):
8192 int ≡ 1 V. This can be switched to raw int values.

D. The Web GUI


The Web GUI frontend design is also based on free soft-
ware Scope application.11 It provides the off-the-shelf func-
tionality shown in the first column of Fig. 1. It is structured
in columns with dropdown panels that group configuration
settings by functionality. We improved the interface adding
several useful functions, like data save/load, configuration
save/load, and stop button.
A left column was added for placing the instrument panels
FIG. 5. Lock-control data flow. The lock-control runs synchronized actions on the
designed for this work, and two bottom panels for the lock-in
PID and Ramp instruments. The red lines are signal data buses, and the turquoise amplifier output visualization (Fig. 6). The instrument controls
lines represent sets of buses used to control timing and operation of the modules. were designed with the philosophy of keeping simplicity with-
Gray dashed lines are selectable data buses. These include all the lock-in outputs out compromising the low-level accuracy. Most of the con-
and the ADC inputs. Any of them can be routed to the PIDs for signal processing trols use integer numbers for input data type, which allows
or the lock-control for event identification and triggering. the user to define the precise value of the FPGA registers that

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-7
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

FIG. 6. Web page GUI front-end showing a rubidium absorption and saturated absorption signal. The display is organized in three columns with sub-panels. The left
one contains one panel per instrument containing their configuration options. The right one contains the oscilloscope visualization options. The middle one contains the
oscilloscope screen and a bottom panel showing the lock-in output values.

the circuits will use and includes text displays that translates with only one control parameter. In the third one (Sec. III C),
these values to the physical magnitudes involved (i.e., seconds we show the square lock-in amplifier working at 31 MHz for a
and volts). Pound-Drever-Hall stabilization application. Some advanced
The oscilloscope screen is in the middle of the page. It capabilities are shown here, like multiple controlled vari-
displays two channels for plotting user selected signals. In the ables, in-device programing for special measurements, and
sample applications discussed below, in Sec. III, one channel different hardware implementations of the same stabilization
shows the spectral response of the system, while the other scheme. Finally, we discuss some potential applications of the
displays the error signal. This provides a fast way to view and toolkit.
evaluate the performance of the system on lock, entering a
lock, and re-locking.
A. Absorption spectroscopy: Ramp, oscilloscope,
and PIDs
III. EXAMPLE APPLICATIONS We tested the off-the-shelf capabilities of the toolkit in an
We report a set of experimental applications of the toolkit atomic vapor absorption spectroscopy experiment with rubid-
presented in order of complexity to show the instruments’ ium. A tunable laser that goes across an atomic vapor cell
usability and potential. In the first one (Sec. III A), we intro- is used to make an optic-frequency scan around one of the
duce the usage of the ramp and the oscilloscope to take the atomic electronic transitions. A photodiode is used to mea-
absorption spectrum of an atomic vapor, with a simple scheme sure the intensity decay at the cell output (Fig. 7), as a result
of one control parameter and one measured variable. Also, we of the absorption on transition resonance. We used a VCSEL,
implement a side-of-fringe locking scheme using a PID con- what ensures mode-hop-free scanning using only one control
troller and the lock control instrument. In the second appli- parameter: the diode current.13 The laser wavelength is cen-
cation (Sec. III B), we add the harmonic lock-in amplifier to tered in 795 nm, suitable for rubidium D1 line (52 S1/2 → 52 P1/2 )
the measure and stabilization scheme, in a saturated absorp- spectroscopy.
tion experiment. We used two output ports and measure two The ramp instrument was used to make the frequency
input variables, in a multi-input-output control system but scan, by performing a voltage-controlled sweep of the current

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-8
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

on the first crossover of error_offset, the lock-control instru-


ment was configured to close the loop on level + time trigger.
The loop-close procedures were configured to stop the ramp
scan and enable the pidA_out. The PID parameters were set
to τ i [ki = 600]  895 µs and kp [kp = 1024] = 1.
The result after reaching the lock-control level + time
trigger condition is shown in Fig. 8 (orange line). The trans-
mitted signal remained in the configured set-point level with
a standard error of σ = 1.85(3) mV.
FIG. 7. Scheme of the rubidium absorption spectroscopy experiment. A vertical-
cavity surface-emitting laser (VCSEL) is steered with two mirrors (M) through a B. Saturated absorption spectroscopy:
rubidium gas cell (Rb), and the transmitted signal is detected in a photodiode (PD). Harmonic lock-in
The signal from the photodiode is read by the ADC on the Red Pitaya board. The
laser’s frequency is controlled with output DAC out1 by changing the set-point on In this experience, we extended the previous setup to
a current driver. make a saturation absorption spectroscopy14 scheme, which
allows us to measure transitions with resolution exceeding
the limit posed by Doppler broadening.15 This scheme uses
driver. The oscilloscope instrument was used for photodiode a pump and probe configuration, implemented here with the
signal acquisition. same beam reflected in a mirror, as shown in Fig. 9. The pump
The ramp was configured to make a scan of ∼1 V through saturates the transition and induces transparency, sensed by
out1 DAC at 7 Hz. In Fig. 8, the transmitted signal measured by the probe as a transmission peak. This technique enables the
using the photodiode is shown with a blue line. The base slope possibility of laser frequency locking to absolute references
of the curve is related to the laser power increment along the with higher accuracy.
scan because of the current variation. The four dips in the We used an ECDL at 780 nm wavelength, suitable for
curve are the absorption lines for each of the hyperfine-split rubidium D2 line (52 S1/2 → 52 P3/2 ) spectroscopy.
transitions. In this kind of laser, the diode current and the position
This experiment was used to test the most simple stabi- of the diffraction grating are controlled to tune the laser.
lization scheme: side-fringe locking. The variable to stabilize The position of the grating is controlled with a piezoelectric
is the transmitted signal, measured from the in1 port. The PID (PZT) element. If both parameters are controlled simultane-
instrument was used to make the feedback response, and the ously, a mode-hop-free tuning range of several GHz can be
lock control instrument was used to control the loop-close achieved.16 Figure 10 shows an example laser frequency scan
event. (blue line) around the transitions Fg = 3 → Fe = 2, 3, 4 for
The locking set-point was configured on error_offset an 85 Rb isotope. In the figure, the optical frequency increases
= 2620 int  0.32 V to lock the side of the last spectrum dip in
the ramp scan, making error = in1 − 2620. To prevent the lock

FIG. 9. Scheme of saturated absorption spectroscopy of rubidium. The emission


wavelength of an external cavity diode laser (ECDL) is controlled with two param-
eters: a voltage on a piezoelectric element (PZT) and the diode current. Moreover,
the laser current can be controlled through two independent signals. One is used
for tuning, and the other is used to generate a modulation in the frequency. The
laser beam is steered with two mirrors (M) through a Faraday isolator (FI), a polar-
FIG. 8. Absorption spectroscopy of rubidium and laser lock as obtained with the izing beam splitter (PBS), and a rubidium cell. Following a quarter wave plate
experimental setup shown in Fig. 7. The transmitted intensity across the rubidium (QWP), a neutral density filter (NF) and a mirror reflect the beam back but with
cell is plotted for a ramp scan (blue line) and for a lock-start event (orange line). The opposite polarization. The beam now reflects on the PBS and is detected on
curve dips correspond mainly to 87 Rb hyperfine absorption lines. The triangular a photodiode (PD). The measured signal is read through the two ADCs on the
shape of the measured signal is due to the frequency-intensity correlation which is Red Pitaya board. One of them is previously DC-decoupled and amplified with an
typical of VCSEL diodes. analog circuit.

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-9
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

FIG. 10. Relevant signals for a saturated absorption spectroscopy open-loop scan (blue) and a triggered closed-loop stabilization event (orange). in2 is the saturated
absorption signal sensed by the photodiode. The laser is scanned across a Doppler-broadened absorption line. At times −3.6 s and 1.2 s, the scan changes the direction.
The positive peaks seen are the expected saturated absorption spectral lines. in1 is similar to in2 but has been DC-decoupled and amplified (see Fig. 7). This is the signal
used for lock-in demodulation. F1o and F3o are the demodulated signals at 1f and 3f, respectively. ctrl_A is the control signal acting on the laser wavelength. The demodulated
signals show the first and third derivative-like behavior, with zero-crossing points on the peaks seen in in2. For locking the laser to a line, the F3o was used as the error signal.
The red line shows the level threshold where the lock-start triggers. The right hand side axis indicates a voltage scale of each signal as expected on the photodiode output
before amplification and on the Red Pitaya’s output.

with ctrl_A. The sub-Doppler hyperfine transition peaks and available for visualization and acquisition. The first three of
the crossover14 peaks were marked with vertical gray lines. them are proportional to the first derivative of the transmitted
For the stabilization of the emission frequency, a lock- signal in2 (at the first order of modulation depth17 ), and the
in scheme was implemented, to get an error signal suitable last two are proportional to the second and third derivatives,
for peak maximum locking, and demodulated from the sig- respectively. The odd derivatives expose in2 minimum and
nal sensed by the photodiode. A harmonic modulation cos_ref maximum as zero crossing points. This characteristic makes
was introduced through the current driver. them suitable as an error signal for min/max peak locking.
Two fast inputs and two fast outputs were used in this In Fig. 10, the F1o and F3o signals are shown. The F3o is not
scheme (Fig. 9). The in2 port was used for direct photodiode sensible to first derivative offsets, like the linear power incre-
signal digitalization, to measure the transmitted laser inten- ment of the current sweep, and less sensible to peak base line
sity. The in1 port was used to measure AC components of contributions that shift the minimum/maximum positions of
the photodiode signal, using an analog high pass filter and the transmitted signal with respect to ideal ones, which is why
amplifier, what allows us to improve the sensitivity of lock-in it was selected as the error signal for the PID input. The filter
demodulation. The acquisition was made using the oscillo- was configured with a proportional component with constant
scope instrument, registering the transmitted intensity and kp = 1.56 × 10−2 , for fast corrections, and an integral compo-
the demodulated signal. The ctrl_A signal on the out1 port nent with constant ki = 5.59 s−1 . The lock-control instrument
was used to control the laser frequency. The ramp instru- was configured to trigger the loop-close event whenever F3o
ment was used for frequency scanning and PID for frequency gets over 2048 int (red line), with the “level trigger.” An exam-
stabilization, through feedback loop. The current and PZT ple of lock start is presented in Fig. 10, with an orange line
sweep amplitudes were tuned through driver hardware. The superimposed to the normal scan signal. In this example, a
out2 port was used to produce the modulation of the laser stability of 226(13) kHz of the optical frequency was achieved
current. after lock, on a 10 min measurement. The frequency deviation
The harmonic lock-in was configured to demodulate the was estimated from F3o standard deviation and the knowl-
in1 signal. Demodulated signals Xo, Yo, F1o, F2o, and F3o were edge of the F3o slope on the locked peak position.18 The

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-10
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

CTRL_A was used to measure the corrections made to the sys-


tem, as an estimation of the frequency deviation that the laser
would have had if it had worked in open-loop configuration:
54(4) MHz RMS over 10 min.

C. Pound-Drever-Hall technique: Square Lock-in


In this experience, an ECDL (centered at 854 nm wave-
length) was stabilized to a reflection dip of a high finesse
Fabry-Pérot (FP) cavity using the Pound-Drever-Hall (PDH)
technique.19 This stabilization scheme uses lock-in demodula-
tion of the laser intensity reflected from the interferometer to
produce the error signal. The modulation frequency must be
greater than the cavity’s bandwidth, which are both typically
chosen to be in the few MHz range. The laser is modulated
producing sidebands that lay out of the transmission peak
bandwidth of the interferometer, so their reflection produces
a beating that can be measured by using a fast photodiode.
This technique is often used for laser stabilization in AMO
Labs.19
The experimental setup is depicted in Fig. 11. Two con-
trol signals were used for laser control: ctrl_A for the current
driver and ctrl_B for the PZT driver. The radio frequency mod-
ulation was incorporated directly into the laser diode using a
bias-T configuration and passive electronic components. The FIG. 12. Transmitted beam intensity (top) and the lock-in demodulation of the
reflected signal was measured by using a fast photodiode with reflected intensity (bottom) for a frequency scan with the Pound-Drever-Hall
scheme, as shown in Fig. 11. The error signal shows a steep zero-crossing point
DC-decoupled output and digitalized, using port in1, for lock- suitable for frequency stabilization via a PID lock.
in demodulation. Another photodiode was used to measure
the transmitted signal through the in2 port for system state
reference. An example measurement for demodulated signal slow output update speed is enough for a PZT driver, whose
error and in2 input is shown in Fig. 12. bandwidth limit is in the order of tens of kHz but with the
Two configurations of hardware ports were used in the downside that the output signal has a high frequency rip-
implementation. Both of them dedicated one of the 14 bit fast ple, which comes from the original PWM signal. To reduce
outputs (out1) to the current driver. In the first configura- side-effects of the ripple, we included a second order passive
tion, the other 14 bit fast output (out2) was used for sq_ref low-pass-filter before the PZT driver. The second configu-
modulation signal and one of the 12 bit slow outputs of the ration option was to use the out2 port for the ctrl_B signal
extension bus (slow_out1) was used for the PZT driver. The of PZT, without any filter. In this case, the sq_ref signal was
supplied through one of the extension digital pins (3.3 V at
125 MSa/s) as a square function. A DC-decoupling capaci-
tor and a second order passive low-pass-filter were used to
build a band-pass filter, for signal conditioning: suppression of
high frequency components, zero-centered signal, and power
attenuation.
The sq_ref modulation signal was configured on 31.25
MHz, the higher available frequency for square Lock-in. A
second order filter with a frequency cut of f c = 38.856 kHz
was used for demodulation, which produces a time lag of
∆t ∼ 8.2 µs over the error signal. This imposes an upper
bound to the feedback gain and/or to the feedback band-
width1 but with no fundamental limits to achieve stabiliza-
1
tion up to 2∆t ∼ 61 kHz, resilient to acoustic and mechanical
perturbations.
FIG. 11. Scheme of the Pound-Drever-Hall frequency stabilization. An external
cavity diode laser (ECDL) is controlled with three signals: a slow control of a piezo-
The ramp instrument was used for PDH spectrum acqui-
electric element (PZT), a slow control of the current, and a fast modulation of the sition, configuring the triangle functions ramp_A and ramp_B
current (sq_ref) coupled directly to the laser diode with a bias-T. The laser beam with a proportional relation ramp_B_factor tuned for opti-
is coupled to a Fabry-Pérot interferometer (FP). The reflected and transmitted sig- mal mode-hop-free scanning. The proportional constant
nals are detected with two photodiodes and are read by the ADCs on the Red was selected considering the hardware configuration option
Pitaya board. selected. The feedback scheme was built using one error

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-11
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

signal and two PIDs, one for each ctrl signal. The PID for the
current setup used proportional and integral terms, while
PZT PID only used the integral term, avoiding undesired fast
corrections over the piezoelectric line. The sample trans-
mitted and error signal are presented in Fig. 12 for one FP
transmission peak, showing the characteristic PDH pattern.19
Next, we will present two advanced usage cases of
the toolkit for continuous data acquisition and re-lock
procedures.

1. Allan deviation: In-device measurements


A measurement of the Allan deviation was made to make
a detailed analysis of the stabilization performance. The Allan
deviation σ y (τ)20 provides a detailed description of the sta-
bility of a system in several orders of magnitude of time. The
value σ y (τ) is the standard deviation of the differences of suc-
cessive mean values of y, presented in Eq. (4), where y is the FIG. 13. Allan deviation (4) of a frequency stabilized ECDL. The laser is stabilized
to a Fabry-Pérot cavity with the Pound-Drever-Hall technique. The fractional fre-
fractional frequency of an oscillator under study, quency of the laser is derived from the error signal (blue) and from control signals
 (orange and green). The blue curve reflects the performance of the closed-loop
1 stabilization system on different time scales. The Allan deviations of control sig-
σy (τ) = (ȳn+1 − ȳn )2 . (4) nals for time ranges τ ≫ τ i represent the corrections made to the system to keep
2
it locked. They can be used as a rough estimation of the open-loop behavior that
The measurement of σ y (τ) requires the continuous acqui- the system would have had without stabilization. Dashed lines mark the time con-
sition of data channels at a high sample rate for a long time stants τ i for each one of the PID integrators. At 10 s, the stabilization scheme
range. This kind of acquisition cannot be performed by using achieves an improvement of 3 orders of magnitude with respect to the estimated
open-loop behavior.
the oscilloscope instrument, limited on a total time range,
nor by a remote acquisition procedure, with the sample rate
limited because of high communication latency. signals can be interpreted as frequency corrections. The
To make this acquisition, we implemented an in-device increment on ctrl_A derived values on short times is related
program, running from a Python script in the Red Pitaya oper- with the proportional term of the PID used for current con-
ating system. The sample script is published in the online doc- trol and tends to reflect the behavior of the error signal. An
umentation.12 The program consists in a large loop that reads improvement of three orders of magnitude in the stability at
values directly from RAM memory mapped registers that cor- 1 s time range can be seen from the plot.
respond to the signals that should be saved and prints them
on the standard output. This simple approach allows one to 2. Re-lock system
redirect the output for local storage or network streaming and The lock-control instrument includes the feature to iden-
remote storage, using the operating system tools. The RAM tify locking events and actuate on them, already described in
memory access and the identification of memory addresses Subsection II C 4. The PDH example provides a case study to
are simplified by the usage of the local API. A set of FPGA regis- test it. With the system locked to a transmission peak, the re-
ters can be frozen for each read procedure, so all the acquired lock tool was configured to trigger when error > 1000 int or
values keep coherence (in the sense that they correspond to when transmitted signal error < 3000 int  366 mV. The “Out
the same clock time bin). A 64 bit counter running in the FPGA of lock” external trigger allowed to capture the re-lock sys-
layer is used to register the accurate internal clock time value tem response under a stabilization induced fail, by hard hitting
of each acquisition. the optic table, which is shown in Fig. 14. Three cycles of re-
This implementation allowed to take large measurements locking can be seen, while the mechanical vibrations are still
of error, ctrl_A, and ctrl_B signals with a sample rate of at affecting the system.
least 50 Sa/s along several hours, which were stored in binary
files of hundreds of Mbytes in a remote computer. With this
3. Parameter optimization and automated tuning
information, the Allan deviation of the fractional frequency of The platform presented allows the user to program
the stabilized laser (calculated from error signal) was mea- scripts which can improve the performance of a locked system
sured, shown in Fig. 13. Also, the ctrl_A and ctrl_B signals in several ways. In particular, the remote programed operation
allow us to estimate the open-loop behavior that the laser of the toolkit enables automated operation and auto-tuning of
would have had, by taking into account the corrected devia- parameters. We outline some ideas which can be implemented
tions during the stabilization time. The fractional frequency in this direction.
Allan deviation derived from these signals was also plotted. A simple example we tried is as follows. The fine tuning
The vertical dashed lines mark the PID integrator time con- of several parameters was automated by a systematic proce-
stants associated with each ctrl signal, as a reference. For dure of trial and evaluation. By scanning several parameters
τ i larger than these references, the curves derived from ctrl and evaluating the error signal for a locked system, optimal

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-12
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

The key features include the following: an in-device oper-


ating system which provides portability and multi-platform
GUI access through a web browser, PIDs which were designed
so that their parameters can be set over several orders of mag-
nitude, enabling the usage on different control applications,
even beyond the ones belonging to AMO labs presented in this
work, two lock-in instruments for precision measurements
with a large working frequency range, including the possibility
to implement a complete Pound-Drever-Hall lock scheme at
31.25 MHz in one device.
The selection of an economical commercial board9 may
ease the acquisition and fast implementation of this toolkit by
a third party in new experiments. Also, the compact design and
remote programmable feature make it useful for mass imple-
mentation in experiments with several control systems with
the centralized monitoring and operation. The FPGA design
and software of the presented toolkit are public domain,10 and
FIG. 14. Relocking behavior example. An ECLD locked to a Fabry-Pérot cavity is
the board’s operating system and application framework are
pushed out of lock by an external perturbation. When this happens, the transmitted
signal (blue) drops below a set threshold (gray line) and the re-lock mechanism is open-source.
activated. To re-lock, the control parameter is scanned with increasing amplitudes
until a new lock condition is found. The perturbation introduced was a mechanical
shock, which takes some ms to dissipate. In the process, the laser gets kicked out ACKNOWLEDGMENTS
of lock a few times until it finally stabilizes. In the figure, three re-locking attempts
are seen. After the third try, the laser stays in lock. This feature is described in We thank Ferdinand Schmidt-Kaler for opening the doors
Subsection II C 4. of the Cold ions and quantum information laboratory (Institut
für Physik, Mainz), where the first laser stabilization tests with
FPGA were conducted. The financial support for this research
was provided by the Ministry of Defense of Argentina (PIDDEF
values were chosen in a semi-automatic fashion. This scan and
23/14) and the National Agency of Promotion of Science and
search procedure can be updated to automatically choose the
Technology (No. PICT 2014-3711.11).
best parameters.
Another more complex example which outlines a direc-
tion in which to work in the future is as follows. We found REFERENCES
that the optimal values for reducing the standard deviation of 1
J. Bechhoefer, Rev. Mod. Phys. 77, 783 (2005).
the error signal in a locked system are not always the best for 2
A. Schwettmann, J. Sedlacek, and J. P. Shaffer, Rev. Sci. Instrum. 82, 103103
starting a lock or re-locking after a perturbation. A more sta- (2011).
3
ble system is sometimes easier to kick out of lock. This points Z. Xu, X. Zhang, K. Huang, and X. Lu, Rev. Sci. Instrum. 83, 093104
into the direction of adaptive control parameters depending (2012).
4
on the state of the system. K. Huang, H. L. Jeannic, J. Ruaudel, O. Morin, and J. Laurat, Rev. Sci.
Instrum. 85, 123112 (2014).
In this way, the toolkit could be used as a dedicated device 5
N. B. Jørgensen, D. Birkmose, K. Trelborg, L. Wacker, N. Winter, A. J.
that detects a laser is on, starts a ramp sweep, finds and opti- Hilliard, M. G. Bason, and J. J. Arlt, Rev. Sci. Instrum. 87, 073106 (2016).
mizes an error signal, chooses the adequate peak to lock, 6
R. A. R. Picone, S. Davis, C. Devine, J. L. Garbini, and J. A. Sidles, Rev. Sci.
configures the lock control trigger, and starts a lock on its Instrum. 88, 045108 (2017).
own, without user intervention. Also, the re-lock system could 7
D. R. Leibrandt and J. Heidecker, Rev. Sci. Instrum. 86, 123115
be complemented to restart parameter tuning when the lock (2015).
8
condition cannot be found again and send alerts to the user L. Neuhaus, R. Metzdorff, S. Chua, T. Jacqmin, T. Briant, A. Heidmann,
when intervention is needed. P.-F. Cohadon, and S. Deleglise, in 2017 Conference on Lasers and
Electro-Optics Europe and European Quantum Electronics Conference
(CLEO/Europe-EQEC) (IEEE, 2017), Vol. 2016, p. 1.
IV. CONCLUSION 9
See https://www.redpitaya.com/f130/STEMlab-board for Red Pitaya,
We presented an embedded toolkit for digital process- “Stemlab.”
10
ing, acquisition, and feedback control through MIMO control M. Luda, “Lock-in+pid” (2018), https://github.com/marceluda/rp_lock-
design. The combination of the FPGA fast deterministic-timing in_pid.
11
See https:// github.com / RedPitaya / RedPitaya / tree / release-v0.95 /
for signal processing and a microprocessor with an operating
apps-free for Red Pitaya, “Free applications,” 2015.
system for overall monitoring and control provides a balance 12
M. Luda, “Lock-in+pid project site” (2018), https://marceluda.github.io/
between programmable electronic precision and algorithm rp_lock-in_pid/.
versatility. This allowed the implementation of several usage 13
C. J. Chang-Hasnain, IEEE J. Sel. Top. Quantum Electron. 6, 978 (2000).
strategies going from simple off-the-shelf gross-control to in- 14
D. Bhattacharyya, B. K. Dutta, B. Ray, and P. N. Ghosh, Chem. Phys. Lett.
device programed fine-control, as shown in the experimental 389, 113 (2004).
examples. 15
D. W. Preston, Am. J. Phys. 64, 1432 (1996).

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-13
Published under license by AIP Publishing
Review of ARTICLE scitation.org/journal/rsi
Scientific Instruments

16 19
T. Führer and T. Walther, Opt. Lett. 33, 372 (2008). R. W. P. Drever, J. L. Hall, F. V. Kowalski, J. Hough, G. M. Ford, A. J. Munley,
17 and H. Ward, Appl. Phys. B: Photophys. Laser Chem. 31, 97 (1983); e-print
W. Demtröder, in Laser Spectroscopy, 3rd ed. (Springer Berlin Heidelberg,
Berlin, Heidelberg, 2008), Chap. 6, pp. 7–10. arXiv:1602.03504.
18 20
M. Luda and J. Codnia, Opt. Pura Apl. 51, 49031:1 (2018). J. R. V. (Chairman), IEEE Standard 1139, 1999, p. 36.

Rev. Sci. Instrum. 90, 023106 (2019); doi: 10.1063/1.5080345 90, 023106-14
Published under license by AIP Publishing

You might also like