Interaction Lab #9 Recitation Report by Cyrus Guo

Lab #8: Serial Communication

Documented by: Cyrus Guo

Instructor: Professors Eric & Young

Aim: Learn about Serial Communication between Arduino and Processing.

Exercise 1: Make a Processing Etch A Sketch

This portion of the recitation was not too difficult. The Etch-a-sketch is a fairly intuitive game to make. The only difficult part was understanding why the ellipses never fully connected, but without further more difficult coding, we had to live with it. This project was Arduino to Processing because the values from the potentiometers were transferred to processing and interpreted as instructions for how to move the ellipse. Here is a video of the exercise:

 

Exercise 2: Make a musical instrument with Arduino

This exercise was slightly easier, though the coding was slightly different from the first one. This project is processing to arduino, meaning that the values of MouseX and MouseY were transmitted to the arduino and given tones to play.  Here is a video of this:

 

Arduino & Processing for Etch-a-sketch:

void setup() {
  Serial.begin(9600);
}

void loop() {
  int firstPot = analogRead(A0);
  int secondPot = analogRead(A2);

  Serial.print(firstPot);
  Serial.print(",");  
  Serial.print(secondPot);
  Serial.println(); 
  delay(100);
}

----------------------------------------------------------------------------------------------------------------------
processing
----------------------------------------------------------------------------------------------------------------------

import processing.serial.*;

String myString = null;
Serial myPort;

int NUM_OF_VALUES = 2;   //2 sensors
int[] sensorValues;      

void setup() {
  pixelDensity(displayDensity());
  size(600, 600);
  background(255);
  setupSerial();
}

void draw() {
  updateSerial();
float posX=map(sensorValues[0],0,1023,0,600);

float posY=map(sensorValues[1],0,1023,0,600);
noStroke();

fill(01);

ellipse(posX,posY,50,50);

print(posX);

print(",");

print(posY);

println();
}



void setupSerial() {
  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[6], 9600);

  myPort.clear();
  myString = myPort.readStringUntil( 10 );  
  myString = null;

  sensorValues = new int[NUM_OF_VALUES];
}


void updateSerial() {
  while (myPort.available() > 0) {
    myString = myPort.readStringUntil( 10 ); 
    if (myString != null) {
      String[] serialInArray = split(trim(myString), ",");
      if (serialInArray.length == NUM_OF_VALUES) {
        for (int i=0; i<serialInArray.length; i++) {
           sensorValues[i] = int(serialInArray[i]);
       }
      }
    }
  }
  
}

-------------------------------------------------------------------------------------------------------------------------------
Arduino and Processing for Music Audio Portion
--------------------------------------------------------------------------------------------------------------------------------
char valueFromProcessing;
void setup() {
  Serial.begin(9600);
  pinMode(7, OUTPUT);
}

void loop() {
   while (Serial.available()) {
    valueFromProcessing = Serial.read();
  }
 
  if (valueFromProcessing == 'E') {
  noTone(8);
  tone(7, 154, 200);
  delay(10);
  } if (valueFromProcessing == 'Y') {
  noTone(6);
  tone(7, 600, 500);
  delay(10);
  }
  delay(10);
}
-------------------------------------------------------------------------------------------------------------------------------
Processing
-------------------------------------------------------------------------------------------------------------------------------
import processing.serial.*;
Serial myPort;
int valueFromArduino;

void setup() {
  pixelDensity(displayDensity());
  size(600, 600);
  background(0);
  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[6], 9600);
}

void draw() {
  if (pmouseX<height/4) {
    myPort.write('E');
  }if (pmouseX>height/2) {
    myPort.write('Y');
}
}

Fish Tank!

Final Project Essay

Name: Connor MacFadyen

Professor: Young/Eric

Project Title

Fish Tank

Project Statement of Purpose *

During the initial project proposal, my partner and I had the idea of creating a pong-like game in which two users would play against each other with various interactive elements. After listening to the comments of the instructors, however, we realized that taking a simple game that already exists wouldn’t be enough. Realizing this, we began to brainstorm again on the different ideas we had in mind and how we could actually create a finished product. The idea we landed on was that of a Tamagotchi, one in which the user would use various sensors on Arduino to give different elements of nurturement to an egg in order to hatch it.

The concept behind this idea was to use the sensor in order to increase the stats and maintain the health of an egg to eventually hatch it. The problem we kept running into with this idea was creating a function in which the health would slowly decrease over time as well as creating a “max health” that couldn’t be passed without resulting in an overfeeding and death of the egg. After trying many times to come with an alternate solution, we felt that the idea of the project was lost without that functionality so we decided to abandon it. Our backup plan and the one we ended up presenting was our Fish Tank. A piece of interactive art in which the user would be able to use the Arduino and keyboards to control a body of water was what we came up with. Our intended audience being anyone who wanted a break from daily human to human interaction to just have some fun, we tried to keep the inputs self-explanatory and easy to use. The goal of our project was to create an “interactive pond” in which the user could interact with the Arduino Board in order to control different functions with fish and the pond itself.

 

Project Plan 

To turn our idea into a reality, we first included some of the ideas from our initial Tamagotchi design in using different sensors to control different aspects of something on processing. Incorporating our new found definitions of interaction post-midterm project, we tried to include as many different functions as we could. The first thing we decided to tackle was creating a pond. Initially, we used the sound function to create a wave representing a water level viewed from the side (like a fish tank).

https://processing.org/examples/noisewave.html

 

Using this a basis for our pond, we started to add objects slowly that would move around the screen and bounce off the perimeter of the screen as we did in class. Turning these objects into fish however made us realize the awkwardness of a fish seemingly swimming backwards – so we had to flip the fishes position completely on impact with the border. The next step was to incorporate Arduino functionality using the moisture and pressure sensors. The idea we first had was to use the moisture sensor to control the height of the wave (more moisture equals a bigger wave). We then used the pressure sensor to create a tsunami like-effect in which the wave would go crazy at different intervals depending on applied pressure. Some of the comments we received about this idea, however, was the awkwardness of creating wave from the top while viewing the bowl from the side. After the user testing session, we tried to incorporate the use of the keyboard as well as we felt as if there wasn’t enough interaction. This, however, was a mistake due to the feedback we received during our presentation. Using both the Arduino board and the mousePressed function at the same time made the user focus on one or the other. The other main things we ended up changing was the perspective. Instead of viewing the bowl from the side, we decided to change it to more of a pond in which the user is looking down on the fish from above. While allowing us to include more interactivity, it limited the use of our sensors in the sense that their effects on the screen were less obvious than before. The functionality of the moisture sensor shifted from changing water levels to starting the game and creating the pond itself, while the pressure sensor became a means to create a bigger wave in correlation with the mousePressed function rather than being the only way to create a wave in our original code. These changes, while seeming to be insignificant at the time changed our entire project more than we intended them to.   Some of the functionality that we attempted to include but could not get to function properly was the “ease” function and new wave functionality. Our plan was to use the keyboard to spawn in some kind of “fish food” in which the existing fish on screen would slowly swim towards the piece of food at the same rate so that they would all arrive at the same time.

https://processing.org/examples/easing.html

The trouble we had with this was getting the fish to flip like they do when they hit a wall in order to pursue the food. They would continually swim backwards and on top of each other which looked strange so we decided to focus more on the mousePressed functionality. Unlike our original code in which the side view was easily seen to be impacted by the pressure sensor, using mousePressed to create a wave-like ripple effect was extremely challenging. Like we used in the RGB circle in class, we attempted to use similar code but a single ripple did not look like water. Instead, we incorporated the code from a YouTube video by The Coding Train to create that ripple bound to mousePressed which resulted in a much cleaner ripple.

In theory, our new project looked much more interactive and aligned more with our definition of interaction in which input must be analyzed to produce a result, the functionality and ease of use suffered. We definitely strayed from our initial goal, to create something “self-explanatory and easy to use” and ended up with a result which left our presentation tester confused. Limiting inputs to the Arduino board rather than trying to include dual-functionality would have greatly benefited our final design.

Context and Significance 

A huge inspiration for our final project was the Thermodynamic of Bird Migration that we looked at in class earlier this semester; https://blog.adafruit.com/2018/05/11/the-thermodynamics-of-bird-migration-simulated-in-a-virtual-world-based-on-seasonal-migration-patterns-of-10k-bird-species/.

I found the interaction of the birds and they avoided each other while still flowing freely to be especially beautiful and tried to create something similar with our project. With my newfound definition of interaction requiring two or more things analyzing each other and reacting accordingly (whether that be from human-human, computer-human, etc.) I would label our final result a success. The problem that we attempted to complete was mostly tackled though our final result definitely strays from our original brainstorming. Like Professor Young mentioned during our presentation, there are surely many similar projects that include fish moving around a screen, but what I liked about our and the most difficult part of our project was incorporating the use of the Arduino board to create results in processing. Because I didn’t have any prior experience with any kind of programming and little to no practice with the serial import functions, at least half of the time spent on the project was including that functionality in our final code.

With more time, I would have very much liked to include the ease function that I could not get to work. Based on the comments I received during the presentation, the interactivity of our project would have been greatly improved by this idea. Another prominent comment I received was the improvement of interaction through the use of different sensors. With more time and more practice, I would have liked to implement the idea that Nick presented in using an actual water tank and pressure sensor to control where the waves are created on processing.

Though our code and ideas changed multiple times (maybe even too many time) throughout the process of creating the final result, I think the project we arrived at would be a great basis for expansion and implementation of more functionality. With more practice, I think I could turn it into something simpler while at the same time including more interactivity to give the users a better experience with using our Fish Tank.

In conclusion, I have learned a great deal in my time spent in class and out of class with both Arduino and Processing. Though I was having some health issues and missed quite a few classes, my time spent in Interaction Lab this semester has inspired me to continue to take classes in which I have no experience, not for the grade but for the opportunity of improvement.

Thanks so much for the semester!

 

Demonstration of Final Project!

IMG_0844

 

Final Blog(Marcela)

Echo Chi

Partner: Crystal Li

First, as my final project is so different from my original idea described in the final project essay before I started to make this project, so I am going to state the new project’s purpose at the very beginning.

A. Project Title

We named our project as “incredible chair” because it is really an amazing chair which can make sounds and everyone can draw something with it.

B. Inspirations

When my partner and I were brainstorming about the final project, we browsed many interactive arts and projects on the website for inspiration and a video about a colorful swing caught our eyes. This kind of colorful swings can change the color of lights when the players are swinging from high to low. Then my partner and I thought only the color changes was not enough because not only it would be bored for the users but also didn’t meet the project requirements(a little utilitarian but that’s the truth). So we decided to add some different kinds of music to this. Also, we thought it was a  little impossible to build a swing in the ima lab so we decided to use more convenient equipment—chairs in the ima lab to achieve this effect.

C. Context and Significance

As I mentioned in my former final project essay and preparatory research and analysis, I talked about the definition of interaction. It does not have a large difference from the midterm definition but I wrote that I thought there should be more methods of interaction. For example, forms of the incomes and outcomes can be more various. And we built more methods to interact with our final project. The player needs to use their whole body to rotate the chair in order to make some incomes and make this chair work. This project requires players more body interactions with the project itself and the users have to rotate their bodies and raise up and put down their arms without any other choices and alternatives. Also, the outcomes of this project has is a combination of voice and sight. Through the users’ rotation of their bodies and the potentiometers on the platform of this chair, users can see different sounds and images based on what they do. The project has achieved my definition of interaction. The forms of incomes and outcomes are more various and the incomes require users to use their whole bodies.

This is a picture which can illustrate my definition of interaction, especially this project. The person in the left of the picture is the user and the right one is the instrument. The user is moving her body and the instrument gives her feedback according to her movements.

D. Audience

Our project is aimed at the people who have interests in music but can’t or don’t want to buy an original instrument, especially the children and students. This project maybe can be put into some arts room such as the piano rooms. When someone wants to have personalized music for fun, he or she can go to sit on this chair and play and draw what they want. And also it can be put into some children’s rooms as their entertainment. Also, it can be used as a teaching tool, let a child sit on it and by rotating his or her body, he or she can learn the sound of the certain note.

E. Conception and design

First I am going to divide this project into four parts, the first one is the gears under the chair seat which need the users to sit on the chair and rotate themselves’ bodies and then the chair will take the gears to rotate and the potentiometer will be rotated so  that the pitch of the sounds can be changed. This is one of my design decision as I mentioned above, this design can make the user has no choice but sit on the chair and rotate themselves to change the pitches. The gears under the seat are made through laser cut. It took a long time for me to draw gears on Adobe Illustrator. At the preparation, we thought about many possibilities to connect the potentiometer with the chair’s rotation. The rotation of the potentiometer should be sustainable. After we asked the professors’ advice, based on our common sense that the gears used as machines units are sustainable and have been used for a long history, we decided to use the gears. We cut two same-size gears then stuck one to the brace of the chair and we cut a little hole on the other one then fixed the potentiometer into this small hole. Then we made a little platform to make sure these two gears stayed on the same level so that they could work.

If someone is going to doubt that the user may just stand near the chair and rotate the chair by hand, the platform attached to the chair handle will eliminate this doubt.

The handles are the second part of this project. There is a distance sensor on one of the handle and if the users want to add some drum beats into the sounds made out by the rotation, they can raise up and put down their arms to achieve it. This brings more body interaction. The coding of the distance sensor, at the very beginning, was going to be made like, if the distance from the arm to the sensor was farther, the voice would be smaller. However, we realized that the sounds the sensor need to make out were drum beats, so we don’t need it to exist all time so we changed our coding into if the distance achieved a certain number, the voice would come out.

Then the last part is the platform attached to the handles as I mentioned above. The platform makes sure that the user must sit on the chair and make the rotation because if the user doesn’t sit on the chair, he or she can not control the rotation and the drum and the potentiometers. The potentiometers are on the platforms. The middle three are designed for changing colors the user can draw on the computer screen or any walls with a projector. The other two are controlling the painting tracks. This is the variety of interaction outcomes.

F. Fabrication and production

The most significant steps in my process must be the production of the gears. The rotation is the most significant part of our project. First, I took a long time to draw the draft on the Adobe Illustrator.

And then how to fix the gear under the seat remained a tough problem. We must cut one gear into half and used the rubber gun to fix them on the brace of the chair and make these two pieces into one piece. Then how to make the gear attached to the potentiometer stay on the same level of the gear attached to the brace. We used strongly hard wires to connect the potentiometer with the Arduino but it didn’t work that well. So we used some cupboards to make a little platform specialized for this gear to make it fix on the same level.

Then during the user test, I received some suggestions about the music we picked from the library. It was not that attractive and we had also realized this. But we tried a lot to use a music file from the website and asked the professors, we failed and were told it could not achieve. This is a large shortage of our project. The lack of variety makes the project cannot make various music as original instruments do.

Also, we received some advice about the handles. Someone suggest me making them more sustainable and beautiful. Then in that weekends, I decided to make a hard supporting board on the same level as the seat and then built the handles based on this board. And eventually, it worked. Then I used some black papers to decorate the handles to make them look better.

G. Conclusions

The goal of my project is to make an instrument which the beginners who are interested in music but don’t or can’t buy original instruments and especially the children and the students can use it. With it, children can be taught the voice of note by adopting themselves into this kind of sounds.

The connection of project and interaction has been mentioned and stated above. Also, how the users interact with the project has also been stated above. This project requires players more body interactions with the project itself and the users have to rotate their bodies and raise up and put down their arms without any other choices and alternatives. Also, the outcomes of this project has is a combination of voice and sight. Through the users’ rotation of their bodies and the potentiometers on the platform of this chair, users can see different sounds and images based on what they do. The project has achieved my definition of interaction. The forms of incomes and outcomes are more various and the incomes require users to use their whole bodies.

And the aspects need to be improved are so many. The first one and the most important one the sounds coming from during the rotation. The variety of sounds is lacking and if we have more time, we must add some buttons which can be stepped by the users’ feet. If the user pushed the button, the sounds will be changed so that the sounds can be various and users can make more personalized music.

The other one is a suggestion raised after the presentation, maybe we can also use the rotation of the chair to control the processing.

Also, the gear can be more sustainable and the wireless connection of Bluetooth should be tested for more times.

The values I learned from the process of the production and the whole class is a new definition of interaction and the combination of the voices and sights. After the production, I have learned that a good project should also make it clear for users to figure out what they should do without any instructions and has meaningful value to the user. The interaction should be used the users’ whole bodies and make the users adopt themselves to the whole project and the feedbacks(outcomes) from the project should be attractive enough to keep the users giving incomes.

Then I am going to state the significance of our project. First, it is personalized and characteristic. The sounds and images coming from the chair can be changed by the actions of users. Everyone can create their own sounds with it and it is so easy for everyone to have a good command of it. If a person who is interested in music but are not in good command of the original instrument. This chair is a good project for him or her. Only by sitting in it and rotating yourself, raising up or putting down your arms, can everyone make excellent sounds. Since many instruments are not convenient to carry to everywhere, but this chair, with wheels, is convenient to move one place to another. Also, original instruments are at the high price and not everyone can afford them. But this chair’s cost will never be that much. In addition, though there are many apps emerging nowadays, users can experience the process of playing music with this chair. The music will change by your movement. That should be so cool.

Arduino part1:

void setup() {

  Serial.begin(9600);

}

void loop() {

  int sensor1 = analogRead(A0);

  int sensor2 = analogRead(A1);

  int sensor3 = analogRead(A2);

  int sensor4 = analogRead(A3);

    int sensor5 = analogRead(A4);

  //int sensor3 = analogRead(A2);

  // keep this format

  Serial.println(sensor1);

Serial.print(sensor1);

Serial.print(“,”);  // put comma between sensor values

  Serial.print(sensor2);

Serial.print(“,”);

  Serial.print(sensor3);

  Serial.print(“,”);

  Serial.print(sensor4);

  Serial.print(“,”);

  Serial.print(sensor5);

  //Serial.print(“,”);

//  // Serial.print(“,”);

//  //Serial.print(sensor3);

Serial.println(); // add linefeed after sending the last sensor value

  // too fast communication might cause some latency in Processing

  // this delay resolves the issue.

  delay(0);

}

part 2:

int   prevSensor3 = 0;

void setup() {

  Serial.begin(9600);

}

void loop() {

  int sensor1 = analogRead(A0);

  int sensor2 = analogRead(A1);

  int sensor3 = analogRead(A2);

  // keep this format

  Serial.print(sensor1);

  Serial.print(“,”);  // put comma between sensor values

  Serial.print(sensor2);

  Serial.print(“,”);

  //  Serial.print(sensor3);

  //  Serial.println(); // add linefeed after sending the last sensor value

  //

  if (sensor3 > 270) {

    if (prevSensor3 == 0) {

      Serial.println(1);

      prevSensor3 = 1;

    } else {

      Serial.println(0);

    }

  } else {

    Serial.println(0);

    prevSensor3 = 0;

  }

  // too fast communication might cause some latency in Processing

  // this delay resolves the issue.

  delay(0);

}

Processing part1:

// IMA NYU Shanghai

// Interaction Lab

// For receiving multiple values from Arduino to Processing

/*

* Based on the readStringUntil() example by Tom Igoe

* https://processing.org/reference/libraries/serial/Serial_readStringUntil_.html

*/

import processing.serial.*;

String myString = null;

Serial myPort;

int NUM_OF_VALUES =5;   /** YOU MUST CHANGE THIS ACCORDING TO YOUR PROJECT **/

int[] sensorValues;      /** this array stores values from Arduino **/

void setup() {

  size(1400, 900);

  background(255);

  setupSerial();

  

// minim = new Minim(this);

  

  // use the getLineOut method of the Minim object to get an AudioOutput object

  //out = minim.getLineOut();

  

  // create a sine wave Oscil, set to 440 Hz, at 0.5 amplitude

  //wave = new Oscil( 440, 0.5f, Waves.SINE );

  // patch the Oscil to the output

  //ave.patch( out );

}

void draw() {

  updateSerial();

  //background(0);

  

  // draw the waveform of the output

  noStroke();

  fill(map(sensorValues[1],0,1023,0,255),map(sensorValues[2],0,1023,0,255),map(sensorValues[3],0,1023,0,255));

ellipse(map(sensorValues[0],0,1023,0,width),map(sensorValues[4],0,1023,0,height),50,50);

  //if (keyPressed)

//{

// switch( key )

  //{

   // case ‘1’:

     // wave.setWaveform( Waves.SINE );

      //break;

     

    //case ‘2’:

      //wave.setWaveform( Waves.TRIANGLE );

      //break;

     

   

     

    //default: break;

  //}

//}

  // draw the waveform we are using in the oscillator

  //stroke( 128, 0, 0 );

// strokeWeight(4);

  //for( int i = 0; i < width-1; ++i )

  //{

   // point( i, height/2 – (height*0.49) * wave.getWaveform().value( (float)i / width ) );

  printArray(sensorValues);

  // use the values like this!

  // sensorValues[0]

  //background(map(sensorValues[0],0,1023,0,255),map(sensorValues[1],0,1023,0,255),255);

  

  // add your code

  //

}

void setupSerial() {

  printArray(Serial.list());

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

  // WARNING!

  // You will definitely get an error here.

  // Change the PORT_INDEX to 0 and try running it again.

  // And then, check the list of the ports,

  // find the port “/dev/cu.usbmodem—-” or “/dev/tty.usbmodem—-“

  // and replace PORT_INDEX above with the index number of the port.

  myPort.clear();

  // Throw out the first reading,

  // in case we started reading in the middle of a string from the sender.

  myString = myPort.readStringUntil( 10 );  // 10 = ‘n’  Linefeed in ASCII

  myString = null;

  sensorValues = new int[5];

}

void updateSerial() {

  while (myPort.available() > 0) {

    myString = myPort.readStringUntil( 10 ); // 10 = ‘n’  Linefeed in ASCII

    if (myString != null) {

      String[] serialInArray = split(trim(myString), “,”);

      if (serialInArray.length == NUM_OF_VALUES) {

        for (int i=0; i<serialInArray.length; i++) {

          sensorValues[i] = int(serialInArray[i]);

        }

      }

    }

  }

}

part2:

// IMA NYU Shanghai

// Interaction Lab

// For receiving multiple values from Arduino to Processing

/*

* Based on the readStringUntil() example by Tom Igoe

* https://processing.org/reference/libraries/serial/Serial_readStringUntil_.html

*/

import processing.serial.*;

String myString = null;

Serial myPort;

int NUM_OF_VALUES = 3;   /** YOU MUST CHANGE THIS ACCORDING TO YOUR PROJECT **/

int sensorValues[];/** this array stores values from Arduino **/

//String sensorValues[];

import ddf.minim.*;

import ddf.minim.ugens.*;

Minim       minim1;

AudioOutput out;

Oscil       wave;

import ddf.minim.*;

Minim minim;

AudioSample kick;

AudioSample snare;

void setup() {

  size(500, 600);

  background(255);

  minim1 = new Minim(this);

  // use the getLineOut method of the Minim object to get an AudioOutput object

  out = minim1.getLineOut();

  // create a sine wave Oscil, set to 440 Hz, at 0.5 amplitude

  //wave = new Oscil( 440, 0.5f, Waves.SINE );

  // patch the Oscil to the output

  //wave.patch( out );

  setupSerial();

  minim = new Minim(this);

  // load BD.wav from the data folder

  kick = minim.loadSample( “BD.mp3”, // filename

    512      // buffer size

    );

  if ( kick == null ) println(“Didn’t get kick!”);

  // load SD.wav from the data folder

  snare = minim.loadSample(“SD.wav”, 512);

  if ( snare == null ) println(“Didn’t get snare!”);

}

void draw() {

  updateSerial();

  printArray(sensorValues);

  //for (int i = 0; i < out.bufferSize() – 1; i++)

  //{

  //  //line( i, 50  – out.left.get(i)*50,  i+1, 50  – out.left.get(i+1)*50 );

  //  //line( i, 150 – out.right.get(i)*50, i+1, 150 – out.right.get(i+1)*50 );

  //}

  // draw the waveform we are using in the oscillator

  //stroke( 128, 0, 0 );

  //strokeWeight(4);

  //for ( int i = 0; i < width-1; ++i )

  //{

  //}

  // use the values like this!

  // sensorValues[0]

  //background(map(sensorValues[0],0,1023,0,255),map(sensorValues[1],0,1023,0,255),255);

  //float amp = map( sensorValues[0], 0, 1023, 1, 0 );

  //wave.setAmplitude( amp );

  //float freq = map( sensorValues[1], 0, 1023, 110, 880 );

  //wave.setFrequency( freq );

  //  //   for (int i = 0; i < kick.bufferSize() – 1; i++)  {

  //  //}

  if (sensorValues[2]==1) {

   

   snare.trigger();

  } else {

  }

}

void keyPressed() {

  // We use a boolean helper variable to determine whether one of the branches

  // of the switch-statement was activated or not

  switch( key )

  {

  case ‘1’:

    wave.setWaveform( Waves.SINE );

    break;

  case ‘2’:

    wave.setWaveform( Waves.TRIANGLE );

    break;

  default:

    break;

  }

}

// add your code

//

void setupSerial() {

  printArray(Serial.list());

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

  // WARNING!

  // You will definitely get an error here.

  // Change the PORT_INDEX to 0 and try running it again.

  // And then, check the list of the ports,

  // find the port “/dev/cu.usbmodem—-” or “/dev/tty.usbmodem—-“

  // and replace PORT_INDEX above with the index number of the port.

  myPort.clear();

  // Throw out the first reading,

  // in case we started reading in the middle of a string from the sender.

  myString = myPort.readStringUntil( 10 );  // 10 = ‘n’  Linefeed in ASCII

  myString = null;

  sensorValues = new int[NUM_OF_VALUES];

}

void updateSerial() {

  while (myPort.available() > 0) {

    myString = myPort.readStringUntil( 10 ); // 10 = ‘n’  Linefeed in ASCII

    if (myString != null) {

      String[] serialInArray = split(trim(myString), “,”);

      if (serialInArray.length == NUM_OF_VALUES) {

        for (int i=0; i<serialInArray.length; i++) {

          sensorValues[i] = int(serialInArray[i]);

        }

      }

    }

  }

}

Working with Electrons | Final Project – Pellegrino (Cossovich)

Final Project | Power Bank

Presentation: Final Project Powerpoint

Objective:

The objective of this project is to build a power bank as DIY as possible for the purpose of learning, experimentation, and for exploring using different chips, navigating blueprints, printing PCB and more. Ultimately, my goal is to build a functioning power bank as “from scratch” as possible. So if it’s possible for me to print the PCBs for both circuits and assemble it, that’s the best option. However, if it’s only possible to print one, or simply to use preassembled modules, that’s also an option although it’s slightly less to my objective of building it completely DIY. Overall, my objective is an explorative inquiry into understanding how a power bank works through building one as DIY as possible.

Inspiration:

My original inspiration for this project simply comes from Shanghai in general. I use my phone a lot when navigating the city both for directions, transportation, and payment alike. However, my phone has, on far too many occasions, run out or nearly run out of battery while I’m out in the middle of the city. For this reason, I’ve always wanted to invest in a power bank or portable charger so as not to run into this danger again. Additionally, I didn’t previously know very much about portable chargers or how they work. Therefore, for my final project, I decided to build a power bank so that I would have one for my phone if needed, so I could learn how it works, and for the satisfaction of building something myself.

How it works:

In it’s most basic sense, a power bank contains two circuits that work as follows: the first is the charging circuit which is designed to charge a Lithium-Ion rechargeable battery. Then the second circuit, the booster circuit, is designed to step-up the voltage from the battery from 3V to 5V so that it can be output to a phone or device at the required 5V.

The basic function of the power bank.

Additionally, when shopping for a power bank, it’s usually customary to check for two main things. The first is the bank’s size in mAh. mAh, or milliampere hours, is the capacity of the battery which is equal to its average amperage multiplied by the number of charging hours. In conventional power banks, this range is generally from 2,000 to 12,000 mAh. Essentially, the higher the mAh, the more times you will be able to charge your phone from it before needing to recharge the bank itself.

Another thing to check when looking for a power bank is its average amperage, or current, that is drawn by the phone or device. Generally, at least 1A is required to register that a device is charging, but overall, banks average between 1-4.8A. The higher the amperage, the faster your phone will charge. So both capacity and speed are the two major components that differentiate various power banks.

The charging circuit itself is usually a TP4056 module. This module is specifically designed to charge single-cell lipo batteries and requires an input voltage of 5V and runs at a fixed 4.2V. The module itself can have customized amperage depending on which resistor is used in the pin 2 connection to ground. The recommended amperage is roughly 37-40% of the battery capacity. In this case, it should be configured to roughly 814-880mA for the 2200mAh battery (described below) which would require using roughly a 1.33k ohm resistor (1.5k ohm –> 780mA; 1.33k ohm –> 900mA). However, as will be explained below in my procedures, I left the module untouched with its standard 1.2k ohm resistor that provides the maximum amperage of 1000mA.

TP4056 Module

This module includes two LEDs which indicate charging. The red LED indicates the device is charging while the green LED indicates standby. If the input voltage is too low (within 30mV of the battery’s voltage) the module will enter standby mode, dropping current output to less than 2uA. In this case, the LEDs will be off. Furthermore, the LEDs will be off if the temperature of the battery is either too high or too low (this is monitored with an NTC thermistor), or if there is no battery output connected.

The battery is a 18650 Lithium-Ion Cell designed with a nominal capacity of 2200 mAh and a nominal voltage of 3.7 V.

As for the booster circuit, there is no clear or defined module. The circuit itself is a DC-to-DC step-up power converter intended to step up the voltage between the input and output while stepping down the current. Most modules function with at least a diode and transistor, to help control the current flow, along with a capacitor and inductor, to help store energy.

Basic Booster Converter

Additionally, the general function enacts through a MOSFET switch (other switches can be used, but generally booster circuits use a MOSFET). The MOSFET works as a transistor that switches between an open and closed state. In the closed state, the inductor receives current flow and generates a magnetic field which stores some energy. In the open state, the magnetic field collapses in order for the current to continue flowing towards the output. This actually reverses the current flow through the inductor and puts it in series with the source. With the inductor and source in series, a higher voltage is attained.

Additionally, the capacitor is charged in parallel with the device at the same boosted voltage. Therefore, when the switch goes back to the closed state, thus reversing the current flow in the inductor and generating a magnetic field while eliminating the inductor and source working in series, the capacitor, protected by a diode to flow to the source, continues to provide the same voltage to the output load.

In essence, the booster circuit works through a switch, generally a MOSFET, that alternates between an open and closed state. The voltage is boosted through the inductor’s reaction to the alternating switch, which puts it in series with the source. Then this voltage output is sustained through the capacitor which is charged simultaneously with the load while the switch is open and then charges the load itself when the switch is closed.

Part I: Booster Circuit Research

After the preliminary research into how the power bank functioned both as a whole and through its individual circuits/components, my next step was determining which booster circuit I should use. While the charging circuit was clearly defined with the TP4056 module, I needed to decide which booster circuit would be best. In this case, I define ‘best’ as being a chip with a clear and readable schematic, datasheet, and explanation of functionality, it should be easy to acquire/available through a Taobao order at a reasonable price, it should be relatively easy to solder (the shape of the component itself shouldn’t be too small and the legs should be well-spaced), and it should have a decently high current so as to provide effective and efficient charging to my device.

Some of the chips that I researched included the HT7750A, MAX641, and LT1111. While I won’t go into too much detail since I didn’t use any of the above chips, they were all configurable booster converters which allowed for stepping-up 3V to 5V, which we needed, or could be configured to step-up a variety of range of voltages. The biggest thing to consider between the above chips was their amperage and their shape. The HT7750A provided the highest amperage, but only at 200mA which is not high enough to be readable by a phone that requires a minimum of 1000mA. Additionally, most of the chips were made to be soldered to a PCB through a machine and are not designed in a friendly way to soldering free-hand.

In the end, we settled on the PAM2401 which, although still providing a challenge to solder, was easily accessible through Taobao, provided 1000mA, and could be configured to boost 0.9-4.75V input to 2.5-5V output (but we just need the 3V-5V configuration).

Part II: Developing Schematics & Board

Now that I knew both circuits required in the power bank, the TP4056 to charge the battery & the PAM2401 to charge the phone, the next step was actually developing the schematic for each and printing the board. Unfortunately, this part, along with the previous research portion, required a lot more time than I had anticipated which will be more evident in the later parts of this inquiry. Because the research process took so long, I didn’t have time to really sit with the schematics or designs as much which explains why there are so many different trials and attempts before settling on a single PCB blueprint that I downloaded prearranged.

TP4056 (trial 1):

I first attempted to recreate the above schematic from the TP4056 datasheet in Eagle. The biggest challenge in this stage was ensuring I used the correct library so the components that I placed would be the correct dimensions for the physical pieces. Additionally, neither Eagle or the Sparkfun library that I had downloaded included a model for the TP4056 chip and I had trouble finding another library that had it.

TP4056 (trial 2):

As a second path, I found the above prearranged Eagle schematic from e-radionica‘s GitHub. This looked complete, however, I had difficulty matching it exactly to the datasheet’s schematic. Additionally, it used a different chip in the Eagle schematic (a DIO5158 instead of the TP4056). To the best of my knowledge, the creator of this schematic used the DIO5158 under the assumption that it has the same dimensions and physical construction of the TP4056 which allows it to sit as a placeholder in the schematic. I attempted to move forward with the downloaded schematic, however, and went about replacing the resistors (which were previously surface-level) with through-hole resistors to make the soldering process easier. However, this was quite time-consuming and I was still unsure if this was the correct schematic so, as will be explained below, I switched to the double-sided complete schematic.

TP4056 (trial 3):

In my second attempt, I found another premade schematic from circuitdigest. However, this used a different opensource software called easyeda rather than Eagle. This schematic came complete with both the charging module and the booster module, however, I isolated the charger module in the below schematic.

I found this schematic much easier to read and it included the correct central chip so I felt more comfortable moving forward with it. The next step, similar to the above attempt in Eagle, was replacing the resistors so that they were through-hole resistors. I then exported it to a board where the long journey of placing/arranging the components began. Two of the attempted iterations are below, however, there were many many many more iterations that I didn’t document.

After spending a good number of hours trying to puzzle through a convenient placement, I decided it was time to move on. Unfortunately, because the initial research and schematic organization process took so much time, I did not have enough time to keep attempting the placement process. However, through the process, I learned a lot about placement theory, such as the order in which components should be placed depending on their nature (i.e. the USB should be at the edge of the board no matter what so it can be connected while the chip should be placed relatively center since it is the focus) along with orientation (i.e. it’s good practice for all components to be oriented in the same direction, either vertically or horizontally).

PAM2401 (trial 1):

For the PAM2401, I used Eagle to design the schematic based on the datasheet configuration.

Datasheet Schematic

Eagle Schematic

This process was much easier since I’m more familiar with the schematic drawing software from working with both Eagle and easyeda. However, after completing the schematic, I realized that the chip I’d been using provided in an Eagle library was different from the chip used in the schematic in that it was missing the PG pin. While they are the same chip, it turns out there are different models/variations of the chip. Due to the impending time constraint, I decided not to pursue the research to correctly wire the model of the chip found in Eagle.

TP4056 & XL6009:

In the end, I settled on using the preassembled schematic and circuit board found through easyeda. Whereas before I’d isolated the TP4056 portion of the circuit, I decided it would be more time effective to simply leave it together with the booster circuit so that they could be printed all at once.

 

While the charger portion of the circuit utilizes the same TP4056 module, the booster side of the circuit uses a different chip, the XL6009. While this chip is still a DC-to-DC boost converter, according to its datasheet its typical uses are designed for higher voltages. For example, the general voltage input range should be between 5V to 32V. While the absolute minimum voltage the chip can take is said to be between -0.3V and 36V, it’s typical configurations are aimed at inputs of 5V or higher. Our booster converter, again, should be 3V to 5V so, while there’s a little concern as to whether this will be an effective booster, at the very least the schematic is readable and the PCB board is already assembled for printing which, at this point in the project, is essential for saving time.

Part III: Printing the PCB

Printing the actual PCB was probably the most exciting process of this project (aside from soldering just because I really do love soldering). The PCB blueprint was for a two-sided PCB, which made it a bit more complicated, but the machine itself was very explanatory.

Attempt 1:

In printing, the biggest thing to pay attention to was which drill the machine required to ensure that it could remove the correct bits of copper effectively.

In the first printing attempt, I accidentally flipped the board without checking that it was aligned in the same position. This caused the backside of the PCB to be printed slightly off-center from the front which blocked some of the holes.

Attempt 2:

On the second attempt, the PCB printed fine overall, however, it did not remove the excess copper from the top layer.

Because of the excess copper on the board, it would be nearly impossible to solder it because any solder that overflows onto the excess copper would force unintentional connections in the wiring.

In the end, not only did the final PCB have excess copper on the surface, but the PCB printing machine we have is not equipped to print the small VIA (vertical interconnect access) holes which the board design requires to make connections between the two sides of the PCB.

Even though the board was relatively unusable, I still wanted to at least try soldering the small TP4056 chip onto its surface. Unlike the perf board that I’d used in the mid-term which functioned entirely with through-holes, the chip in this circuit is only surface level. I soldered it by first adding just a small dot of solder to each point on the PCB that had a connection. Then I did the same to each leg of the chip. Finally, I used the iron to basically melt the two together. In the end, I think it is slightly crooked, so if the circuit was fully assembled it would not work properly, however, it was still good practice for the full ‘DIY’ experience.

Part IV: Circuit Assembly

Despite all of my research and groundwork provided in the previous steps with the goal of creating a completely DIY power bank, in the end, I had to compromise to assembling the circuit with premade circuit modules for both the TP4056 and the booster circuit.

Since the circuits were already assembled into PCBs with USB connectors, the most challenging aspect of this part was simply figuring out how to solder the battery. After watching a video tutorial, I soldered it by first scratching the surface of the battery end a little before applying a healthy amount of flux and then soldering by continually feeding the solder until it finally stuck. Then I used hot glue to ensure it wouldn’t pop off.

Part V: Does it work?

Now that the power bank is assembled, the biggest remaining question is, does it work? So the first test was simply to see if it worked at all.

I used Kevin’s phone, which was completely dead and turned off, to test and it takes a micro-USB cable. After plugging it in and turning on the booster module with the switch, the phone did register charging because a white light started blinking at the base. After about a minute, the phone actually powered itself on, as dead phones do when they charge, which, without acute measurements, means that at the very least, the power bank works to charge a phone. Once the phone was on, it did not register on the screen itself that it was charging, however, very gradual the battery life would increase.

When I tested it on my phone, which is an iPhone requiring the lightning bolt adapter, it similarly did not register the charging state on the phone itself, however, the overall charge percentage would gradually increase. The overall charging is very slow, however, due to the low current of the booster circuit (which will be explored below). For example, I kept Kevin’s phone charging throughout the entirety of our project presentations last Thursday (roughly 2 hours) and it went from completely dead to 10% charge. So although it is quite slow, it works.

Part VI: Measurements

Pre-Assembly Individual Circuit Voltage Measurements:

Before assembling the circuit at all, I measured the input/output voltages of each circuit uniquely. When provided 4.91V by the power regulator, the TP4056 module maintained a constant output of 4.1V. Additionally, the booster circuit (which is a mysterious circuit we found in the lab, who’s exact chip or core is unknown), when given 3.06V from the power regulator, output 5.06V.

TP4056 Module:

In terms of the TP4056 module, Rudi helped me wire it with a multimeter that can read current.

While in standby mode (green LED, not charging), the current measured at about 0.1uA.

In charging mode (red LED), the current measured at roughly 340mA and an output voltage of roughly 4.15V.

Using the above measurements, we can calculate the circuit’s wattage using current * voltage: 1.411 W = 4.15 V x 0.34 A.

Additionally, we wanted to test the charging trend over time. The battery itself was already almost charged. Initially, it read 3.96V and, after running the charging module for roughly 5min while we measured the current, the voltage had increased to 4.2V. In that short time, it was evident that, as the voltage increased, the current decreased (which makes sense in order to satisfy Ohm’s law that current is proportional to the voltage across two points).

In order to explore this concept further, we first had to discharge more of the battery.

Using the booster circuit, I attached two wires to the USB output.

I then connected the booster circuit to a motor. The motor draws a high current so, after turning on the module, it was effective in rapidly discharging the battery.

As stated above, the battery initially had 4.2 V. After 30 minutes of charging the motor, the battery had decreased to 3.874 V. In further inquiry, I would continue discharging the battery using the motor and monitor not only the voltage but the current as well. From there, I would use the TP4056 module to charge the battery and, similarly, monitor the current and voltage in 5-10 minute increments. With this information, I would calculate the circuit’s overall average efficiency using the efficiency formula [(Poutput / Pinput) x 100%].

Booster Module:

As for the booster module, I would like to follow a similar line of inquiry as above and monitor its charging of a specific device (ideally a phone) over time and, additionally, calculate its average efficiency.

In terms of actual measurements, I compared the current and voltage output of the module when connected to my Bluetooth earbuds and to my iPhone.

***** disclaimer [start] *****

When completing the measurements, I recorded all measures of current in mA. However, as evidenced by the measurements below, 1.35 mA is frighteningly small and relatively impossible for charging a phone that requires a minimum 1A. Therefore, while I will keep the measurements as I have in my notes to maintain their integrity, it’s possible that the measurements between these disclaimers should be in A rather than mA (ex. 1.35mA –> 1.35A) as a result of poor recording.

First, the quiescent current (or measurement of current when there was no load attached) measured at roughly 2.05mA and 5V.

When attached to my Bluetooth earbuds, the red light on my earbuds illuminated to indicate charging. The current measured at 1.72mA (see disclaimer) and the voltage at 5.045 V.

Finally, when connected to my iPhone, the iPhone itself did not indicate that it was charging. However, the charge did increase from 13% to 14% and the current measured at 1.35 mA (see disclaimer) and the voltage at 5.09 V.

Additionally, I think there is a discrepancy because, even if we switch all the measurements of current into A, it doesn’t seem likely that the quiescent current should be higher than the current when there is a load attached. Therefore, I think it’s possible that the quiescent current is accurate at 2.05 mA and I forgot to switch units when measuring higher currents with the load. Altogether, I’m not entirely sure where the error is in these measurements, but my best guess is that they should read 2.05mA (quiescent), 1.72A (earbuds), and 1.35A (iPhone).

***** disclaimer [end] *****

Part VI: Summary of Measurements

Overall, the power bank works in the sense that it is capable of re-charging a lipo battery and can then discharge the battery through the booster circuit in order to charge a device. While the TP4056 module functions with similar general parameters as was expected through its datasheet, continued inquiry would involve both monitoring its usage overtime along with calculating its efficiency so as to have better comparable evidence of its function.

Additionally, with the booster module, I would like to continue with a similar inquiry into its usage over time along with its efficiency. However, the module itself is still a mystery to me because it doesn’t appear to have incorporated a specific chip. So, while I don’t have a datasheet to reference it with, based on the general input/output measurements it seems to function like a basic boost converter as I explained above in Preliminary Research. It would be good to know more about how this circuit works to see if its possible to modify it for higher currents. While overall the power bank functions effectively, it is not very efficient because the loads on the booster converter are unable to draw a high enough current.

Part VII: Housing Fabrication

Now that the circuit is functioning and we have gathered some measurements of it, the final step is to actually encase it in something so it is functional for everyday use. My goal for the power bank’s design is to be both small and to be comfortable to hold in your hand so it is more effective as a transportable device.

I first used hot glue to arrange all of the components around the battery. I tried to keep it as compact as possible while also keeping the USB connectors and button in a reachable location. Additionally, the glue helps to create a surface for the modules so that they’re supported in the back when you plug in a chord. However, it’s important to avoid gluing directly behind any of the module’s central chips since its possible they could heat up and melt the glue.

I decided to crochet the case out of yarn because it is softer than a 3D or laser cut fabrication which would make it more comfortable to carry in a pocket. My only concern with the crocheted case is that it might insulate heat when the modules are engaged. However, I made sure to use a relatively looser stitch which will hopefully allow the circuit to breath.

   

I made sure to leave a hole on either side of the case for the USB chords and, additionally, left a small hole on the top for accessing the button. In the end, it doesn’t look like your conventional power bank, but with its small size and soft texture I think it works nicely for carrying it easily and comfortably in a pocket.

After closing the case, I realized that I forgot to include a space in the crochet for viewing the LEDs on the charging module which is essential to knowing whether the battery is charged/charging. However, after testing the charging circuit in the case, it turns out that the LEDs reflect really well and are visible through the holes in the crochet. So even though they’re not entirely clear, they are readable.

Materials: 

The materials list really depends on which construction you follow. As elaborated above, I initially researched a number of different circuit configurations before settling on using the assembled modules.

For Module Based Assembly:

  • 18650 Lithium-Ion Rechargeable Battery (x1)
  • TP4056 Lipo Charging Module (x1)
  • 3V to 5V DC-to-DC Booster Module (x1)
  • Slide Switch (x1)
  • Wires (xMany)
  • Hot Glue
  • Yarn & Crochet Hooks

For Measurements:

  • Multimeter with current reading capabilities (x1)
  • Alligator Clips (xMany)

For Complete DIY Assembly:

  • TP4056 Chip (x1)
  • XL6009 Chip (x1)
  • 1k ohm resistor (x6)
  • Red LED (x1)
  • Green LED (x1)
  • Micro-USB (x1)
  • 5k ohm resistor (x1)
  • 220uF capacitor (x1)
  • 47uF capacitor (x1)
  • 1uF capacitor (x2)
  • 1N5824 Diode (x1)
  • 10uF capacitor (x2)
  • 33uH inductor (x1)
  • NTC thermistor (x1)
  • USB-A3 (x1)
  • 18650 Lithium Ion Battery (x1)
  • Zener Diode (x1)

Depending on which construction you make, further materials lists can be made by referencing the relevant datasheet linked above.

Improvements:

The most significant improvement that I would like to make with respect to this inquiry as a whole would be overall time management. I spent roughly 75% of the process researching how power banks work, how each circuit in the bank works, along with researching so many different chips for the booster converter that when it came time to actually design the power bank, I didn’t have enough time to really sit with and test various schematic constructions, PCB blueprints, or to thoroughly measure and document the end circuit’s functionality. While I certainly learned a lot through the research process, it’s time consumption prevented me from creating a completely DIY circuit as I had intended.

In terms of the power bank itself, some improvements that I’d like to implement in a future iteration would be:

  • Using a slide switch rather than a push button to activate the booster circuit,
  • Research into the mysterious booster circuit module that I used and see if there’s any way it can accommodate a higher current so as to facilitate faster device charging,
  • To more thoroughly document the two circuit’s current/voltage relationship over time along with their efficiency, and
  • To wire exterior LEDs to the charging circuit so they are more visible to the user.

Final Remarks:

I entered this project with the goal of creating a power bank as DIY as possible. While I, unfortunately, was unable to use my own designed or printed PCB for the final power bank, I did get a taste for the process of designing your own. Through the extensive pre-assembly process, I got much more comfortable referencing and reading datasheets, understanding how specific components function in a circuit, and, more specifically, how slight changes in resistors or other components can modify the circuit’s stats. Additionally, I familiarized myself with importing/modifying/designing schematics using both Eagle and easyeda software and gained a new respect for the process of organizing components on a PCB for printing. Finally, even though there are possible discrepancies in my measurements above, I think I gained a better understanding not only of how to complete these measurements, but also in how to compare them back to their respective datasheet and use the measurements to better understand the circuit functionality itself.

In the end, while the final power bank was a simple assembly, the many failed attempts and trials to create it completely DIY were extremely rewarding and fundamental to the overall learning process.

Works Cited

https://www.belkin.com/us/resource-center/portable-charging

https://circuitdigest.com/electronic-circuits/power-bank-circuit-on-pcb

https://circuitdigest.com/electronic-circuits/power-bank-circuit

http://www.learnabout-electronics.org/PSU/psu32.php

https://en.wikipedia.org/wiki/Boost_converter

https://en.wikipedia.org/wiki/MOSFET

Final Project (Guiding Light) Mike Jung, Rudi

Personal Definition of Interaction

My personal definition has not changed from the beginning of the semester. I still remember one day that we had to write our own definition of interaction. Even though I had just joined the class, after reading the materials that was assigned it was very clear for me what interaction was. When I heard the word interaction, I thought simply it is communication between human and human,but after taking this class, the definition of interaction has became more clear and vivid for me. After thinking what interaction was, and having to make projects with arduino and processing my definition has become more clear. My personal definition of interaction is always happening between at least 2 objects. It could be people to people, people to computers, and even computers to computers. When a movement, action, sound, or even any input is inside a value, and which creates output is an interaction. But to be sure, if the input does not create output for example like error, then we can not say there is an active interaction. Giving examples of interaction could be anywhere we go, the noise that family mart makes, us typing the keyboard, and even us talking on the phone. Also I learned that the games we daily play is not really easy to make. Even though they might not use the same processing or arduino, the fact that they have to make every vaulse and corrections seems really hard after making my own project in IMA.

 

Concept and Design

From the beginning of the final project we faced the most difficult problem as usual. Me and my partner always have a lot of ideas that we want to make, but that fact that we are not really good at putting them into reality. The first idea we had was pretty good in my mind. We wanted to make a robot like R2D2 or BB6. In order to do that we had to use bluetooth sensor and change and connect the controller with our processing and arduino. We had already bought the BB6 model to make, and while we were planning and learning how to change the controller and the bluetooth, we were stuck. We decided to not use the bluetooth sensors and come up with the different idea. We have made our first mistake in this. We should have pursued our goal by asking our professor. It was totally our fault even though Rudi reached out to use to help, we did not ask or get advice from him.

 

Moving on to the second idea, we were going to make a skateboard with LEDs for the safe skateboarding when it is dark. Since longboarding and skateboarding is trend right now, a lot of people are hurt or get into an accident since they do it in the dark. In order to do that, we needed more time to do so. And also we had to buy more things that was too much for us.

 

After another failure of making idea into a reality, our final decision was to use the laser module that will guide the way to the steps. We have connected 2 servos using the 3D printer, and connecting them to the laser. Our intention was put the mirrors on where ever we want, and by adjusting the laser machine, we can point the ways or directions. We have accomplished to make the laser machine to point the points horizontally and vertically. Since we were using the mirrors reflection, we thought that the light will be strong enough to guide until the last step. But the light was not strong enough. As Rudis’ comment it is true that we have found the spinning table at the last moment of our project, since it was cool to use. But since we wanted to make the full table of foods with the laser pointing from the appetizer to main dish and to dessert, we thought it could look better since we are in china, and chinese foods mainly come in a course menu.

 

Purpose and Significance

Our purpose came in from the laser show that people think it is really cool. One exhibition really got us into putting this project. Which was called Nescafé’s commercial that uses lasers and many mirrors to reflect the lasers to make a really cool shape. From this we got the idea of putting our project together. In my personal opinion, we could have really made this cool by adjusting the locations and the stronger lasers. Since this is just a exhibition we wanted to make it use for something that may be useful. As I explained in our presentation, Jeff and I went to Korean restaurant which the food order is similar to chinese restaurants. And jeff picked more than 3 main dishes that we would not be able to finish. From this we got the idea that if we had a display of the foods and lasers pointing at the foods using the mirrors, we would not have to face this kind of problems and also convenient for the people who serves us food. We would not be asking about how to order the food and people who are looking at the food will be also interested and amused by how pretty it is.

User Testing

We have got a lot of critical comments that led us to change a lot of the project. When we were presenting to our classmates and professors, we just had our laser machine built. From this user testing, most of the comments were “What is the purpose of this?”,”Just for fun or does it do something.” From this comment we came up with what we have, and even though we got comments that we should use the stronger laser, we were not able to change that even though we knew that the light was not strong enough since we were lacking time.

 

Conclusions

Our final goal of the project was to create a visual and creative way to show the customer of the restaurant how the course menu would work. I think our project did align with the my definition of interaction. It did have input and output and also human was interacting with the device with is technology. On the other hand I think we could have made the project better by letting the people to control the laser machine we have made. Since it was just sitting in one spot, I think it did not fulfill my definition of interaction. And also if we have more time, we will change the laser to be stronger and arrange the plating again so whenever a person points at the start of the dish, they will get to the point of dessert. From our failure, I have learned again that time management is really important, also I should reach out for help or get help from other like friends and professors if they recommend it. But also I think Jeff and I have accomplished a lot of thing not only from the final project, but also in class generally. I never thought I will be doing something with computer programming, but now I have better understanding of how I can make and make codings. I am very proud that I made it until the last project and also that I can show people some of the work I have put in.

 

 

import processing.serial.*;

import processing.sound.*;

SoundFile file;

Serial myPort;

int valueFromArduino;

void setup() {

  fullScreen();

  background(0);

  printArray(Serial.list());

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

} 

void draw() {

  stroke( mouseX, mouseY, 0);

  line( width/4, height/4, mouseX, mouseY);

  line( 3*width/4, height/4, mouseX, mouseY);

  line( width/4, 3*height/4, mouseX, mouseY);

  line( 3*width/4, 3*height/4, mouseX, mouseY);

}

void mouseMoved() {

  setServo(0);

}

void mousePressed() {

  background(random(255));

}

void mouseDragged() {

  setServo(1);

}

void setServo(int laser) {

  int h = int(map(mouseX, 0, width, 1800, 500));

  int v = int(map(mouseY, 0, height, 1800, 500));

  //println(“h: ” + h  + ” ” + “v: ” + v);

  myPort.write(h + ” ” + v + ” ” + laser + ‘\n’);

}

 

 

 

#include <Servo.h>

Servo horizontal, horizontal1, vertical, vertical1;

#define LASER 11

void setup() {

  horizontal.attach(9);

  vertical.attach(10);

  horizontal1.attach(13);

  vertical1.attach(7);

  pinMode(LASER, OUTPUT);

  Serial.begin(9600);

}

void loop() {}

void serialEvent() {

  int h = Serial.parseInt();

  int v = Serial.parseInt();

  int I = Serial.parseInt();

  if (Serial.read() == ‘\n’) {

    horizontal.writeMicroseconds(h);

    delay(1);

    vertical.writeMicroseconds(v);

    delay(1);

    horizontal1.writeMicroseconds(h);

    delay(1);

    vertical1.writeMicroseconds(v);

    delay(1);

    digitalWrite(LASER, I);

  }

}

Final Project: Traditional Dress Around the World — Iris & Luna

1.   PROJECT NAME: Traditional Dress Around the World

2.  PROJECT STATEMENT OF PURPOSE

The chief purpose of our project is to help people to understand different traditional dresses from different countries around the world with fun. In this modern age, the whole world is connected closer and it’s easier to meet people from a different country with a different cultural background with us. Therefore, diversity is becoming a more important issue nowadays. Especially in NYU Shanghai, we have students from more than thirty-two countries all over the world. When meeting with people who have a different cultural background, it’s important to know about his or her culture. This can show your sincere respect to the different cultures. Also, without understanding these different cultures, maybe your unconscious action is offensive in another culture. Therefore, we design this globe to help people to understand the diverse dressing cultures more. What’s more, traditional cultures keep disappearing nowadays since fewer people pay attention to these cultural heritages. However, these traditional dresses passed on by our ancestors are the physical embodiment of our history and the soul of our culture. We can’t make these invaluable cultural heritages disappear.

In conclusion, our project intends to help people to understand different traditional dressing cultures and arouse people’s attention to the disappearing traditional culture.

3.  LITERATURE AND ART, PERSPECTIVES AND CONTEXTS

Our idea came from the huge globe model in Shanghai Navigation Museum, on which the pattern is shown by the projector. What’s more, the audience can interact with the globe. I found that it’s an easier and more interesting way to learn geography by combining the knowledge with image and the information is shown more clearly than a planimetric map. Therefore, I came up with the idea to make a globe which can also show different types of geographical knowledge. Originally, this project is intended to help children to learn some essential knowledge about geography in an interesting way.

Link: https://timgsa.baidu.com/timg image&quality=80&size=b9999_10000&sec=1544900365832&di=d4333b6dd79135619767104d963b5d13&imgtype=0&src=http%3A%2F%2Fs3.lvjs.com.cn%2Fuploads%2Fpc%2Fplace2%2F2017-12-06%2F5b27dcbd-9961-4b15-8039-d5c7feeee56c.jpg

However, after reading the article about the commodification of the culture of Wa, I came up with the idea that I could use the globe to help people to learn about the traditional cultures, other than the geographical knowledge. The use of a globe is not limited to the study of geography. Also, after learning the real time pixels and seeing the example of monalisa, we decided to use this skill to show the image of the users wearing different traditional dresses.

4.      PROJECT DESCRIPTION

The main part of our project is the globe. There are six buttons on each continent except Antarctica. When starting the processing, a world map wil appear on the screen. When the user press the button, several names of countries from that continent will appear on the screen and user can use three buttons on a box to choose which country’s traditional dress they want to try and learn about. After choosing the country, the picture of that country’s traditional dress will appear but the face of that picture will be the user’s face captured by the camera. We use the face library in processing to automatically recoganize face and when huaman face is detected at the right place, processing will save the image automatically. Besides the picture, there is also some information about the traditional dress, including the name, how they look and why people dress like this. Users can choose to retake the photo by pressing the button on the box. They can also choose to return and choose another country.

5.    PROJECT SIGNIFICANCE

Our project is intended for not only children but also adults since this project is easy to understand and interesting to interact with. Also, all the people, including both children and adults should know different traditional cultures around the world. By interacting with our project, the audience can have the chance to take a selfie in different traditional dresses as well as learn something about the traditional dresses. As is mentioned above, in this globalized world, it’s important for every one to learn about the traditional cultures since the traditions are disappearing and people nowadays have more chance to interact with people from a different cultral background. With our project, I hope more people can learn about various traditional dress culture.

6.      PROJECT DESIGN & PRODUCTION

At first, we planned to use a tellurion. However, after trying to saw it with a saw and even an electronic saw, we still failed to cut it into two halves. Then, we tried to 3D print a hollow ball and print a map to stick on the ball. However, we were told that it’s difficult to print such a big hollow ball. After that, we bought a polyfoam ball. However, we failed to cut it into two halves again since it was too fragile. Finally, we got a suggestion from our Professor Cossovich that we could use laser cut to make a globe. After so many times of failures, we finally successfully got a ball by laser cut.

Then we begin to work with the code of processing. We used a cute gif of the Earth as the begining picture. Then, a world map will occur on the screen, with the names of the countries that users can choose on different continents. After pressing the button on a continent, the user can use the mouse to choose which country’s traditional dress he or she wants to try.  It took us a lot of time to move the pixels captured by the camera to the part of the face of the pictures of traditional dresses. Then, the user can click save the image to take a photo or back to map to choose another country.

After user testing, we got lots of helpful suggestions. Firstly, We added some short introductions to the traditional clothes so that the users can learn more about the dressing culture, including the name of the dresses, how they look and why people there dress in this way. Secondly, we changed the data of the pixels so that when the user facing the camera right in the middle, the image will also in the middle. Also, we made the camera like a mirror so that when the user moves to the right, the image on the screen will also move to the right. Thirdly, we moved all the interaction part to the button. Users can choose the country by the button instead of the mouse. Finally, we used the face detection library so that processing can automatically save the image when the camera detects a human face. Users can press the button to retake the photo or go back to the map. We also got the suggestion that we could add traditional music from different countries as the background music. Therefore, besides traditional dressing culture, users can also learn about traditional music. What’s more, the style of traditional music often fits the style of traditional dress. Users can have a better experience and understanding with the music. However, for lack of time, we failed to add background music.

After that, we began to connect the buttons to Arduino. Originally, we thought it was an easy job. However, we met lots of difficulty in this step. At first, the button didn’t work and we thought that maybe it was the problem of wires. Therefore, I weld the wires to the buttons again. However, the buttons still didn’t work. Then, we changed the breadboard and Arduino to check if it was the problem with our equipment, but the buttons still didn’t work. Finally, we turned to Professor Cossovich for help. He helped us to connect the circuit in a different way and the buttons finally worked.

After successfully connecting all the buttons to Arduino and connecting Arduino to Processing, I began to complete the final step — assemble the globe. Because we made some mistakes in the drawing of laser cut, we have to use glue to stick all the components together. Finally, we printed out the map and stick it onto the globe.

7.     CONCLUSIONS

The goal of our project is to help people to help people to understand different traditional dresses from different countries around the world with fun. If we have more time, we will add background music. Also, we’ll include more costumes from different countries, hopefully all countries from which all the students in NYU Shanghai come from. For the sake of beauty, we’ll add LEDs on the globe and when the users choose one continent, this continent will be lightened. From this project, I learned that everything should be prepared earlier since we completed our project only one hour before the presentation. I also learned that in an interactive project, user experience is the most important thing. For example, if the pixels of the camera are shown in the opposite way, the users will feel it difficult to put their face in the middle.

At last, diversity is one of the most important features of today’s world. Also, traditional cultures are disappearing at an alarming rate. It’s important for everyone to learn about different cultures as well as the traditional cultures and pass down these valuable heritages.

Interaction Lab Final Project Fall 2018

Final Project Documentation

Documented on: December 18th, 2018

Documented by: Cyrus Guo

Instructor: Professors Eric & Young

Aim: Describes and assesses the process of the project with the benefit of practical experience and objective hindsight.

CONCEPTION AND DESIGN:                              

From the start, I realized that my original design of an Arduino Processing snake was not going to be interactive or interesting enough for this final project. In the end, the design of this project was intended to be a continuation of my midterm project. After some feedback from that project, I realized that if I were to make an instrument project again, the ergonomics needed to be better; and what is more natural than the shape of your own hand? In the end, the goal of my project was to create a musical instrument with arduino and processing that facilitated interesting interaction within your body parts. I wanted the user to interact not only between their two hands, but also between the fingers of each hand as well.  When one of the four fingers touches the thumb, a note plays. Since there are only four fingers on each hand, a potentiometer on the top of the hand turns between four intervals, essentially extending the range of notes to two full octaves (with three Cs). I originally wanted a flex sensor on my elbow joint to be the interval changing mechanism, but since my flex sensor was broken, I tried an accelerometer. However, the accelerometer was not completely applicable to my project, so due to a time and resource constraint, I ended up using a potentiometer  (see diagrams in next section).

From the beginning, I knew that I wanted to use 3D printing to create the gauntlet, since my midterm project did not involve it. Also, I wanted to use some other interesting materials that I had not used before, and I got the opportunity to do so with transparent filament for my LED to shine through and conductive glue to create connections between the fingers and thumb.  

(3D printing process  ↓)

Transparent Filament on palm( ↓)

FABRICATION AND PRODUCTION:

Before the arduino and processing parts, since I had a good idea of what I wanted to build, I started with the digital fabrication component of my project. First, since Nick had kindly donated a glove to me, I started with the 3D printed finger pieces of the gauntlet. Even though I had already procured the .STL files needed, I also needed these components to actually fit on the glove and by extension my hand.  Since the UP Studio 3D printing software is unable to scale based on real dimensions (inches, cm, etc.), I had to test print multiple parts and extrapolate a size to print. After everything was printed and fitted onto the glove, I had to carry on with the sensor component of my project. I knew that I wanted some interesting sensor to use to change intervals, but the flex sensor and accelerometer were not functioning the way I wanted them to.  In the end, I used a potentiometer to easily change the intervals. I mounted switches onto each finger and had them press against the thumb piece to create the notes. With the physical portion completed, I was ready to move on to the Arduino-Processing coding section.

During the user testing session, my project was mostly working, so I was able to acquire some valuable feedback. The testers’ biggest concerns was that the switches were hard to press and not aesthetically pleasing either. Also, many testers believed that there was a lack of feedback when the notes were played. From here, I knew what to improve with my project. Instead of switches, I ended up using conductive paint, as it blended in with the color of the gauntlet pieces, and it allows me to use a larger contact surface area for ease of use.  To address the issue of feedback, I added a light on the palm of the hand shaped like Iron Man’s repulsor that glowed only when a note was played. With this, my project was complete, and everyone who I asked to test my project after these changes were satisfied. Despite the final project being a far cry from my original sketches, I believe that the changes were good and the project in the end also aligns with my original vision. Here are some evolutionary sketches (chronologically ordered):

  

CONCLUSIONS:

The goal of this project was to make a fun instrument with an interesting interactive twist inspired by Iron Man. Since interaction as a two way relationship between two or more things(any noun), this project is certainly interactive. First, from the fundamental level, Arduino and Processing must interact with one-another for the instrument to work. On top of that, there is interaction between the fingers and thumb, as they have to touch each other to make a note.  At the highest level, the person wielding the gauntlet is interacting with the gauntlet and the computer. Because of this multi-leveled interaction, almost all aspects of my project aligns with my definition of interaction, and most users thought so as well. After the initial learning curve of understanding how the project works, most users interacted with it very well and found it very interesting and fun. Most people could not tell the difference between the black plastic and black conductive glue, so the way the notes were played was almost magical. If I had more time, I would definitely incorporate much more interesting and interactive sensors to the interval changing portion of my project like I originally intended.  Also, I could make the .wav files more compatible with the aesthetics of the project (synths instead of piano notes).  Lastly, I would like to have the left hand have more interaction as well, maybe with another sensor that changes between different instruments.

From all of the resource shortages to the failed ideas, I have learned that making something out of nothing is never easy and that perseverance is key.  Nick especially taught me that if something doesn’t work, use critical thinking, figure out the root of the problem, and break that problem into smaller parts to fix it. In the end, despite all of the setbacks and failures, I was still able to make a project that fulfilled my original idea, and it served to make my project something that I’m proud of.  Even if this gauntlet doesn’t solve littering or save the polar bears, it is something interesting and shows that even with the limited technologies that IMA students have, it is still possible to create something fun and interactive.  Now imagine what we will be capable of when we learn more and have access to more equipment and resources!?

—————————————————————————————————————————————–

Demonstration of Final Project:

<script src=”https://gist.github.com/cyg229/7cdf35c7b859c7a654b0441da4129845.js”></script>

 

All code compiled in Github Gist: 
https://bit.ly/2BBYPjl

Final Project: Etch-A-Sketch+ (Thomas Waugh)

Etch-A-Sketch+

                  

Our project, the Etch-A-Sketch+ is based on the traditional Etch-A-Sketch, however ours has additional features and is more visually stimulating. The controller of a traditional Etch-A-Sketch only has two knobs, ours not only has an extra knob but also four extra buttons. The wiring is pretty sample, after all, the physical component is little more than a bonafide fightstick that one would use for a game such as Street Fighter.

The code is pretty basic. There are three knobs. The first controls the size of the circle, the second controls the x-value of the circle and the third controls the y-value. The first button randomizes the background color of the program. If the button is held down it strobes the light rapidly, producing a cool effect (epileptics be warned). The second button creates a horizontal line of circles which behave identically to the primary circle. The third does the same as the second but in a small X shape. The fourth button randomizes the inside color of the circle. The controls are very intuitive and can be mastered within seconds.

import processing.serial.*;

String myString = null;
Serial myPort;

int NUM_OF_VALUES = 7;
int[] sensorValues;

int snakeLength = 0;

int red = 0;
int blue = 0;
int green = 0;

int redBG = 255;
int blueBG = 255;
int greenBG = 255;

void setup() {
  //size(700, 700);
  fullScreen();
  background(255);
  setupSerial();
  delay(150);
}

void draw() {
  updateSerial();
  printArray(sensorValues);
  if(snakeLength == 35){
    changeBG();
    background(redBG, greenBG, blueBG);
    snakeLength = 0;
  } else {
    snakeLength++;
  }
  
  fill(red, blue, green);
  ellipse(sensorValues[1], sensorValues[2], (sensorValues[0]/4)+25, (sensorValues[0]/4)+25);
  
  if(sensorValues[3] == 0){
    randomBG();
    background(redBG, greenBG, blueBG);
  }
  
  if(sensorValues[4] == 0){
    horizontal();
  }
  
  if(sensorValues[5] == 0){
    crossShape();
  }
  
  if(sensorValues[6] == 0){
    changeColor();
  }

  
  filter(ERODE);
  delay(15);
}

void keyPressed(){
  if(key == '1'){
    randomBG();
    background(redBG, greenBG, blueBG);
  }
  
  if(key == '2'){
    horizontal();
  }
  
  if(key == '3'){
    crossShape();
  }
  
  if(key == '4'){
    red = int(random(0, 255));
    green = int(random(0, 255));
    blue = int(random(0, 255));
  }
}

void horizontal(){
  ellipse(sensorValues[1]+50, sensorValues[2], (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
  ellipse(sensorValues[1]+100, sensorValues[2], (sensorValues[0]/4)+10, (sensorValues[0]/4)+10);
  ellipse(sensorValues[1]+150, sensorValues[2], (sensorValues[0]/4)+5, (sensorValues[0]/4)+5);
  ellipse(sensorValues[1]+200, sensorValues[2], (sensorValues[0]/4)+5, (sensorValues[0]/4)+5);
  ellipse(sensorValues[1]-50, sensorValues[2], (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
  ellipse(sensorValues[1]-100, sensorValues[2], (sensorValues[0]/4)+10, (sensorValues[0]/4)+10);
  ellipse(sensorValues[1]-150, sensorValues[2], (sensorValues[0]/4)+5, (sensorValues[0]/4)+5);
  ellipse(sensorValues[1]-200, sensorValues[2], (sensorValues[0]/4)+5, (sensorValues[0]/4)+5);
  ellipse(sensorValues[1], sensorValues[2], (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
}

void crossShape(){
  ellipse(sensorValues[1]+50, sensorValues[2]+50, (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
  ellipse(sensorValues[1]-50, sensorValues[2]+50, (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
  ellipse(sensorValues[1]+50, sensorValues[2]-50, (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
  ellipse(sensorValues[1]-50, sensorValues[2]-50, (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
  ellipse(sensorValues[1], sensorValues[2], (sensorValues[0]/4)+15, (sensorValues[0]/4)+15);
}

void changeBG(){
  redBG = redBG + int(random(-3, 3));
  blueBG = blueBG + int(random(-3, 3));
  greenBG = greenBG + int(random(-3, 3));
}

void randomBG(){
  redBG = int(random(0,255));
  blueBG = int(random(0,255));
  greenBG = int(random(0,255));
}

void changeColor(){
  red = int(random(0, 255));
  green = int(random(0, 255));
  blue = int(random(0, 255));
}

void setupSerial() {
  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[ 2 ], 9600);
  

  myPort.clear();
  myString = myPort.readStringUntil( 10 );
  myString = null;

  sensorValues = new int[NUM_OF_VALUES];
}

void updateSerial() {
  while (myPort.available() > 0) {
    myString = myPort.readStringUntil( 10 ); // 10 = 'n'  Linefeed in ASCII
    if (myString != null) {
      String[] serialInArray = split(trim(myString), ",");
      if (serialInArray.length == NUM_OF_VALUES) {
        for (int i=0; i<serialInArray.length; i++) {
          sensorValues[i] = int(serialInArray[i]);
        }
      }
    }
  }
}

void setup() {
//  Serial.begin(9600);
//  pinMode(2, INPUT_PULLUP);
//  pinMode(3, INPUT_PULLUP);
//  pinMode(4, INPUT_PULLUP);
//  pinMode(5, INPUT_PULLUP);
//}
//
//void loop() {
//  
//  int sensor0 = analogRead(A0); // size potentiometer sensorValues[0]
//  int sensor1 = analogRead(A1); // x potentiometer sensorValues[1]
//  int sensor2 = analogRead(A2); // y potentiometer sensorValues[2]
//  int sensor3 = digitalRead(2); // button 1 sensorValues[3]
//  int sensor4 = digitalRead(3); // button 2 sensorValues[4]
//  int sensor5 = digitalRead(4); // button 3 sensorValues[5]
//  int sensor6 = digitalRead(5); // button 4 sensorValues[6]
//
//  Serial.print(sensor0);
//  Serial.print(",");
//  Serial.print(sensor1);
//  Serial.print(",");
//  Serial.print(sensor2);
//  Serial.print(",");
//  Serial.print(sensor3);
//  Serial.print(",");
//  Serial.print(sensor4);
//  Serial.print(",");
//  Serial.print(sensor5);
//  Serial.print(",");
//  Serial.print(sensor6);
//  Serial.println();
//
//  delay(100);
//}

Week 11 Recitation: Making a Media Controller, Professor Rudi

In this recitation, I used a potentiometer as a physical controller to control the size of a pixel the image break into.

I wanted to create something like this because I was inspired by the reading, “Computer Vision for Artist and Designers”. Quote “To do this, each video pixel’s brightness is compared to a threshold value and tagged as foreground or background accordingly”. Because this article was writing about how people use sensors to detect people’s presence and use a different color of pixels to distinguish the difference. I wanted to try it. So I broke an image to pixels and used a potentiometer to control it.

//Arduino part of the code

void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0) / 4;
Serial.write(sensorValue);
// too fast communication might cause some latency in Processing
// this delay resolves the issue.
delay(10);
}


//Processing part of the code

import processing.serial.*;
Serial myPort;
int valueFromArduino;
PImage img;
int Size = 20;
void setup(){
  size(600, 404);
  img = loadImage("hokusai.jpg");
   printArray(Serial.list());
    myPort = new Serial(this, Serial.list()[ 1], 9600);
}
void draw(){
  noStroke();
  int w = img.width;
  int h = img.height;
  img.loadPixels();
  for (int y = 0; y < h; y=y+Size) {
  for (int x = 0; x < w; x=x+Size) {
      int i =  x + y*w;
      fill( img.pixels[i] );
      ellipse(x,y,Size,Size);
    }
  }
  img.updatePixels();
   while ( myPort.available() > 0) {
    valueFromArduino = myPort.read();
   }
    println(valueFromArduino);
   Size=round(map(valueFromArduino,0,260,0,width)); 

}

final : sky snake (Annie)

To start off, we wanted our users to have an interactive experience that would utilize the body as a control feature. When debating on the method of control for our game, we didn’t want to use buttons, potentiometers, or the keyboard as a means of control because it wasn’t interesting or immersive enough for the user. After all, we thought that those controls mainly involved the hands in the context of our game, which is not anything different than a typical computer game. As we tested our game with these controls as a substitute, it guaranteed our need for a control sensor that fit our definition of interaction, which keeps in mind the enjoyment of the user. Therefore, we decided on using a tilt sensor because it fit into our image of what we wanted to make. Since our game character is a snake that is trying to reach the top of the sky, we designed our controller to be placed on the user’s head. In this way, we wanted to mimic the feeling of being a snake as the user tilts their head from side to side. In the process of creating our project, we had a lot of difficulty at first with our original game plan. As we started fabricating the code, we realized that it strayed too far from our original concept, which was the inspiration from the classic arcade snake game. With this in mind, we had to start over and find a way to better convey our ideas in new code. We did manage to salvage the code of the snake character from the original code, but it was still difficult to produce the function that we wanted, since neither of us had a background in coding. To try and find a solution, we went to different fellows for help and they gave us suggestions for the functions that we could use in our game, such as distance(), loadPixels(), and get(). It was difficult to determine which one we would use, because we were confused on the criteria that each one had to meet. Ultimately, we decided on the loadPixels() function because it could detect the color for each of the collisions that happen in our game when the snake catches a colored object. Our goal for this project was to create a game that would have some properties of the classic arcade snake while having its own twist, because we figured that the remakes of the game were all in the same format. Having made our own version, there are a lot of things that we did not take into account for, and we received some critique on how to improve our game. For example, I recall that someone suggested that there should be a progress bar in the game to indicate where the user is at and to make it an overall clearer playthrough of the game. Additionally, someone had also said that the visuals of the game could be improved. We had made hand-drawn pictures of the characters as well as the objects that the character had to catch/avoid, but it was too late to incorporate them into our game since we stuck with using the loadPixels() function, which would not work with P-images that have no color. Despite having these many obstacles, we learned a lot from the interactions made with our game. People still had fun playing it and one person commented that the way we utilized the tilt sensor was an interesting choice. Ultimately, we made this game for audiences that like to play games and are nostalgic of the classic games that everyone has played before or at least seen before. In the future, I shall approach planning and brainstorming with more objective insight, to try and improve from my mistakes.

2333

2329