Saturday, June 30, 2012

Final Project::: The Self-Motivated Xylophone

For the final project I chose to do a Self-Motivated Xylophone - you hit it once and it will play many notes for you!

https://vimeo.com/45028437

The project was meant to serve as a prototype for a larger installation with many of the same technical aspects. Basically what it should look like when it's completely done is a deconstructed and interactive tongue drum that will respond to some physical input and play all around the installation. Since a xylophone is also percussive and melodic I thought it would be a great chance to test out the technical aspects and see what kind of issues I would run into both with a smaller scale project like this and then keeping in mind the foreseeable challenges of trying to apply these concepts to a larger scale. 

This is a tongue drum 

The way this works is that there are six piezo pickups on the bottom of the keys on the xylophone that are programmed in a way that enables them to recognize when they are being hit and then play a unique sequence associated with that piezo. All of the piezos and solenoids are linked to notes within C major making any note hit (that is not sharp or flat aka on the upper shelf) sound good with each other. You can also play notes while a sequence is running as well to complement the sequence that is being played. 




The biggest problems I ran into were basic power and resistor errors (that were easily fixed with some help) and then not fully understanding the algebraic function that allows the xylophone to play all the numbers in the sequence. Once figuring that out I was able to program all the solenoids to have different sequences and accurately program the piezos to respond to a hit.

Here's the code I wrote


int piezo1 = A0;
int piezo2 = A1;
int piezo3 = A2;
int piezo4 = A3;
int piezo5 = A4;
int piezo6 = A5;
int piezo1Value=0;
int piezo2Value=0;
int piezo3Value=0;
int piezo4Value=0;
int piezo5Value=0;
int piezo6Value=0;


//SEQUENCE 1
int sequence1[] = {
3 , 4 , 6 , 8, 5, 11, 2, 5, 11, 2, 5, 11, 2, 6, 6, 5 ,4, 7, 7, 8, 11, 10, 9, 11, 10, 9, 3 , 4 , 6 , 8, 5, 11, 2, 5, 11, 2, 5, 11, 2, 6, 6, 5 ,4, 7, 7, 8, 11, 10, 9, 11, 10, 9};
//52 values
int delays1[] = {
20, 20, 20, 25, 30, 30, 30, 25, 100, 50, 30, 30, 30, 20, 100, 25, 30, 90, 90, 25, 100, 25, 30, 30, 30, 25, 20, 20, 20, 25, 30, 30, 30, 25, 100, 50, 30, 30, 30, 20, 100, 25, 30, 90, 90, 25, 100, 25, 30, 30, 30, 25
};

//SEQUENCE 2
int sequence2[] = {
11, 10, 8, 3, 4, 5, 2, 6, 7, 2, 4, 6, 7, 8, 8, 2, 11, 7, 6, 2, 5, 4, 9, 3, 8, 7, 6, 3, 11, 9, 4, 5, 6, 4, 8, 5, 6, 11, 10, 8, 4, 2, 11, 3, 4, 2, 4, 5, 7, 3};
//52 values
int delays2[] = {
60, 80, 60, 20, 60, 80, 20, 20, 60, 80, 60, 100, 20, 30, 50, 60, 80, 20, 20, 60, 80, 20, 100, 20, 80, 20, 25, 30, 40, 50, 60, 80, 20, 40, 60, 80, 40, 20, 60, 80, 100, 20, 30, 40, 50, 20, 20, 100, 60, 60
};

//SEQUENCE 3
int sequence3[] = {
4, 2, 11, 11, 6, 5, 4, 8, 8, 8, 10, 12, 11, 10, 12, 11, 5, 8, 7, 3, 3, 11, 2, 11, 3, 11, 4, 8, 6 , 8, 5, 11, 2, 5, 11, 2, 5, 11, 2, 6, 6, 5 ,4, 7, 7, 8, 11, 10, 9, 11, 2};
//52 values
int delays3[] = {
60, 80, 200, 200, 60, 80, 200, 200, 60, 80, 100, 150, 30, 40, 50, 60, 80, 20, 200, 60, 80, 20, 200, 60, 80, 100, 20, 30, 40, 50, 60, 80, 20, 150, 60, 80, 20, 200, 60, 80, 100, 150, 30, 40, 50, 20, 20, 100, 60, 60, 20};

//SEQUENCE 4
int sequence4[] = {
10, 11, 4 , 8, 9, 10, 2, 5, 12, 10, 3, 4, 2, 6, 6, 5 ,2, 7, 4, 8, 5, 2, 9, 11, 10, 9, 10, 11, 4 , 8, 9, 10, 2, 5, 12, 10, 3, 4, 2, 6, 6, 5 ,2, 7, 4, 8, 5, 2, 9, 11, 10, 9};
//52 values
int delays4[] = {
20, 20, 20, 25, 30, 30, 100, 25, 10, 20, 20, 20, 30, 60, 10, 20, 30, 80, 100, 70, 70, 100, 30, 100, 100, 70, 20, 20, 20, 25, 30, 30, 100, 25, 10, 20, 20, 20, 30, 60, 10, 20, 30, 80, 100, 70, 70, 100, 30, 100, 100, 70
};

//SEQUENCE 5
int sequence5[] = {
3 , 4 , 6 , 8, 5, 11, 2, 5, 11, 2, 5, 11, 2, 6, 6, 5 ,4, 7, 7, 8, 11, 10, 9, 11, 10, 9, 3 , 4 , 6 , 8, 5, 11, 2, 5, 11, 2, 5, 11, 2, 6, 6, 5 ,4, 7, 7, 8, 11, 10, 9, 11, 10, 9};
//52 values
int delays5[] = {
60, 80, 60, 20, 60, 80, 20, 20, 60, 80, 60, 20, 30, 25, 20, 10, 60, 80, 60, 80, 150, 20, 150, 20, 30, 20, 60, 80, 60, 20, 60, 80, 20, 20, 60, 80, 60, 20, 30, 25, 20, 10, 60, 80, 60, 80, 150, 20, 150, 20, 30, 20
};

//SEQUENCE 6
int sequence6[] = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 2, 2, 5, 6, 8, 10, 12, 11, 4, 3, 6, 9, 11, 5, 7, 4, 8, 2, 9, 5, 4, 10, 11, 8, 7, 7, 6, 3, 5};
//40 values
int delays6[] = {
60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 100, 200, 300, 400, 500, 60, 80, 200, 200, 60, 80, 200, 200, 60, 80, 100, 200, 300, 400, 500, 60, 80, 200, 200, 60, 80, 200, 200, 60, 80};


void setup(){

  for(int i = 2; i < 11 ; i++) {
    pinMode(i, OUTPUT);
  }
  Serial.begin(9600);

}


void loop(){

  //PIEZO 1 - is on low d
  piezo1Value = analogRead(piezo1);
  //Serial.println(piezo1Value);
  if(piezo1Value >200){
    for(int i = 0; i < 51 ; i++) {
      digitalWrite(sequence1[i], HIGH);
      delay(20);
      digitalWrite(sequence1[i], LOW);
      delay(delays1[i]);
    }
  }
 
//PIEZO 2
//is on g
piezo2Value = analogRead(piezo2);
//Serial.println(piezo2Value);
  if(piezo2Value>200){
    for(int i = 0; i < 51 ; i++) {
      digitalWrite(sequence2[i], HIGH);
      delay(20);
      digitalWrite(sequence2[i], LOW);
      delay(delays2[i]);
    }
  }
 
//PIEZO 3
//on middle c
piezo3Value = analogRead(piezo3);
//Serial.println(piezo3Value);
  if(piezo3Value>1000){
    for(int i = 0; i < 51 ; i++) {
      digitalWrite(sequence3[i], HIGH);
      delay(20);
      digitalWrite(sequence3[i], LOW);
      delay(delays3[i]);
    }
  }
 
//PIEZO 4 - is on high c
piezo4Value = analogRead(piezo4);
 //Serial.println(piezo4Value);
  if(piezo4Value>300){
    for(int i = 0; i < 51 ; i++) {
      digitalWrite(sequence4[i], HIGH);
      delay(20);
      digitalWrite(sequence4[i], LOW);
      delay(delays4[i]);
    }
  }

//PIEZO 5
//on low c
piezo5Value = analogRead(piezo5);
Serial.println(piezo5Value);
  if(piezo5Value>950){
    for(int i = 0; i < 51 ; i++) {
      digitalWrite(sequence5[i], HIGH);
      delay(20);
      digitalWrite(sequence5[i], LOW);
      delay(delays5[i]);
    }
  }
 
//PIEZO 6 - I USED ONE LESS THAN 40 BECAUSE 0 COUNTS AS A NUMBER IN WEIRD MATH LANGUAGE - same with all of them!
//on high E
piezo6Value = analogRead(piezo6);
//Serial.println(piezo6Value);
  if(piezo6Value>600){
    for(int i = 0; i < 39 ; i++) {
      digitalWrite(sequence6[i], HIGH);
      delay(20);
      digitalWrite(sequence6[i], LOW);
      delay(delays6[i]);

    }

  }

}


Overall, I'm very pleased with how this project came out and am excited to use these principles in the larger piece!


Saturday, June 23, 2012

Final Project Concept & Progress

For my final project I plan on creating a percussive xylophone that works with you to create melodic and beautiful harmonies and melodies. The idea is that certain notes trigger a string of notes that are in the same key as the note hit with the mallet. There will be piezo pickups taped to the bottom of the keys that will trigger a series of solenoids to perform their dance.

So far I've run into a few coding issues with testing on LEDs...

The following code represents progress thus far and issues I've been having with:
  • creating a threshold that disables sensors from being read beyond that threshold 
  • LEDs starting 'HIGH' rather than 'LOW' thus reversing the order of how it is lit 
  • general troubleshooting with Serial Monitor values.


This is how it performs with the above code:
 

I used a FSR instead of a piezo for this example as well. Currently waiting on the rest of the parts, can't wait to try it out with actual solenoids! 



Friday, June 22, 2012

H Bridge Lab

H Bridges allow the motor to spin in two directions! I wish I had taped something to the axel to better visualize it. The switch controls the direction. 

Tuesday, June 19, 2012

Stupid Pet Trick



After getting a makeover, the Stupid Pet Trick had it's seamless debut in class. The discussion provided a glimpse into user perspective and reasoning behind the interface. For us it was a playful way to explore these technologies in an interesting way, but perhaps if fully fleshed out into a bigger project more thought and consideration to design and purpose would be necessary in order for it to be effective and meaningful to someone experiencing it.

Multiple Serial Output Lab



All types of data!



Reading data from the sensor


Hello! 


What happens when you enter data into the Serial Monitor


Was unable to get Processing to make the ball appear. Not sure what the issue was since I was reading data from the sensors. Will try to figure out where I went wrong before the end of class!

Monday, June 18, 2012

Serial Out Lab

ASCII Characters! Arduino 'writes' serially in ASCII (instead of translating) and 'reads' serially in numbers we can understand



Hex Characters in CoolTerm!


 How to identify all serial ports available on the machine in Processing

 Graphing via Processing, so satisfying!


This lab was the way we've communicated serially and opened up a conversation between the Arduino and the computer. As we move on this is going to be an insane and awesome tool to use!

Tuesday, June 12, 2012

Tone Output Lab



FSR Controlled Piezo Pitches


Musical Instrument


Best Song Ever



These were super fun. Definitely going to use these concepts to create interesting noise projects in the future! 

Servo/Analog Out Lab

Servo Controlled with Flex Sensor

Saturday, June 9, 2012

Stupid Pet Trick::: Prototype

IT WORKS!

It took us a few minutes to figure out how to use the same value (from one flex sensor) to send to two different servo motors, but then we figured it out! Other issues we encountered were really minor, ie. taping wires together, hooking up a flex sensor test incorrectly, etc.

Here's the code we are using and a video of the prototype:



Thursday, May 31, 2012

Sensor Walk

After spending an afternoon walking around the area, I think the most memorable human/sensor interaction was with a sliding door 3 blocks from campus. There is a Gristedes who's sliding doors are on the corner of West 3rd and Mercer. People walking by the door will often cut into the diamond shaped piece of cement since it is closer than walking around it, however this area activates the sliding doors. In my observations, there were many alarmed pedestrians who were not aware the sensor would react by taking the 3ft shortcut!


Tuesday, May 29, 2012

Fantasy Device:::Bike Forcefield


My fantasy device is based on my everyday experience of riding a bike in NYC and not being as visible and therefore less safe than a car. Many friends have gotten into bike accidents because cars and pedestrians have made reckless decisions, unaware of the consequences involved. Unfortunately due to the lack of space in the city, it would be difficult to do more to protect bikers on the road than bike lanes, which are arguably just as treacherous, as many don't respect it. 

This device would focus on creating a forcefield that would protect the biker inside from traffic and pedestrians and function primarily to prevent collisions. 


 
The user interface is designed in such a way that it has presets and sensors that give the user total control while also a feeling of safety and security. The forcefield would have three modes that are located on the frame where many gears are located and can be set to: 
Automatic (at center): will detect the speed and trajectory of large moving objects towards a biker versus the trajectory of the biker and activate the forcefield when the biker is considered in danger
Always on: If a biker feels particularly unsafe whether from a threat of attack or threat of getting hit by a car the biker can manually turn on the forcefield. 
Always off: When a biker does not want the forcefield to activate there is a manual off lever


The buttons on the handlebars would act as manual overrides to the levers. Pushing forward would create a forcefield, pulling toward the rider would negate the effect if necessary, and pushing down would click it into off mode.

First Arduino Program






Did not have a lot of difficulty with this project. With help from the notes and code from class this circuit and program was really simple! Very exciting! 

Thursday, May 24, 2012

Assignment 1

Assignment 1: Observation. Pick a piece of interactive technology in public, used by multiple people. Write down your assumptions as to how it's used, and describe the context in which it's being used. Watch people use it, preferably without them knowing they're being observed. Take notes on how they use it, what they do differently, what appear to be the difficulties, what appear to be the easiest parts. Record what takes the longest, what takes the least amount of time, and how long the whole transaction takes. Consider how the readings from Crawford reflect on what you see.




Object of choice: Elliptical Machines at the gym


The elliptical machines at the Palladium gym at NYU are multi-functional interactive machines, housing resistance to motion, a heart rate sensor, and an entertainment  system. People typically use them for all the functions they provide and they are intended to be easy to operate and interact with. The data from user generated motion on the machine is averaged and displayed on the screen along with a TV station or radio station of your choice. 


In my observation, it seemed like the longest interaction was the setting up of the machine to the users preferences as there are so many ways the machine can be tailored to fit one's needs: one can adjust length of workout, personal weight, entertainment preferences, height, resistance, and age. Selecting each one individually does not take that much time, however the whole process takes about 1-2 minutes before the user is exercising with limited interaction. Everything else about the machine is automated and very user friendly. 


Crawford talks about interactivity as more of a conversation than a reaction, and requires both parties to listen, consider, and respond. The elliptical does this across the board in a number of ways: it listens and adjusts to preferred settings and then responds with the realization of those settings, it understands when you stop on the machine and instantly pauses it, and it feels when your hands are not on the heart rate monitor and asks you to adjust accordingly. The level of interaction with the elliptical machines is rather sophisticated for workout equipment. 

Tuesday, May 22, 2012

This blog is intended to document my experience with Intro to Physical Computing at ITP with Scott Fitzgerald! :D