Howdy, Stranger!

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

Supported by

EEG triggers using parallel_port_trigger plug-in

OpenSesame version

4.1.9

Operating system

Windows 10

Backend

PsychoPy

Expected behavior

I am using the parallel_port_trigger plug-in for an EEG experiment. I inserted the plug-in before the relevant stimulus, which is presented on a sketchpad item. To test the precision of the appearance of the trigger, I also added a small black rectangle at the bottom of the screen and attached a photo diode to the screen. Ideally, the rising of the photo diode signal would begin with the trigger.

Actual behavior (what goes wrong)

There is a delay between the rising of the photo diode signal and the trigger. Specifically, the trigger appears 80-90 ms prior to the rising of the photo diode.

Error messages (if any)

None.

What did you try already?

Nothing much, since I don't know if this is the standard with EEG experiments on OpenSesame and whether there is anything to be done in this case or whether the only solution is adjustment of trigger timing during data preprocessing.

Experiment file (optional)

Comments

  • Hi @elinora18

    I have copied and pasted @SigmundAI's recommendations on this matter below. I hope it helps!

    ---

    This is expected given the current item order: the parallel_port_trigger item runs before the sketchpad, so the trigger is not locked to the actual screen refresh on which the stimulus appears. The next sketchpad still has to be shown on a vertical refresh, and the monitor itself may add scan-out / pixel-response latency.

    I added a recommended setup to the workspace.

    So: I would not treat this as an unavoidable OpenSesame problem. First change the order so the trigger comes immediately after a 0-ms sketchpad, then remeasure with the photodiode. If there is still a stable offset, that offset is likely due to the display hardware and can be corrected during EEG preprocessing.

    ## Recommended OpenSesame sequence for EEG trigger + visual stimulus

    Instead of:

    1. `parallel_port_trigger`

    2. `target_sketchpad`

    use:

    1. `target_sketchpad`  

      - Duration: `0 ms`

      - Contains the stimulus and the photodiode rectangle

    2. `parallel_port_trigger`

      - Use a short pulse, e.g. `5–10 ms`

    3. `keyboard_response` / other response item  

      - The stimulus remains visible until another visual item replaces it.

    ## Why this helps

    A `sketchpad` with duration `0` is shown and then OpenSesame immediately continues to the next item. Because the screen content remains visible, the trigger item that follows is sent immediately after the display flip, which is usually much closer to actual stimulus onset than sending the trigger before the sketchpad.

    ## Additional notes

    - An 80–90 ms trigger-before-photodiode delay is too large to be just one missed refresh. It may include:

     - the trigger pulse duration;

     - waiting for the next monitor refresh;

     - monitor input lag / pixel response time;

     - scan-out delay, especially if the photodiode rectangle is at the bottom of the screen.

    - If the photodiode patch is at the bottom of the display, it will naturally rise later than something near the top because monitors refresh line-by-line.

    - Put the photodiode patch at the same vertical position as the critical stimulus if you want to measure the timing of that stimulus specifically.

    - Use a short trigger pulse unless your EEG system requires a longer one.

    - After changing the sequence, test again with the photodiode. If a constant residual delay remains, correct for it during preprocessing.

  • edited 2:34PM

    Thanks so much for the helpful info!

    Just to make sure I understood correctly, so here the suggestion is that the duration of the stimulus (and rectangle for the diode) is defined NOT in the sketchpad (which is 0 duration) but rather in the keyboard response? If so, then another problem would be that the keyboard response ends if participants press the keyboard before the intended duration ends. So if I want the stimulus to appear for 1,000 with the following sequence:

    • Sketchpad with stimulus - 0 ms
    • Trigger - 5-10 ms
    • Keyboard response - 1,000 ms

    And participant presses the keyboard before the 1,000 ms, then it is not what I want, because I want a fixed duration of the stimulus for 1,000 ms. Or did I miss anything?

    Note: The photo diode is at the bottom of the screen, but I guess that doesn't fully explains that whole delay of 80-90 ms.

Sign In or Register to comment.