You are on page 1of 8

Manual Data-Streamer V1.

3 – USB and LPT version


1) Installing Data Streamer
2) Options in the software
3) Using the software
4) Comments on safety and implementation

1) Installing DataStreamer
Download the software installer to your local machine and then launch it. The current software
version is Windows-based, but please contact us (see section 5 for contact information) if there
is a need for the software on other operation systems. During the automatic installation
process, DataStreamer will be installed as a single standalone file on your desktop and the
MatLab DataPlugin will be installed. The plugin, which is alternatively available for free from the
National Instruments website (see http://www.ni.com/example/29178/en/), is only needed for
users who want to generate protocol files in MAT format. To use DataStreamer, connect your NI
DAQ card via USB to your machine, switch it on, make sure it is correctly recognized by the
operation system, and then launch DataStreamer.

2) Options in the software


Figure 1 displays the user interface of DataStreamer. Version V1.3 is specifically created for four
output channels: two auditory channels, one tACS channel and a digital channel for triggers.
- Timer and Buffer Settings
In this tab you specify the sampling rate of the digital input data in Hz (also see point 3) and the
chunk size at which the data is read in. The sampling rate used to create the stimulus protocol
must be exactly the same as the Sample Rate specified here. The Chunk Size determines how
many samples are read in at once. As a rule of thumb you can make the Sample Rate and Chunk
Size equal. However, in some systems, a large Chunk Size can cause errors if too much data is
read in at once leading to an overflow of the buffer of your personal computer. In this case,
reduce the Sample Rate and/or Chunk Size (if you decide to lower the Sample Rate, note that
you should (re-)create stimulus protocols with the same sampling frequency!). You can monitor
in the Windows Task Manager (tab Performance) whether you are close to filling the physical
memory of the computer when test-running your specific stimulus protocol with DataStreamer
for the first time; this should be checked especially when using a 32bit Windows system with
4GB of RAM or less.
- Device Settings
In this tab the specific National Instruments devices are specified. Automatically all analog and
digital channels are identified. Also the source of the triggering is identified. If you have more
than one National Instruments device
connected you will have to specify which
device you want to use. In a default situation
with one NI DAQ, nothing needs to be
changed in this section.
- Audio Gain
In this tab you can change the multiplicative
gain that is applied to the first two analog
channels. This is relevant for experiments
employing these channels, such as auditory
waveforms (hence ‘Audio Gain’) but also
non-auditory stimulation devices that take
analog inputs such as somatosensory
stimulation devices, additional electrical
stimulation devices, etc.
- Conversion Factor
In this tab you can change the multiplicative
gain that is applied to the third analog
channel. Since this is the channel designed to
be used for driving the tCS machine, the
Figure 1. The user interface of the DataStreamer.
indicated unit is mA/V. See point 4 for further details on how to determine and set this gain
factor.
- MATLAB Source File Settings
In this tab you can load the specific source file, i.e. Stimulus Protocol (also see point 3). The
default import format is .mat (Matlab format). Alternatively, a version that can read a standard
.txt format is available upon request, e.g. for users without access to Matlab.
- Actual values
This tab displays the output during the experiment. It specifies the acquired sampling rate, the
elapsed duration, and the channel length (i.e., the total number of samples per channel).
- Status
This tab displays the status of the sampled data of the source file. It displays the amount of data
read from the file and the amount of data streamed to the digital-to-analog device.
- Status indicators
At the bottom of the user interface there are four indicators of the status of the experiment.
From left to right:
Armed. The source file (stimulus protocol) has been loaded and is ready to be streamed.
Triggered. DataStreamer has started to go through the stimulus protocol; streaming has begun.
End of File. The entire source file has been loaded into the buffer (DataStreamer has found the
end of the file). This does not mean that the experiment is over, since the final chunk of data
may still need to be streamed until DataStreamer and the experiment are finished.
Ready. DataStreamer has completed streaming the full stimulus protocol to the NI DAQ
(‘ready’).
These indicators are green for the LPT version of Datastreamer and red for its USB version.
- The exit button
The exit button is used to stop the experiment and close the program.

NOTE 1: Both starting and correctly closing the DataStreamer software causes the program to
stream a series of ‘zeros’ to the NI DAQ card. This is to ensure that, if a tCS machine and
participant are connected in subsequent measurements, the starting voltage is at zero, ensuring
that no unexpected electrical stimulation can occur. We therefore strongly recommend to
always close DataStreamer using the Exit button. The well-known program closure button (red
‘x’ in top-right of program window) does not reset channels to zero and should therefore be
avoided. If for whichever reason proper closure of the program was not possible, the same
functionality (resetting of voltages) is implemented when DataStreamer is started. Best practice
is therefore to always (re)start DataStreamer before connecting a participant.

3) Using the software


a. Creating a Stimulus Protocol

Firstly one should create a Stimulus Protocol (loaded in the ‘MATLAB Source File’ in the user
interface), which needs to be a matrix containing four rows with an equal number of columns
(even if the first two ‘audio channels’ are not desired or used, these rows cannot be omitted
from the Stimulus Protocol). Rows represent the sequential channels of the NI DAQ card.

Row 1: ‘Audio Channel’ 1 (can also be connected to non-audio devices as mentioned above).

Row 2: ‘Audio Channel’ 2.

Row 3: ‘tACS Channel’: the waveform to be sent to a tCS machine with a remote control option.
While not restricted to tACS, most likely this row will hold a sinusoid signal of a particular
frequency (not the sampling frequency, but a sinusoid at the desired tACS stimulation
frequency, sampled at the stimulus protocol’s sampling frequency, see template/example
scripts provided along with the software and this manual).

Row 4: ‘trigger Channel’: digital channel containing instantaneous triggers that can be used to
trigger stimulation devices directly (e.g. LED, TMS, EEG). The relative timing of these events with
respect to the tACS signal in row 3 determines the phase at which stimuli are triggered.

There should be one sampling frequency that pertains to the stimulus protocol as a whole,
which can be determined per experiment as desired or required. As a rule of thumb, the higher
the sampling rate the better (the higher the resolution of waveform signals and the better the
sound quality in case of auditory stimulation), as long as the computer running DataStreamer
and the NI DAQ can handle the data stream. A sampling rate of 10.000 Hz for instance should
easily be sufficient and be feasible on most standard hardware.

Values in rows 1-3 (“analog channels”) must be floating point values and should fall within the
range between -1 and +1. Row 4 (“digital channel”) should only contain unsigned 8 bit integer
values corresponding to the requested digital output. These integer values should range from
zero to 255 or less, depending on the number of bits for which the LPT port of the to-be-
triggered external device is configured. We suggest implementing a 50ms up-phase (i.e.
duration) of the digital output to ensure that the trigger can be detected by the external
hardware. Finally, the last column of the entire matrix (final sample) should contain only zeros
to reset all voltages (an extra precaution related to safety considerations discussed in Note 1
above).

The format of the Stimulus Protocol, i.e. source file, is a file (.mat) created in MATLAB
(MathWorks), in which the matrix containing the rows is a variable of the type Double, named
stimuli. A Matlab script for generating a template stimulus protocol file in .mat format can be
downloaded together with the present manual from this website: https://osf.io/h6b8v/. A
version of DataStreamer that can read .txt files is available upon request. Users without access
to Matlab can adapt this version to other programming environments. We can be contacted for
support.

b. Starting the experiment

Once a Stimulus Protocol is created you can use the user interface. Open DataStreamer, change
the Sample Rate and Chunk Size as required, then load the stimulus protocol (i.e. source file),
and wait until the file is fully loaded. This is indicated by the status indicator ‘armed’. Change
the audio gain and the tACS gain factor as desired. In tACS experiments, we recommend to now
connect the participant and enable the external control of voltages from your tCS machine.
DataStreamer will not start until it receives a start trigger. Dependent on the version of the
program it will be sensitive to different trigger types. The USB version of the program waits for a
USB input resembling a keypress of number 5 (one could just press number 5 on the keyboard
to start the program). The LPT version waits for any input from the connected LPT port. Once
the trigger is detected, the indicator ‘trigger’ will light up and the streaming process will be
initiated instantaneously. Ensure that you have downloaded the correct version for the specific
needs of the experiment.

4) Comments on safety and implementation

When a tCS machine is connected ensure that you only allow external control of voltages after
DataStreamer has been newly opened (see NOTE 1 above). For example in a NeuroConn
(Neuroconn, Ilmenau, Germany) device only start the Remote option after the program is
opened. Moreover, disable the Remote option or disconnect participants during breaks and
before turning on or off, or (dis-) connecting the NI DAQ to avoid sending an electric pulse to
the subject.

More generally, we advise that safety checks and voltage measurements should always be
performed before using new lab equipment and experimental setups, to ensure participant
safety. If there are questions, please contact us for support.

The current version of the Data Streamer is created to have two auditory, 1 tACS, and one
digital trigger channel output. However, this can be easily adapted upon request to
accommodate more channels with different features if required.

From channel amplitude to actual tACS intensity

There are a few stages involved in going from the tACS channel amplitude (the numbers in Row
3 of the Stimulus Protocol) to the actually achieved intensity of electrical stimulation. We take
this example of a tACS experiment:
1) Stimulus protocol file. Row 3 contains a sinusoid signal that oscillates between -1 and 1
(any extremer values will be clipped). Note that in actual tACS experiments, one will
usually want to ramp up/down the stimulation intensity at the beginning/end of the
experimental run. Ramping can be implemented in the stimulus protocol by sequential
multiplication of the first and last sections of the sinusoidal signal with a monotonically
increasing/decreasing value between 0 and 1 over samples.
2) Conversion (gain) Factor in DataStreamer user interface. The value of each sample in row
3 is multiplied by the Conversion Factor times 0.5, yielding a specific voltage at the
output of the NI DAQ that depends on the configured output voltage range. E.g., a
Conversion factor set to 0.8 mA/V (Datastreamer GUI) will convert a value of ±1
(Stimulus protocol, row 3) into an output voltage of ±0.4V for an NI DAQ configured to
have a ±1V output range.
3) Transfer gain of the tCS. The tCS machine converts the NI DAQ output voltage into a
current. Note that users should always check with the manufacturer or documentation
of their tCS macines how exactly the device converts input voltage into output current
(transfer gain). In our lab, we use NeuroConn stimulators with a transfer gain of 2 mA/V;
i.e., an input voltage (NI DAQ output voltage) of ±0.4V results in an output current (tACS
intensity) of ±0.8mA.
4) Note that tCS machines may produce a constant current offset irrespective of external
input signals. This should be checked with the manufacturer or documentation of the
used tCS machines, and/or should be measured at the output of the tCS (i.e. with an
amperemeter). Any current offset should be corrected for.

tACS Example calculations:

Goal: administer tACS with 1.6 mA intensity from peak to peak (i.e., -0.8 to +0.8mA).

Stimulus protocol: sinusoid signal in Row 3 (ramped up and down) ranging from -1 to 1.

DataStreamer: Conversion factor set to 0.8mA/V, produces an NI DAQ output voltage


(equivalent to tCS machine input voltage) ranging from -0.4 to +0.4V.
tCS machine (with transfer gain TG): if the TG is 2 mA/V (as in our NeuroConn devices),
output to electrodes (taking into account impedance) leads to an electrical current ranging
from 2 (TG) x -0.4 to 2 x 0.4 mA, i.e., -0.8 mA to +0.8 mA. This constitutes a peak to peak
amplitude of 1.6mA.

5) Contact information

Sanne ten Oever (sanne.tenoever@maastrichtuniversity.nl)


Lars Riecke (l.riecke@maastrichtuniversity.nl)
Department of Cognitive Neuroscience
Faculty of Psychology and Neuroscience
Maastricht University
The Netherlands

You might also like