Hello everyone,
I trust this message finds you all in good health. I’m reaching out as I’ve encountered a challenge while attempting to connect my experiment to the EGI station for EEG-fMRI with ERP configuration.
Following the instructions provided in the EGI NetStation manual (Page 55: https://www.egi.com/images/stories/manuals/GES_400/core/GES_400MR_uman_8100401-55_20150722_hires.pdf), I designed a simple experiment in PsychoPy-2023.2.3 (Sending triggers via EGI NetStation — PsychoPy v2023.2.3).
However, upon attempting to establish the connection as per the guidelines, I encountered an error, details of which are provided in the uploaded images.
If anyone has encountered a similar issue or has insights into its resolution, I would greatly appreciate your assistance and guidance.
Thank you in advance for your help.
Best regards,
Mohammadreza
Hello,
I can help you debug a bit. Just to verify:
- You’re using the most recent version of PsychoPy for Windows
- Have updated the egi-pynetstation package via the plugin manager
- You have a 400-series amplifier
- The IP of the windows computer is on same network as the amplifier (can be reached by web browser 10.10.10.51)
- EGI Net Station is open, connected to the amplifier, and ECI is enabled (right pane towards bottom) with the port specified in your PsychoPy code block
-Peter
Hello Peter,
Thank you for your message, and I apologize for the delay in responding.
I’ve connected the device to my computer and have gathered all the information you requested:
- You’re using the most recent version of PsychoPy for Windows: Yes, I’m currently using PsychoPy 2023.2.3 for Windows.
- Have updated the egi-pynetstation package via the plugin manager: Actually, no, I haven’t updated the egi-pynetstation package. I assumed that since I’m using the latest version, there wouldn’t be a need. Is my understanding correct?
- You have a 400-series amplifier: Yes, I’m using the Net Amp 400a.
- The IP of the windows computer is on same network as the amplifier (can be reached by web browser 10.10.10.51): Unfortunately, despite attempting to connect today, I couldn’t establish a connection. The IP address of the Windows computer doesn’t seem to be reachable via the web browser at 10.10.10.51.
- EGI Net Station is open, connected to the amplifier, and ECI is enabled (right pane towards bottom) with the port specified in your PsychoPy code block: I’m not entirely confident about this, but I believe I have configured it correctly. I’ve attached Figure 1 for your reference.
Additionally, I have some updates that might be relevant. I’ve connected my laptop to the EGI system as shown in Figure 2. The blue arrow indicates the db9 to USB converter, and the red arrow denotes the clock synchronization line, which is connected to the amplifier. I’m confident that the db9 connector is plugged into the net station (Figure 3: net station before connection db9, Figure 4: net station after connecting, and Figure 5: device manager of laptop). I don’t completely understand why the EGI library cannot send triggers to the net station despite their apparent connection.
Furthermore, I attempted to send a stimulus using the serial port following the instructions at Sending triggers via a Serial Port — PsychoPy v2023.2.3. When I don’t specify a condition as the start time (define zero instead), a db9 trigger is displayed in Net station. However, when I include a condition (such as “stimulus”), they are unable to detect the “stimulus”. I’m unsure about what should replace the “stimulus” in this case.
I apologize for the long explanation. Please let me know if you require any further clarification or information.
Figure 1:
Figure 2:
Figure 3:
Figure 4:
Figure 5:
Thank you for the added information!
The egi-pynetstation package is meant to send events via the ethernet connection. So while you can send events using PsychoPy’s default serial connection over the db9, you won’t be able to take advantage of using event codes other than simply DIN (pin) numbers.
To try and further troubleshoot the network connection:
- Is your PC desktop connected by ethernet to the network hub that also connects to the EGI amplifier?
- Can you post a picture of the network settings on your windows PC?
- I updated the egi-pynetstation package after the last release of PsychoPy so I think you’ll still need to do that update plugin.
- This is good information (previously 5 with screenshot) although I’m not sure why it says “Status Off”. Does it still say “Off” when you turn on Net Station (upper left corner)?
Peter
Dear Peter,
Thank you for your prompt response. I apologize for the delay in my communication; unfortunately, I have not had access to the device in recent days.
I am pleased to inform you that I have successfully connected the device to the EGI system using an Ethernet cable through the network hub, following your instructions. As a result, I am now able to receive responses using Psychopy and the EGI package.
I have a quick question, if you don’t mind. We also need to connect an MRI-compatible camera to the presentation PC, and I wish to have all the equipment synchronized and working simultaneously. While I know how to start and synchronize the camera using MATLAB (using TCP/IP protocol), I am curious if there is a way to achieve this in Psychopy. I have come across information suggesting that it is possible to use the socket library in Python for this purpose (code is attached). Do you have any insights or suggestions on how I can achieve this?
I have attached an example code from my MATLAB and Python work for your reference.
Thank you once again for your guidance.
Mohammadreza
Matlab Code:
address = “169.233.33.33”;
port = 5555;
client = tcpclient(address,port);
%Getting the version string
command = “version”;
write(client, command, “string”);
% while(client.NumBytesAvailable <= 0)
% end
answer_length = client.NumBytesAvailable;
response = read(client, answer_length, “string”);
Python:
import socket
Server address and port
address = “169.233.33.33”
port = 5555
Create a TCP/IP socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Connect to the server
client_socket.connect((address, port))
Send the command
command = “version”
client_socket.sendall(command.encode())
Receive the response
response = client_socket.recv(1024).decode()
Print the response
print(response)
Close the connection
client_socket.close()
Glad the EGI module is working for you!
If you can connect to the camera with TCP/IP then you should be able to do so with Python. I would suggest opening another topic for this and see if others chime in.
Who makes the camera? They might already have python code available to connect to.
If the camera itself can register the TR, then you’d have everything synchronized by just starting the camera recording at the first TR with the MRI and stopping it at the end of the experiment.
Dear Peter,
I want to extend my gratitude for your message.
I am thrilled to share that I have managed to successfully connect the camera to the setting, and am now able to read data from it using Python over TCP/IP.
Once again, thank you for your invaluable assistance in resolving this issue. Wishing you all the best.
1 Like