12/14/2009

PComp Final – OpenEEG BCI

For my final Physical Computing project I am currently constructing an EEG machine based on the design of the OpenEEG project at sourceforge. The idea is to use signals that are known to cause predictable spikes to trigger some action, what exactly that is still needs to be determined.

For a general overview of EEGs consider the Wikipedia entries, they give a (rather enthusiastic) overview of the device.

1. EEG – Overview

So far I've ordered the openEEG boards from Olimex and made active electrodes. However, it seems as if one channel (2 electrodes) isn't working properly, which may due to the whole soldering and desoldering they went through. A great guide on how to build your own active electrodes can be found here:http://www.dcc.uchile.cl/~peortega/ae/



Here is a flic of the whole project at work, so far


In the long run, I think I would like to go for something ambitious. Next semester I will be taking Learning bit by bit and will hopefully learn about writing classification algorithms (regressive ones in particular because they facilitate one-dimensional classification) using varies EEG potentials (slow sensory motor cortex activity, P300 response, N400 & P600 respectively).
However, more work is still to come and to be done.

11/12/2009

#_9 Kitchengame




Kitchengame was a game that started from the idea to have people interact with live music. MinWoo had outlined a project earlier that aimed at visualizing live music in public spaces via user (audience) interaction (his blog for more info).
As we were figuring out how we would imagine the audience to interact directly with a musical performance, we thought of laser-tripwires that would could capture the crowd dynamic in a visual way. After we went through some scenarios, we changed our initial plan and started to think of a game scenario we could use this basic principal for. So, our idea was to use photocells (photo resistors) and lasers to trigger sound instead of visuals. Also, instead of passively registering the audience's interaction we used laserpens as "guns" that would have to be shot at the photocells, thereby enabling direct interaction with the interface.

The basic game setup so far: a one way interaction with two teams trying to shoot photocells with laserpointers and thereby triggerin sounds. We still wanted to include some real world musical element so we decided to add another player to each team that would have to play some instrument, which would 'activate' the photocells (i.e. make them read values) and control a visual output. This as outline for our mediacontroller project, we started to organize materials and test some small setups:
10 laserpens (eBay 10$)
12 3,5" Photocells (electronic goldmine ~20$)
2 Arduinos (wherever ~60$)
(1 Arduino and multiplexer also possible)
cardboard (free – 18th Street Fellowship)


After we had tried various game scenarios, we decided to set up two Arduinos, one [1] reading six photocells and the other[2] reading values from piezzo sensors that were attached to the physical instruments (cardboardboxdrum). The analog values read from the piezzos on [2] were linked to a Max Patch and whenever they would receive readings above a threshold (I think 50 for our setup) a digital signal was communicated to [1], which would then start reading from the three photo cells matching the piezzo source signal to the appropriate team (if drummer of team A drums, field players of team A can score).
Here is a video MinWoo made of the game being played at the presentation (thanks to the fierce players: Dawn, Cody, and Sarah Jenny on the one side, Chika, Leo, and Rory on the other side):

The critique afterwards was pretty cool because many detailed comments where made that showed that the basic concept worked but that many details weren't really fleshed out. The most important one, I thought, was that we should have introduced a scoreboard. Also the connection to the MaxPatch could've been clearer or at least been projected. All in all, I am happy with the outcome as I never designed a game before (especially no physical one).


Here are the codes we used for the photo cell sound communciation.
***********************************************
***********************************************
Arduino
*********************************************** ***********************************************
int analogOneA = 0; int analogTwoA = 1; int analogThreeA = 2;  // analog input
int analogOne = 3; int analogTwo = 4; int analogThree = 5;

int digitalOne=12,digitalTwo=13;//digitalPins to communicate with the other Arduino

int sensorValue = 0;  // reading from the sensor

void setup() {
  // configure the serial connection:
  Serial.begin(9600);
  // configure the digital input:
  pinMode(digitalOne, INPUT);
   pinMode(digitalTwo, INPUT);
}

//we were having trouble with the for-loop
//which is why we call from each pin with full declarations of evey pin


void loop() {
 //if signal arrives from the piezo buzzer
 if(digitalRead(digitalOne)==1)
 {

  // read the sensor:


  sensorValue = analogRead(analogOne);
  // print the results:
 // Serial.print("analogOne-");
  Serial.print(sensorValue, DEC);
  Serial.print(",");
 
  // read the sensor:
  sensorValue = analogRead(analogTwo);
  // print the results:
 // Serial.print("analogTwo-");
  Serial.print(sensorValue, DEC);
  Serial.print(",");
 
  // read the sensor:
  sensorValue = analogRead(analogThree);
  // print the results:
  //  Serial.print("analogThree-");
    Serial.println(sensorValue, DEC);
 }

if(digitalRead(digitalTwo)==1)

{
sensorValue = analogRead(analogOne);
  // print the results:
 // Serial.print("analogOne-");
  Serial.print(sensorValue, DEC);
  Serial.print(",");
 
  // read the sensor:
  sensorValue = analogRead(analogTwo);
  // print the results:
 // Serial.print("analogTwo-");
  Serial.print(sensorValue, DEC);
  Serial.print(",");
 
  // read the sensor:
  sensorValue = analogRead(analogThree);
  // print the results:
  //  Serial.print("analogThree-");
    Serial.println(sensorValue, DEC);
}
 
}




***********************************************
***********************************************
Processing code
*********************************************** 


import processing.serial.*;

import ddf.minim.*;
import ddf.minim.signals.*;


Serial myPort;

int counterA=0, counterB=0;
// Init objects
Minim minim;

AudioPlayer win;

AudioPlayer oneA;
AudioPlayer twoA;
AudioPlayer threeA;

AudioPlayer oneB;
AudioPlayer twoB;
AudioPlayer threeB;

void setup() {




  myPort = new Serial(this, Serial.list()[0], 9600);

  minim = new Minim(this);

  win = minim.loadFile("winner.mp3");

  // first team
  oneA = minim.loadFile("1.wav");
  twoA = minim.loadFile("2.wav");
  threeA = minim.loadFile("3.wav");
  //second team
  oneB = minim.loadFile("4.wav");
  twoB = minim.loadFile("5.wav");
  threeB = minim.loadFile("6.wav");
}

void draw() {

  // First Photocell
  if (oneA.isPlaying()) {
    //counterA +=1;
  }
  else {
    oneA.rewind();


  }

  //Second Photocell
  if (twoA.isPlaying())
  {
    //  counterA+=1;
  }
  else {
    twoA.rewind();

  }
  //third Photocell
  if (threeA.isPlaying()) {
    //counterA+=1;
  }
  else {
    threeA.rewind();

  }

  //AND THE WINNER IS
  if (counterA>10)
  {
    //win.play();
  }

  // First Photocell
  if (oneB.isPlaying()) {
    //counterB +=1;
  }
  else {
    oneB.rewind();


  }

  //Second Photocell
  if (twoB.isPlaying())
  {
    //  counterB+=1;
  }
  else {
    twoB.rewind();

  }
  //third Photocell
  if (threeA.isPlaying()) {
    //counterB+=1;
  }
  else {
    threeB.rewind();

  }

  //AND THE WINNER IS
  if (counterB>10)
  {
    //win.play();
  }



}


void serialEvent(Serial myPort) {

  String myString = myPort.readStringUntil('\n');
  println(myString);

  if (myString != null) {
    myString = trim(myString);
    int sensors[] = int(split(myString, ","));

    for (int sensorNum = 0; sensorNum < sensors.length; sensorNum++) {
      print("Sensor " + sensorNum + ": " + sensors[sensorNum] + "\t");
    }
    println();

    //first team
    if (sensors[0] > 200) {
      oneA.play();
    }


    if (sensors[1] > 200) {
      twoA.play();
    }

    if (sensors[2] > 200) {
      threeA.play();
    }

    // second team
    if (sensors[3] > 200) {
      oneB.play();
    }


    if (sensors[4] > 200) {
      twoB.play();
    }

    if (sensors[5] > 200) {
      threeB.play();
    }
  }
}

void stop()
{
  win.close();
  oneA.close();
  twoA.close();
  threeA.close();
  minim.stop();

  super.stop();
}

11/11/2009

#_X Electrodes and OpAmp


Yesterday I finally got started with (basically) what I came for to ITP; developing and creating BCIs (Brain Computer Interface). 2nd year Mustafa has been working on it all semester long for his course "Rest of you" taught by Dan O'Sullivan so we decided to join forces on this one.

So far, I managed to hook up electrodes to a simple Op-Amp differential circuit and get some reading of body activity. However, the results so far are not closely something that could match any medical machines, which is mainly due to the bad amplification a single Op-Amp offers and also the rather arbitrary application of the electrodes to my body – not even close to 10-20 or any other systematic way. However, that was the first step and I am happy to keep going with this stuff.

10/18/2009

#_8 Data Log


Here are some nice screen shots of data logs from FSR measurements. I tweaked some of the processing source code to vary the display. I changed the values by inversely mapping them (serialValue=map(serialValue,0,1023,width,0);) to add some, in my opinion, aesthetic interest to the graphs.
The Arduino was programmed with Lab code by Tom Igoe.





#_7 Servo

Servos are a cool thing, actually. Though, I did my lab three days ago, I got it out today and started building a coffee cup drum, which has to be completed yet. Figured, since I drink so much coffee and don't have a mug I should at least do something useful with all the crap cups.
However, here is my servo lab for now.

10/14/2009

#_6 virtual MIDI and the Tone Library

After I did my Tone labs the last two days, I was sort of wanting to do more, especially since Leo did this really beautiful piece for his stupid pet trick(check it out at: http://itp.nyu.edu/~lk1068/blog/index.php?/project/stupid-pet-trick/). So, today I finished my own little MIDI controller using my FSR and a flex sensor. I am using a virtual MIDI device for that and sending it to Renoise.
For the media controller assignment we want to definitely do something that involves MIDI and maybe sending serial to Max/MSP for visuals so this will really come in hand.
Next is the servo motor.

10/08/2009

#_5 Stupid Pet Trick

Edit: Alright, now it's working! Wirewrapping is the way to go. And if NASA does it, who could resist. The new sensor needs different thresholds, which aren't adjusted yet properly so the LEDs and the buzzer trigger a bit too easily. Will upload a video asap.

The idea was to have a FSR, a Force Sensing Resistor, detect touch pressure during human interaction... this concrete example aimed to measure the strength of a handshake and respond along two thresholds: red LEDs = 180 and buzzer = 280. In the bigger picture it might be a great tool in the context of assistive technology, i.e.: people with autism or other mental/neural disorders could create their very own threshold that prevents people from touching them too hard or inappropriately according to their perception.



























Okay, while assembling and actually making the cutting edge design of my stupid pet trick, my freakin' FSR broke. Let that one be a lesson: do not solder FSRs unless they aree in a spot where no force is applied to the sensor as a whole. So off to the shop I went and got a new one. Though, now I am not sure where exactly to put it.


9/27/2009

#_4 Electronica

All went fine, though I somehow didn't soldier the power jack properly, which is why it was somewhat awkward. Made me unsoldier it... was an "interesting" experience.


LEDs – serial hook up. As I added the third one they were all working, however not as bright anymore.

LEDs – parallel circuit.

9/25/2009

#_3 Analog In

The lab went great. At first the force sensor I used was giving me trouble but I was basically using the wrong resistor for the LED. However, I was reading from the sensor all the time so it was easy to track down that something was wrong with LED connection. Lucky, huh... The potentiometer didn't give me any trouble and it was fun to soldier power and ground to it.
Also realized that you can use mathematical operators within the println command, which gives you the values you are sending to the LED in the serial monitor.

Don't have any idea for the Pet trick yet... just got the complete edition of Adrian Tomine's Optical Nerve comics in the mail today, hope that gives me some inspiration.

9/24/2009

#_2 Phantasy Device – Discourse Prototyper


This is the discourse prototyper. It let's you prototype a discourse by simply rolling it through ink and continuously printing on to (almost) any surface. The prototyper only let's you print the introduction, seminal parts to discursive constellations (i.e. analyze, interpret, conclude) are left out. Anyway, you get the point.


This device is the result of the horribly dullifying experience you have when attending school in a system that lacks multiple choice exams. So, you would get an excerpt of text, make your conclusion while reading and not thinking that it is worth more than two, three sentences. However, your teacher demanded a ten page essay written in 90 minutes (as a 14 year old). So, the discourse prototyper would have made a lot easier in school.


9/17/2009

#_1a Blinking LED Switch

This is my Arduino. Ground and power (5V) are hooked up.













This is my setup consisting of the Arduino microcontroller, a breadboard, yellow and red LED, 10k resistor (switch) and two 220 resistors (LEDs) and wires. I used two wires as switch, which I connected by using a screwdriver.













These are the blinking lights.









Video of the final product.


The code used was the basic code provided on the ITP PComp Wiki, i.e.:
// declare variables:
int switchPin = 2;      //  digital input pin for a switch
int yellowLedPin = 3;   //  digital output pin for an LED
int redLedPin = 4;      //  digital output pin for an LED
int switchState = 0;    // the state of the switch

void setup() {
pinMode(switchPin, INPUT);       // set the switch pin to be an input
pinMode(yellowLedPin, OUTPUT);   // set the yellow LED pin to be an output
pinMode(redLedPin, OUTPUT);      // set the red LED pin to be an output
}

void loop() {
// read the switch input:
switchState = digitalRead(switchPin);

if (switchState == 1) {
// if the switch is closed:
digitalWrite(yellowLedPin, HIGH);    // turn on the yellow LED
digitalWrite(redLedPin, LOW);       // turn off the red LED
}
else {
// if the switch is open:
digitalWrite(yellowLedPin, LOW);   // turn off the yellow LED
digitalWrite(redLedPin, HIGH);     // turn on the red LED
}

}


Source: http://itp.nyu.edu/physcomp/Labs/DigitalInOut

9/16/2009

#_1 sensorwalk

There are quite many sensors when walking around the various hoods I pass on a daily basis. The more sensors I thought I was encountering the more metaphoric – and blurry – they got (policeman [analog or digital], hanging doorbell in a shop that triggers unreliably [analog or digital], motion detecting water tap [digital?] vs basic water level measuring toilet flush [analog, I guess], individual tolerance level [analog, we still believe]).
So, here are the most basic ones I figured out, sticking to the literal meaning of sensor (i.e.: 1 : a device that responds to a physical stimulus (as heat, light, sound, pressure, magnetism, or a particular motion) and transmits a resulting impulse (as for measurement or operating a control) http://www.merriam-webster.com/dictionary/sensor):








1. Trafficlight
digital sensor
(red hand: 0 | man: 1)












2. Public Phone
.1 Coin Slot
digital sensor
(noMoney/noTalk = 0 | Money/Talk = 1)

.2 Dial
digital sensor
(noPress = 0 | Press = 1)

.3 Receiver
analog sensor
(mumblemumble = 0.1-0.3 | blablabla = 0.4-0.8 | AARGH = 0.9-1)
hypothetically assuming a scale on which 0.4-0.8 would be the stereotypical sound level (SPL) for a phone conversation.

Considering language in general, one might model words as reality sensors. Negations, local or global, form digital pairs and lexicalized opposites form analog poles, which allow for states in between that can be formalized on scales. So you could model pairs such as happy/unhappy as a way of digital expression whereas pairs such as happy/sad have more of an analog touch to them. Similar, all/not all (*nall) vs all/none, live/not live vs live/die, ...

9/07/2009

#_0

Hello [wired] world!

This blog is intended to document my Physical Computing attempts and hopefully advances during the class with the same title taught by Rory Nugent at NYU's Interactive Telecommunications Program (ITP) this fall (2009).
Feel free to contact me or to comment on any of the future posts.

Keep it unreal in the realer world.