Acquisition of signals from 2 Emotiv Epoc headsets

Obtaining data from various hardware devices
TPAC
Posts: 12
Joined: Thu Mar 10, 2011 10:30 am

Acquisition of signals from 2 Emotiv Epoc headsets

Post by TPAC »

Hi all,


I'm wondering if it is possible to get the signals from 2 (or more) EMOTIV Epoc headsets in Openvibe. For instance, this would allow to create nice multi-player games based on motor-imagery or any other BCI paradigm...

Emotiv people told me it was definitely possible to connect several headsets on one machine (each headset communicating with itw own dongle plugged in its own USB port).

But I don't know

1) if all my headsets should be "research edition" or higher (they did not answer the question)

2) if it would be possible that all the signals be synchronized

3) how to do this in a dedicated openvibe scenario


Has anyone already tried this kind of development ? Is it even technically possible ?


Thank you for your feedback on this.

Best regards,

TPAC

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by lbonnet »

Hi TPAC !

In my opinion, the solution is to run 2 openvibe Acquisition Servers at the same time, each one connected to a different headset, with a different connection port.
In the openvibe Designer, you add 2 acquisition clients, connected to the 2 different servers (according to the connection ports).
With this solution:
1) if all my headsets should be "research edition" or higher (they did not answer the question)
I guess yes, as each headset would have his own driver instance working. And the driver requires Research Edition.
2) if it would be possible that all the signals be synchronized
When you press "play" in the Designer, the 2 acquisition clients start acquiring data at the same time. Synchronization is straightforward.
If you chose the same block size in the acquisition, and the same sampling frequency (this is not a problem I believe:)), you should be able to connect the two streams in boxes.
3) how to do this in a dedicated openvibe scenario
2 Acquisition clients, connected to two processing pipelines in the same scenario. e.g (acquisition client -> signal display) * 2
Has anyone already tried this kind of development ? Is it even technically possible ?
Technically, it may require some modifications for the Emotiv driver. Currently, the driver just connects to the EmoEngine, and wait for a "user" to register on it.
Then the data collect can start.

I didn't investigate further, but maybe it's a matter of registering another user to the EmoEngine (one for each connected headset).
I don't know if the current implementation will work, and I don't have 2 EPOCs for testing (actually it may work, but I'm not sure). If someone does, please give us your feedback :)

Hope this helps !

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by yrenard »

Dear TPAC and Laurent,

running the two acquisition servers on different computers shoud definitely do the trick !

TPAC, in such situation, you'll have to change the hostname in the Acquisition Client Boxes instead of the ports, so that they point to the right machines.

I hope this helps,
Yann

TPAC
Posts: 12
Joined: Thu Mar 10, 2011 10:30 am

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by TPAC »

Hello Laurent, Yann,

Thank you for your help. I will investigate this and will give you a feedback...

Regards,

TPAC

ozzik
Posts: 1
Joined: Thu Oct 27, 2011 11:35 am

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by ozzik »

Hello TPAC

I was wondering if you (or someone else) had successfully got the pair of EPOC devices to work on a single machine? If so, are there any hidden tricks I should be aware of?

All the best,
Petr

TPAC
Posts: 12
Joined: Thu Mar 10, 2011 10:30 am

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by TPAC »

Hello all,

Sorry for giving my feedback so late.

After my first investigations, it appeared that 2 headsets (Research edition) can be seen by the same machine using the Control Panel and Test Bench softwares from the EMOTIV company. Actually, it is not a big discovery. This is just a confirmation of what they say.

I then tried to connect 2 headsets in openvibe using 2 different acquisition servers with two different port numbers (i.e. 1024 and 1025) as advised in a previous message (see above). Well, the signals coming from both headsets are received, but in a very stranger manner. Actually, I see the same signals in the two windows and a strange effect of the baseline, as if openvibe was switching from one headset to the other. My feeling is that there is a parameter 'missing' in the acquisition server box in order to specify to openvibe to which headset to connect to. For the moment, one can 'only' specify the name of the machine and the number of the port, and I have the impression that the two acquisition servers are listening to the 2 dongles that are paired with the two headsets, which causes the weird behavior I described above (indeed, when I turn off one headset, the signals acquired seem totally ok).

Well I don't know if it is a huge work to add this functionality (I might have a look if someone points me to the right starting direction). I have not yet tested the other solution consisting in acquiring the signals of each headset on a separate machine...

Thank you in advance for your advice or your own feedback if you managed to solve this problem.

TPAC

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by lbonnet »

Hi all,
Sorry for the late reply.

It's been a while since the last time I got my hands in the Emotiv Driver code.
Anyway, my intuition is that the Emotiv SDK allows different connections through different User ID.
The driver creates a user id for the connection, and manipulates a handler then. Every subsequent calls need the User Id.

If 2 instances of the driver are running at the same time, I suppose 2 different IDs are created and managed separately.
From what you are saying , I guess it does not work as I expected...

I don't have 2 Emotiv EPOC to test this setup, but I will (hopefully) receive some new headsets soon. I will be able to test then.

To help better understand the problem, can you provide us the Log file of the acquisition server ?
To do so, go in your configuration file openvibe.conf and modify or add the following tokens :

Code: Select all

Kernel_MainLogLevel = Trace
Kernel_FileLogLevel = Trace
This enables the log level "TRACE", used in the driver to print useful information... including the user ID created.
This slows down a bit the execution.

You will find in the log directory the file acquisition-server.log.

Laurent
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

rino
Posts: 1
Joined: Wed Feb 22, 2012 10:53 am

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by rino »

Hi,

here an Output from the openvibe-acquisition-server.log with two Emotiv dongles/Headset connected.

Bests

Reiner
Attachments
openvibe-acquisition-server.log
(61.92 KiB) Downloaded 725 times

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by lbonnet »

Hi rino,

Thanks for the feedback and log file. It indeed seems like the driver try to connect to both devices at the same time.
I will need some time to check precisely what's going on.

We just received last week our new headsets. I'm on a tight roadmap right now, so I won't be able to test properly.
I'll keep you posted if I find some spare time for that; or if a colleague can handle the job.

If one of you has some C++ knowledge, I remind you you can try to modify the Emotiv Driver by yourself :)
Contributions are always appreciated ;)

PS : Tutorial for driver developer (to understand the driver principles)

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

TPAC
Posts: 12
Joined: Thu Mar 10, 2011 10:30 am

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by TPAC »

Hi all,

Finally, it seems that getting the signals from 2 Emotiv headsets in Openvibe is possible, provided that :

1) you use the Emotiv Research Edition SDK_v1.0.0.5-PREMIUM
2) in ovasCDriverEmotivEPOC.cpp, you search for this line :

if(m_bReadyToCollect)

and you replace it with :

if(m_bReadyToCollect && m_ui32UserID == m_oHeader.getExperimentIdentifier())

After this, you have to recompile.

In your openvibe scenario, you will include two acquisition clients, with different port numbers (e.g. 1024 for the first one and 1025 for the second one).

Then of course, you have to run two acquisition servers. In the Driver properties, set Identifier = 0 in the first acquisition server and set Identifier =1 in the second one. In fact, this number is used to tell each acquisition server to which headset to listen to (I did not try to make something more elegant).

Do not forget to plug the two dongles and to turn on your headsets. Press the play button in the scenario, and you should get the signals...

Just to be precise, I just tested this under Windows 7 32 bits, with openvibe-0.13.1-svn3210-src.

I hope this helps...

TPAC

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by yrenard »

Amazing, thanks for sharing !
Yann

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by lbonnet »

Many thanks TPAC !

I will do a proper configuration box for the headset identifier, to have something a bit cleaner.
You gave me the main idea, it saves me much time !

One more item on the TODO list, I'll try to check it for the next release.

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by lbonnet »

SVN Trunk has been patched, ready for the 0.14.0.

I added a spinbutton widget in the configuration window of the driver.
Enter the User ID you want to use for the acquisition (starting from 0 for the first headset connected).
And don't forget to use different connection ports for the Acquisition Servers :)

I spent some time trying to find a better - automatic - solution but I can't find a proper use of the Emotiv API to know if a connection with a defined user ID is being used or not...

Anyway, thanks for your help TPAC !

Laurent
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

mdv
Posts: 6
Joined: Wed Feb 22, 2012 12:37 pm

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by mdv »

hi TPAC, lbonnet and others,

we tried again to connect 2 EPOCs in openvibe.

we installed the latest release (0.14.2), and when we connect 1 acquisition server (1024, identifier 0), we see nice signals.
when we connect a second acquisition server (1025, identifier 1), the signals get completely messed up (we see flat baseline with spikes) for both 14channel amps ... :(

We really dont know what is going on and are wondering if others tried succesfully to combine multiple EPOCs with this release? or what we could try to discover why we obtain this behaviour?

thanks a lot!
maarten

TPAC
Posts: 12
Joined: Thu Mar 10, 2011 10:30 am

Re: Acquisition of signals from 2 Emotiv Epoc headsets

Post by TPAC »

Hi Maarten,

Do you use the Emotiv Research Edition SDK_v1.0.0.5-PREMIUM ? From my experience, there is no hope with older versions of the SDK...
I also remember that one should plug each headset sequentially : first plug dongle 1, then set headset 1 to ON (check the two green lights on the dongle), then plug dongle 2, and finally set headset 2 to ON.

I hope this will help you.

TPAC

Post Reply