Contributions:CereStim

Versioning
Author
Alexander Belsten (belsten@neurotechcenter.org)
William Engelhardt (engelhardt@neurotechcenter.org)
Version History
- 2021/07/21 - R6337 - Initial private release for internal testing.
- 2022/01/29 - R6515 - Implementation of stimulation train.
- 2022/05/25 - R6763 - New acquisition mode to measure impedance of electrodes.
Source Code Revisions
- Initial development: 6337
- Known to compile under: 6763
- Broken since: --
Functional Description
This output extension integrates the Blackrock CereStim 96 intracranial stimulator with BCI2000. This integration enables automated stimulation of up to 96 electrodes with 15 different stimulation waveforms.
Integration into BCI2000
To enable the use of the CereStim with BCI2000, first enable the extension in your CMake configuration in the Extensions folder of the CMake GUI (enable EXTENSIONS_CERESTIM=On). Then generate the BCI2000 Visual Studio solution in CMake (More details about this can be found on the Configuring BCI2000 for Compilation page). Next, open the solution with Visual Studio and rebuild the BCI2000FrameworkAppModule. Then rebuild any user application module with which you want to use the extension. Once the extension is built into the user application, you can enable it by appending --EnableCereStim=1 to the user application module start executable command in your batch file.
Parameters
The CereStim is configured in the "CereStim" tab.
-
Figure 1: CereStim parameters, as described below.
The configurable parameters are:
ImpedanceMeasurement
Enable to measure the impedance of the used electrodes in StimulationTriggers parameter. It starts measuring when you press "Set Config" in a separate window.
DynamicConfiguration
Enable to dynamically load stimulation configurations during the experiment. This allows you to have more than 15 configurations. This makes the Expression in StimulationTriggers parameter upload the desired configuration, and then StartExpression trigger the uploaded configuration. If there is no expression in StartExpression, the stimulation will start immediately after being uploaded.
-
Flowchart which shows the stimulation behavior under the specified modes
AppliedVoltage
The CereStim drives current, so the applied voltage fluctuates according to the impedance between the current source (electrode) and drain. This dropdown parameter sets the maximum applied voltage. Note that there will be no notification that this maximum has been met.
AppliedCurrent
This parameter sets the maximum applied current in microamps. Unlike the maximum applied voltage, which fluctuates and therefore may or may not hit the maximum, maximum applied current parameter serves as a safety check for your uploaded stimulation configurations. Setting this parameter to a desired maximum applied current ensures that no stimulation above this current will be applied. If set to auto, the default will be the maximum current at which the CereStim can stimulate.
AppliedPhaseCharge
This parameter sets the maximum applied phase charge, where charge=amplitude*width. Amplitude is the current amplitude in microamps, and width is phase duration in microseconds. If set to auto, this parameter will default to the maximum value.
AppliedFrequency
This parameter sets the maximum frequency that stimulation pulses can have in Hz. If set to auto, this value defaults to the maximum.
StimulationConfigurations
-
Figure 2: Stimulation pulse shape definition in BCI2000.
-
Figure 3: Stimulation pulse shape and train shape definition. The stimulation pulses on the left would take place during the "Stimulation duration" phase on the right.
This parameter is where stimulation pulses are defined. You can define up to 15 different stimulation pulses. The pulse shapes are defined according to Fig. 2.
Additional Notes:
- For each configuration, if the Cathode first row is
1, then the negative magnitude pulse precedes the positive pulse. If this row is0, then the positive pulse precedes the negative pulse. The current sink for each pulse is the patient ground, which is the green safety connector on the back of the CereStim. However, suppose you wish to provide bipolar stimulation between two different electrodes within the brain. In that case, you can make two configurations that have the same pulse shape parameters but have reversed Cathode first parameters. These stimulation configurations can be triggered at the same time to approximate a bipolar stimulation pattern. Current can still potentially flow to the patient ground, but if the impedance between the two electrodes is significantly less than the impedance between the electrodes and patient ground, the majority of the current will flow between the two electrodes. Information on how to define these two electrodes can be found in the StimulationTriggers parameter. Note that valid frequencies depend on the phase and interphase duration of the pulse. - If a train still has more time in its desired duration, new expressions won't be triggered. This is a software constraint and can be changed with future implementation.
- If only one pulse is desired, Train Duration and Train Frequency don't have to be specified, or they can be set to 0.
- Hardware limitations:
- Maximum number of configurations: 15 (can be bypassed by using DynamicConfiguration mode)
- Number of pulses: 1-255
- Amplitude: 1-215 uA (Micro), 100 uA-10 mA (Macro)
- Width: 1 - 65,535 us
- Frequency: 4 - 5000 Hz
- Interphase duration: 53 - 65,535 us
- Balanced Phase: Phase 1 * Width 1 must equal Phase 2 * Width 2
- Train Repetitions: 0 - 65,535 OR infinite (by setting Train Duration to 0 with a Train Frequency)
StimulationTriggers
-
Figure 5: Stimulation triggers have an expression, a configuration ID, and list of electrodes.
This parameter defines when electrodes are stimulated, with what configuration they are stimulated with, and what electrodes are stimulated.
- Expression: The Expression row is where a BCI2000 expression should be defined. If not in DynamicConfiguration mode, when this expression is true, the associated configuration in the Configuration ID row will be delivered. Note that two columns can have the same Expression, which allows for concurrent stimulation between different electrode locations. If we are in DynamicConfiguration mode, then the expression uploads the associated configuration to the CereStim. If StartExpression is not defined, then stimulation will start immediately after.
- Configuration ID: The Configuration ID row defines the applied pulse shape and corresponds to the column number in the StimulationConfiguration parameter. When multiple IDs are specified, they will occur in sequential order, with the subsequent stimulation configuration starting right when the previous one ends. However, using multiple IDs has not been tested thoroughly, and is not recommended.
- Electrode(s): Lastly, the Electrode(s) row specifies which electrodes will be stimulated. Elements in this row can be single values that specify a single electrode, or an embedded list in which you can specify multiple electrodes (from 1-96).
Additional Notes:
- You can only stimulate up to 15 electrodes concurrently.
- Concurrent stimulation groups, as defined by their equivalent Expression expression, must have non-overlapping electrode lists and matching train frequency and train duration.
StartExpression
Only for use in DynamicConfiguration mode. Expression to start stimulation using the uploaded configurations. Can be left empty to start stimulation immediately after uploading.
DeviceInfo
This parameter is auto-populated with information about the hardware and firmware versions of the CereStim stimulator that is connected. This information will be viewable during offline analysis by opening the resulting .dat file.
States
CereStimStimulation
This binary state is equal to 1 when stimulation is being applied. This is set by the CereStim hardware, and might not be accurate for quick stimulation pulses.
CereStimStimulationSoftware
Equal to 1 when stimulation is being applied, from BCI2000's point of view. This can better capture quick stimulation pulses.
CereStimUploadStatus
The configuration number that is currently uploaded, e.g., 1 is the first column in the StimulationConfigurations table. If multiple configurations are uploaded, the two ids are added together.
SCIT
To help out with creating the BCI2000 parameters, a GUI has been made which should make it easy to translate your stimulation specifications into BCI2000 parameter files. The GUI also visualizes the stimulation from three different perspectives, making it easy to tell if your parameters are really what you want. There is a Stimmulation Configuration tool user reference which will further tell you how to use this tool.
-
Figure 6: The CereStim GUI which creates BCI2000 parameters from stimulation specifications.
Compliance Voltage
The CereStim drives current, however it can only do so across a certain voltage difference. The maximum specified voltage for the CereStim is 9.5 V. Below shows a test conducted, where the delivered voltage was measured for known impedances. The first figure plots the measured current on one axis, contrasted with the specified current on the other axis over varying resistances. This can be helpful for determining if your desired current will be fully delivered. However, these are just examples, as the real constraint is the voltage. The next graph shows the desired voltages (which can be calculated from your specified current and the measured impedance), and the difference from what is actually delivered.
-
Figure 7. Measured vs specified currents for example impedances. Where the line flat-lines is where the compliance voltage is met.
-
Figure 8. The difference in measured and desired voltage. It can be seen that the measured voltage starts dropping off around 6 V. The compliance voltage is officially listed at 9.5 V, however based on this testing, you are not getting 100% of the current at voltages after 6 V.
The purpose of these graphs is to show you to be aware of the voltage you are producing with your desired current and impedance. If it is close to the compliance voltage, then the full current won't be delivered. For example, if you were stimulating at 3 mA with an impedance of 2.8 kΩ, this would be a desired voltage of 8.4 V (Ohm's Law). According to our tests, the measured voltage is 7 V, which is a difference of 1.4 V. When converting this back to current, this is a difference of 0.5 mA (17% difference). Depending on the experiment, this could be a difference that needs to be noted.
Monopolar, True Bipolar, Pseudo Bipolar
The CereStim sends current out to the specified electrode, then the current is returned to the grounding electrode. Because of this, both software and hardware changes are needed to specify which type of stimulation: monopolar, true bipolar or pseudo bipolar. For each stimulation type, there is an example stimulation configuration, hardware configuration, and explanation of the setup below.
Monopolar
Monopolar stimulation is when current goes from one contact to the ground. In this example, when StimulusCode is 1502, both Channels 1 and 2 will have monopolar stimulation.
-
Channels 1 and 2 are connected to the desired brain regions, and the ground is connected to a grounding pad on the patient.
-
Example Stimulation Configuration
-
Both channels are using the same stimulation configuration.
Pseudo Bipolar
Pseudo bipolar has the same hardware configuration as monopolar stimulation. The difference is when both are triggered, one has a positive voltage first while the other has a negative, thereby inducing bipolar stimulation.
-
Same setup as monopolar stimulation.
-
The only difference between the two configurations is the first column: "Cathode first". Having zero as a value makes the anode as first.
-
The two channels are triggered at the same time, yet use separate configurations.
True Bipolar
True bipolar requires a hardware change. The return contact must be connected to the ground, which makes the current return through the specified contact. If different return channels are desired, it must be physically changed every time.
-
Channels 1 and 2 are connected to desired brain regions, current is returned through the Channel 2 contact.
-
Example Stimulation Configuration
-
Only Electrode 1 is being stimulated, because current is returning through the contact that Channel 2 used to be connected to.
Latency

Figure 6 shows the latency of stimulation over 220 trials. Stimulation pulses were acquired using a gUSBamp at 38.4kHz and a block size of 50ms.








