PsychoPy + Eye Tracker + EEG

484 views
Skip to first unread message

Sabrina Hoppe

unread,
Jan 22, 2016, 3:53:39 AM1/22/16
to psychopy-users
Hi everyone,

I have a running setup with an Eye Tracker (Tobii TX300) and a PsychoPy Presentation. Now, I would like to add an EEG device (TMSi Mobita) to the setup. Could you suggest a way of doing this? As far as I know, the Mobita cannot be directly integrated into PsychoPy, right?
Alternatively, I thought I could use openVibe and use their Python Scripting box to play the PsychoPy presentation. However, the presentation does not run from within openVibe (fails to load wx, which it can find when started oudside of openVibe). I've asked on their forum what the reason could be, but no response so far.
Does anyone here have suggestions either on how to get a PsychoPy Presentation to run within openVibe, or how to integrate Mobita into my setup?

Thanks in advance :)
Brina

Jonathan Peirce

unread,
Jan 22, 2016, 6:27:35 AM1/22/16
to psychop...@googlegroups.com
I think it would be easier to use PsychoPy and send signals to your EEG device than trying to present your experiment through openVibe. Most EEG systems can receive trigger signals on a parallel port or something similar and these are relatively easy to set up. You just need to find out what signals your EEG device expects to receive.

Jon
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/73499568-9aba-4740-8dbc-93dd2a2456a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Jonathan Peirce
University of Nottingham

http://www.peirce.org.uk


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

Brina

unread,
Jan 22, 2016, 7:44:35 AM1/22/16
to psychopy-users
Thanks, Jon! Sadly we don't have a trigger cable at the lab and would therefore prefer a software solution over buying and setting up new hardware. So in case someone has further software suggestions, please let me know. Otherwise I might come back with hardware issues in the next weeks ;-)
Sabrina

Jonathan Peirce

unread,
Jan 22, 2016, 7:46:20 AM1/22/16
to psychop...@googlegroups.com
There must be something that connects the computer to the EEG system. What is that?

For more options, visit https://groups.google.com/d/optout.

Brina

unread,
Jan 22, 2016, 7:55:18 AM1/22/16
to psychopy-users
an adhoc WiFi network

Michael MacAskill

unread,
Jan 24, 2016, 4:00:57 PM1/24/16
to <psychopy-users@googlegroups.com>
Hi Brina,

As Jon suggests, there will be a communication protocol that your EEG expects (it just uses network signals rather than voltage pulses over a cable). To that extent, there is no real difference between a "hardware" and "software" solution. From the stimulus computer end, regardless of the hardware (parallel port or wifi), you have to implement the software required to communicate over it.

(1) Minor point: Having said that, you will probably get more reliable timing if it is possible to have both the PsychoPy computer and the EEG connected to a local network using ethernet cables rather than wifi (i.e. they don't need to be physically connected to each other, just each connected to a local network).

(2) Check in the EEG manual for what the communication protocol is. Ideally this would be UDP messaging but might be TCP messaging. Either can be implemented in Python (and hence PsychoPy), but UDP messages are much simpler to use.

We can't give further advice without seeing what the communication protocol is for your particular EEG system.

Regards,

Michael
--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND

Senior Research Fellow, michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072
University of Otago, Christchurch http://www.nzbri.org/macaskill

Brina

unread,
Jan 25, 2016, 2:01:58 PM1/25/16
to psychopy-users
Hi Micheal,

thanks for the detailed answer, I appreciate it!


As Jon suggests, there will be a communication protocol that your EEG expects (it just uses network signals rather than voltage pulses over a cable). To that extent, there is no real difference between a "hardware" and "software" solution. From the stimulus computer end, regardless of the hardware (parallel port or wifi), you have to implement the software required to communicate over it.

(1) Minor point: Having said that, you will probably get more reliable timing if it is possible to have both the PsychoPy computer and the EEG connected to a local network using ethernet cables rather than wifi (i.e. they don't need to be physically connected to each other, just each connected to a local network).

The Mobita does not have any free port while the head cap is connected, so no Ethernet cable or any other physical connection is possible.
 

(2) Check in the EEG manual for what the communication protocol is. Ideally this would be UDP messaging but might be TCP messaging. Either can be implemented in Python (and hence PsychoPy), but UDP messages are much simpler to use.

According to the manual, the protocol TCP/IP. I'm not sure how relevant this is, but these further specifications are given: It's WLAN IEE 702.11b/g, 9dBm (8mW) radiated power and a WEP encryption.
 
I do have a computer science background but no experience in TCP, networking or driver coding. What would you recommend as a first step? I really  don't know where to start here...

Thanks,
Sabrina

Michael MacAskill

unread,
Jan 25, 2016, 3:35:37 PM1/25/16
to psychop...@googlegroups.com

> On 26/01/2016, at 08:01, Brina <sah...@gmail.com> wrote:
>
> I do have a computer science background but no experience in TCP, networking or driver coding. What would you recommend as a first step? I really don't know where to start here…

Hi Sabrina,

Great, so it sounds like you'll be well-placed to deal with this. There are lots of on-line resources for implementing TCP communications in Python.

> According to the manual, the protocol TCP/IP. I'm not sure how relevant this is, but these further specifications are given: It's WLAN IEE 702.11b/g, 9dBm (8mW) radiated power and a WEP encryption.

These technical specs won't be too relevant: its just a (poorly secured) wireless network like any other, but used to connect two specific machines rather than provide a connection to the internet. I'm not sure which direction this ad hoc network will go: it sounds like the EEG hosts the network (i.e. you join it from your computer like you would any other wireless network), but it is possible that it expects to join one broadcast by your computer (the manual should specify that). If your computer has to host the network itself, just google for instructions on how to set one up on your particular operating system.

The communication technology is TCP/IP. At this stage, this still doesn't tell us how to meaningfully communicate. The analogy is that we now know that the means of communication with a particular person should be by e-mail rather than Twitter, but we don't know the e-mail address of the receiver or what language she speaks.

The first step is to find out the IP address of the EEG system on the ad hoc network. There will also be a particular port number that the EEG will be listening on. The analogy here is that the IP address is like the street address of an apartment building, but to ensure a letter goes to the right person, we also need to know the apartment number.

With that information, communicating in python is actually pretty simple. Here is some example code adapted from <https://wiki.python.org/moin/TcpCommunication>:


import socket # a standard python module that allows TCP & UDP communication

IP_number = '127.0.0.1' # this example value is your computer's home address, which can be used
# for testing purposes. You will need to replace this with the actual EEG IP address.

port_number = 5005 # your EEG manual should specify what port it is listening on
buffer_size = 1024 # for simple protocols, sometimes you might want to make it shorter than this default
message = "Hello, World!" # sadly, your EEG won't understand this

# set up the communication socket with who-knows-what default technical characteristics:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# point the socket to the actual destination (the EEG in your case):
s.connect((IP_number, port_number))

# and send a message. The content of this, only the manual can tell you:
s.send(message)

# the EEG might send data back in response (probably not so important for you):
data = s.recv(buffer_size)

# shut the connection down when done:
s.close()

So the code to set up and use the communication link isn't very daunting.

But the key thing we don't yet know is what the actual communication protocol is. By 'protocol', here I mean the message format and sequence expected by your particular EEG, rather than the technology used to send it. Hopefully the manual should gives those details, but I would expect that there will be specific strings of characters that represent trigger/event markers and perhaps commands to start & stop recording etc. That really will be specific to your brand and model of system and so unless someone here is familiar with that particular EEG, you'll need to dig it out of the manual or speak to the manufacturer's technical support team.

Hope that helps?

Mike

Brina

unread,
Jan 25, 2016, 6:21:07 PM1/25/16
to psychopy-users
Ok, thanks a lot! I'll look into this, ask the manufacturer for more details (the manual does not go give any further details) and let you know at some point how far I got ;-)
Sabrina
Reply all
Reply to author
Forward
0 new messages