Final Project – Emotune Teller

Here is Saskia and peter’s final project – EMOTUNE TELLER.

Is this a emotion vender as we present in the last presentation? Yes, but not exactly.

Is this a fortune teller? Yes, but not exactly.

In the last presentation, we planed to create a emotion vender to encourage people to interact with the other people, even they are strangers, like in the subway station, but we find that there is someone already use the model gacha to create a game. Even though we just use one same object in our project, we don’t want to create something similar to the other people. Therefore, we decide to remain our intention–after a semester’s study, i think ii have some new idea about ‘what is interaction’. Look back to my stupid pet trick and midterm project, i find that all the interaction that i have un these project were only within people and physical object, people can interact with the physical screen or some object to achieve the interaction. However, for this time, since it’s the final project so we decided to create something new base on the interaction we have learnt this semester — we now figure out that the interaction should not only within people and the object but the people and people. We want to create something to encourage people to have more conversation with the other and even pass down the positive feelings.

Motivation and Reference:

The motivation is the ‘new interaction’ that we have learnt this semester. The reference is a book called “the book of answers”   which is magic book can be a fortune teller that the reader can think of any question in mind and than open the book, then the book will give you an answer. When I first know this book, I think it’s very interesting book that people can get some inspiring words or something bad. I think it’s a good good way for people to interact with other to pass down the positive feeling. Therefore,we decided to create a ‘fortune tell’ to achieve our outcomes of emotion vender.

The model we choose is typical Chinese chiromancy which can tell your fortune based on your palm print. However, in this case, our emotion teller is not tell your fortune based on your palm print but the other people. The idea is that one people come by and the machine will make sound to attract the passer-by, and then there will be some guideline on the screen which need the people to follow the guideline to do something. The first thing we want the user to do is type one thing which touched her or him the most today, the thing can be a complain about the tough life or something good happen that day. Thus, the first step is for the user to relive the emotion. After that we will ask the people put their hand on the box in the signed position. And then the user will get a video which is recorded by the last user so he or she will a video record which represents his or her fortune. At last, the user will be asked to recorded a video to pass down the inspiring words and give the positive feeling to the next user.

Material:

q-touch sensor

ultrasonic ranger sensor

led 13

Arduino

jumper cable

Breadboard

Processing and Arduino

The ultrasonic ranger sensor is used as if the people come by the machine the computer will make sound “hey” to attract the passer-by’s attention while the q-touch sensor is used as if the people put their hand on the signed position the led will light up.

The Arduino’s function is our project is attracting the passer-by to come close to our machines and as the object of fortune tell. The processing is used as showing the guidelines on the screen, play and record the video.

-What we leart:

1.It’s not that hard to connect the elements on the breadboard and Arduino but we have learnt something new in this process. I remembered that we have some workshop in one of the recitation, I chose to learn more about code so I didn’t go to the worship which show us how to use the solder. However, since we didn’t have enough jumper cables for this project, we turned to one of the faculties to ask how to use the solder and this is the totally new thing for us to learn in this class.

2. We use the video library which we have learnt in the lecture to set up our webcam to record our video, and then we found another library which we didn’t have time to learn in the class, we find ‘VideoExport’ to export video. It’s a new library and a new technology that we use as the first time.

3. After that, we need to record the  audio play it for the next user, we also have to find more references from the library so we find ‘Minim’ to record and play the audio.

4. Besides, we used ArrayList to store and recored videos in each trial, that is to say, the length of the list will go up by one each time the program is run.

5. Then we use Switch+case to decide which trial to play on the screen.

6. We use the q-touch sensor and the ultrasonic ranger to achieve the interaction and update the value of these sensor to processing.

User test:

We get some feedback and suggestion from the presentation and the IMA show. It’s very interesting that one of our classmate ask a question to us that if we only ask the people to type to complain about their tough life is too negative to pass down the positive feeling. Actually, we have always think about this question, since we think relive the bad feeling can be good for the people to experience but it’s truly that we will remind the people’s bad memory so we decided to change this to let the people type any of the thing they would like to relive or share with the other people, it’s their choice to type what’s kind of information about themselves. Another feedback we get is, for next step, we can think about how to protect the user’s privacy, since we need the user to video record their inspiring words on the screen to pass down the positive feeling but we find that we don’t give their the warning that their face will be showed on the screen, so when we set up our project on the IMA show and some users find their face are showing on the screen and they will be vigilant and shy. Therefore, we are thinking about to insert a image of mask or any of the funny face on the screen to cover the user’s face to protect their privacy and make them more comfortable to do the video recored.

 

 

 

 

 

 

 

 

 

 

int userID = 1;
int state = 0;
float counter = 0;
int rqdtime = 150;
int FPS = 60;
String PATH = "/Users/siskia/Desktop/Final/";
//"/Volumes/SAVE HERE/Final/";
//"/Users/siskia/Desktop/Final/";
int touch;

import ddf.minim.*;

int NUM_OF_SE = 7;
AudioPlayer[] SE = new AudioPlayer[NUM_OF_SE];
AudioPlayer previousA;
AudioPlayer hey;

Minim minim;
AudioInput in;
AudioRecorder recorder;

import com.hamoid.*;
import processing.video.*;
Movie previousV; 

Capture cam;
VideoExport videoExport;

import processing.serial.*;
Serial myPort;

String FROM_ARDUINO = null;
String TO_ARDUINO;

int A2P = 2;
int P2A = 0;

int[] sensorValues;
int[] PValues;

TextBox tbox;
PrintWriter words;


void setup() {
  fullScreen();
  setupSerial(3);
  setupCam(FPS);
  instantiateBox();
  setupAudio();
  setupVideo();
}

void draw() {
  updateSerial();
  //sendSerialData();
  //echoSerialData(20);
  int ptouch = touch;
  touch = sensorValues[1];

  switch(state) {
  case 0:   
    rectMode(CORNER);
    fill(255);
    rect(0, 0, width, height);
    int distance = sensorValues[0];
    if (distance <= 80) {
      state++;
    }
    break;

  case 1:
    counter++;
    rectMode(CORNER);
    fill(255);
    rect(0, 0, width, height);
    textSize(width/5);
    textAlign(CENTER, CENTER);
    fill(0);
    if ( hey.position() == hey.length() ) {
      hey.rewind();
      hey.play();
    } else {
      hey.play();
    }
    text("HEY YOU!", width/2, height/2);

    if (counter >= 90) {
      state++;
      counter = 0;
    }
    break;

  case 2:
    tbox.display();
    break;

  case 3:
    PImage hand = loadImage("hand.png");
    rectMode(CORNER);
    fill(255);
    rect(0, 0, width, height);
    fill(0);
    textAlign(CENTER, CENTER);
    textSize(width/40);
    text("Wanna know if you'll get luckier today?", width/2, height/4);
    textSize(width/30);
    text("Place your hand on the Emotune Teller!", width/2, height/3);
    imageMode(CENTER);
    image(hand, width/2, height/2 + height/4, height/3, 1.36 * height/3);
    if (touch == 1) {
      state++;
    }
    break;

  case 4:
    fill(255);
    rectMode(CORNER);
    rect(0, 0, width, height);

    if (counter <= rqdtime) {

      if (touch == 1) {
        counter = counter + 1;
        fill(0);
        textAlign(CENTER, BOTTOM);
        textSize(width/30);
        text("analyzing...", width/2, height/2 + height/5);
      } else {
        fill(255, 0, 0);
        textAlign(CENTER, BOTTOM);
        textSize(width/30);
        text("DO NOT MOVE YOUR HAND AWAY!", width/2, height/2 + height/5);
      }

      noFill();
      rectMode(CENTER);
      strokeWeight(18);
      stroke(0);
      rect(width/2, height/2, 3 * width/4, height/6);

      rectMode(CORNER);
      noStroke();
      fill(255, 0, 0);
      rect(width/7.6, height/2 - height/13.8, (counter/rqdtime)*(3 * width/4 - width/90), height/6 - height/46);
    } else {
      noFill();
      rectMode(CENTER);
      strokeWeight(18);
      stroke(0);

      rect(width/2, height/2, 3 * width/4, height/6);
      rectMode(CORNER);
      noStroke();
      fill(255, 0, 0);
      rect(width/7.6, height/2 - height/13.8, 3 * width/4 - width/90, height/6 - height/46);

      fill(0);
      textAlign(CENTER, BOTTOM);
      textSize(width/30);
      text("Success!", width/2, height/2 + height/5);
      textSize(width/40);
      text("Remove you hand to view the result", width/2, height/2 + height/4);
      if (touch == 0) {
        state++;
        counter = 0;
      }
    }
    break;

  case 5:
    counter++;
    fill(255);
    rectMode(CORNER);
    rect(0, 0, width, height);
    textSize(width/20);
    textAlign(CENTER);
    fill(0);
    text("RESULT...", width/2, height/6);
    playVideo();
    playAudio();
    if (counter > FPS * previousV.duration()) {
      state++;
    }
    break;

  case 6:
    fill(255);
    rectMode(CORNER);
    rect(0, 0, width, height);
    textSize(width/40);
    textAlign(CENTER);
    fill(0);
    text("Now that it is your turn to leave a message to others...", width/2, height/6);
    text("Put hand back in to start recording; remove it when done", width/2, 5 * height/6);
    monitorCam();
    noFill();
    stroke(0);
    strokeWeight(6);
    ellipse(width/2, height-height/12, width/30, width/30);

    if (touch == 1) {
      noStroke();
      fill(255, 0, 0);
      rectMode(CENTER);
      rect(width/2, height-height/12, width/60, width/60);
      startREC();
      recordAudio();
    } else {    
      noStroke();
      fill(155, 155, 155);
      rectMode(CENTER);
      rect(width/2, height-height/12, width/60, width/60);

      if (ptouch == 1) {
        if (touch == 0) {
          exportCam();
          exportAudio();
          state++;
        }
      }
    }
    break;

  case 7:
    fill(255);
    rectMode(CORNER);
    rect(0, 0, width, height);
    counter++;
    textAlign(CENTER);
    textSize(width/20);
    fill(0);
    text("THANK YOU!", width/2, height/2);

    if (counter >= 150) {
      state = 0;
      userID++;
      counter = 0;
    }
  }
}

void setupAudio() {
  minim = new Minim(this);
  for (int i = 0; i <= NUM_OF_SE - 1; i++) {
    SE[i] = minim.loadFile("SE" + i + ".mp3", 2048);
  }
  hey = minim.loadFile("Hey.mp3");
  in = minim.getLineIn();
  recorder = minim.createRecorder(in, "mic" + userID +".wav");

  previousA = minim.loadFile(PATH + "mic" + (userID - 1) + ".wav");
}

void playAudio() {
  if (previousA.position() == previousA.length() ) {
    previousA.rewind();
    previousA.play();
  }else{
    previousA.play();
  }
}

void recordAudio() {
  recorder.beginRecord();
}

void exportAudio() {
  recorder.save();
}

void setupCam(int FPS) {
  frameRate(FPS);
  cam = new Capture(this, 640, 480, FPS);
  cam.start();
  videoExport = new VideoExport(this, "camera" + userID + ".mp4", cam);
  videoExport.startMovie();
}

void startREC() {
  videoExport.saveFrame();
}

void monitorCam() {
  if (cam.available()) {
    cam.read();
  pushMatrix();
  imageMode(CORNER);
  translate(cam.width, 0);
  scale(-1,1);
  image(cam, -width/2 + cam.width/2, height/4);                                                    
  popMatrix();
  } 
  
  
}

void exportCam() {
  videoExport.endMovie();
}

void setupVideo() {
  previousV = new Movie(this, PATH + "camera" + (userID - 1) + ".mp4");
}

void playVideo() {
  previousV.play();
  previousV.speed(0.5);
  if (previousV.available()) {
    previousV.read();
  }
  imageMode(CENTER);
  image(previousV, width/2, height/2);
}

void reset(){
  fullScreen();
  setupSerial(0);
  setupCam(30);
  instantiateBox();
  setupAudio();
}

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

  FROM_ARDUINO = myPort.readStringUntil( 10 );
  FROM_ARDUINO = null;

  TO_ARDUINO = myPort.readStringUntil( 10 );
  TO_ARDUINO = null;

  sensorValues = new int[A2P];
  PValues = new int[P2A];
}


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


void sendSerialData() {
  String data = "";
  for (int i=0; i<PValues.length; i++) {
    data += PValues[i];
    if (i < PValues.length-1) {
      data += ",";
    } 
    else {
      data += "n";
    }
  }
  myPort.write(data);
}


void echoSerialData(int frequency) {
  if (frameCount % frequency == 0) myPort.write('e');

  String incomingBytes = "";
  while (myPort.available() > 0) {
    incomingBytes += char(myPort.read());
  }
  print( incomingBytes );
}

void instantiateBox() {
  strokeWeight(1.5);
  tbox = new TextBox(
    "It must be tough these days...", 
    width/2, height/2, // x, y
    width/2, height/4, // w, h
    color(0), color(-1, 040), // textC, baseC
    color(-1, 0100), color(0)); // bordC, slctC

  words = createWriter("words"+ userID + ".txt");
}


class TextBox {

  final color textC, baseC, bordC, slctC;
  final short x, y, w, h, xw, yh;

  String txt = "";
  String title; 

  TextBox(
    String tt, 
    int xx, int yy, 
    int ww, int hh, 
    color te, color ba, color bo, color se) {

    title=tt;

    x = (short) xx;
    y = (short) yy;
    w = (short) ww;
    h = (short) hh;

    xw = (short) (xx + ww);
    yh = (short) (yy + hh);

    textC = te;
    baseC = ba;
    bordC = bo;
    slctC = se;
  }

  void display() {
    textSize(width/30);
    textAlign(CENTER, CENTER);
    fill(0); 
    text(title, x, y/2);
    textSize(width/60);
    text("Type to complain", x, height - y/3);
    text("Press Enter to continue...", x, height - y/4);
    rectMode(CORNER);
    fill(baseC);
    rect(0, 0, width, height);

    textSize(width/50);
    textAlign(CENTER, CENTER);
    fill(textC);
    text(txt, width/4, y/2 + y/16, width/2, h*2);
  }

  void tKeyTyped() {

    char k = key;

    if (k == ESC) {
      key=0;
      return;
    } 

    if (k == CODED)  return;

    final int len = txt.length();

    if (k == BACKSPACE)  txt = txt.substring(0, max(0, len-1));
    else if (k == ENTER || k == RETURN) {
      words.print(txt);
      words.flush();
      words.close();
      userID++;
      state++;
    } else if (k == TAB)  txt += "    ";
    else if (k == DELETE)  txt = "";
    else if (k >= ' ')     txt += str(k);
  }


  void tKeyPressed() {
    if (key == ESC) {
      key=0;
    }
    if (key != CODED)  return;
    final int k = keyCode;
    final int len = txt.length();
    if (k == LEFT)  txt = txt.substring(0, max(0, len-1));
    else if (k == RIGHT)  txt += "    ";
  }
}


void keyTyped() {
  if (state == 2) {
    tbox.tKeyTyped();
    int n = int(random(0, NUM_OF_SE - 1));
    SE[n].rewind();
    SE[n].play();
  }
}

void keyPressed() {
  if (state == 2) {
    tbox.tKeyPressed();
  }
  if (key == ESC) {
    key=0;
  }
}

3D Model and 3D Printing

This week we learnt about how to use tinkercad to create a 3D model. First of all, we find a reference from the websites which posted in IMA pages. It’s a lamp, so we decided to use that lamp as a model to set up a 3D model to print a lamp. There is a great challenge during that process, it’s hard for us to build the ring between each layer of the lamp because we have to place each cylinder by one own hand and the workload is huge. Luckily, we only need to do this for one time and then we can simple copy that one and then adjust the size to fit into different layers. It’s our first time to do the 3D modeling through tinkercad so it’s hard for us to know how to find the example or some simple steps but we fix this problem later. As the result, we did make a model of that lamp, it’s not as good as we imagined because the shape is a little bit wired but it’s a lamp we created by ourselves.

Final Project

 

Saskia Zeng

Marcela Godoy

INTM-SHU 101 002

16 April 2018

My definition of “interaction”

From the beginning of the semester, we have think about the meaning of “interaction” and the professor gave us some videos to watch to develop our own idea of what is interaction. I remember that all the projects we have seen before are very creative and amazing. It’s my first time to know that art can be connected with interaction media, in that case, I thought what is interaction is people interact with the physical elements, no matter the computers or the sensors through the code we can control the physical elements to achieve what we want. In that time, I thought interaction just like people can control and use the machines better than before, like we can explore into the art area. However, after nearly a semester’s study, we learn about Arduino, processing and even 3d printer. There is a question occur to me that  who/what  we really interact with in these way of interaction media? Is the physical elements or the other people? Now, I think I get the answer. Interaction is among the people, it’s the silent conversations between the users or creators. When you interact with a “machine” you will notice that there are someone else also join in that project, you will know what the creator what you to achieve.  Therefore, the interaction is the heart-to-heart communication for you to know the other people better, even the stranger. Like the computer is like the most common interaction in our daily life. You can simply click the link or app to get information. But you are not interact with the code of the computer system or the screen itself but the people who establish the website and who write the article or leave the comments. It can distance people closer together, like you don’t need to go to a specific place to meet someone rather than you can have the iPhone call or video chat to have the meeting. In this case, this kind of interaction will make people dependent on the technology. Therefore, what we need to do is let the people participate into the real world through the physical elements to interact with the real person.

My final project

I will do this final project with my partner, Peter. Actually, we want to create a game at first, just like our midterm project to let the people interact with some sensors and then they can have some “achievements”. However, the question that “what is the meaning of interaction” remind us that we can take advantage of the interaction to express and convey feelings. Interaction is not within the people and the physical screen, we need to let the people back to the real world to interact with the real person and the real social environment through the physical elements like our computers. From this point, we want to create a “vending machine” to sell the memory and the emotion. We’d like to make a big (maybe not big, it depends) vending machine like a gashapon machine which filled with the “capsule toy”. You can have one capsule that you need to write down some words to the other, it can be a word which can represent you recently emotion, some words you are not dare to tell the other, a wish, something you like or something you want to achieve and so on. For the user, you will get one capsule from the machine and there will be a computer behind the machine. When you get one capsule, there will be one guide on the screen. To follow that guide, you need to  preform some action like give a smile, a clapping. Then you can open the capsule and read other’s little note. We are aiming at pass the emotion among people and close the distance between people. Besides, this machine can be placed in the metro station or on the busy street for people to interact with someone they don’t know.

 

 

 

Recitation: Drawing Machine

Saskia Zeng

Marcela Godoy

INTM-SHU 101 002

15 April 2018

Materials:

Potentiometer

Processing

Arduino

USB cable

motor

Power jack

ic chip

power supply

jump cables

Laser-cut and 3D printed mechanism

pen and paper

Process

For the first step, I read the guidelines very carefully to make sure that I know what we need to do first and the next, besides, I read the image of the circuit of the drawing machine to know how to connect all the electronic elements on the breadboard. Then, I just connect the all the elements one the breadboard and then I unload the “stepper-oneRevolution” but unfortunately the stepper motor is not working as I wish to rotate. I check the connection of the circuit I find some mistake that the I connect the wrong pin with the ic chip and the direction of the ic chip is not correct.

Unfortunately, after I corrected my connection of the circuit I find that the Arduino is so hot and I cannot upload the code to processing. At first, I thought that maybe my circuit is not correct but I checked again, it’s correct. I turned to the instructor to ask him for help. He told me that I need to check the circuit before I connect it with Arduino and also check the Arduino. However, we find that my Arduino was burned because I plugged in the power source before I upload the code.

Then I borrowed an Arduino to continue my work but when I check my circuit, it’s work but when I connect the Arduino I burned it again. For this time, I didn’t plugged the power source and I check the circuit so there is still something wrong with my circuit. My partner checked it for me and told me that my direction of the ic chip is wrong and I need to fix it. After that, the circuit is right.

After that, we built the plastic arm to hold a pen, it’s not that hard like to connect the circuit but it also took me some time to connect the plastic arm and the Laser-cut and 3D printed mechanism together. Because we have the individual works before we connect all of our work together, we put them on the laser-cut to have the whole draw machine.

 

The final drawing

Part B

reflection:

1. Add a reflection about the use of actuators, the digital manipulation of art, and the creative process to your blog post. What kind of machines would you be interested in building?

For this question, the actuator in this drawing machine is the stepper motor which can rotate to let the machine drawing. This machine reminded me of my stupid pet trick, I use the motor to open the door to make an automatic rolling door for the little tiny bear. However, for the digital manipulation of art it’s remind’s me of one of Kenya Hara’s work. That is a simple exhaust fan which the shape and the image on the fan is like a CD, in other words, he used a disc to like a fan.I guess that we can use the Motor to be the actuator to rotate the fan. But why Kenya Hara’s fan is interesting is that you will be more comfortable when the exhaust fan works because the shape of the fan will stimulus your sense of hearing, you will connect the fan with the CD player. It’s very interesting.

2.Choose an art installation mentioned in the reading ART + Science NOW, Stephen Wilson (Kinetics chapter). Post your thoughts about it and make a comparison with the work you did during this recitation. How do you think that the artist selected those specific actuators for his project?

I choose the project called “Hysterical Machine” by Bill Vorn. In his work, he is making a chaotic world beyond the functional machine. We know that the machines are working follow the code and they are functionally. But in Vorn’s work, he uses the sophisticated sensors and pneumatic motor to react by directing the light at the viewer. Comparing Vorn’s work and our drawing machine I think the biggest difference is we can control the Potentiometer to draw but the “Hysterical Machine” is triggered by the viewers and then simulate the viewer. However, our drawing machine is only do some work that the people can also do, it’s more like to replace the human labour but for Vorn’s work, the work can reveal the fact of the society. His work is more like to be viewed and needed to be understood.

 

 


/*
 Stepper Motor Control - speed control

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.
 A potentiometer is connected to analog input 0.

 The motor will rotate in a clockwise direction. The higher the potentiometer value,
 the faster the motor speed. Because setSpeed() sets the delay between steps,
 you may notice the motor is less responsive to changes in the sensor value at
 low speeds.

 Created 30 Nov. 2009
 Modified 28 Oct 2010
 by Tom Igoe

 */

#include <Stepper.h>

const int stepsPerRevolution = 250;  // change this to fit the number of steps per revolution
// for your motor


// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

int stepCount = 0;  // number of steps the motor has taken

void setup() {
  // nothing to do inside the setup
}

void loop() {
  // read the sensor value:
  int sensorReading = analogRead(A0);
  // map it to a range from 0 to 100:
  int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
  // set the motor speed:
  if (motorSpeed > 0) {
    myStepper.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    myStepper.step(stepsPerRevolution / 100);
  }
}

Interaction lab Recitation 07

Saskia Zeng

Marcela Godoy

INTM-SHU 101 002

Reflection

In this recitation, we have the guest talk about some recent project. What interest  e the most is the project that turn plastic into something new. They transform plastic into a precious item, it’s very creative and unique way for people to recycle the plastic waste. Everyone can transform the plastic waste into what they want or what they need. The guest show us some of their works, like the ear rings, handbags and necklaces. They are beautiful and colorful that they are so unique. It’s also a good way to teach people how to recycle and how important for people to recycle the waste and let the people that it’s possible to turn the recycle into an interesting way. The guests from Xinchejian are so talented and creative but they are also respectful because they are trying to help the other people and also our environment or even the whole world. They are not only do these things for their interests but for helping others and I think that is what we need to learn. In that case, our project is not only for the fancy stuff, like good looking, beautiful backgrounds or other fancy things. It’s important for us to think why we start to do that?

 

Inspiration

http://www.eefocus.com/zhang700309/blog/11-12/236514_6b541.html

One of the references we find is the interaction between processing and the light sensor, in the website we find that through the light sensor and processing we can turn down the light of the picture. It’s very interesting that can be an element into our project.

Pour Reception – Water as a digital (material) interface

This is the reference we find from the website that the professor gave to us. It’s interesting that we find that not only the light or the physical things can be like one element in the project but the water can do. We find that the water level can be used in Arduino.

 

Midterm project – SpongeBob Quest

Name: Saskia Zeng

Project name:SpongeBob Quest

Date:  March 23rd, 2018
Instructor: Marcela

Partner: Peter Wang

Reference:

1.I find a website that there is a tutorial to make interaction with the oil painting and light sensor in processing. This interaction make the picture fall off in darkness.

http://www.eefocus.com/zhang700309/blog/11-12/236514_6b541.html

2. Another reference is from the website called Creater which we were told that we can find some references to our project. In this website we find something really interesting but what inspired us the most is “Pour Reception – Water as a digital (material) interface”. Through this, we realize that the water can be a digital input and then we choose the water level sensor as one of our elements.

Pour Reception – Water as a digital (material) interface

Aim: To design a game which can stimulate people’s five senses.

 

Introduction:

This is a adventure game for only one player. The player will play as Patrick who want to invite SpongeBob to hangout for outdoor activities. For the first step, when you come to the SpongeBob’s house you find that he is sleeping so that you have to wake him up. There is a physical “SpongeBob” which is made by a box and drawn like a SpongeBob and in this box there is a sound sensor, what we what the user to do is make some noises, like to yell to the “SpongeBob” then the sound sensor works with processing — the picture that show one the screen will change (before you wake him up, there is a picture that the SpongeBob is sleeping but if you make some noises to make the sound sensor works then the picture will change into a picture that the SpongeBob open his eyes). After you wake him up, you two go to a park to play game outside. Unfortunately, the sun is burning and the weather is too hot for SpongeBob to survive. He is going to be “dry”!. For this step, what we want you to do is cover the sun because there is light sensor behind the sun. If you cover the sun, it means that you cover the light sensor so the background will become darker as the light sensor receives less light. Through this, you safe SpongeBob’s life and then you guys have a good time. It’s worth mentioning that there is a time limit for this stage, we set up for ten seconds. If you cannot figure out that you need to cover the sun to give the shabby to SpongeBob, the SpongeBob will get dehydrated and become dry. Therefore, there is another storyline for the people who didn’t cover the sun. We use a plastic bottle to be the dry SpongeBob, for this stage, what we want you to do to save SpongeBob’s life is pour the water into that bottle and then you save his life.

We won’t tell you want you need to do during the game, there is a guidelines on the screen you can follow it to play this game.

Process:

  1. Find the reference and develop our idea about this project
  2. Choose the elements and materials
  3. Materials:ArduinoProcessingPaper BoxCard Board

    Printed Papers

    Plastic bottle

    Breadboard *1

    Jumper cables

    Wires

    Sound sensor*1

    Light sensor*1

    Water level sensor*1

    220Ohm Resistor*1

    4. Write a storyline for this game (just like I have mentioned in the introduction), then I tried to find

    some appropriate pictures that we can print them out. In this way, I have to choose the picture that

    can have a use of guidelines because we don’t want to give too much words on the screen to guide

    the player to finish the game, what we want to do is leave more space for the player himself/herself

    to interact with the physical elements, screen and think more about the game itself.

    5. We connect the elements on the breadboard, it’s not hard but it’s not easy as well. Because we want to put all the elements on one breadboard but we have three sensors to connect with the breadboard, it’s hard for me to make it in order. Before we start to do that I thought it might be hard to do but when we actually did it, it’s not that hard. After that, I began to deal with the physical elements to make more like the SpongeBob because we want the player to have the more direct experience to interact with the physical elements, themodel should be more lively.

    6. Write the code with Arduino and Processing

    For Arduino, we need to wrote about the sound sensor, light sensor and water level sensor and we can find the example then change them into the format that can fit into our situation. There is a problem that we need to add some picture to the screen to show the process of the game but it’s hard for us to use the functions to draw the pictures that we need. Therefore, we were thinking about to insert some picture into Processing but we didn’t learnt yet. In this way, we  search the code from the official website of Processing to find out how to do with our own code. For our code, we searched from the official website of Processing and the note of Marcela (send from Arduino to Processing).

     

7.Connect the my computer to text it 

For this step, after we finish the product appearance part and the code part we connect the computer with Arduino to text it works or not. For the first time, we got some problems with the screen part, like we have already put some ‘blank’ into an appropriate location to make the picture in order and the words can be clear to see but when we run the code for the first time, it seems like everything is in a mess and the game interface is not clear enough, besides, the transmission between the different stages is not good enough.

Actually, we only have one storyline for the first time but after we test it we find that it’s too easy for the player to play if we only have two stages so we decided to create another storyline to give the player more chances to play and the storyline will be more complete.

User Testing and Reflection 

We got some feedback from both our classmates and the faculties and we think all their suggestions are helpful for us to develop our idea for the final project (not only for this project)

a. Be more clear for the user — I have think about this suggestion for a long time, firstly I think it’s right to be for the user, like you have to give the clear guidance for them to know what to do first and what to do next. It’s truly that our guideline is not clear enough for the player to read. However, we have think about this point before the show, the reason why we didn’t use the words to tell the user how to do next but use the picture to give them instruction is we try to leave more space for them to think “why they design like this”. We think it will be more fun for the user to think not to follow but it’s truly that our guideline is too vague and too brief. We have to make sure that everyone know what the game mean (but not everyone know how to survive)

b. Make everything in order —For this suggestion we know that we have three stages then we have three model to play as SpongeBob and each stage into only one. Like, we have a box with the sound sensor, a card board with the light sensor and a bottle with water level sensor. All the three elements represent SpongeBob so when the player play our game they might be confused about interact with which element can achieve the goal. To improve it, we think we need to make them in order, like there is only one SpongeBob keep all the sensors that you can yell to him, cover him or pour this water into him and in that way, it may be much more clear for the user to know what they need to do.

c. This game is only a prototype — If it’s a adventure game then it have to be challengeable  so that the user will have the experience of success and failure (we think it will be more interesting for the player to play). Through this, we need to add more stages to make a complete storyline and more interesting plot.

d. We want to design for five senses, I have read a book called “Designing Design” which written by Kenya Hara. In this book, Kenya Hara says that the good design should design for five senses even plus time and space to design for seven senses. You can touch, smell, taste or hear to the product will be good interaction between the user and products. His words inspire us to do this project and it’s the reason why we both have the computer-based screen and physical elements for the player. This project just remind me of the technology of VR (virtual reality), it’s true that VR can be personally on the scene and the user can hold the “gamepad” to change the direction to make the move. However, we think it might be more fun and real for people can touch something, like they can press something or make sound, to make the physical like a ‘human’. You can talk to the computer just like you talk to a real person and you might feel like you are not interact with a ‘dead’ computer but a real person.

 

 

but it’s only a prototype. We want to show a completely adventure game with a storyline and background music.

Arduino:
void setup() {
  Serial.begin(9600);
  pinMode(9, INPUT);
}


void loop() {
  int light = analogRead(A0);
  int water = digitalRead(9);
  int sound = analogRead(A1);

  Serial.print(sound);  
  Serial.print(",");
  Serial.print(light);
  Serial.print(",");
  Serial.print(water);
  Serial.println();

  delay(10);
}

Processing:
import processing.serial.*;
String myString = null;
Serial myPort;

int stage = 0;
int nstage = 3;

Textbox start;
Textbox next;
Textbox end;

int[] values;
int light;
int sound;
int water;

PImage background1;
PImage happysb;
PImage sadsb;
PImage before;
PImage after;
PImage drysb;
PImage ending;

int sleepState = 0;
int sunState = 0;
int dryState = 0;
float frame = 0;
float countdown;
int n = 200;


void setup() {
  fullScreen();
  setupSerial();
  background1 = loadImage("background1.jpeg");
  happysb = loadImage("happysb.png");
  sadsb = loadImage("sadsb.png");
  before = loadImage("before.jpg");
  after = loadImage("after.jpg");
  drysb = loadImage("drysb.jpg");
  ending = loadImage("ending.png");
  start = new Textbox("START");
  next = new Textbox("NEXT");
  end = new Textbox("END");
}

void draw(){
  updateSerial();
  if(stage == 0){
  stage0();
  }else if(stage == 1){
  stage1();
  }else if(stage == 2){
  stage2();
  }else if(stage == 3){
  stage3();
  }else if(stage == 4){
  stage4();
  }
}

void setupSerial() {
  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[4], 9600);
  myPort.clear();
  myString = myPort.readStringUntil( 10 );
  myString = null;
  values = new int[nstage];
}

void updateSerial() {
  while (myPort.available() > 0) {
    myString = myPort.readStringUntil( 10 );
    if (myString != null) {
      String[] serialInArray = split(trim(myString), ",");
      if (serialInArray.length == nstage) {
        for (int i=0; i<serialInArray.length; i++) {
          values[i] = int(serialInArray[i]);
        }
      }
    }
  }
}
void stage0(){
  imageMode(CORNER);
  image(background1, 0, 0, width, height);
  fill(0);
  textSize(100);
  textAlign(CENTER, CENTER);
  text("SpongeBob Quest", 500, 180);
  start.display();
  start.checkclick(1);
}

void stage1(){
  sound = values[0];
  fill(255);
  rectMode(CORNER);
  rect(0, 0, width, height);
  fill(0);
  textSize(100);
  textAlign(CENTER, CENTER);
  text("WAKE HIM UP!!!", width/2, 180);
  if(sleepState == 0){
    imageMode(CENTER);
    image(before, width/2, height/2 + 100, 600, 400);
  }else{
    imageMode(CENTER);
    image(after, width/2, height/2 + 100, 600, 400);
    next.display();
    next.checkclick(1);
  }
  if(sound >= 150){
  sleepState = sleepState + 1;
  }
}

void stage2(){
  light = values[1];

  if(sunState <= 10){
    if(light < 20){
      tint(130 + (light * 5));
    }else{
      tint(255);
    }
    imageMode(CORNER);
    image(background1, 0, 0, width, height);
    tint(255);
    imageMode(CENTER);
    image(sadsb, 1000, 700);
    log("BURNING!!!", 40, 700, 550, 230, 100);
    timelimit();
  }else{
    tint(155);
    imageMode(CORNER);
    image(background1, 0, 0, width, height);
    tint(255);
    imageMode(CENTER);
    image(happysb, 900, 650);
    log("YEAH!", 40, 1150, 550, 200, 100);
    end.display();
    end.checkclick(2);
  }
  
  if(light < 5){
    sunState = sunState + 1;
  }


}  

void stage3(){
  water = values[2];
  fill(255);
  rectMode(CORNER);
  rect(0, 0, width, height);
  if(dryState == 0){
    imageMode(CENTER);
    image(drysb, width/2, height/2 + 100, 600, 400);
    fill(0);
    textSize(100);
    textAlign(CENTER, CENTER);
    text("SAVE SpongeBob!!!", width/2, 180);
  }else{
    imageMode(CENTER);
    image(happysb, width/2, height/2 + 100);
    fill(0);
    textSize(100);
    textAlign(CENTER, CENTER);
    text("Good Job!", width/2, 180);
    end.display();
    end.checkclick(1);
  }
  if(water == 1){
    dryState = 1;
  }
}

void stage4(){
  fill(255);
  rectMode(CORNER);
  rect(0, 0, width, height);
  fill(0);
  textSize(100);
  textAlign(CENTER, CENTER);
  text("CONGRATULATIONS~!", width/2, 100);
  imageMode(CENTER);
  image(ending, width/2, height/2 + 100, 500, 500);
  
  rectMode(CENTER);
  strokeWeight(10);
  stroke(0);
  if((mouseX > (width/2) - 100) && (mouseX < (width/2) + 100) && (mouseY > 750) && (mouseY < 850)){
    fill(245);
  }else{
    fill(255, 150);
  }
    rect(width/2, 800, 200, 100, 7);
    fill(0);
    textSize(50);
    textAlign(CENTER, CENTER);
    text("Again?", width/2, 800);
    if((mouseX > (width/2) - 100) && (mouseX < (width/2) + 100) && (mouseY > 750) && (mouseY < 850) && (mousePressed == true)){
      stage = 0;
      sunState = 0;
      dryState = 0;
      sleepState = 0;
      frame=0;
    }
}

class Textbox{
  String inbox;
  
  Textbox(String write){
  inbox = write;
  }
  
  void display(){
  rectMode(CENTER);
  strokeWeight(10);
  stroke(0);
  if((mouseX > 1100) && (mouseX < 1300) && (mouseY > 750) && (mouseY < 850)){
    fill(245);
  }else{
    fill(255, 150);
  }
    rect(1200, 800, 200, 100, 7);
    fill(0);
    textSize(50);
    textAlign(CENTER, CENTER);
    text(inbox, 1200, 800);
  }
  
  void checkclick(int n){
    if((mouseX > 1100) && (mouseX < 1300) && (mouseY > 750) && (mouseY < 850) && (mousePressed == true)){
    stage = stage + n;
    }
  }
}

void log(String text, int tsize, int tempx, int tempy, int tempxx, int tempyy){
  String say = text;
  int textsize = tsize;
  int xpos = tempx;
  int ypos = tempy;
  int xsize = tempxx;
  int ysize = tempyy;
  strokeWeight(8);
  stroke(0);
  fill(245);
  rectMode(CENTER);
  rect(xpos, ypos, xsize, ysize,10);
  fill(0);
  textAlign(CENTER, CENTER);
  textSize(textsize);
  text(say, xpos, ypos);
}

void timelimit(){
  if(frame >= n){
    frame = n;
    stage = 3;
  }else{
    frame++;
  }
  fill(255, 0, 0);
  rectMode(CENTER);
  rect(100, height/2, 50, n - frame);
}

Recitation 6 – Serial Communication

Materials:

Potentiometer *1

Breadboard *1

Arduino

Jumper cable

2200hm Resistor

 

Step 1

Create a Processing sketch that sends data to Arduino. Receive that data and express it using physical components (ie. servo, led, buzzer).

In this process, we connect the Arduino to the computer and then set up a new window for Arduino and also for processing. What the outcome I want to achieve is when we click the “grey” block and the led will light up.

Firstly, I find the example from the slide of the class, there is website which we can find the different example for Arduino and processing.  What I need to do is sending the data from processing to Arduino, I changed the component from the example to a Led and then I built a circuit on the breadboard because we have learnt several different circuits and this circuit is one of them, it’s easy for me to connect the circuit. Since we already have the example what I need to do is only change it a little bit, like I changed the Ledpin number to the number that I connect to the Arduino. Then I send the data from processing to Arduino and when I click the window of the grey block from processing, the Led will light up.

 

 

Step 2

Create a circuit using your Arduino to send data from physical inputs (ie. variable resistors, buttons, tilt switch) to Processing. Receive the data and express it visually in your Processing sketch.

In this step, what I need to do is send the data from Arduino to Processing. I chose the variable resistor as the physical input to send the data to Processing. What the outcome I want to achieve is when I change the value of the variable resistor then the widow under Processing will show the different number. It’s easy to follow the example in class to do the code part.

Step 3

1.What are the possibilities for interaction that you can envision?

To answer this question, we can reflect on the process of sending data form processing to Arduino and also send data from Arduino to Processing. Just like the Professor Marcela have showed us in class, when she changed the value of the variable resistor, by sending data from Arduino to Processing, she the size of the ellipsis will change by the changeable value of the variable resistor. It’s a interesting and reflective interaction, we can explore in this processing. The interaction can work like the “magic mirror” which can “reflect” someone’s behavior as the input and then give the output which can be distorted but the output is connected to the input.

2.What are some of the benefits of controlling physical elements with computational media and of controlling screen-based computational media through physical interaction?

We can change the question into what are some benefits of controlling Arduino with Processing and controlling Processing with Arduino. For the former one, it’s control the physical elements with the creen-based computational media, to show how can data influence the physical elements, it’s a interaction that the people can easily touch, feel, or see, it’s easier for people to interact with a physical thing. The benefit can be people can easily control a physical element or machine (maybe) even in a long distance. The latter one is controlling creen-based computational media with physical elements. It can be interesting for people to interact with a “living mirror”, people can see the processing animations on the screen when they control the physical elements and  I think it’s kind of work like the VR. It’s more interesting then sensors and the animations on the screen can be diverse so you can control one element then see the different output.

3.Can you think of real world applications that take advantage of communication between the physical and screen-based computational media?

First of all, I think computer itself can be en example, you type, move the mouse or control the touchpad, the screen will give you different windows at least, and the animations can be different information showing on the screen, it’s kind of interaction I think. Besides, I think the VR can be another example, like you can enjoy in a game that you feel you just in that environment. You can control the “steering engine” and then you will see how well you play in the baseball game.

Step 1
Arduino:
// IMA NYU Shanghai
// Interaction Lab
int valueFromProcessing;
int ledPin = 2;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // to receive a value from Processing
  while (Serial.available()) {
    valueFromProcessing = Serial.read();
  }
  if(valueFromProcessing == 'H'){
    digitalWrite(ledPin, HIGH);
  }else{
    digitalWrite(ledPin, LOW);
  }
  delay(10);

}

Processing:
// IMA NYU Shanghai
// Interaction Lab


import processing.serial.*;

Serial myPort;
int valueFromArduino;


void setup() {
  size(500, 500);
  background(0);

  printArray(Serial.list());
  // this prints out the list of all available serial ports on your computer.
  
  myPort = new Serial(this, Serial.list()[7], 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.
}


void draw() {
  // to send a value to the Arduino
  if (mousePressed) {
    myPort.write('H');
  } else {
    myPort.write('L');
  }
}

Recitation 4-Interaction Lab

Step 1: Choose an image or a theme that inspires you. Some suggested sources of inspiration are:

What inspires me is in “Bauhaus School of Arts”, the first graph by Josef Albers. The black, white and gray one. What interests me the most in this graph is the black and white part are connect like a zip.

Step 2: Considering the image you chose as a starting point or inspiration to create an animation with Processing using any 2D primitive or vertex shapes. Using the functions that were covered in class, create an animation with Processing. Using paper to sketch your idea may help.

For this step, I was thinking about to draw this graph in processing  , exactly this graph but it’s a little hard for me to “copy” this graph, oh not copy. I mean I what to “copy” this graph with some animation to make some of blocks move like the zip and the block will change the color, but I quit it.

I try to make my minder in order because I got kind of out of mind.

For the first step, I draw a 400*400 square filled with white, then I used a stupid way to draw some little square within that big one.  I draw it one by one and code one by one, it’s not a hard work but it took me some time to count. I’m thinking about if there is a better way to draw the little square more faster.

int i = 0;

void setup(){
size(400, 400);
}

void draw(){
i = i + 1;
background(255);
fill(0);
rect(0 – i, 360, 40, 40);
rect(80 – i, 360, 40, 40);
rect(160 – i, 360, 40, 40);
rect(240 – i, 360, 40, 40);
rect(320 – i, 360, 40, 40);
rect(40 + i, 320, 40, 40);
rect(120 + i, 320, 40, 40);
rect(200 + i, 320, 40, 40);
rect(280 + i, 320, 40, 40);
rect(360 + i, 320, 40, 40);
rect(0 – i, 280, 40, 40);
rect(80 – i, 280, 40, 40);
rect(160 – i, 280, 40, 40);
rect(240 – i, 280, 40, 40);
rect(320 – i, 280, 40, 40);
rect(40 + i, 240, 40, 40);
rect(120 + i, 240, 40, 40);
rect(200 + i, 240, 40, 40);
rect(280 + i, 240, 40, 40);
rect(360 + i, 240, 40, 40);
rect(0 – i, 200, 40, 40);
rect(80 – i, 200, 40, 40);
rect(160 – i, 200, 40, 40);
rect(240 – i, 200, 40, 40);
rect(320 – i, 200, 40, 40);
rect(40 + i, 160, 40, 40);
rect(120 + i, 160, 40, 40);
rect(200 + i, 160, 40, 40);
rect(280 + i, 160, 40, 40);
rect(360 + i, 160, 40, 40);
rect(0 – i, 120, 40, 40);
rect(80 – i, 120, 40, 40);
rect(160 – i, 120, 40, 40);
rect(240 – i, 120, 40, 40);
rect(320 – i, 120, 40, 40);
rect(40 + i, 80, 40, 40);
rect(120 + i, 80, 40, 40);
rect(200 + i, 80, 40, 40);
rect(280 + i, 80, 40, 40);
rect(360 + i, 80, 40, 40);
rect(0 – i, 40, 40, 40);
rect(80 – i, 40, 40, 40);
rect(160 – i, 40, 40, 40);
rect(240 – i, 40, 40, 40);
rect(320 – i, 40, 40, 40);
rect(40 +i, 0, 40, 40);
rect(120 + i, 0, 40, 40);
rect(200 + i, 0, 40, 40);
rect(280 + i, 0, 40, 40);
rect(360 + i, 0, 40, 40);
delay(9);
if(i == 80){
i = 0;
}
}

 

 

int i = 0;

void setup(){
  size(400, 400);
}

void draw(){
  i = i + 1;
  background(255);
  fill(0);
    rect(0 - i, 360, 40, 40);
    rect(80 - i, 360, 40, 40);
    rect(160 - i, 360, 40, 40);
    rect(240 - i, 360, 40, 40);
    rect(320 - i, 360, 40, 40);
    rect(40 + i, 320, 40, 40);
    rect(120 + i, 320, 40, 40);
    rect(200 + i, 320, 40, 40);
    rect(280 + i, 320, 40, 40);
  rect(360 + i, 320, 40, 40);
  rect(0 - i, 280, 40, 40);
  rect(80 - i, 280, 40, 40);
  rect(160 - i, 280, 40, 40);
  rect(240 - i, 280, 40, 40);
  rect(320 - i, 280, 40, 40);
   rect(40 + i, 240, 40, 40);
  rect(120 + i, 240, 40, 40);
  rect(200 + i, 240, 40, 40);
  rect(280 + i, 240, 40, 40);
  rect(360 + i, 240, 40, 40);
  rect(0 - i, 200, 40, 40);
  rect(80 - i, 200, 40, 40);
  rect(160 - i, 200, 40, 40);
  rect(240 - i, 200, 40, 40);
  rect(320 - i, 200, 40, 40);
  rect(40 + i, 160, 40, 40);
  rect(120 + i, 160, 40, 40);
  rect(200 + i, 160, 40, 40);
  rect(280 + i, 160, 40, 40);
  rect(360 + i, 160, 40, 40);
   rect(0 - i, 120, 40, 40);
  rect(80 - i, 120, 40, 40);
  rect(160 - i, 120, 40, 40);
  rect(240 - i, 120, 40, 40);
  rect(320 - i, 120, 40, 40);
  rect(40 + i, 80, 40, 40);
  rect(120 + i, 80, 40, 40);
  rect(200 + i, 80, 40, 40);
  rect(280 + i, 80, 40, 40);
  rect(360 + i, 80, 40, 40);
  rect(0 - i, 40, 40, 40);
  rect(80 - i, 40, 40, 40);
  rect(160 - i, 40, 40, 40);
  rect(240 - i, 40, 40, 40);
  rect(320 - i, 40, 40, 40);
  rect(40 +i, 0, 40, 40);
  rect(120 + i, 0, 40, 40);
  rect(200 + i, 0, 40, 40);
  rect(280 + i, 0, 40, 40);
  rect(360 + i, 0, 40, 40);
  delay(9);
  if(i == 80){
  i = 0;
  }
}
/Users/siskia/Desktop/白Red 2018-03-03 14.39.49.mp4

Stupid Pet Trick

Yutong Zeng

Professor Marcela Godoy

Interaction Lab

24 February  2018

Stupid pet trick

——Automatic Rolling Door for the Dolls

The outcome as I wish: a practical joke

when there is a people coming the door and open automatically (in this case, this “rope” with the door on one side while another side is tied up a spider) but because of the limited power for the motors cannot lift up the normal size of the paper door.

What I have made is an automatic rolling door for the little tiny bear but what I truly wanted to make is a normal size rolling door for an adult however, because of the limited power of the motors I cannot make it comes true so I can only make a tiny one for the little bear.

There are two motors on the top of the box and there is a paper door in the side, I fixed the infrared sensor inside of the box which can sense that the bear is close to the door and then the motors will work to lift the door up so that the bear can walk through the door.

Materials:

Breadboard *1

Arduino*1

Motor*2

Infrared sensor*1

Wires

Jumper Cables

22ohm Resister*1

Transistor *1

Diode *1

paper

Carton*1

Process:

a.I drew a sketch of what I want to make (a rolling door which tied up with a fake spider )

b. Connect all the components on the breadboard 

c.coding,

the code is easy to type, for the first step,i was trying to use only one string to lift up the door but the balance is not that good so i used two strings to fix it. However, the code for the first step is only for one motor

#define pin A1
int d = 0;
const int motor = 9;
int cs = 0;

void setup () {
Serial.begin (9600);
pinMode(motor, OUTPUT);
pinMode(pin, INPUT);
cs = 0;
}

void loop () {
uint16_t value = analogRead (pin);
double distance = get_IR (value);
d = distance;
Serial.println (value);
Serial.print (d);
Serial.println (” cm”);
Serial.println ();
if(d != 4){
analogWrite(motor, 200);
delay(6000);
analogWrite(motor, 0);

}
delay (2);
}

double get_IR (uint16_t value) {
if (value < 16) value = 16;
return 2076.0 / (value – 11.0);
}

d. Check the code works or not

The first code works well and for the next step, I added another motor on to the box to keep the balance of the door, then I got a question that how to connect two motor with the Arduino. Firstly, I was thinking about using to breadboard to let the two motors work separately, it’s a stupid idea, I know but I did it that time and when I was testing it works or not, I figured out that it’s so stupid to do in that way because the exact breadboard was useless.

e.Debugging

From that case, I connected the two motors in parallel.

 

 

f.The “device” need to be perfect

g.Re-debugging

h.Done

 

Reflection:

The code is not hard to think but how to achieve the outcome which I want it’s hard. Firstly, the power for the motors are so limited so that the rotate speed is not enough to lift the “paper door”, according to this I changed the 1k resistor to the 220ohm one to lift the paper door but it’s still hard to make it. Therefore, I was trying to move the motors more closer to the door to make it easier to lift it up but I failed, too.

It’s hard to lift the door up by the thin string, I tried to make it be perfect over and over again and then I found a way to fix it. I used the hot glue gun to stick the ring on the motor and then when the motor works the string will roll on the motor.

Besides, for the first test, the rotational speed of the motor it too high so I have to change the speed, lower. I searched the example for the Arduino to change the rotational speed.

—— analogWrite(motor, 200);

According to this, I can change the speed.

Another problem is I don’t know how to close the door automatically, I can open the door automatically but close the door is hard for me to make it so for the next step I’m thinking about a way to close the door automatically not manual.

I have tried in some ways, like, I have tied two heavy things on the door to make sure that the door can close but the erasers are not heavy enough to close it can the time is not enough so I have to quit this plan.

Another way I’m thinking about is adding more two motors on the bottom of the box and code in the same way to close it.

Productive view:

1.The power of 5v is not enough for the next time I can just connect it to the 220v of power.

2.The maximum value of the rotational speed is only 255 so if I want to put it into the productive way I have to change it into the bigger one.

3.”Hide” the wires and make the surface clean

4.I’m still thinking about the commercials value.

 

 

 

#define pin A1
int d = 0;
const int motor = 9;
int cs = 0;

void setup () {
        Serial.begin (9600);
        pinMode(motor, OUTPUT);
        pinMode(pin, INPUT);
        cs = 0;
}

void loop () {
        uint16_t value = analogRead (pin);
        double distance = get_IR (value); 
        d = distance;
        Serial.println (value);
        Serial.print (d);
        Serial.println (" cm");
        Serial.println ();
        if(d != 4){
          analogWrite(motor, 200);
          delay(6000);
          analogWrite(motor, 0);

        }
        delay (2);
}

double get_IR (uint16_t value) {
        if (value < 16)  value = 16;
        return 2076.0 / (value - 11.0);
}

Recitation3- Sensor

Part A

1.What did you intend to assemble? Why did you choose that specific sensor and output?

– We choose the infrared distance sensor and the buzzer. The reason why we choose the vibration sensor as the “specific sensor” and the buzzer as the output because we want to make a sample device just like the car alarm which can make loud sound to warn the driver to stop when the distance to the surroundings is too close. We think this device plays an important role in the daily life and after a few weeks’ study we find that we can make it!

2. Which materials did you use? Which circuit(s) did you use as a reference for them?

– *Breadboard

*Arduino

*Infrared distance sensor

*Buzzer

*Wires

*LEDS
*220ohm Resistors

3.What sources did you use in order to program them? Did you have to modify them?

– We click the “infrared distance sensor” on that page and then turn to a website showing the introduction of this kind sensor. From that page we find that there are some introduction of the sensor itself and it have the image of how to connect is with each other, besides, we also find that there is a wiki mode of coding. We just follow that sample but we have to change some details to fit into our circuit.

4.Which different steps you went through to make it work? Did it work as expected?

– To complete this circuit we connect the breadboard and Arduino them connect all the components on the breadboard. However, we got into trouble with coding, at first we think we can only follow the sample we found from wiki but we find that we have to change it to fit into out own circuit. It’s hard for us to rewrite it and we have tried several times but it still cannot work as we hope. What we want is when the distance bigger than 10cm the green LED light up but when the distance smaller than 10cm the greed LED fade but red LED lights up and the buzzer makes sound.

The code we write:

//connect gp2d120x to A1

#define pin A1

const int safe = 8;

const int unsafe = 9;

void setup () {

Serial.begin (9600);

pinMode(pin, INPUT);

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

}

void loop () {

uint16_t value = analogRead (pin);

double distance = get_IR (value); //Convert the analog voltage to the distance

Serial.println (value);                 //Print the data to the arduino serial monitor

Serial.print (distance);

Serial.println (” cm”);

Serial.println ();

delay (40);

 

if(distance <= 10){

digitalWrite(safe, LOW);

digitalWrite(unsafe, HIGH);

tone(9, 1000*distance, 40);

}else{

digitalWrite(safe, HIGH);

digitalWrite(unsafe, LOW);

}

 

}

//return distance (cm)

double get_IR (uint16_t value) {

if (value < 16)  value = 16;

return 2076.0 / (value – 11.0);

}

4. What conclusions can you draw over the work you did?

– The example can help sometimes but even there are some example we can take it as reference we have to make it into our own work. We cannot just copy the sample and change the number, what we need to do is know where is this example come from.

5.Can you relate your experience building this circuit to any device you interact in your daily life?

– The car alarm which can makes sound when you are too close to the surroundings

6.If you were to continue experimenting, what would your next steps be?

– Carrying a camera which can show where you are and it can explore an air bag to make sure that you will not hit to the surroundings.

Part B

1.How is writing code similar to making dumplings?

-Actually, I’m not sure about this question because i don’t think the code writing can be connected with the dumplings making. Can we understand the question as how is writing code system similar to making dumplings. We need to organize the structure both for the code and dumplings, we have to have the outline to order the process.

2.As Manovich describes in the Language of New Media, the influence of computers on new media is clear. In what ways do you believe the computer influences our human behaviors?

-For this question, as we know that the computer can do some stuffs that the human cannot make it immediately and individually so in some ways the computer can replace of the human workforce. The media in the past few years the people have to know all the details about the news and the events through the books and newspaper, the people have to remember what the information is and all the details but from recently years. It’s too easy to get the information from the website and the app, the people can only remember that where they can get the information because it’s so easy to get the imformation.