Skip to content

Using Lock In Amplifiers

William Wood edited this page Dec 3, 2018 · 2 revisions

Using Lock-In Amplifiers

This is a guide on how to use the standard Lock-In Amplifier functions.

Basic Principles

Lock-In amplifiers in JISA are represented by classes deriving from the LockIn abstract class. Those with dual-phase capabilities extend from DPLockIn (which in-turn extends LockIn). These classes allow you to:

LockIn and DPLockIn:

  • Read amplitude of locked-in signal
  • Read frequency of reference signal
  • Set and read frequency of internal oscillator
  • Set and read amplitude of internal oscillator
  • Set and read phase of internal oscillator
  • Set and read whether reference uses external signal or internal oscillator
  • Set and read time constant
  • Wait for stable lock

DPLockIn only:

  • Read in-phase component of locked signal (X)
  • Read 90-degree out of phase component of locked signal (Y)
  • Read phase of locked signal

Configuring the Instrument

To configure the lock-in amplifier, you can use the setRefMode(...) and setTimeConstant(...) methods:

SR830 lockIn = new SR830(new GPIBAddress(0, 30));

// Use external reference signal
lockIn.setRefMode(LockIn.RefMode.EXTERNAL);
// Use internal reference signal
lockIn.setRefMode(LockIn.RefMode.INTERNAL);
// Set time constant to 10 seconds (or as close as possible)
lockIn.setTimeConstant(10.0);

For internal referencing you can configure the oscillator:

// Set frequency to 15.5 Hz
lockIn.setOscFrequency(15.5);
// Set phase to 45 degrees
lockIn.setOscPhase(45);
// Set amplitude to 50 mV
lockIn.setOscAmplitude(50e-3);

Reading Measurements

The LockIn classes provide several methods for making measurements:

// Get reference frequency (internal or external)
double frequency = lockIn.getFrequency()
// Get locked signal amplitude
double amplitude = lockIn.getLockedAmplitude();

For dual-phase capable instruments, you also have:

double amplitudeX = lockIn.getLockedX();
double amplitudeY = lockIn.getLockedY();
double phase      = lockIn.getLockedPhase();

Stable Lock

You can make your thread pause until a stable lock has been acquired by use of the waitForStableLock(...) methods:

// 1% margin for 5 seconds
lockIn.waitForStableLock();
// 0.5% for 10 seconds
lockIn.waitForStableLock(0.5, 10000);

Example Program: Using Lock-In as a Spectrometer:

public class Main extends GUI {

  public static void run() throws Exception {

    SR830      lockIn = new SR830(new GPIBAddress(0,30));
    ResultList list   = new ResultList("Frequency", "Amplitude");
    
    list.setUnits("Hz", "V");
    lockIn.setRefMode(LockIn.RefMode.INTERNAL);

    Table table = new Table("Table of Results", list);
    Plot  plot  = new Plot("Plot of Results", list);
    Grid  grid  = new Grid("Result", table, plot);

    grid.show();

    for (double f = 1.0; f <= 100; f += 0.5) {

      lockIn.setOscFrequency(f);

      // Make sure time constant ~ 10x period
      lockIn.setTimeConstant(10.0 / f);
      lockIn.waitForStableLock();
      
      list.addData(
        lockIn.getFrequency(), 
        lockIn.getLockedAmplitude()
      );

    }

    list.output("spec.csv");

  }

  public static void main(String[] args) {

    try {
      run();
    } catch (Exception e) {
      Util.exceptionHandler(e);
    }

  }

}

Clone this wiki locally