Contributions:LabJackADC

Synopsis
A BCI source module that allows recording of digital/analog inputs and streaming of digital inputs with a LabJack device (T4 or T7).
Location
http://www.bci2000.org/svn/trunk/src/contrib/SignalSource/LabJackSource
Versioning
Authors
Robert Ellis (ellis@neurotechcenter.org)
Version History
V1.0-12/15/2022-Allows acquisition of digital/analog signals using a LabJack device
Source Code Revisions
None
Functional Description
Allows recording of digital and analog inputs using a LabJack T4 or T7. The first instance of a digital input channel (FIO, MIO, EIO, CIO) listed will be recorded as a digital stream. This module has been tested with a LabJack T7 connected via USB, though it should also function with a LabJack T4 and with ethernet connection.
Usage
Make sure to install the necessary drivers here beforehand. In CMake, enable “BUILD_CONTRIB” under “BUILD”. To use with a batch file, append “Start executable LabJackADC --local” under “Startup system localhost”.
Connection Setup
USB setup is straightfoward---connect the device to your computer via a USB cable, and confirm the connection by opening Kipling (installed with the necessary drivers in the previous section).
-
Valid USB connection
If the "USB" box is green, you will be able to use LabJackADC with USB connection.
To set up an ethernet connection, connect an ethernet cable between the LabJack device and your computer and go to Kipling. Note that the ethernet cable will not supply the device with power (unlike the USB cable), so you will have to still use the USB cable to supply power to the device. You will likely see a grey Ethernet box. Press on the green USB box and navigate to the Network Settings tab. You should see "Connection Status: Connected" (troubleshoot). We will assign the device a static IP: open Command Prompt on your (Windows) device and run "ping 192.168.1.3", you should see something like
-
Valid IP Address
If you do get a response, you will have to use another address (try 192.168.1.226, for example). After finding an address which yields no response, return to Kipling and under configure change the setting to "Manual". Enter this IP in the "IP" field, enter 255.255.255.0 in the "Subnet" field, and enter your routers default gateway into the "Gateway" field (run ipconfig in Command Prompt to find this). In the DNS field, you can enter 0.0.0.0 if you are using a T7, if you are using a T4 its recommended to copy what you used in the "Gateway" field to avoid errors. The "Alt-DNS" field can be left as 0.0.0.0. Apply the changes and go to the "Device Selector" tab.
In the "Device Selector" tab, disconnect the device and press "Refresh Devices". If the Ethernet box is still grey, setting a static IPv4 IP address for the ethernet port could resolve the issue: to do this, open Control Panel, then under Network and Internet, click "View network status and tasks". Under active networks, you should see an ethernet connection. Click on the network for the LabJack device and open Properties. In the list of items one should be named "Internet Protocol Version 4 (TCP/IPv4)". Double click this item and in the new menu click "Use the following IP address". For the IP address use 192.168.1.2 and use the same Subnet and Gateway you used for the LabJack.
After applying these changes return to the Device Selector in Kipling and refresh devices. You should see either a yellow or green Ethernet box. If this is the case, the connection can be established and you may use an ethernet connection for LabJackADC. When restarting your computer, it may be the case that the connection won't automatically reestablish--in this case go to Kipling, and click on the Ethernet box, even if it is grey, and the connection should reestablish. If you run into errors, more information can be found here and here.
Parameters
-
LabJackADC Parameters
SourceCh
Number of source channels to be used. Currently supports up to 36 channels (AIN0-13, FIO0-7, MIO0-1, EIO0-7, CIO0-3).
SampleBlockSize
Number of samples to be collected before processing
SamplingRate
Number of samples to be collected per second. Maximum sampling rate depends on setup (connection type, numbers of channels used, resolution, etc). Information about LabJack’s sampling rate can be found here.
ChannelNames
Channel names must be entered in the format of their label (ex: “AIN0”, ”FIO3”). The first FIO channel listed will have data stored as a stream under “DigitalStream”. The channels listed under "SourceCh" are supported
SourceChGain
Factor by which channel’s data will be scaled
SourceChOffset
Value by which each channel’s data will be offset
Resolution
Allows the user to adjust the resolution used. Takes a value between 0 and 8, where 0 is the default/recommended value. More information on resolution here.
Range
The amplitude of the signal, between 0V and 10V. Higher ranges get processed faster, while lower ranges take more time to process. More information here.
Connection
Specifies which connection to be used: 1 uses USB connection, 2 uses Ethernet connection, and 0 uses the first connection detected (USB or ethernet).
States
DigitalStream
The first FIO channel listed in ChannelNames will have data stored in DigitalStream.