Research Use of Emotiv EPOC

P300 and Emotiv EPOC: Does Emotiv EPOC capture real EEG?

Posted on October 7, 2011 by Hiran Ekanayake (Originally on December 25, 2010)

For my earlier article titled “P300 and Emotiv EPOC: Does Emotiv EPOC capture real EEG?” I received an enormous response from various interested parties. Since I’m continuously using the Emotiv EPOC for my research work with good confidence, I thought of extending the discussion about the good side of it with some convincing results. About two years ago, when I first encounted Emotiv, I discussed about it with some neuroscientists. However, they were very reluctant to believe that such a device can capture real EEG, and they tended to disregard it merely considering it as a toy. However, about two years later, now, I can see a lot of research papers appears in the web that have used the Emotiv EPOC. As a researcher, a person should look into things critically, but with an open mindset. Therefore, I hope this small article will help for some of you to rethink about the Emotiv and its capabilities.

Some Details About Emotiv EPOC

Table 1 Specification of the Emotiv EPOC

Figure 1 Scalp locations covered by Emotiv EPOC

A Brief Introduction to P300, and How it is Obtained?

The P300 (or P3) is one of the components in an ERP waveform (Figure 2). It is a positive deflection in voltage (2-5µV) with a latency of about 300-600ms from the stimulus onset. It is typically measured by placing electrodes covering the regions Fz, Cz and Pz (Figure 3). Since, the strength of an ERP signal is very low it is usually hidden within noise and not visible in a typical EEG signal. Therefore, to see the actual ERP waveform we have to average segments of single-trial ERP (called epochs) which comes by repeating the experiment for several times (trials). Before averaging, it would be necessary to bandpass filter the original EEG signals (typically the pass band within 1-20Hz) and remove artifacts resulting from various sources, such as eye movements. The whole process can be done using the EEGLAB toolbox.
The most popular experiment for obtaining P300 is called the P300-speller (Figure 4), which is a 6x6 matrix of alphanumeric characters where one of its rows or columns gets flashed at a time, randomly, resulting a sequence of flashes (also called the odd-ball paradigm). During each such sequence, the subject focuses on one of the characters in the matrix and whenever the subject sees a flash occurs in the cell that contains the character, the subject has to advance his/her count of flashes (just a mental activity, not to shout). OpenViBE is an open source tool for setting up P300 experiments and for designing various other neurofeedback applications. After the experiment, the averaged EEG epoch signals (meant for each EEG channel) for targets (flashes of focused cells) are compared against averaged EEG epoch signals for non-targets (flashes of non-focused cells). What we would expect is that signals for targets should have ERP characteristics while non-target signals should end up with random noise. However, random artifacts within EEG and latencies of events could significantly distort the resulting ERP waveforms.

Figure 2 ERP waveform and its components (note the direction of positive signal downwards; obtained from Wikipedia)

Figure 3 The 64-channel electrode montage and the channel sets (obtained from Krusienski et al., 2008)

Figure 4 P300 Speller Visualization component in OpenViBE

A Brief Description About the Experiment

All the experiments conducted here are single subject experiments unless specifically stated. For the P300 visual stimulus, I have employed OpenViBE version 0.11.0 and the experiment design is shown in Figure 5. Both flash duration and non-flash duration have been set to 125 milliseconds. The Run Command boxes are linked to a console program which sends makers on experiment start, target stimulus and non-target stimulus to the EEG recording application over UDP. I have not employed TestBench, because it can receive markers only through the serial port and could result longer latencies when loop back solution is used. On the other hand, although OpenViBE can be configured to record EEG as well, I refrained from that option as well because it did not promise me a reliable data recording (higher system load for OpenViBE). I have collected data using two Emotiv EPOC headsets, one of which is a bit older one. Other than for P300 visual stimulus, I have conducted an auditory stimulus test, in which a beeper emits a beep sound for every 5 seconds (non-random duration) and subject was sitting in less than 1 meter to the recording computer with opened eyes. Recorded EEG data has been filtered for a pass band of 1-20 Hz and eye movement artifacts and other strange artifacts have been manually removed. Almost all data processing has been performed using MATLAB and EEGLAB toolbox.

Figure 5 OpenViBE design for the P300 experiment

Results and Discussion

Results of the P300 visual stimulus test are depicted below:

Targets (330 events)
Non-targets (1658 events)

Figure 6 ERP waveforms of all channels for target stimulus

Figure 7 Waveforms of all channels for non-target events

Figure 8 ERP waveforms of each channel for target stimulus

Figure 9 Waveforms of each channel for non-target events

Figure 10 ERP waveforms of O1 for each trial for target stimulus

Figure 11 Waveforms of O1 for each trial for non-target events

Figure 12 Comparion of ERP waveforms of O1 for target (in blue) and non-target (in red) stimulus

Figure 13 Comparion of ERP waveforms of F4 for target (in blue) and non-target (in red) stimulus

Figure 6 depicts a promising appearance of ERP waveforms in each EEG channel and it is visible that something has happened about 305 milliseconds after the stimulus. The waveform for non-target stimulus in Figure 7 does not show such a tendency. When the powers of the signals (values in y-axis) are compared, waveforms for non-target events (Figure 7) have lower power than for target events. From Figure 8, it is visible that channels 7 and 8 (O1 and O2 scalp positions, respectively) have the highest amplitude ERP waveforms. Therefore, Figure 10 has been obtained to see how it looks like in each single-trial, which seems to be somewhat linear. Figures 12 and 13 again compares ERP waveforms for target and non-target events at both O1 and F4 scalp locations to clearly differentiate the resulting waveforms.

Figures 14 and 15 shows the results obtained using the second Emotiv EPOC headset:

Figure 14 ERP waveforms of all channels for target stimulus (headset 2)

Figure 15 Comparion of ERP waveforms of O1 for target (in red) and non-target (in blue) stimulus (headset 2)

Figures 14 and 15 again present promising appearance of ERP waveforms. However, now the highest peak has been occurred about 266 after the stimulus, which is lower than the value obtained for the first Emotiv EPOC headset. This could be due to several reasons: communication latencies between different programs during the two occasions, subject’s mental condition has been changed, two headsets are different in some ways, etc. On the other hand, the highest peak point may be N2 rather than P3. Further, repeating of this P300 experiment has resulted me different peak points for each Emotiv EPOC headset, but centralized around 300 milliseconds. Therefore, it is not reasonable to believe that P300 response occurs exactly 300 milliseconds after the stimulus. However, hopefully Emotiv EPOC can capture that response, which I consider as the good side of the Emotiv EPOC.

Figures 16 and 17 shows ERP behavior for auditory stimulus:

Figure 16 ERP waveforms of all channels for auditory stimulus

Figure 17 ERP waveforms of F3 for each trial for auditory stimulus

From Figures 16 and 17, it is apparent that the brain functions differently for auditory stimulus. However, the time for perception seems to be somewhat closer to that resulted in visual stimulus.

Repeating the Experiment

There were several requests asking about how to setup the software framework to replicate this experiment. Therefore, I thought describing it here. Please feel free to contact me if the steps are unclear or need more details.

  • Download and install OpenViBE from http://openvibe.inria.fr/ (my version 0.11.0 Aug.2011)
  • Download http://neurofeedback.visaduma.info/P300New.zip and unpack the files
    Open the file p300speller2.xml (file is in P300New) using the OpenViBE menu
  • Double click on the box with the label “Target Letter Generation” and setup the path for the Lua Script to p300-speller-target.lua (file is in P300New)
  • Download and install the com0com null modem emulator from http://sourceforge.net/projects/com0com/
  • Read the instructions and create a COM port pair in com0com, e.g. COM1-COM2
  • Modify the windows environment variables’ path variable by including the folder where the PortWrite.exe can be found (file is in P300New)
  • In the TestBench select one of the ports in the created pair, e.g. COM1 (follow Marker > Configure Serial Port)Open the command prompt and type “PortWrite COM2 2”. If you are successful in setting up the path variable and COM port pair, you will see that TestBench receives the marker value 2
  • Restart the OpenViBE and run the model p300speller2.xml (to run use the start button in the OpenViBE designer; Also you will need to click on the window with the title “keyboard stimulator” and press on the 'a' key on the keyboard). Now if you can see flashing rows and columns in the OpenViBE visualization window as well as markers in the TestBench, your first task is complete. Note that marker value 3 indicates the start of the experiment, value 1s when targets are displayed and 2s when non-targets are displayed.
    Note: I assumed that you have Emotiv EPOC research edition in which the TestBench software is included.

Analyzing the EEG data using MATLAB (my version 7.6.0 R2008a) and EEGLAB (my version 10.2.3.4b):

  • If you use TestBench to record EEG your recorded file will be in EDF format. To convert it into CSV format use the EDF to CSV converter tool in TestBench
  • Now, you need to extract the relevant fields from the CSV file in MATLAB, i.e. 14 EEG positions and markers. To do that you have to import the CSV file data to MATLAB and remove the column numbers other than column numbers 3:16 and 36.
  • Import the data file in EEGLAB (File > Import data > From ASCII/float file or Matlab array) by specifying the sample rate as 128. Note: EEGLAB can be downloaded from http://sccn.ucsd.edu/eeglab/
  • In EEGLAB, prepare the data as follows: specify the event channel as channel 15 (File > Import event info > From data channel); channel location file as emotive.ced (Edit > Channel locations – Read locations & autodetect; file is in P300New); high pass filter at 1 Hz (Tools > Filter the data > Basic FIR filter – Lower edge); and low pass filter at 20 Hz (Higher edge).
  • Note: You can use the following MATLAB script to import data to MATLAB as well as for importing and preparing data in EEGLAB described above:
    % import data from testbench csv file
    tbdata = importdata('filename.csv');
    eegdata = tbdata.data;

    % remove unwanted fields
    eegdata(:,17:35) = [];
    eegdata(:,1:2) = [];
    eegdata = eegdata';

    % Prepare data in EEGLAB
    eeglab
    EEG = pop_importdata('data',eegdata,'srate',128); % import data from MATLAB array
    EEG = pop_chanevent(EEG, 15,'edge','leading','edgelen',0); % event channel
    EEG = pop_chanedit(EEG, 'load',{'emotiv.ced' 'filetype' 'autodetect'}); % channel locations
    EEG = pop_eegfilt(EEG, 1, 0, [], [0]); % highpass filtering at 1Hz
    EEG = pop_eegfilt(EEG, 0, 20, [], [0]); % low pass filtering at 20Hz
    eeglab redraw

  • Now do the necessary artifact removals using the tools available in EEGLAB.
  • Next, extract target and non-target epochs (Tools > Extract epochs)
  • Finally, required ERP plots can be obtained using the options available under the Plot menu.

Bibliography (some more to come)

  • Krusienski, D.J., Sellers, E.W., McFarland, D.J., Vaughan, T.M., Wolpaw, J.R. (2008). Toward enhanced P300 speller performance. Journal of Neuroscience Methods,167:15-21.
  • L.A. Farwell and E. Donchin, "Talking off the top of your head: toward a mental prosthesis utilizing event-related brain potentials," Electroenceph. Clin. Neurophy., vol. 70, pp. 510-523, 1988.
  • A. T. Campbell et al., “NeuroPhone: Brain-Mobile Phone Interface Using a Wireless EEG Headset,” Proc. 2nd ACM SIGCOMM Wksp. Networking, Sys., and Apps. on Mobile Handhelds, New Delhi, India, Aug. 30, 2010.

End note:

Those who would like to read about my original document titled “P300 and Emotiv EPOC: Does Emotiv EPOC capture real EEG?” can access the document by clicking here.

I am doing these things for my own satisfaction in addition to formal research work. More formal discussions about my research work and publications can be accessed by clicking here.

I would appreciate if you can leave a comment at my blog place or send me feedback to my email address.


Last updated: 08-10-2012 — Hiran Ekanayake