DAQ Sync LabJack Setup

DAQ Sync LabJack Setup

Align and synchronize data acquisition systems

Herein is an expansion on setting up your LabJack for the DAQ Synchronization project. This can be a standalone project or can be considered part of the overall DAQ Synchronization Project. With this part of the project, a very inexpensive DAQ, called the LabJack, is used to record several signals that can typically be found in neuroscience research. This DAQ can stand alone or be aligned to other recording DAQ using other parts of the DAQ Synchronization project.

The LabJack (LJ) is probably sufficiently fast for most needs. Nyquist Sampling states that your slowest signal (eg a 200 Hz Camera) can be captured IN ITS ENTIRETY by sampling at just over two times that signal (400.1 Hz would do it). The absolute maximum speed of sampling for the LabJack is dependent on several factors, but it can easily sample all four of the signals laid out here at 2000 Hz. Using some odd looking math shown below, the LJ can digitally sample signals at 3.3V or 5V (or 10V if you want). It can also sample inverting (!) analog signals safely up to 10V, and can output digital signals at 3.3V (the typical 5V TTL signal will require a bit of work, and another $6 board. Instructions can be found here). Neat!


In this part of the project we go over an example of how to set up the LJ to record four unique signals, each at one sampling rate. This example shows a variety of signals that represent a range of what can typically be found in science research. See the table below for a particular example setup and how to input it into the LJ software (described in detail below so that you can adapt it for YOUR RESEARCH).

Equipment Signal LabJack Input LJStreamUD Row +Ch -Ch Scaling Equation
Barcode 5V Digital FI04 0 193 199 y=floor(a/2^4)-2*floor(a/2^5)
Trial start/LED 5V Digital FI05 1 193 199 y=floor(b/2^5)-2*floor(b/2^6)
Camera 3.3V Digital FI06 2 193 199 y=floor(c/2^6)-2*floor(c/2^7)
Treadmill 5V Analog AIN01 3 1 199 y=d


This part of the project assumes you have the LabJack set up as shown here and have the software installed. Go to Start => LabJack => LabjackStreamUD to open the software. Input the following:


More information of each input can be found on the LabJack site. But to go over what is going on here:

  • The ‘# Channels’ is four (3 digital and one analog)
  • The scan rate is set to 2kHz (choose what makes sense to you and what the LJ can handle). The max sample rate of the U3 is 50kHz. The max scan rate depends on how many channels you are sampling per scan. Full resolution streaming is limited to 2500Hz. More info here
  • Generally, keep the Resolution and SettlingFactors at zero
  • Indicate you want to log the file (write to file) by ensuring that check box is black
  • Add a Data File Prefix (example: May3FourCh) to name your log file. An index is also automatically added when more than one file is generated (example: May3FourCh_0 and May3FourCh_1)
  • Increase the Max File Size to something that makes sense. If the maximum file size is reached, a new separate file will be generated and you can just stitch the files together post-hoc
  • Change the working directory to someplace that makes sense to you
  • Change the graph history to something that makes sense to you and your experiment (ten times the scan rate?). This is just what will be displayed in this Window
  • Indicate that you want to graph all four signals in this window by ensuring the rows are all marked green in “Graph?”
  • !!!!! Be sure to disable scaling by ensuring that “Disable Scaling” is not checked (white)

Now the fun stuff. We’ll work backwards, from row 3 to 0.

  • Row 3: This is our analog signal we are recording on AIN01. The +Ch tells the software which pin on the LJ to record a voltage from. We are using AIN01, so we set the +Ch to 1. There are four analog pins available on the LJ. If we chose to use AIN00, we would set the +Ch to 0. Next, we set the -Ch to 199 or ground. The LJ compares the voltages between two points. By setting the -Ch to 199, we are telling it to compare our positive channel (AIN01) to ground (199). Next is the scaling equation. The LJ stores the voltage in a variable (as a letter) that corresponds to the row in the LJStreamUD. We are in the fourth row here, so “d” is the variable. When you do analog readings the scaling is 1:1, so no scale is applied. We simply set y=d
  • Row 2. This is our camera input, coming in on FI06 on the LJ. The LJStreamUD does something really cool to get a digital reading from an analog input function, thus allowing streaming. By setting the +Ch to 193, we are telling it to read the 16 bits of the Digital I/O (in decimal form for speed) and store it in the variable for this row. Because we are in the second row (index 0) the variable here is “c”. Then we use math to pull out the reading of our desired pin from the 16 bits.

    y=floor(loggerVar/2^DIONum) - 2*floor(loggerVar/2^(DIONum+1))

    Where “loggerVar” is the default scaling equation variable that holds the bitmask value, and “DIONum” is the digital IO number of interest.

    Here, loggerVar is c, and DIONum is FI06 or 6. Therefore this equation becomes


    The -Ch is fine to be chosen as ground, 199.

  • Row 1: Here is our Trials Start/LED 5V TTL. Again, we choose the +Ch to be 193 (read the bits of our digital IO) and store it in a variable for this row (“b”). Then we math for the scaling equation:


  • Row 0: This is the TTL from the Neuropixels. Bla bla, math:


Hit the “Start Stream” button to begin acquiring data. Data will be saved as a .dat file. There are many ways to view/plot/manipulate the data, including just renaming the file as .csv and opening with a spreadsheet viewer (MS Excel). The data file (.dat) will have a header with useful information about the time of starting etc. Then each row will have a timestamp and a corresponding reading for each channel (4 channels in this example).


ONE Core acknowledgment

Please acknowledge the ONE Core facility in your publications. An appropriate wording would be:

“The Optogenetics and Neural Engineering (ONE) Core at the University of Colorado School of Medicine provided engineering support for this research. The ONE Core is part of the NeuroTechnology Center, funded in part by the School of Medicine and by the National Institute of Neurological Disorders and Stroke of the National Institutes of Health under award number P30NS048154.”