P300 Experiment

P300 signals are brain signals that occur in response to a visual stimulus. They tend to occur approximately 300 ms after the stimulus appears.

Here, we show you how to use Mentalab Explore and an oddball experiment to elicit P300 signals. The code is open-source and available here. You can run it as is or use it to build your own P300 based applications.

In this experiment, the oddball experiment has two visual stimuli: a blue rectangle and a red oval. The red oval is the so-called "oddball". The participant must press `space` whenever the red stimulus appears.

P300 visual stimuli
A blue rectangle is the standard stimulus. The red oval is the "oddball". When presented with the oddball, participants must press space.



  1. Install explorepy. Choose Option 2 (Python) if you are installing explorepy on a Windows system.
  2. Download the explorepy code directly from GitHub. To do this, click on the green Code button, and “Download ZIP”. Remember where you extract the files, you will need this location later.
  3. Activate your Anaconda virtual environment: conda activate myenv
  4. Install the required packages: pip install scikit-learn matplotlib psychopy mne
  5. In the Conda terminal, navigate to the p300_demo folder in the examples directory of explorepy.


  1. Setup the cap and electrodes. Place EEG electrodes in the desired locations (e.g. Cz, Pz, CP1, CP2, P3, P4, Oz, etc.) and the ground electrode on mastoid (or any other location far enough from other electrodes).

P300 Experiment

  1. Turn on the device, ensure it is advertising, and then run the following command in your terminal (replace #### with your device ID, e.g. Explore_1438):

    python experiment.py -n Explore_#### -f rec_file_name

    The experiment has 10 blocks and there are 5 trials in each block (50 trials in total). You can change this in the experiment.py script. Just look out variables: n_blocks and n_trials_per_block variables.

    The experiment produces three csv files in the working directory; one for ExG data, one for motion data, and one for markers.


  1. To analyse the recorded data and generate plots, run the command in your terminal:

    python analysis_csv.py -f rec_file_name

    This analysis will generate P300 waveform plots that look similar to those shown below.

P300 wave forms
Waveforms produced from the P300 oddball experiment using the Mentalab Explore device and explorepy.

For more information or support, do not hesitate to get in contact at: support@mentalab.com

Copyright © 2024 Mentalab