Sending triggers via parallel port to eego software

Hi There,

Before making any further suggestions - is there a readon your team are using PsychoPy2 rather than updating to a newer version? There are lots of nice improvements in more recent releases!

Thanks!
Becca

Hi Becca, thanks for your reply.

There’s no good reason we’re using PsychoPy2, and I’m currently in the process of trying to get this updated. Annoyingly some of my attempts to fix this issue are a bit hamstrung by my limited access to the admin rights on the PC we’re using, but I’m hoping this issue will be resolved in the next few days.

I’m mainly wondering if before I am able to change other drivers/settings on the PC I don’t have access to just yet, if there’s something I need to change either with the code or the builder component I’ve outlined in my original post

Thanks again

Hi there - two thoughts:

  1. I’m not quite sure if this also applies to your setup, but as per this advice, you should beware of USB-parallel-port connections. Am I correct that, based on your explanation, your stimulus computer is outputting via parallel port into the eego EEG software, which has USB input? If so, then @habboud’s warning in that post about timing precision may apply.
  2. If the EEG system is never seeing a value, are you sure that any of the if statements ever evaluate to true? Is images definitely the variable name that holds the image string? Just something to check.

@jtseng The eego does accept TTL input. Due to its small size, a small connector is used. ANT Neuro makes a cable that converts from a commonly used DB25 connector to their small connector.

I don’t know if the eego accepts USB input.

i’ll be going back into the lab tomorrow so will try some of these suggestions then, thanks for your help.

if there’s no obvious issue anyone can see with what i’ve posted then perhaps it is just a question of tweaking things here and there until it works! i’ll update this post with any news of success/failure!

Hi @Ral,

Apologies for the questions, but can I just clarify the following so I can help as best I can:

  1. You say you have tried these solutions separately and together. When you try the version with the code component, are you firstly removing the parallel port component from your routine?
  2. For the Builder only version of your issue (with the PP component only and no code component), how long is each trial? Also how does the trial come to an end - is it automatic or controlled by the participant?
  3. For the version with the code component only, what is the actual image component in your trials routine called? Is this also called images in the same way as the column header in your conditions file?

Thanks!

Kim

1 Like

hi @Kimberley_Dundas !

To answer your questions:

1 & 2 - I’ve tried running this with only the code component, without a PP component, and I’ve also tried this the other way round, so only the PP component and no code.

2 - The trial lasts indefinitely until the participant presses a button. I’ve also tried the trials with a timed structure, for instance the participant has 5 seconds to press a response.

3 - I’d need to double check this tomorrow morning when I’m back in the lab but I’m quite sure I made sure the image component was named either “images” or “image” and tried using both of these in my code, mainly because I wasn’t sure which of these the code was searching for and wanted to check this.

I hope this helps in the meantime but I can confirm my answer to question 3 tomorrow.

Thanks for your help it’s much appreciated!

Great, thanks!

With the Builder-only version, can you try:

  1. Making sure that the image component is right at the top of your component list in your trials routine (to do this just right click on the image component name and select ‘move to top’).

  2. Reducing the duration of the PP component firstly to something like 0.2s to see if this sends a trigger. I’m wondering whether the trial could end before the 5s trigger duration is over, which may have weird effects as the value will never reset to 0. If this sends a trigger we can set it to end when the participant makes their response, but for now let’s just see if that’s the problem.

  3. I know you mentioned that ePrime picks up the triggers using this PP address but I just want to double check the issue isn’t to do with the address, as you mentioned a USB connection. Just try the above 2 suggestions with the port address you’re using already, and then again with each of the USB options that I believe were still in the Port address drop down in PsychoPy2 (they should be ‘LabJack U3’ and ‘USB2TTL8’). Just to be certain that this isn’t the issue before we try other things.

Thanks again!

Hi Kim

Thanks for your reply.

I’ve now tried each of these ideas and still don’t see the triggers in the eego software. I re-ran an experiment on e-Prime just to double check it works there and the triggers appeared.

For point 3, I didn’t have the second address you mentioned but the LabJack U3 address returned the error: “No module named u3”.

I tried compiling the experiment to script to see if the port component was acting as I would expect and from what I can tell it seems to be referencing the column in my conditions file (shown in my first post) correctly, however nothing seems to be happening?

    # *port* updates
    if t >= 0 and port.status == NOT_STARTED:
        # keep track of start time/frame for later
        port.tStart = t
        port.frameNStart = frameN  # exact frame index
        port.status = STARTED
        win.callOnFlip(port.setData, int(conditionStart))
    frameRemains = 0 + 0.2- win.monitorFramePeriod * 0.75  # most of one frame period left
    if port.status == STARTED and t >= frameRemains:
        port.status = STOPPED
        win.callOnFlip(port.setData, int(0))

Thanks again for your help

Thanks for trying those out @Ral,

I have two more things for you to try, as I can’t see a problem with your set up from what you’ve kindly provided here. But the first one will involve you downloading and installing a .dll file on the machine running PsychoPy, so you will need access to the admin rights on that machine.

  1. Download and install the InpOutx64.dll file from here. You need to use the “Binaries only - x86 & x64 DLLs and libs” option under the Download Links subheading.

You then need to put the InpOutx64.dll in the same folder as your PsychoPy experiment file. Then restart PsychoPy and try running your experiment again. You can get a more detailed explanation on this post.

  1. Step 1 might solve your problem, but if not (or in the meantime whilst you wait for admin rights) then we need to find out more about the parallel port. To do this, there is a demo in the Coder view which will help. I know this demo exists in PsychoPy3, so I’m hoping it also exists in PsychoPy2! To run the demo, open Coder view > demos > hardware > parallelPortOutput.py. If you run this and there’s an error, please paste that error here.

I hope this makes sense, do let me know if anything needs clarifying!

Kim

hi @Kimberley_Dundas

I’ve now got back into the lab and tried both suggestions you made. I tried running the demo for the parallel port both before and after updating the driver from 32 to 64bit and both times got this error message:

Welcome to PsychoPy2!
v1.85.2
()
Problem compiling: [Errno 13] Permission denied: ‘C:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\hardware\parallelPortOutput.pyc’

Running: C:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\hardware\parallelPortOutput.py

1.6276 WARNING psychopy.parallel has been imported but no parallel port driver found. Install either inpout32 or dlportio
1.6276 WARNING Could not initiate port: global name ‘ParallelPort’ is not defined
1.6278 WARNING Monitor specification not found. Creating a temporary one…
2.5454 WARNING Couldn’t measure a consistent frame rate.

  • Is your graphics card set to sync to vertical blank?
  • Are you running other processes on your computer?

Traceback (most recent call last):
File “C:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\hardware\parallelPortOutput.py”, line 32, in
parallel.setData(0) # sets all pins low
File “C:\Program Files\PsychoPy2\lib\site-packages\psychopy\parallel_init_.py”, line 165, in setData
raise RuntimeError(‘Port address must be set using setPortAddress’)
RuntimeError: Port address must be set using setPortAddress

The first real line of the error message seems to suggest to me PsychoPy doesn’t even have access to the demos for the parallel port? In which case perhaps admin rights is the real crux of the issue here? But perhaps you can advise on this.

Many thanks again

Thanks so much @Ral. I have more steps, we will get this sorted!

  1. Apologies for the repetition but is the inpout32/inpout64 file in the same folder as your experiment (rather than in the same folder as PychoPy itself)? There is certainly an issue with PsychoPy’s access to the driver, potentially because it’s located in the Program Files which are likely to be protected by admin rights, rather than in your user space. Can you put both drivers (32 and 64) in the same folder as your experiment file just to be on the safe side? Then try your experiment again, not the demo. If it works now, great, if not move onto the next step.

  2. It looks as though, because the demos are only currently located in Program Files, PsychoPy can’t access those, you are totally right. In Builder view, if you click on the Demos tab there, do you see an option to ‘Unpack demos’? If you do, select that and choose/create a folder that is in your own user space. Then try running the demo again, and any error message (or any message at all) please again paste here.

Thanks so much!

Kim

Hi @Kimberley_Dundas

Yes, both the 32 and 64 file are in the same folder as my experiment. I had an earlier issue before all this where the parallel port input wasn’t working at all (throwing up some kind of error message) but I solved this by installing the 32bit .dll file and having this in my experiment folder too. The issue now seems to be that even though it can ‘see’ the parallel port, it’s not able to see any data sent from it? I’m not very experienced in this side of things though so is a bit of a guess.

I’ve tried unpacking the demos in builder view, but didn’t have the option of the parallel port demo via hardware, these were the only visible options:

Many thanks

Thanks again so much for trying out these steps. So, I’m asking this as someone else as just had this exact issue and this is how we solved it! Can you please make sure that:

  1. You have the driver files in your experiment folder exactly as this person does, so the 3 inpout files that you can see here. Note that the .dll and . lib files are x64 and the .h file is the 32 (screen shot from this post):


2. Go to Device Manager > Ports > Find your parallel port from the drop down > Right-click Properties > Resources tab. Can you please send a screen shot of what you find here?

Thank you so much for your patience with this.

Thanks again,

Kim

Hi @Kimberley_Dundas

Apologies for the late reply, I’ve only just managed to get back in the lab.

I’ve double checked the layout of the experiment folder. There doesn’t seem to be any issues, however when trying to use the inpout64.dll file the experiment just won’t run. It seems I have to have the 32bit version installed instead and it works fine?

I’ve been to the resources for the pport in device manager too, and here’s what I find:

Many thanks for your continued help on this!

Ah, apologies. I assumed you wouldn’t be able to install the 32 bit .dll without admin rights (as I believe the installer requests admin permission), but if that’s installed and working then good. The thing that’s odd is that your error message from before still points to an issue with the driver.

Thanks for checking the ports. The address is certainly correct which again leaves only the driver. To be doubly certain about this, could you just send a screenshot of the contents of your experiment folder? If all is well here I can talk to other members of the team to shed some light on the issue. However, I really would recommend upgrading to PsychoPy 3 if you’re able to as there are lots of improvements and bug fixes in newer versions.

Thanks for your patience,

Kim

Hi Kim

Strangely installing the 32bit .dll is one of the few things the PC will allow me to do with my current level of permissions.

Here’s the contents of my experiment folder:

If this can’t be solved through any tweaks within the folder or PsychoPy itself, and if everything appears to be working I might just have to chalk this up to a permissions issue I think? If so I’ll have to think of ways to circumvent this issue altogether but at this point this is probably more achievable!

Thanks again for your help

This is going to sound ridiculous, but as a last ditch attempt can you please try:

  1. Renaming the inpout32.dll file so that it’s all lower case (as I’ve written it here)
  2. Finding the inpout32.lib file from the extracted folder and also placing it in this folder.

In the meantime I’ll ask the rest of the team to check there’s nothing obvious I’m missing!

Thanks,

Kim

Hi @Kimberley_Dundas

Unfortunately neither of those ideas worked either! I’m beginning to think this setup is just completely hamstrung by admin permissions so unless your colleagues have any ideas as to things I might have missed I might have to put this to rest as I’m sure many of the useful suggestions you’ve provided would have worked on any other setup!

Many thanks

Hi @Ral,

I think you’re right, I’ve ran this past my colleagues and there’s nothing obviously wrong from everything you’ve kindly sent.

So, at this point what I would usually do is send over a demo experiment for you to test out/ask you to send your experiment over so I can test it but this won’t work due to the version of PsychoPy that you’re running. So, if you can (and it will likely help generally anyway), I would strongly recommend that you seek admin permission and install the latest version of PsychoPy from here.

If you find that you solve the issue do keep the thread updated as it would be great to help others who might face the same issue!

Thanks,

Kim