SSVEP-Based BCI

Forum for discussion on different user applications
Post Reply
Zahra
Posts: 6
Joined: 17 Apr 2015, 03:20

SSVEP-Based BCI

Post by Zahra » 17 Apr 2015, 03:29

Hi all,

I am working on a BCI system in which the user navigates in a virtual world using four commands with four specific frequencies to evoke the SSVEP. I'm recording the EEG using Emotiv EPOC and my virtual world is built in the VrealmBuilder and I have to do the signal processing in MATLAB.

I need to know how to connect the virtual world to the BCI2000.

Thanks a lot.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: SSVEP-Based BCI

Post by boulay » 17 Apr 2015, 11:22

I've never used VRealmBuilder before but it seems to be Matlab-based?

If you're doing the signal processing and the application in Matlab, having you considered doing the signal acquisition from the EPOC in Matlab too? I've never done this and I can't help you with it but it seems more straightforward than including BCI2000.

Using BCI2000 has some advantages in that the Emotiv EPOC module is well-tested and the data format is rich, and has some tools already available for analysis. These are actually pretty big advantages.

You will have to use the Emotiv.exe, MatlabSignalProcessing.exe, and StimulusPresentation.exe

Please read their respective Wiki pages on how to use each.

You will have to configure BCI2000 to use AppConnector. See here: http://www.bci2000.org/wiki/index.php/T ... _Connector

And you will have to configure your VR application to read states and control signals from the specified UDP port. I've done this with an Unreal Engine application but I've never used VRealmBuilder.

Zahra
Posts: 6
Joined: 17 Apr 2015, 03:20

Re: SSVEP-Based BCI

Post by Zahra » 18 Apr 2015, 12:51

Hi Boulay,

Thanks for the response.

Yes, VRealmBuilder is MATLAB-based.

Can you explain what you mean by doing the signal acquisition from the EPOC in MATLAB?

I can read the data recorded by Emotiv which is connected to BCI2000, in MATLAB, by converting .dat files to .mat

You mean there's no nead for BCI2000 and I can do this by Emotiv and Vrealmbuilder and MATLAB only?

Thank you.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: SSVEP-Based BCI

Post by boulay » 18 Apr 2015, 14:59

Well I've never used it, but I'm confident there's a Matlab-based Emotiv library that will allow you to get the data in real-time through Matlab alone.

A very simple implementation will have a loop and in each iteration of the loop you will get a block of data from the device, do the signal processing, then update the VR environment. Doing this synchronously in this manner is probably not great; you'll have to take many samples on each iteration to make sure the device doesn't overflow while you are doing the signal processing and display update. To make this less choppy in the VR environment, you should use the control signal to update an animation target rather than update a pose.

Doing the acquisition, processing, and display update asynchronously would be better (i.e., each has its own thread). This is considerably harder to do in Matlab.

Zahra
Posts: 6
Joined: 17 Apr 2015, 03:20

Re: SSVEP-Based BCI

Post by Zahra » 20 Apr 2015, 02:44

My preferance is to do all this asynchronously, so it's going to b harder..

How can I find that MATLAB-based Emotiv library?

And also, I need to give the user a feedback, right? Is it better to be just a sound or I need to do something visually too?

Thanks a lot.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: SSVEP-Based BCI

Post by boulay » 20 Apr 2015, 10:39

I don't have an Emotiv device nor its SDK, but you might find some information at link below [1].

By "feedback" I meant the navigation you described. I don't know if you were planning on providing continuous control or one navigation command per trial (e.g., movement on a grid). If you are doing continuous control then I suggest having the character/camera moving at a constant velocity and then the control signal changes the yaw.

[1] https://emotiv.com/forum/forum15/topic2051/messages/

Zahra
Posts: 6
Joined: 17 Apr 2015, 03:20

Re: SSVEP-Based BCI

Post by Zahra » 26 Apr 2015, 02:08

I tried to find a way not to use BCI2000 and just use Emotiv and MATLAB,
but it seems to be harder than using BCI2000

Do you know anyone who has worked on this?
I mean connecting Emotiv directly to MATLAB.

Thank you.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: SSVEP-Based BCI

Post by boulay » 26 Apr 2015, 13:14

No I haven't used it and I don't know anything about it other than what I've said.

OK then continue with BCI2000.
Use the Emotiv source module, the MatlabSignalProcessing module, and for the application module you will likely use DummyApplication or StimulusPresentation, and you will use the built-in AppConnector features.

In VRealmBuilder you'll need to read from the UDP port that AppConnector is writing to.

You may also have to create a new state (or several states) that VRealBuilder will set.

By the way, how do you plan to drive the flashing? Are you using LEDs? Or are you relying on flashing in the VR world?

Zahra
Posts: 6
Joined: 17 Apr 2015, 03:20

Re: SSVEP-Based BCI

Post by Zahra » 26 Apr 2015, 14:42

That's one of my big concerns,
I want to have some lamps to flash in the VR world, I don't have time to use LEDs and I'm not professional in programming them.

I need to either :

. Put four flashing lamps around the virtual world page which have the camera's coordinates and move with it while navigating,

or

. Put flashing lamps near each destination or some how make the objects of the destination flash.


Either way, I need to know how to generate this stimulus in the VRealmBuilder.

Maybe it's possible to have a regular lamp in the VR and control the frequency it's flashing with, in MATLAB?


Do you have any suggestions on that?

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: SSVEP-Based BCI

Post by boulay » 28 Apr 2015, 10:07

I don't know much about SSVEPs but there are many papers about it that should give you the information you need to determine the range of frequencies that can be used to entrain the EEG and the separation between frequencies. You will also want to make your scene fast enough that the VR engine renders it faster than the screen's refresh rate, and use VSYNC to tie it to the screen's refresh rate. Then, knowing your screen's refresh rate, you will have to figure out what frequencies you can use. A screen with a refresh rate of 60 Hz will have a maximum flashing rate of 30 Hz, with some other possible frequencies being 20, 15, 12, 10, 8.5714, 7.5, 6.667, 6, 5.4545.

Code: Select all

rr = 60;
flash_rates = 1./(2/rr:1/rr:1);
I think this doesn't give you enough options in the "good" SSVEP range, which is why many SSVEP researchers uses LEDs.

Virtual reality HMDs are expected to operate at faster refresh rates than 60 Hz. The Oculus Rift DK2 uses 75 Hz, and it is expected their consumer device will use 90 Hz.

Zahra
Posts: 6
Joined: 17 Apr 2015, 03:20

Re: SSVEP-Based BCI

Post by Zahra » 28 Apr 2015, 12:14

Thanks Boulay,

yeah I have read a lot about the frequencies I can make within the range that my monitor's refresh rate allows me.

Now my only problem is how to generate these frequencies.

My virtual world is in VRealbuilder and I have to generate the stimulus in it, since I can't have another program running while the subject has to look at the VR page. So the only choise is to do it in Vrealmbuilder or by MATLAB.

Do you know any ways I can have a light flash with a frequency in MATLAB?
or to control a light which is in a .wrl file (VRealmBuilder file) with MATLAB?

Thanks a lot for all the time you put in answering my questions.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: SSVEP-Based BCI

Post by boulay » 28 Apr 2015, 12:33

I'm sorry I've never used VRealmBuilder and have no idea how it works.

I use Unreal Engine 4, and I have been able to send it commands with BCI2000 using a UDPNetworking class I found online [1]. If I were to use UE4 for SSVEP, then I would make the objects know how to blink on their own (i.e., each object would be told its frequency, then on every tick it would count an internal number of 'off' frames and on some ticks, when the count_off reached a value, it would turn on for one frame and reset the count_off). I would have BCI2000 transmit which frequency was selected (i.e., from 0-3) and then the game would select the onscreen object that was flashing at that frequency. In a HMD with low persistence it might be necessary for "on" to be more than one frame.

One thing that is missing from this setup is for the game to tell BCI2000 about the game state, so future offline analyses of the data could reconstruct the game state pretty easily with only the BCI2000 .dat file. In fact, this is missing from my current setup. What I do is write the game state information to a log file and I also write BCI2000 commands that come in through UDP to the same log file; this allows me to synchronize the recorded data and the log file later. It's hardly ideal and has issues with latency and jitter.

[1] https://forums.unrealengine.com/showthr ... UDP-Server

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests