Philip Kromer (Primary Contact), Ralph Robinett, Roger Bengtson, Charles Hays
Department of Physics, University of Texas at Austin

Dept. of Physics RLM 5.208 MS C1600
University of Texas Austin, TX 78712
512 471 6438      FAX 512 471 9637

Advanced Laboratory

PC-Based Digital Lock-In Detection of Small Signals in the Presence of Noise


Several interesting experiments in the advanced laboratory require an accurate measurement of a slowly varying, extremely small voltage. Lock-in detection is a powerful technique to recover such a signal, even in the presence of broadband noise whose magnitude is several times greater than the signal itself. We have implemented a versatile, low-cost digital lock-in analyzer completely in software. No specialized hardware is required beyond a general-purpose data acquisition board and a low-noise amplifier, yet the detector has a sensitivity of 20 nV and negligible offset drift. Since all signal processing takes place on the computer, students can display the waveform as a time series or power spectrum as it progresses through the instrument, which makes it an extremely useful teaching tool. We describe the implementation of the lock-in detector and describe its use in a measurement of the resistance of a superconductor as it undergoes its superconducting transition. Its versatility, resolution, and teaching utility make this tool excellently suited to the advanced laboratory.

Support required for apparatus (ie. special needs in order to set up the equipment at the AAPT meeting):

If we can get Liquid Nitrogen (a liter or two), that would be great, but we can bring it otherwise.

Approximate size:

We need about six feet of table space to spread out on -- enough space to set up a computer and a poster display. It all pretty much fits on or under the table.

Does this apparatus require Electrical Power? Yes... we need to plug in the computer

Is this apparatus intended for use with and overhead projector? No.

Will you be present to set up your apparatus? Yes.

Equipment required to construct apparatus:

This is a list of the equipment we used and its approximate price. However, all of it is general-purpose equipment and any equivalent items will work.

Computer Dell Optiplex GX1 (Pentium II-233 $2000 w/ 64 MB RAM, Windows NT)

Software National Instruments LabView 5.0 $300 (w/ (Needed to run our software) Educational Discount)

DAQ Board National Instruments PCI-MIO-16E-4 $1000 (Need at least a 16 bit DAC, 50 kHz sampling rate, 4 input channels and 1 output channel)

Amplifier BurrBrown OPA111 and other about $35 misc. electronics (Any low-noise, 1000x gain amplifier)

Superconductor Colorado Superconductors Kit K5 $140 (4-point probe w/ thermocouple)


We have implemented a PC-based digital lock-in analyzer (LIA) completely in software1. It is both a powerful measurement device and a useful tool for teaching the basics of lock-in detection. We use the LIA to measure the resistance of a superconductor as it undergoes its superconducting transition, but it is a versatile device. It may be applied to any experiments which requires detection of a small (less than a microvolt), slowly varying (stable over several seconds) voltage that is in response to an externally applied voltage:

The Hall effect in semiconductors[11], The use of a thermistor bridge to detect small temperature changes[12], Many other examples from physics and engineering [11,12].

Measuring small signals

It is difficult to measure such a small signal for several reasons[5, 6, 7]. Measurement systems suffer from offset and drift several effects (common-mode error, thermoelectric offsets, internal offsets, and rectification of noise) will add or subtract to the signal level you measure, and these offsets will vary with temperature and time. These errors may be mitigated but not eliminated.

Small signals will also be contaminated by noise. The experiment should be set up to minimize the effects of noise as far as possible, and to eliminate those noise sources (such as ground loops and electromagnetic interference) which may be eliminated. However, there are other sources of noise (such as Johnson noise, 1/f noise, and shot noise) which are due to fundamental processes and may not be eliminated. Since some of these noise sources have a 1/f spectrum the noise amplitude increases as the frequency goes to zero their effect will be worst at DC.

If, however, we were able to move the signal of interest away from DC if the quantity appeared as a periodic signal at some other frequency several benefits would result. Offset and drift would no longer be a concern, as long as they did not introduce a significant common-mode error. We could choose a frequency high enough to avoid 1/f noise, yet low enough to be "quasi-static" (to not materially affect the phenomena under study), and which is far from any significant noise source. Since our signal would be stable in frequency and phase, it will be easy to distinguish from noise.

Application: Resistance of a Superconductor

For example, these concerns have consistently plagued our experiment to measure resistance versus temperature for a Y1Ba2Cu3O7-x sample15 as it undergoes its superconducting transition 13,14. We use the four-point configuration shown in Figure 1. A constant current is applied at points A and D, and the resulting voltage drop appears across B and C. A "T"-type thermocouple measures the temperature. (It is important to use a "four-point" technique different contacts to apply the current than to measure the voltage since the contact resistance is typically several ohms, much more than even the room temperature resistance of the sample).

Our sample shows a room temperature resistance near 20 mW. An applied current of 10 mA gives a voltage drop, at room temperature, of 200 mV. In order to be convincingly "super-" conducting, we would like to observe the resistance drop by several orders of magnitude. This means we must measure a voltage less than 200 nV in the superconducting state.

Unfortunately, the large temperature difference (300 K) between the sample and the amplifier cause thermoelectric offsets, and the student must carefully null the amplifier before beginning the lab. (It is also unconvincing to depend on carefully zeroing the amplifier after all, this only means that you are as "superconducting" as your shorting terminator.) Furthermore, the amplifier we use gives 1 mV of input noise at DC.

Our solution is to modulate the applied current and use lock-in detection. We apply a 37 Hz, 10 mA current across points A and D (Figure 1). The resistive voltage drop will show up across B and C, at 37 Hz and in phase with the applied current. The lock-in analyzer extracts only that component of the signal. It discards offset errors, 1/f noise, and thermoelectric effects; only that portion of the broadband noise near 37 Hz survives, yielding a remarkable improvement in sensitivity.

Overview of Lock-In Detection

A lock-in detector takes a periodic reference signal and a noisy input signal and uses a phase-sensitive detector (PSD) to extract only that part of the output signal whose frequency and phase match the reference10. To see how the phase sensitive detector works, consider a reference signal, Sref, which is a pure sine wave with frequency wref: ,

and apply it as the input to the system:


Since the input to the PSD, Sin, varies in response to the applied signal, we expect that it will have the same frequency and a constant phase shift to the reference.

We may model this noise as uniform broadband noise: that is, the noise consists of sine waves of given amplitude, at every possible frequency and phase.

Figure 2 shows, on a log scale, a typical amplitude spectrum for the input signal. One can see the large DC offset and noise component and the generally broadband nature of the noise.

We must extract only the interesting part of the input signal; to do so we rely on a simple trick from trigonometry. If we multiply two sinusoidally varying functions, the resulting signal is equivalent to a sine wave at the sum of the input frequencies, plus a sine wave at the difference of the input frequencies. To see this, recall the sum rules for cosines:

. If we add those two equations, the last term will go away and we find

or equivalently,

Let us see what happens if we multiply twice our reference signal times our noisy output signal.

Since the reference and the signal had the same frequency, the difference frequency is at DC (zero frequency). If we low-pass filter the multiplied signal, we will find that only two terms survive, the DC term due to the output of the system, and the component of noise with frequency near the reference signal.

If we adjust the phase of the reference so that , then and then

The amplitude of the filtered signal is the amplitude of our system output, plus a (significantly reduced) noise contribution. The phase of the noise signal will not match the phase of the reference, but rather will vary randomly.


Our LIA performs lock-in detection completely in software we read the time-varying signal, noise and all, into memory using a general-purpose data acquisition (DAQ) card. The input waveform passes through all the subsequent stages of lock-in detection as a digital record. The program handles all of the details, from extracting the resistance and other quantities to graphing and logging that data.

The program is written in National Instruments LabView, version 5.0. LabView is a visual high-level programming language for data acquisition, analysis, and simulation. "Coding" a LabView program involves laying out a data flow diagram. For example, the figure at the right shows the section of our LIA program in which the lock-in is performed.

The only hardware required is a high-gain low noise amplifier16 and a general-purpose DAQ card17. The DAQ card must have three analog inputs (temperature, applied current, and voltage) and one analog output (the reference signal) with at least 12 bits of resolution and a 20 kHz sampling rate. We used a National Instruments PCI-MIO-16E-4 multifunction I/O board, which worked excellently, although we recommend a board with 16- or 24-bit resolution for demanding applications.

Overview of the Program

Our program begins by initializing the DAQ card it sets the acquisition parameters, such as the sampling rate and the voltage range of each signal, and performs other housekeeping. The program must also output the reference wave to use as the applied signal. There are many applications where we cannot use the reference to directly generate the applied signal; one must instead use the applied signal to generate the reference. We can not use the applied signal directly any DC offset in the reference signal will cause the LIA to pass through a proportional amount of DC noise from the input. (The excellent results our LIA achieves are due in part to the high precision of the reference signal; its only errors are due to quantization and sampling error, which show up as a negligible high-frequency component). For example, in optical systems the applied signal is modulated by mechanically chopping the light beam. In such cases, one uses a phase-locked loop to synchronize the reference with the applied signal. This would greatly increase the complexity of our implementation and so we concentrate on those applications in which we can directly modulate the applied signal.

Since the smallest voltage our board can input is on the order of a millivolt, it is necessary to amplify the input signal. Any low-noise, high gain amplifier will work; we use a homemade two-stage device based around the Burr-Brown OPA111. Once the signal is read in by the DAQ board, no further signal degradation occurs the signal is now a digital record and is processed exactly. Therefore, the sensitivity of the instrument is limited only by the quality of its input amplifier. We believe that with an amplifier of sufficient quality its sensitivity could rival that of commercial units.

To generate the applied signal, the program calls a routine that writes the reference waveform into an output buffer and starts its generation. In our implementation we use 1024 points to represent four cycles of the waveform. The DAQ card generates this waveform at an output rate of approximately 5500 Hz, which yields the reference frequency of 37 Hz. From then on until the program ends, the DAQ board continuously generates the waveform no interaction with the computer is necessary.

The program also sets the data acquisition parameters and begins acquisition. The board continuously samples its inputs at the specified rate and stores the values in a temporary buffer. Our program periodically retrieves the contents of the input buffer and processes that batch of samples as an array. In practice, we trigger each acquisition to occur as the DAQ board begins generating its output waveform buffer, and we acquire an entire output period at a time (the board we use makes this straightforward). Since our acquisition is thus synchronous and continuous, we avoid any windowing errors. (If we did not sample continuously, there would be a discontinuity in the record where we acquired each array; these discontinuities would appear as noise at the frequency which we execute the loop.) Instead, we always read in an exact number of cycles and we process each buffer in real time.

The program then enters the main loop of the program. The program begins the main loop by reading in the applied current, the voltage drop, and the temperature. The voltage drop is passed to a subroutine that performs the phase-sensitive detection (PSD). The PSD routine simply multiplies the input signal by twice the reference, as we argued above. Since the input and reference have the same frequency, the input signal amplitude appears as the zero frequency (DC) component of the multiplied signal. Everything else including the offensive DC offset and line noise contributions appears at higher frequencies. If we use a low-pass filter with a large time constant, we will recover only that component which matches the reference in phase and frequency.

The PSD routine next low-pass filters the result using a fifth-order Butterworth filter with a 0.5 Hz cutoff frequency. Changes in the input signal that occur much faster than the output filter time constant will not survive.

Thus, the superconducting transition appears to take approximately a second, while of course its true duration is much less. However, as long as the sample warming rate is slow (as long as there is a poor thermal link between the sample and its environment), the transition temperature may be quite accurately determined.

The result is a waveform containing the voltage drop sampled at around 5500 Hz. It is inconvenient to graph or store this much data, and so we take the mean over four cycles (0.108 s) of the voltage drop. We also divide by the nominal applied current to get the resistance. The program records this average value, as well as the iteration number, applied current, and temperature, to a tab-delimited file. (It is straightforward to import a tab-delimited file to most spreadsheet applications, but for long data sets, they are slow to generate. In that case we stream to a binary file and write a separate conversion program in LabView.)

Each loop also updates several graphs that display, in real time, the status of the system and the detector. For example, at right is the "airline cockpit" view of the program, used for development and debugging. It shows (clockwise from top right) the input and applied waveforms; their power spectrum; the multiplied and multiplied-filtered signals; the resistivity versus time, versus temperature, and log resistivity versus temperature.

A student performing this experiment would only need to see the resistivity versus temperature graphs. However, when introducing students to the lock-in analyzer, it is extremely useful to display the waveform as it proceeds through the program, and even more so to display its spectrum. The student can directly observe the effects of broadband or line noise, and can see the LIA filter their contributions from the input. This visualization is impossible to perform with a "black box" commercial unit.

The program then repeats the main loop. This process continues until the user requests the program to stop, at which point the program stops the output generation and the acquisition, performs housekeeping such as closing its data file, and exits.


The main graph in Figure 6 shows a data set recorded as the sample warmed up from approximately 80 to 200 K. The applied current was 10 mA at 37 Hz, and the output filter was set at 0.5 Hz. Each point in the graph is the average over four cycles (0.108 s) of the lock-in output. The inset graph shows the initial portion of the transition on an expanded y-axis.

One can clearly observe the transition at 115 K. The transition is not sharp: this is a general characteristic of high-transition temperature superconductors. Above the transition, we can see that the resistance increases linearly with temperature. Below the transition, we find that the resistance is 0 ± 0.02 microohms. The noise appears to be smaller between 90 and 100 K because the thermoelectric offset disappears, then reappears in this region; this reduces the noise somewhat.


The lock-in analyzer we have described is a versatile tool. Although we have specifically discussed a superconductivity experiment, it would be straightforward to adapt the LIA to any small signal that may be periodically modulated. It is also low-cost in the sense that the equipment required (computer, DAQ board, and amplifier) is readily available and is used for many different experiments. The program not only replaces the lock-in amplifier but also handles the thermocouple calibration and records and charts the data. It is quite sensitive, and its sensitivity can be further improved with an appropriately expensive input amplifier and ADC. Its primary advantage over a commercial unit, however, is as a teaching tool. The ability to display both time series and frequency spectrum displays of the signal to have an arbitrary number of spectrum analyzers and oscilloscopes connected to the signal path is of great utility. Furthermore, LabView has powerful simulation capabilities: it can not only implement the LIA but also can simulate the entire experiment. In fact, in order to acquaint our students with LabView and lock-in detection, we give each student a partial simulation to complete before lab. That is, we can not only place a lock-in analyzer on every PC in our lab, we can give each student one to take home! These features make the PC-based digital lock-in analyzer an excellent tool for the junior- or senior-level physics lab.


Sources of, and defenses against, noise:

Lock-in detection: