Using E-Prime and Emotiv TestBench to send markers via serial (COM) port

For an experiment we are doing, we are using a single computer to run an E-Prime script and record EEG data using Emotiv's EPOC headset and its native software, TestBench. Here's a walkthrough on how to set up E-Prime, TestBench and a virtual COM port in order to send triggers from E-Prime to TestBench.

Things you'll need:

I recommend setting up and also opening programs in the following order. The object is to sync E-Prime and TestBench via virtural COM port.

Setting up and using VSPE

Open VSPE and the first thing you want to do is go to Emulation > Stop
You could also press the giant stop button on the interface.

vspe01

Your initial VSPE screen should look like this after you've pressed "stop"

Now, Device > Create...
You could also press the red asterisk button next to the "Stop" button.
For device type, select "Connector," then press "Next"
Choose your virtual serial port.
NOTE: Don't choose a serial port that's actually being used!
I recommend going with COM10, just to be safe.
Then, click "Finish"

vspe02

This is what your screen should look like after you've set up your virtual COM port.

Now, simply press the "Play" button. You could also do the same thing by going to Emulation > Start. Assuming there isn't any other problems (selecting a used COM port, driver issues, etc.) your COM port should have a status that says "Ready" and a message that says "Initialization... OK"

vspe03

This is what it looks like when everything is good to go. If the bottom status message is red and says "Initialization... FAILED" or something like that, something is wrong.

 

I am absolutely no help in terms of troubleshooting. I will defer to Eterlogic for any problems you may encounter. You really shouldn't encounter any. Your #1 error (at least, my #1 error) may stem from using the wrong version. There is a 32-bit and a 64-bit version. Using the wrong version will mess you up and your virtual COM ports will fail to initialize.

You can also save your set up so you never have to go through this process again. I recommend starting the program, pressing stop, then loading your saved VSPE set and pressing start before loading anything else.

Test Bench

First, if you're just testing to see if this works, you don't need your dongle or headset. Just the program. I will be working without the program on this walkthrough.

Go to Marker > Configure Serial Port
In this window, drop down and select the virtual serial port you created (in this case, COM10)
I keep everything else default. So just hit OK.

testbench01

 

At this point, your TestBench is set up. To make sure you're able to receive markers, test by sending a manual marker trigger by going to Marker > Send Manually.
For Name, input anything. I'll use "test". Value will default to "1".

testbench02

 

When you hit "Send" a message in the Event Log in the main TestBench window should appear.

testbench03

 

You will see a marker sent there when your E-Prime file sends a marker.

At this point, you are done with TestBench. Don't close it, just move it off to the side or minimize it.

Setting up E-Prime

This is a modified version of Xu Cui's post using serial port triggers in conjunction with a NIRS instrument, Hitachi ETG-4000. The same steps work with Emotiv TestBench! Yay!

Open E-Prime and go to Edit > Experiment > Devices
Now press "Add..." at the bottom. Click "Serial".
Now select the serial device and press "Edit..." at the bottom. You could also double-click on the device.
Change the COM Port to your virtual COM port (in this case COM10). Press OK.
In the Properties: Experiment Object Properties window, press "Apply" then "OK".

eprime01

 

I'm not exactly sure if TestBench can accept alphanumeric marker values, but I do know they accept numeric marker values. Modified slightly from Xu Cui's post, we will use this following script:
Serial.WriteString "1" ' for marker 1
Copy and paste that into an InLine script in E-Prime

eprime02

 

You can change the number to any two digit number you want (I never tried three digit markers, so I'm not sure if that works).

At this point, you can insert this InLine script or similar scripts before the onset of any stimuli and a marker will be sent to TestBench. I've set up a very simple experiment and it worked fine!

testbench04

 Notes on markers

Emotiv accepts single digit markers from E-Prime.
The numeric marker triggers 0 - 9 sent from E-Prime are registered as marker values 49 - 57 in Emotiv.
The alpha marker triggers A - Z (note the capital letters) are registered as marker values 65 - 91
The alpha marker triggers a - z are registered as marker values 97 -  123
Other symbols (e.g. !@#$%^&*()-=_+[]\;',./<>?:"{}|~`) can also be used as markers.

Using a multi-digit marking system sends two triggers at the same time. For instance, the trigger marker "10" would register two markers, "50" then "49". This is because 1 = 50 and 0 = 49.

There are essentially ~100 markers to use, using single digits. You shouldn't run out of markers. If you do, you are a very eccentric marker person.

 

Hopefully this helps! Good luck!

 

4 thoughts on “Using E-Prime and Emotiv TestBench to send markers via serial (COM) port”

  1. andrewgadie says:

    Hey. Great post. Trying to get this to work now actually, struggling to get EPrime to open the serial port. I wonder if you have any advice, or maybe you could send me the simple EPrime script you made (incase I made any glaring errors with my own).

    Thanks!

  2. Nick Wan says:

    I don't have a script on hand, but the two places you'll have an error will either be in the devices tab in experiment or in an inline script somewhere. If you post your error, I could probably be of a little more assistance.

  3. Aviation says:

    Do you use any code to time sync the experimental and the EMOTIV data acquisition computers? When I have used python and the EGI NetStation system we use script to ensure synchronization of computer clocks. What have you used for the E-Prime-EMOTIV systems.

    On another note, I find about 100 ms delay in the N1 for auditory tones using the wireless EMOTIV system. Anyone else found the same thing? The N1 shows up between 200 and 250 ms post-stimulus.

  4. Nick Wan says:

    I never used a sync for this equipment, but our EEG data acquisition and our E-Prime time sync has generally been accurate from initial testing of the hardware and software. In comparison with our SynAmps, the data aren't markedly different (aside from the difference in sampling rate).

    Can't speak to the N1 delays -- our P3 experiment has the oddball peak at 300ms, as expected.

Leave a Reply