Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

StimTracker Duo and Parallel Port Triggers

I used the instruction for parallel port (EEG triggers) and after installing the parallel_port_trigger plug in and downloading the DLPortIO driver I plugged new_parallel_port_trigger_init to the beginning of my experiment and new_parallel_port_trigger_send to the beginning of the practice_sequence which is where the stimuli first gets presented and ideally where I'd like the triggers to be recorded. I have tried to set it on dummy mode with the port address set to the default 0x378, but when I ran the experiment with the fNIRS connected I got the error message:


exception type: AttributeError

exception message: pptrigger not found
time: Fri Jun 08 13:52:17 2018

This computer does not allow me to directly plug in the DisplayPort Cable directly from the Parallel Port Output. This being the case; I have a CEDRUS StimTracker Duo connected to the computer via USB. This being the case, I fear the StimTracker might be complicating the process, but have not seen this type of issue addressed before.
The StimTracker support makes it clear that a USB driver is necessary and I have already gone ahead and installed that as well.

I have also tested the StimTracker on E-Prime using sample code and it successfully sent the event triggers.
Following a similar set up I tried changing port address to 0x3E8 which is COM3 where the USB Serial Port that the StimTracker is using. Then I also changed the bits per second to 115200. I tried emailing CEDRUS for help but they told me that they did not have any information that is specific to the OpenSesame software because they have no in-house experience with it.

However their website had some sample Python code on GitHub so I downloaded the zip file and placed it into the OpenSesame folder. I then tried to run the following script in the debug window:

import pyxid

# get a list of all attached XID devices
devices = pyxid.get_xid_devices()

dev = devices[0] # get the first device to use
if dev.is_response_device():

    while True:
        if dev.response_queue_size() > 0:
            response = dev.get_next_response()
            # do something with the response

I'll then get an indentation error, so once I try and fix it to the best of my ability I get an error code:

ImportErrorTraceback (most recent call last)
in ()
----> 1 import pyxid
3 # get a list of all attached XID devices
4 devices = pyxid.get_xid_devices()

ImportError: No module named pyxid

I would really like to run this experiment on OpenSesame so if anyone has any suggestions as to how I can get the software to recognize the StimTracker please let me know.


  • After switching from dummy mode to verbose I have had success running the experiment all the way through, albeit limited as sometimes it'll tell me Python crashed.

    Now the problem seems to be about actually getting the [Markers] to show up on the receiving computer. The events are still coming up empty. I feel there is still something I'm missing, perhaps telling OpenSesame the exact moment I want the events recorded? I have no clue how to do this but will include the latest results from running the experiment below:

    Parallel Port Trigger plug-in has been initialized!
    Starting experiment as ExperimentProcess-10
    Expyriment 0.9.1b2-11-gc100ee8 (Python 2.7.13)
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024 experiment started at Tue Jun 12 15:57:18 2018 disabling garbage collection
    Resetting the parallel port on address: 0x3E8
    Sending value 10 to the parallel port on address: 0x3E8
    Waiting 100 ms to reset
    Resetting the parallel port to zero
    Sending value 10 to the parallel port on address: 0x3E8
    Waiting 100 ms to reset
    Resetting the parallel port to zero
    Sending value 10 to the parallel port on address: 0x3E8
    Waiting 100 ms to reset
    Resetting the parallel port to zero
    Sending value 10 to the parallel port on address: 0x3E8
    Waiting 100 ms to reset
    Resetting the parallel port to zero experiment finished at Tue Jun 12 15:58:36 2018
    failed to close Parallel port
    experiment.end(): enabling garbage collection

  • Hi FlintMarco,

    As far as I understand from your story, the Stimtracker Duo is reachable through a virtual serial port (connect by USB) and not the parallel port. The parallel port trigger plugin only works with parallel ports.

    Thanks for the bug report, the error in dummy mode is fixed in 1.0.4.

  • Hi _Bob,

    Thank you for pointing me in the right direction. After looking through a few older posts about the use of serial ports I implemented inline scripts that should have been able to send the triggers. The experiment runs without any problems. However, the triggers are still not being registered or sent. In order to test if it was working correctly I tried putting the following into the debug window:

    print 'I just sent trigger 1! (or did I ... ?)'

    The result I got was NameError: name 'exp' is not defined.

    To give you an example of my inline script. the serial_setup inline script is plugged in right at the start of the experiment:

    we will need to import the 'serial' module,

    which allows us to send and receive

    information via the serial port

    import serial

    next, we will need to start a connection to

    the serial port

    exp.trigger = serial.Serial('COM3', baudrate=115200, bytesize=serial.EIGHTBITS)

    finally, we want to make sure that the

    connection to the serial port will be stopped

    when the experiment is aborted or finished


    The second inline script is plugged into the practice_sequence after the reset_feedback:

    this sends a trigger with value 1

    if you require a different value, please

    use a number between 0 and 255


    This is my setup for the time being as I just want to get OpenSesame to send a trigger before I begin to specify the amount and specific time to send. If you have any suggestions as to where I'm going wrong please let me know. I appreciate your help.

  • edited June 2018

    The variable exp does not exist and I would also split it up in a 'init' script (beginning of the experiment) and a 'send trigger' script which you can put in a sequence in a loop. When you want to use a variable through the entire experiment, you can put 'var.' before the variable name Something like this:

    'init' script:

    import serial
    var.experiment.serial_port = serial.Serial('COM3', baudrate=115200, bytesize=serial.EIGHTBITS)

    'send trigger' script:


Sign In or Register to comment.