INPUT MY OUTPUT
RESEARCH & EXPERIMENTS
Category: Physical Computing
Music is a very powerful medium that many people use as a spiritual beacon that helps to guide, motivate, relax, and feel something greater than oneself. For such a powerful form of media we often see very bland modes to control it (mp3 players, home stereo systems, etc.), but why not give this medium the altar it deserves. In collaboration with Christie Leece and Katie Tibbetts – we created a physical computing piece called The Altar. The Altar uses candle light to play and adjust an audio composition that is meant to embrace the power of music. The piece was made with 17 photo cells, 1 Arduino Mega, and a whole lot of love. The tops of each tier is lazer cut (totaling 6 hours to engrave the entire piece). As we continue to improve the piece, we hope to place this in a public space (such as a church), to allow more guests outside the NYU ITP community to enjoy it. Overall, I’m really happy with the way the project turned out and feel there’s still a lot of room to explore experimental audio controls.
 
This week when I went to get a cheese burger at 5-Napkin the tables were all full.  I asked for them to put me on a wait-list and they provided me with this silly looking device.  They said it will beep when my table opens up and that it would likely take 20 to 30 minutes.  They also warned me that the device only works within a 1 block radius and that I should stay close to the restaurant.  With that said…I walked around the block, but it was boring.  There was nothing to do and no other shops on the street.  One of my pet-peeves is that I hate it when people waste my time.  To avoid this I walked past the 1 block radius and went to Barnes & Noble.  I browsed some books and all of a sudden my buzzer was going off!! Vibration and 12 red LED’s were blinking!! I was happy the radius was bigger than I was notified and I walked back to the restaurant.  There I observed other people who were receiving similar devices.  Some people who received it waited outside the restaurant and soaked up the sun, while others waited inside the restaurant.  Overall, the wait was likely 20-30 minutes for everyone with a device.

So is this device even interactive?  From a user’s perspective it isn’t very interactive…It just distributes a message when a table is open.  However, from the hostesses perspective at the restaurant it is interactive.  It can listen to the hostess as he/she sets the designated table and it can respond to her request when the table is open – thus allowing me to come back to the restaurant.

What are the difficulties with this product?  Well for one thing it is ugly and large.  It can easily be stolen and it doesn’t give the user much of a clear idea to when the table will actually be ready.  It’s like waiting for a train without knowing when the train will come.  It’s range also seems a bit short if the area is sparse (as it was in my case).  It also isn’t very entertaining as many people using this divice are in a state of purgatory waiting for their table.  Ok – let’s stop hating…What is good about the device?  Well…to start – the messaging is very clear.  Even without being told how it works I think anyone can understand the language of the vibration and blinking LED’s versus it’s idle state where it is a cold hard object.  It seems to be very reliable and has a good control with a hostess that can send out a message on command.

Perhaps the device could be better if there was a game included for bored customers waiting.  Perhaps there can be a better visual indication or a timer that lets the user know how much time they have before they have to run back to the restaurant. Perhaps the shape can be more interesting as well, or more appealing, or latch on to an existing device such as a watch or cellphone.


 

 
In the second Serial Communications lab I learned how to read multiple Arduino inputs and use this information to control visual actions in processing.  In order to hand-off multiple serial data one must divide the data through printing with comma’s “,”, spaces ” “, and newlines “\n”.  This allows the computer to distinguish which numbers are associated with which sensor.  In Processing we learned how to use the trim(myString) function remove spaces and the split(myString, ‘,’) function to remove the comma’s and place information in an array[].
 
When sending this serial data we use a flow of serial communication (Serial.begin(9600)).  However, when generating highly graphical work this can potentially cause sluggish response times and fill the Serial buffer (or so I’m told).  In order to avoid these issues I also learned about the handshake method.  This method only sends out the Serial data when requested rather than flowing at the standard 9600 bits per millisecond.  The handshake method involves creating one extra function in processing that uses Serial.available() to only send data when it is greater than 0.  Processing then sends a byte to Arduino for it to retrieve the desired information.  Below is the video of this and the code.

import processing.serial.*;
 
boolean firstContact;
 
float bgcolor;               // Background color
float fgcolor;               // Fill color
float xpos, ypos;            // Starting position of the ball
 
Serial myPort;
 
void setup() {
  size(570, 350);
 
  //println(Serial.list());
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
  myPort.bufferUntil('\n');
 
  background(0, 240, 150);
}
 
void draw() {
  background(bgcolor);
  fill(fgcolor);
  // Draw the shape
  ellipse(xpos, ypos, 20, 20);
}
 
void serialEvent(Serial myPort) {
  String myString = myPort.readStringUntil('\n'); //read the serial buffer
 
  // if I have any bytes other than the linefeed:
  if (myString !=null) {
    myString = trim(myString);
 
    //if I haven't heard from the microcontroller yet, listen:
    if (firstContact == false) {
      if (myString.equals("hello")) {
        myPort.clear(); //clear the serial port buffer
        firstContact = true; // i've had frist contact from the microcntrl
        myPort.write('A'); //ask for more
      }
    }
 
    //if I haven't heard from the microcontroler, proceed:
 
    else {
      //split the string at the commas and convert it to integers
      int sensors[] = int(split(myString, ','));
 
      //print out values received:
      for (int sensorNum = 0; sensorNum < sensors.length; sensorNum++) {
        print("Sensor" + sensorNum + ": " + sensors[sensorNum] + "\t");
      }
      println();
 
      if(sensors.length>1){
        xpos = sensors[2] * 255;
        ypos = map(sensors[1], 0, 580, 0, height);
        bgcolor = map(sensors[0], 0, 1024, 0, 255);
      }
    }
    myPort.write("A");
  }
}

 
Lastly, to get creative I used a potentiometer and an FSR to create an Etch-A-Sketch.  I ideally would like to have two potentiometers for it to function properly, but the prototype concept can be seen here.  It would also be great to add a ball switch on the piece that would erase the sketch every time the device is flipped upside down.

This week for Physical Computing I outputted the bytes from a photo cell (connected via Arduino) to a Processing sketch.  This will allow me to visually see what sensors are doing and how they react to changes thus allowing me to better understand and control sensor driven interactions.Below is the code from Arduino:

void setup(){
 Serial.begin(9600); 
 
}
 
void loop(){
  int analogValue = analogRead(A0);
  int brightness = map(analogValue, 170, 790, 0, 255);
 
  Serial.write(brightness);
 
}

Below is the code from Processing:

import processing.serial.*;
float xPos = 0;
 
Serial myPort;
 
void setup() {
  size(570, 350);
 
  //List all the available serial ports
  println(Serial.list());
 
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
 
  background(246, 249, 0);
}
 
void draw() {
}
 
void serialEvent(Serial myPort) {
  float inByte = myPort.read();
  println(inByte);
 
  float yPos = height - inByte;
  stroke(2, 100, 185);
  line(xPos, height, xPos, height- inByte);
 
  if (xPos>=width) {
    xPos=0;
    background(246, 249, 0);
  }
  else {
    xPos++;
  }
}

In this lab we also learned about ASII Dec values versus their Characters.  When using Serial.println() one receives Dev values, while when using Serial.write() one receives characters.  An ASII table can be found here. More information on Serial communication can be found on my awesome teachers blog (Co-Founder of Arduino – Tom Igoe).