12
A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware Experimentation By: Steven C. Hageman / AnalogHome Introduction Lock-In amplifiers have been around since their first development as described by Dicke in the 1940’s[1] and they are still used today in many experimental systems. The technique is also called by a variety of names: Phase Sensitive Detection, Synchronous Detection and Narrow Band Detection. Originally the technique was used to enable measurement on very small signals that would otherwise be obscured by even the best available amplifiers noise. By modulating the signal, AC amplifying it, then synchronously demodulating it, and applying a very narrow Low Pass Filter, the result is: a very narrow detection bandwidth that totally bypasses the 1/f amplifier noise problems and hence produces a very low noise floor. Basic Lock-In Technique All electrical systems have increasing noise as the frequency approaches DC [2], this noise is called 1/f noise. Even though amplifier noise has been reduced nearly 1000x since the 1940’s, 1/f noise is still a limiting factor in many high performance measuring systems. The Lock-In Amplifier technique is an effective way to deal with this excess noise problem. A common experiment that is limited by noise is shown in figure 1, this experiment is the measurement of optical absorption by illumination of a test sample by a light source. Figure 1 – A typically challenging optical measurement. High attenuation of the optical sample makes measuring the resulting light intensity difficult because of detector and amplifier noise. After the light passes through the optical sample it is attenuated greatly, thus necessitating amplification to get a measurable signal. The signal plot in figure 2 illustrates the signal and noise problem. Figure 2 – A signal and noise diagram for the measuring system of figure 1. The attenuated signal (red) is obscured by the Detector + Amplifier 1/f noise. Interfering signals (Blue) are usually also present. Page 1 of 12 Copyright 2018 Steven C. Hageman

A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

Embed Size (px)

Citation preview

Page 1: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

A Modern DSP Based Lock-In Amplifier Designed for Code andHardware Experimentation

By: Steven C. Hageman / AnalogHome

Introduction

Lock-In amplifiers have been around since theirfirst development as described by Dicke in the1940’s[1] and they are still used today in manyexperimental systems. The technique is alsocalled by a variety of names: Phase SensitiveDetection, Synchronous Detection and NarrowBand Detection.

Originally the technique was used to enablemeasurement on very small signals that wouldotherwise be obscured by even the best availableamplifiers noise. By modulating the signal, ACamplifying it, then synchronously demodulatingit, and applying a very narrow Low Pass Filter,the result is: a very narrow detection bandwidththat totally bypasses the 1/f amplifier noiseproblems and hence produces a very low noisefloor.

Basic Lock-In Technique

All electrical systems have increasing noise as thefrequency approaches DC [2], this noise is called1/f noise. Even though amplifier noise has beenreduced nearly 1000x since the 1940’s, 1/f noiseis still a limiting factor in many high performancemeasuring systems. The Lock-In Amplifiertechnique is an effective way to deal with thisexcess noise problem.

A common experiment that is limited by noise isshown in figure 1, this experiment is themeasurement of optical absorption byillumination of a test sample by a light source.

Figure 1 – A typically challenging opticalmeasurement. High attenuation of the opticalsample makes measuring the resulting lightintensity difficult because of detector andamplifier noise.

After the light passes through the optical sample itis attenuated greatly, thus necessitatingamplification to get a measurable signal. Thesignal plot in figure 2 illustrates the signal andnoise problem.

Figure 2 – A signal and noise diagram for themeasuring system of figure 1. The attenuatedsignal (red) is obscured by the Detector +Amplifier 1/f noise. Interfering signals (Blue) areusually also present.

Page 1 of 12 Copyright 2018 Steven C. Hageman

Page 2: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

As figure 2 demonstrates, this experiment willyield poor results as the resulting signal is belowthe detector and amplifiers noise. Interferingsignals are typically power line (50/60 Hz)related.

The Lock-In Amplifier technique is a solution tothis problem (figure 3). First, the light source ismodulated or chopped at some frequency highenough to move the signal out of the detectors +amplifiers 1/f noise region and also away fromany interfering signals. In the old days, a rotatingmechanical light chopper might have been used,today a LED or Laser illumination source couldbe electrically switched on and off.

The now modulated light is passed through theoptical sample and detected by the photo-detector.The detected AC signal is then amplified by a lownoise amplifier (figure 4). The signal is thendemodulated with a synchronous demodulatoroperating at the same frequency as the lightchopper.

Figure 3 – The Lock-In Amplifier solution to themeasurement problem of Figure 1. Here arotating wheel acts to chop or modulate the lightsource.

After demodulation the original signal is at DCagain, and this DC signal can then be filtered witha very narrow Low Pass Filter (LPF). Theresulting system noise bandwidth can be made

very small resulting in a greatly improved signalto noise ratio.

Figure 4 – After modulating (chopping) the signal(Red) is now shifted up in frequency to avoid theamplifier noise and any interfering signals (Blue).

The Basic Lock-In Amplifier

The basic Lock-In amplifier consists of some sortof reference source output that is used tomodulate the experiments driving signal and asynchronous demodulator that is driven from thesame reference (figure 5). As will be shown, thephase relationship between the signal source andthe demodulator is important.

Figure 5 – The basic block diagram of a Lock-InAmplifier. The various function blocks may be:analog, digital or a combination of both.

Page 2 of 12 Copyright 2018 Steven C. Hageman

Page 3: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

Classical Analog Lock-In

The first synchronous demodulators were Analogand were built with a switched, +1/-1 gainamplifier combination. One possible circuit isshown in Figure 6. Using the best availablediscrete circuits today [3], allows this sametechnique to extend from DC to better than 1MHz modulation frequency.

The demodulation function for the circuit shownin Figure 6 is a square wave, so this technique hasa response at the fundamental modulationfrequency, and also at odd harmonics of themodulation frequency. These harmonic responsesare impossible to separate from the desiredfundamental response and therefore can add tomeasurement errors if they are large enough [4].

Figure 6 – The first Lock-In Amplifiers used asquare wave synchronous demodulator similar towhat is shown here. The gain is switched from +1to -1 at the modulation frequency.

Other circuit configurations can be used for thesynchronous demodulator and at higherfrequencies the circuit of figure 6 can be replacedwith a diode ring mixer. This can extend theuseful demodulation frequency range to severalhundred MHz.

The demodulator of figure 6 has been available inIC form since the 1980’s as the Analog DevicesAD630 [5]. A more modern analog / digitalcrossover IC is also available [6].

The circuit of figure 6 is also called a: PhaseSensitive Detector. For instance, if thedemodulation signal and the frequency of theswitching are in phase the output of the circuitwill be essentially a full wave rectifier. In thiscase the DC output of the Low Pass Filter will beproportional to the amplitude of the signal.

Conversely, if the phase of the demodulatingsignal is shifted 90 degrees (or in quadrature) withrespect to the input signal, the output of the LPFis now sensitive to the phase of the input signal.

This phase sensitive demodulation is detailed infigures 7 and 8. The input signals in figure 7 and8 are shown as sine waves as this is the easiestway to visualize the phase relationships of thevarious signals. The actual input signal can be ofany waveform shape.

Figure 7 – If the input signal (VG1) and thedemodulating signal (VG2) are in phase, then thecircuit of figure 6 acts like a full wave rectifierand the output (VF1) is proportional to the inputsignal amplitude. After low pass filtering theoutput would be a DC signal.

Page 3 of 12 Copyright 2018 Steven C. Hageman

Page 4: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

Figure 8 – If the input signal (VG1) and thedemodulating signal (VG2) are 90 out of phase(quadrature), then the circuit of figure 6 acts likea phase detector and the output (VF1) isproportional to the phase difference between thesignals. As can be seen, the DC Level (VF1) inthis case is zero when the signals are exactly 90out of phase.

It is clear from figure 7 and 8 that when using theclassical synchronous demodulator of figure 6,the phase relationship of the signals is criticalwhen measuring either phase or amplitude.Wandering amplitude or phase will not giveconsistent readings with this type of circuit.

Of note: This ‘Analog’ Lock-In Amplifiertechnique was used by Hewlett-Packard startingin 1958 in their Microwave Power Meter productsand continues to be used today [7].

Classical DSP Based Lock-In

In the mid 1980’s analog Lock-In Amplifiers gaveway to Digital Signal Processing (DSP) baseddesigns. These DSP based Lock-In Amplifierswere based on the very common Quadrature or IQdetection method that is still used in all sorts ofdigital demodulators today including SoftwareDefined Radios (SDR’s) (figure 9). The enablingtechnology was the availability of high speed, 16bit Analog to Digital Converters (ADC’s).

Figure 9 – DSP Based Lock-In Amplifier,everything after the ADC input is implementeddigitally.

There are three big advantages with DSP Baseddesigns,

1) All the processing and filtering after the ADCis done digitally eliminating all the matching,accuracy, drift and tuning problems of Analog.

2) The demodulator implements both an in-phaseand a quadrature detector section so that theactual magnitude and phase of the input signalcan be determined for any phase relationshipbetween input signal and the reference. This was avery important performance improvement.

3) The Reference signal is implemented as adigital sine wave. When combined with a true,digital multiplying demodulator, this eliminatedthe third order response problem of the classicanalog demodulator of figure 6.

These commercial DSP designs have progressedin performance over the years and now canoperate from DC to several hundred Megahertz.

A Lock-In Designed for Experimentation

Commercially available Lock-In Amplifierscontain many features and usually have built in

Page 4 of 12 Copyright 2018 Steven C. Hageman

Page 5: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

displays and user Interfaces. This makes themeasy and quick to apply to a variety ofexperiments. The user of a commercial instrumenthowever is constrained in using the processingalgorithms and hardware configurations “assupplied” by the instrument manufacturer.

This “Closed System” configuration stiflesexperimentation into new approaches.

Experimentation today is defined as an: “OpenEcosystem” configuration of hardware andsoftware that can be modified or extended at willand as needed.

It is with this need in mind that I designed aLock-In Amplifier Platform that is expresslydesigned for quick experimentation in both thehardware and software domains.

Hardware Design for Experimentation

The basic hardware design of figure 10 is built ontwo main PCB sections. The main board containsthe power supplies, 32 Bit Microprocessor, DirectDigital Synthesis (DDS) source and two fast 16bit ADC’s. These base functions are needed for allconceivable configurations.

Figure 10 – A modernized Lock-In platformdesigned for experimentation. A single 32 BitMicroprocessor controls all the digital functionsof the instrument. The Analog sections (yellowblocks) are quickly replaceable via a mezzaninePCB for easy adaptability to any requirement.

The ADC core functions consist of two very highperformance 16 bit ADC converters that canconvert at up to 2 MSPS in 16 bit mode or up to2.4 MSPS in 8 bit mode. Most designs that usehigh-speed ADC’s have a separate FPGA tocontrol data acquisition and storing the ADCsamples to memory. This design uses the latesthigh-speed, MIPS based, 32 Bit Microprocessorto do this function entirely itself. TheMicroprocessor contains 512k bytes of on-boardRAM for saving ADC data directly and by usingthe Microprocessor to directly control the ADC’ssaves two other chips, namely: A FPGA andexternal RAM chip. More importantly however,this configuration saves the user from having todeal with yet another piece of code + compiler +programmer that would be needed in workingwith a separate FPGA.

The Microprocessor chosen also includes aperipheral divide down counter that is clockedfrom the low noise system clock. The output fromthe divider is a low jitter, square wave, that isused to generate the sample trigger clock for theADC’s. The ADC sample trigger clock is easilyprogrammable from DC to 2.4 MSPS as dictatedby the desired sampling rate.

The Source Output is generated by a commercialDDS IC. The output is a sine wave of up to 25MHz, but this can be modified to be any waveshape as may be required by the experimentsneeds. Attenuation and offset controls are builtinto the main board to control the output up to+/-5 Volt maximum with 2 mV resolution. Theoffset can also be controlled over the full +/- 5Volt range. Source harmonics are less than -55dBc, which is comparable to a ‘good’ analogoscillator.

What needs to change to adapt this platform toany experimental configuration is the analog IOthat is shaded yellow in figure 10.

The replaceable Analog Front End (AFE) is built

Page 5 of 12 Copyright 2018 Steven C. Hageman

Page 6: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

on a plugin mezzanine PCB that can be quicklydesigned around any specific application need.The AFE typically contains the signal inputconnectors and the input signal conditioning asshown in figure 11. Connection between theboards are made through four, 10 pin, board toboard connectors. The board to board connectorsprovide analog and digital IO, along with powerto the AFE Mezzanine.

Figure 11 – The Analog IO is what needs tochange to adapt the new Lock-In Amplifierplatform to any possible need. In this design theAnalog IO functions are placed on an easilyreplaceable mezzanine PCB that plugs into themain PCB.

Modern Analog functions still need digital controland this is accomplished by having two SerialDigital IO (SPI) controls, one for each analogchannel brought up to the mezzanine PCB. Thesetwo channels may be further expanded by the useof SPI IO expanders to any number of digitalchannels.

To provide maximum isolation between the AFEchannels, each AFE channel is supplied byindependent, low noise, linear regulatorssupplying +6 and -5.5 Volts. A system power railof +7 Volts at high current is available to themezzanine for driving high current loads such as:LED’s, relays, etc.

One AFE design that has been developed(pictured in figure 11) is a general purpose AFEthat uses 4 nV/rt-Hz JFET input amplifiers, has again range of 0.1-1000, Input Impedance of 1Megaohm and a bandwidth of up to 15 MHz. Thisgeneral purpose AFE allows the measurement ofany signal from: +/- 2 mV to +/-20Volts full scale.

Other designs have included,

* Ultra Low Noise Bipolar Input Amplifiers * Photodiode / Transimpedance Amplifiers * Ultra High Impedance Amplifiers * Piezo Transducer (Charge) Amplifiers * Low DC Drift, Chopper Stabilized Amplifiers

In some applications, the Lock-In Amplifier isused in a closed loop control system whichusually includes some form of analog output.Since the Lock-In processing algorithms aredigital in this design, the final result of the anyprocessing is a digital number. This digital resultcan then be fed to a suitable DAC that is scaledexactly as required for the experiments needs. TheAnalog Output in this design resides on the AFEMezzanine board. This location makes it easy tomodify and adapt the output to fit any systemrequirements.

Since imperfect parts are used for the source andAFE gain setting resistors the gain varies fromboard to board. To overcome this a calibrationprocess was developed for this design. The mainboard contains a general purpose 32k byteEEPROM that can be used for calibrationmemory. This EEPROM can be used to store upto 8k, floating point numbers and these can beused for storing calibration constants.

General purpose cal routines have been developedthat use the on-board DDS Source as an AC testsignal. The source is first calibrated with the helpof a high resolution True RMS reading DVM.

Using the calibrated DDS source with suitable

Page 6 of 12 Copyright 2018 Steven C. Hageman

Page 7: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

attenuators and making actual input comparisonmeasurements with the DVM, the AFE boardsgains and offsets can be determined and stored onboard. A calibration performed in this mannertakes only a few minutes and has the accuracyand traceability of the DVM.

Software Design for Experimentation

Modern digital radios are said to be “SoftwareDefined” (Software Defined Radios or SDR’s)because it is the software that defines thedemodulation characteristics of the radio not thehardware. In Analog radios for instance,demodulating AM and FM signals had to be donewith different hardware detectors. In a SDR, oncethe signal is digitized properly any demodulationmay be performed simply by changing thedemodulation algorithm in software.

Coupled with Open Software [9], this approachleads to the possibility of quick experimentationand bread-boarding of new ideas in softwarewithout having to change the underlyinghardware.

This same technique has been applied to Lock-InAmplifiers with this design. The signal isdigitized early in the processing chain and then byvarying the amount of samples taken, sample rateand the processing algorithms, nearly any desireddemodulation can be achieved by changing onlythe processing software.

One common digital processing technique is tooversample the input signal. This is used toincrease the effective number of bits in the ADC.Since this design uses a 16 bit ADC, the naturaldynamic range is approximately 6 dB times thenumber of bits or approximately of 96 dB. If thereis sufficient random noise in the signal to ‘dither’the LSB’s of the ADC, then by sampling thesignal 16 times for each desired output sample wecan increase the effective resolution by a factor of

4 (Square Root of 16 = 4). This is like adding 2bits to the ADC. Oversampling by dither noise isusually easily accomplished because, whateversignal transducer is used, it will usually havesufficient noise to dither the ADC LSB’s. TheAFE gain just needs to be set high enough to getthe signals natural noise floor above the ADCnoise by a few LSB bits [8]. If required, externaldither can also be added to the signal path.

Another very common processing step that isfound in SDR’s, but not much of anywhere else isundersampling. Normal sampling is when theNyquist criteria is applied to a baseband signal.Everyone knows this to be something like: “Youmust sample a signal at greater than twice thesignals bandwidth for there to be no digitalaliasing of the signal back into the baseband.” Thekey word here is: Bandwidth. As long as thesampling rate is greater than twice ‘bandwidth’then there will be no aliasing of the signals tobaseband. This is illustrated in figure 12.

Figure 12 – An illustration of undersampling. Thedesired signal is in red, the trapezoid around thesignal is the bandwidth of the analog signal path.When the signal (Red) is digitized at a Fsamprate it will be ‘mixed’ to a lower frequency asshown (Blue). In this example the signal wouldactually wrap around to negative frequencies,then appear as the baseband signal shown. Thisbaseband signal can then be low pass filtered toremove any other mixing products.

Page 7 of 12 Copyright 2018 Steven C. Hageman

Page 8: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

As long as the analog signal path and the ADC’ssample and hold dynamic bandwidth is greaterthan the signals absolute frequency, thenundersampling will work. The ADC’s sample andhold function acts like a mixer and just like amixer, multiple digital images show up in theundersampling output. The resulting basebandsignal can be digitally low-pass filtered to removeany other mixing products just as in done withreal hardware mixers. The advantage should beclear, the down-conversion can be changed at willbecause all the down-conversion parameters areadjustable in software. Another benefit ofundersampling is the required ADC sampling rateand therefore the data rate is greatly reduced,simplifying the ADC memory hardware deign.

Undersampling has another use that can beexploited to great advantage in Lock-InAmplifiers. In some experiments it is desired tomeasure not only the fundamental response, but toalso measure the 2nd and possibly 3rd harmonic ofthe signal at the same time. Some Analog Lock-InAmplifiers have the capability to measure the 2nd

harmonic, but not the third and never all at once.With this software defined Lock-In Amplifier it ispossible to measure all three signals at once as isshown in figure 13.

In figure 13 a 10.7 MHz signal is digitized at asampling rate of 2 MHz. The AFE analog signalbandwidth was > 32 MHz and the ADC used inthis design has a sample and hold bandwidth of50 MHz. This allowed the fundamental, 2nd and3rd harmonics to be digitized simultaneously. Thefundamental then shows up at an apparent baseband frequency of 700 kHz, the 2nd harmonicappears as 600 kHz and the 3rd harmonic appearsas 100 kHz. Since the experiments frequency ofoperation is determined by the internal sourcefrequency from the Lock-In Amplifier, thefundamental and harmonic frequencies are alsoknown and the multiple aliasing does not matterbecause all the signals frequencies are known andcan still be separated in frequency.

Figure 13 – Here a 10.7 MHz signal with itsharmonics was digitized at 2 MHz, the resultingfundamental signal, the 2nd and 3rd harmonics ofthe signal all alias back to baseband and are stilleasily distinguishable.

The ability to separate and identify aliased signalsis a unique feature of a source / receiverinstrument. The signal and all the harmonicfrequencies are known, since they are set by theon-board source and they can be avoided orcombined as desired in the resulting outputspectrum.

In the example shown in figure 13 all threesignals can be processed digitally at once becausethey can all be arranged as baseband signals atknown and different frequencies. This processingcapability is simply unobtainable in any Analogor current Digital Lock-In Amplifier and is adirect result of the software defined nature of thisdesign.

All current Digital Lock-In Amplifiers use theclassical processing approach that is shown infigure 9. This DSP scheme mimics a zeroIntermediate Frequency analog down converter aswould be found in modern SDR designs, but thisis not the only approach that can be used.Complex FFT’s can be performed on the digitized

Page 8 of 12 Copyright 2018 Steven C. Hageman

Page 9: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

signals that will yield similar and possibly moreuseful results.

Using a FFT approach, a conversion scheme likewas shown in figure 13 is possible, where eachsignal can easily be separated in frequency, aseach signal shows up in a different FFT Bin.

Demodulating a signal like figure 13simultaneously is impossible using theconventional DSP approach of figure 9.

All FFT’s by their nature return a complex result.This complex result has magnitude and phaseinformation that is similar to the I/Q output of theconventional DSP processing Lock-In Amplifierof figure 9. By using one of the Lock-InAmplifiers channels to measure the source, as areference and the other channel on the detectoroutput, Gain and Phase information may bereliably measured and processed as required(figure 14). A further benefit is that a gain ratiomeasurement of the output / input signal can bemade effectively eliminating any light sourceintensity fluctuation from the measurement result.This results in improved measurement stability.

Figure 14 – With dual input channels, a referencechannel measurement can be compared to theattenuated sample measurement. Hence, thecomplex gain and phase properties of the samplemay be determined.

Noise floor reduction techniques that are usedextensively in SDR’s are applicable to this OpenSoftware Lock-In Amplifier design also.

One such technique is: Noise Floor De-Embedding. The process works like this: Thenoise floor is accurately measured. It is a wellknown fact that any signal that measures 3dBabove the noise floor is actually a signal at thenoise floor because the noise powers add to asignal giving an apparent 3 dB amplitude abovethe noise. A correction can then be made for thenoise floor and a better estimate of the signalsactual amplitude can be made. In this case, thesignal would be reported with a 3 dB loweramplitude than what was measured. Thisprocessing has effectively De-Embedded thenoise floor from the measurement. Practically thistechnique may increase the dynamic range by 7 to10 dB [10].

Another very useful technique that is used in verylow signal to noise environments is: CrossSpectrum Analysis.

Figure 15 – Cross Spectrum Analysis isperformed by vector summing one complex FFToutput with the complex conjugate of anotheridentical channel. If the additive noise isuncorrelated in both analog channels, then thenoise will cancel out with averaging. Givenenough averages this technique can enhance thenoise floor by 20 dB or more.

Page 9 of 12 Copyright 2018 Steven C. Hageman

Page 10: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

In cross spectrum analysis (figure 15), two ormore analog input channels are connected to thesame signal source. By vector summing onechannels FFT result directly with the complexconjugate of the other channel, the noise of theanalog channels will average out, but the signalwon’t. With enough averages, the noise floor ofthe instrument can be effectively lowered by 20dB or more [11].

Cross Spectrum Analysis works because bothanalog channels will have uncorrelated noise andthis noise can be vector averaged out, but the realsignal in each path is correlated and will notaverage out.

The processing gain of a cross spectrum analysisis,

Reduction dB = 5 dB * Log10(Averages)

For 1000 FFT averages the noise floor can bereduced by 15 dB (or 5.6x less voltage noise).

Once the hardware design reaches the achievablelimits of the input amplifier device noise, NoiseDe-Embedding or Cross Spectrum Analysis is theonly way to get real reductions in the noise floor[10].

Any or all of the above techniques can be appliedto this common hardware platform because of theOpen Software nature of the design. Thesetechniques cannot be easily applied to anycommercial instruments because of theimpossibility of changing a commercialinstruments software.

Signal Processing

Depending on the requirements, the digital signalprocessing may be performed entirely by the on-board microprocessor or raw data may be

transferred to a control Personal Computer (PC)for further processing. The microprocessor usedhere can perform a highly optimized 16k pointFFT in under 30 milliseconds. The 32 BitMicroprocessors highly optimized DSPcommands along with 512k bytes of on-boarddata RAM allow for extensive signal processingto be performed by the instrument itself.

The 32 Bit Microprocessor also includes is anintegrated Floating Point processor Unit (FPU),which can provide both single and doubleprecision floating point results in a singleinstruction. Real double precision math inhardware opens up a whole new realm ofcomputational possibilities that are not availablewhen emulating Floating Point in software,because of the speed advantages.

With the Open Software approach, the signalprocessing can be partitioned between the on-board microprocessor and the control PC in anyway that makes sense for the specific application.

Hardware Control

The microprocessor on the main board is able torun self contained applications which is useful forclosed loop system where the output is an analogsignal. Many times however, Lock-In Amplifierapplications use the instrument as a measuringdevice transferring commands and data to a PCthat is used for further processing, display andstorage.

To facilitate PC control a USB 2.0 connection issupplied in this Lock-In Amplifier design. TheUSB connection is connected to the on boardMicroprocessors UART and runs at up to 3MBAUD.

If isolation is required to the PC to cut groundloops, a simple add on USB isolator can beinserted in the USB cable between the instrument

Page 10 of 12 Copyright 2018 Steven C. Hageman

Page 11: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

and the PC [12] and the instrument may bebattery powered.

Control commands to the Lock-In Amplifier areprocessed through a SCPI like command parser[13]. For instance, a command to start a dataacquisition sequence, and read the result wouldbe: “CHANel1:MEASure?”, which can beshortened to: “CHAN1:MEAS?”. The commandabove would initiate a data capture on channel 1and return the data array result.

With the Open Software nature of the instrument,any command may be added or multipleoperations can be combined into one as may bedesired for the experiment at hand.

This makes control of the instrument easy andintuitive. In SCPI a standard set of commands arealways present like,

*IDN?, Which asks the instrument to identifyitself,

*RST, Which causes the instrument to presetitself to the power on state.

The command parser API is easy to extendmaking the addition of application specificcommands straightforward.

This is useful because different AFE designs willalmost certainly require custom command sets forcontrol.

Wrapping the design up

The hardware design was sized to fit acommercial extruded enclosure that measures 5 x6 x 2 inches tall. The front and rear panels of thisdesign are flat plates which allows custom frontand rear panels to be easily made to fit anycustom application.

Using a simple hardware chassis design allowsfor easy access to the hardware for developmentand troubleshooting purposes as the hardwareslides out of the chassis for access.

The all aluminum enclosure also provideselectrical shielding and environmental isolationfrom drift inducing air currents.

The design with the universal JFET Input AFEconsumes about 7.5 Watts total from a 9 VDCsource, which leads to only a few degrees Ctemperature rise of the enclosure.

Figure 16 – The experimental Lock-In Amplifierdesign fits in a 5 x 6 x 2 inch tall commercialenclosure.

Notes / References

[1] Robert H. Dicke, Physicist, Popularized theLock-In Amplifier.https://en.wikipedia.org/wiki/Robert_H._Dicke

[2] Even chopper amplifiers have 1/f noise.Though choppers are better than other types ofamplifiers, their noise will eventually have a 1/fshape if you look at a low enough frequency.

[3] The best analog switching circuits available

Page 11 of 12 Copyright 2018 Steven C. Hageman

Page 12: A Modern DSP Based Lock-In Amplifier Designed for …analoghome.com/articles/a_modern_dsp_lockin_amplifier.pdf · A Modern DSP Based Lock-In Amplifier Designed for Code and Hardware

today were actually developed in the 1970’s in theform of the very fast and low capacitance DMOSswitches like the Siliconix (now Vishay) SD210series which are still available today.

[4] Some ‘advanced’ Analog Lock-In Amplifiersimplemented a quasi-sine wave demodulatorbased on the Walsh function and implementedwith a 4 step quantized sinewave multiplier.These designs had the effect of reducing the oddharmonic responses about 20 dB from theirsquare wave based counterparts. See: PrincetonApplied Research Model 5210.

[5] This is interesting, because the same AnalogDialog Magazine that introduced an IC form offigure 5, the AD630, also had articles on DSPbased chips and methods that could duplicatethese analog functions digitally. See: AnalogDialog V17n1, 1983. The AD630 is limited todemodulation frequencies of less than 200 kHz.

[6] Analog Devices ADA2200 a more modernLock-In Amplifier chip.

[7] See Hewlett Packard Journals,HP434A, Vol 9 No 12, August 1958HP431A, Vol 12 No 10, June 1961HP436A, Vol 27 No 2, October 1975

The most modern design to use a Lock-InAmplifier technique is the Keysight E4416A.

[8] The rule of thumb here is that foroversampling to work well that the random noisethat dithers or modulates the ADC LSB’s shouldbe a couple of bits or at least: 2 * 6 dB = 12 dBabove the natural ADC noise floor. The noiseshould have a normal distribution. Usually thesignal transducers and AFE amplifier noise andgain can be adjusted to meet this goal. Sometimesextra dither is added to the circuit directly aheadof the ADC.

[9] “Open Software” is defined here as: Sourcecode that you have access to and can modify as

needed. This is in contrast to “Closed Software”as would be found inside a typical commercialinstrument. There is no way to modify ClosedSoftware to meet your needs because you don’thave access to it.

[10] Hageman, Steve. “Measuring Small SignalsAccurately”, EDN August 23, 2012.https://www.edn.com/design/test-and-measurement/4394635/Measuring-small-signals-accurately--A-practical-guide

[11] Eventually the analog channel noise willbecome correlated at low enough levels due tocrosstalk leakage, power supply coupling orthermal drift and the averaging will cease to beeffective. Practically, I find this to happen at -20to -30 dB reduction in the noise floor, unlessextreme care is taken in de-coupling every aspectof the hardware design.

[12] USB isolators based on the Analog DevicesADuM4160 can be found on-line at veryreasonable prices. These isolators can be veryeffective at reducing ground loop noise andproviding leakage current isolation in USBconnections.

[13] SCPI stands for: “Standard Commands forProgrammable Instruments” and is a humanreadable, mnemonic based syntax that is usedextensively to control instruments. http://www.ivifoundation.org/scpi/

Author Information:

Steve Hageman is a confirmed “Analog-aholic”having fallen ill to the disease in about the 5th

grade. Since then he has designed and built allsorts of Analog and RF equipment spanning DCto 50 GHz. Currently he designs custominstrumentation for all sorts of interestingprojects.

Page 12 of 12 Copyright 2018 Steven C. Hageman