Meet the neural helmet

After meeting the teachers of the group we started using Eugenio’s Emotiv EPOC headset and MindYourOSC software to connect the helmet to Processing.

At the time of writing Emotiv offers two types of helmet the EPOC (which gives you data regarding thoughts, feelings and expressions) and the EEG (which gives you all the EPOC data plus the raw signal sensors).

Eugenio illustrating the Emotive EPOC

I had the opportunity to test the helmet first and I was quite impressed when I first calibrated the device: the software lets you interact with a virtual cube using your brain activity. After a few minutes of training I was able to do a combination of three actions (pushing, pulling and lifting the cube).

First calibration test

As quick test (and to show a little magic to our audience) we came up with a  Processing sketch that lets the user trash pieces of paper with data coming from the sensors.

In our first experiment only one signal from the headset was used: we noticed that muscular movements were the strongest so we used the eyebrow raise value as a main input.

As you can imagine the results were quite entertaining 🙂

Raise eyebrows to change the wind!

The code to retrieve the signal data from MindYourOSC over the OSC protocol, is quite straight-forward:

 

OscP5 oscP5;

void setup() {
size(800, 600, OPENGL);
//start oscP5, listening for incoming messages on port 7400
//make sure this matches the port in Mind Your OSCs
oscP5 = new OscP5(this, 7400);
}
void oscEvent(OscMessage theOscMessage) {
// check if theOscMessage has an address pattern we are looking for
if (theOscMessage.checkAddrPattern("/EXP/EYEBROW") == true) {
// parse theOscMessage and extract the values from the OSC message arguments
wind = theOscMessage.get(0).floatValue();
}
}

 

}

Playing with the neural headset and Processing: Affective Circles

From HYPERRITUAL:

This Processing sketch demonstrates interaction with the Emotiv EPOC‘s Affectiv™ data. The five circles grow or shrink and brighten or dim according to the values (between 0 and 1) of “Engaged/Bored,” “Excitement,” Excitement Long Term,” “Meditation,” and “Frustration.”

 

/**
 * ProcessingEpocOsc1
 * by Joshua Madara, hyperRitual.com
 * demonstrates Processing + Emotiv EPOC via OSC
 * uses EPOC's Cognitiv Left and Right to move a circle
 * left or right
 */
 
import oscP5.*;
import netP5.*;

public float cogLeft = 0;
public float cogRight = 0;
int circleX = 240;

OscP5 oscP5;

void setup() {
  size(480, 360);
  frameRate(30);
  smooth();
  
  //start oscP5, listening for incoming messages on port 7400
  //make sure this matches the port in Mind Your OSCs
  oscP5 = new OscP5(this, 7400);
}

void draw() {
  background(0);
  
  // draw graph ticks
  int i;
  for (i = 1; i <= 11; i++) {
    stroke(map(i, 1, 11, 0, 255));
    float tickX = map(i, 1, 11, 60, 420);
    line(tickX, 250, tickX, 269);
    line(tickX, 310, tickX, 329);
  }
  noStroke();
  
  // draw bar graph
  drawBarGraph(cogLeft, 270);
  drawBarGraph(cogRight, 290);
  
  // determine whether to move circle left or right
  if((cogLeft >= 0.5) && (circleX >= 0)) {
    circleX -= 5;
  } else if ((cogRight >= 0.5) && (circleX <= 480)) {
    circleX += 5;
  }
  
  // draw circle
  fill(color(25, 249, 255));
  ellipse(circleX, 150, 90, 90);
}

void drawBarGraph(float cogVal, int barY) {
  if(cogVal >= 0.5) {
    fill(color(22, 255, 113));
  } else {
    fill(color(255, 0, 0));
  }
  float len = map(cogVal, 0.0, 1.0, 0, 360);
  rect(61, barY, len, 20);
}

void oscEvent(OscMessage theOscMessage) {
  // check if theOscMessage has an address pattern we are looking for
  if(theOscMessage.checkAddrPattern("/COG/LEFT") == true) {
    // parse theOscMessage and extract the values from the OSC message arguments
    cogLeft = theOscMessage.get(0).floatValue();
  } else if (theOscMessage.checkAddrPattern("/COG/RIGHT") == true) {
    cogRight = theOscMessage.get(0).floatValue();
  }
}

HYPERRITUAL (CC BY-NC-SA 3.0)