Final Project-Burning Calorie, Filling Color

Instructor: Moon

Partner: Shirley (Xuehan) Zhao

Burning Calorie, Filling Color

A “coloring book” where the crayon is your body

Description: 

This is a coloring book where the user moves his body to make and fill the color. On the cover page, the user clicks a sketch that he wishes to work on. Then he chooses to start a new work of this sketch or to resume a previous one. Having a sketch open, light purple flashes in the area targeted, and the user moves his bodies to set the color he wants on the color bar. Pressing the key once, the color on the color bar would be brushed onto the targeted area, and then it moves to the next area if the key is pressed again. During or after coloring, the user clicks the “back” button to return to the cover page or he can click the “save” button to save his work as an image.

Demo of Project:

One of the users’ work:

work zl1297

Continue reading

Lab12-Media Controller

Date: May 5,2017

Partner: Ziyu (Silvia) Lu

Instructor: Moon

Aim of today’s lab: Control the images on as Processing sketch with a controller made with Arduino.

Material used: Arduino, Breadboard, LM35 Temperature Sensor, wires.

Exercise:

Ziyu proposed that we can use the Temperature Sensor to create a “oven”. So we looked up online and found three images, a dough, pieces of bread and burnt toast:

miantuan

Credit to Christine’s Recipes

shu

Credit to: MYKITCHEN

hu

Credit to: www.flickr.com/photos/francoisroche/2584062428/#sthash.knoyWwjw.dpuf

And we began to make the circuit and write the Arduino code for this. We checked the Temperature Alarm’s code to learn how to read the data from temperature sensor. And we also checked the code Moon gave us to do the serial communication. At first, we made the image change from dough to bread when temperature is higher than 25, but then we found that because of the surroundings’ temperature is too high, Processing would display the bread’s image upon running it. So we changed the range to higher than 30, this time it works. Similarly, we also made some adjustment in terms of the temperature range that makes the image into burnt toast. This is our final work:

Things learned: We should always review things we learned before and combine them with things we learned recently to create more amazing things!

Lab 11: Drawing Machines

Date: April 28, 2017

Partner: Ziyu (Silvia) Lu

Instructor: Moon

Aim of today’s lab: Creating drawing machines by using an H-bridge to control stepper motors attached to mechanical arms.

Material used: 

  • 1 stepper motor
  • 1 SH75440NE ic chip
  • 1 5 volt power supply
  • 1 power plug
  • 1 potentiometer from your kit
  • 1 Arduino and USB cable from your kit
  • Laser-cut mechanisms
  • Pens that fit the laser-cut mechanisms

Process:

First, we connected the circuit following the instruction. The challenge we found is how to connect the stepper motor to the circuit because we are so confused about the 8 pins and all the wires twine with each other. So Silvia and I decided to take charge of each side and finished connecting eventually. And then we uploaded the example code to make the motor work.

And then, we added a potentiometer and also cooperated with another group to make this drawing machine.

Things learned:

We should always be careful when making the circuit as well as uploading the code. But it was really fun to actually use this steep motor to draw something and control the speed.

Final Project Proposal

Instructor: Moon

Partner: Shirley (Xuehan) Zhao

Definition of interaction: Interaction, based on my understanding is the mutual connections between different objects. The objects can be people, program, components or even visual image and movement. To achieve interaction, we must design the bilateral feedbacks to each movement or each data sent.

Final project proposal: For my final project, I am going to partner with Shirley and we are going to design a game named “Burning Calorie, Filling Color”. In this game, players will color certain images with their body. By using three acceleration sensors, we can count the times player shaking their body, any three parts including head, hands and feet, and transform the times into RGB value to form a color. The color is used to fill in certainly area the player chooses. After finishing all the coloring, the picture will be saved and sent to the player. The motivations of our final project are encouraging people to do more exercise and helping them release stress. Combining with Shirley’s proposal that we should encourage users to dance, my initial idea was to draw a certain image according to the users’ movement. However, we then found out that the leap motion is not that precise which may influence the user experience. Then, inspired by the coloring book “Secret Garden”, we decide to create another version of coloring book to achieve both targets. To design this game, there are two parts—processing and Arduino—need to be made and also the connection between them. For Arduino, we are going to use it to connect the acceleration sensors, which can count the times of user’s movement—shaking body. And for the processing, we are going to use it to do the coloring part as well as design the start and end page for our game. To achieve the coloring part, we need to create a mask and separate the image into different part by using Photoshop. We also want to create the effect of color changing as the player shaking their body so she can get a sense of what the color she is creating is. Besides, we want to make wireless connection between Arduino and processing to improve the user experience as well as solve the problem of limited USB interfaces.

Interactions related to my project: The established interactions related to our project is the draw images by body movement I mentioned before. I have seen a lot of projects that people can let certain sticks come out from a plane and the convex sticks could form a shape or even a picture. However, I think these kinds of projects require the users to have art creativity and painting ability. But by simply coloring an image, the users can actually do whatever she wants and create her own work.

Lab 10: 3D Modeling

Date: April 21, 2017

Instructor: Moon

Aim of today’s lab: Using Tinkercad, design a 3D model of a wearable device, a game controller or a security camera that utilizes one components or equipment

Exercise:

I used the 4 digit displayer and I wanted to create something similar to a clock.

I started with creating a container to fit the displayer in. At first, I used the basic shape “Tube” and “box” wishing to create something like this:

Screen Shot 2017-04-21 at 4.10.32 PMWhile I was working on making the box internally tangent to the tube, my friend Jiaxin reminds me that even though I can calculate precisely, these two objects cannot connect to each other. So I chose to use the “Cylinder” and group it with a “box” to make this:Screen Shot 2017-04-21 at 2.27.16 PMAnd then I added one heart and a base to make it looks like a clock.Screen Shot 2017-04-21 at 4.01.35 PMOne thing worth noticing is that the diameter of the circle is larger than 40mm so you can only see the digital screen from the front.

Things learned:

Creating a 3D model is much more complicated but fun than I imagined. The stereoscopic design requires us to imagine how it would look like beforehand and design it in a practical way.

Lab 9: Illustrator Stamp and Trip to AutoDesk Office

Date: April 14, 2017

Instructor: Moon

Aims of today’s lab: Create a stamp and get to know better about Autodesk

Task 1: Stamp

My inspiration is a character from the American TV show “Friends” called Joey. He always begins his communication with others by saying “how you doing” and I think it would be fun if I can do a stamp of it.

I made this stamp basically following the video and most parts went smoothly EXCEPT one thing. I firstly made this:Screen Shot 2017-04-17 at 11.44.04 AMThen I tried to remove the two radians within the polygon. I clicked all the buttons under “shape modes” but none of them worded. So I tried to fill the two shapes and use “merge” under “pathfinders”. It worded, like this:Screen Shot 2017-04-17 at 11.47.52 AM(As I am writing the documentation I realize that I somehow changed the shape , though it doesn’t affect my stamp.)

Then I changed the font and added an emoticon to make my final version:Screen Shot 2017-04-17 at 1.01.50 PMAnd then I made some adjustments and reflected it in order to do the laser cutting following the video:Screen Shot 2017-04-17 at 12.11.30 PM

Task 2: Field trip

The trip to Autodesk was really inspiring and informative. I first was quite shocked by how Autodesk develops from a small team to a impressive company now. Their developing process also indicates the overall technology development which is changing our daily life significantly.IMG_9697

One thing attracts me especially is their strategy that they provide free tool for everyone but more advanced tool also for experienced users. I think it’s quite helpful to attract more people to learn about 3D printing and actually use it.

The trip also provides me insights about working in a company like this and what we can create, both of which promote me to explore more.

Midterm Project- Make Lehman Happy

Date: 31 March 2017

Instructor: Moon

Partner: Xuehan (Shirley) Zhao

Title: Make Lehman Happy! — A fun/funny game that helps raise people’s awareness of NYU Shanghai values and policies.

Description: In this game, players should first judge the statement on each bubble–whether it is consistent with NYU polices or values or not. If the play click the “right” bubble, i.e. the statement is true, Prof. Jeffery Lehman will be happy and his photo will go up. Once the photo reaches the tope, the “Lehman proud of you” video will play showing that he is quite satisfied.  On the contrary, if you keep clicking on the wrong one, Lehman will cry.

Demo:

Continue reading

Lab 6: Serial Communication

Date: 17 March 2017

Instructor: Moon

Partner: Silvia (Ziyu) Lu

Material used: Arduino, breadboard, wires, LED  switch, 220 and 10k resistors

Exercise 1:

We first decided to create a  project that can send data from processing to Arduino. So I proposed that we may use processing to control the LED. Then Silvia began to write the code for Arduino and I wrote the code for processing. Basically, I drew four rectangles and when the mouse is in different rectangle, different LED would turn on. When we ran both processing and Arduino, everything went well except when the mouse in the “white” area. While it is supposed to turn off all LEDs, one LED still turned on–like this:

After turning to Daniel for help, I realized that I didn’t define the “white” area in processing, so I added one line defining that when mouse is in this area, processing would send ‘W’ to Arduino, and when Arduino receives that, it would turn all the LEDs off. Here is the final work:

Exercise 2:

Then we decided to send multiple data from Arduino to processing. Silvia proposed that we can use four switches to control a ball drown in processing to move right, left, up and down. So this time, I wrote the Arduino code and Silvia wrote the Processing. However, after we ran, it didn’t work. Then Jiwon found out that we didn’t power the switch. So we reconnected the circuit and it finally worked.

IMG_9073

Things learned:

  1. When using “if” statement, I need to define every possible situation carefully, otherwise error may occur.
  2. When using the breadboard, I need always to power the circuit.
// Exercise 1
// Processing part
import processing.serial.*;

Serial myPort;

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

  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[1], 9600);
}

void draw() {
  noStroke();
  fill(255, 0, 0);
  rect(0, 0, width/2, height/2);
  fill(0, 255, 0);
  rect(width/2, 0, width, height/2) ;
  fill(255, 255, 0);
  rect(0, height/2, width/2, height);
  if (mouseX < width/2 && mouseY<height/2) {
    myPort.write('R');
  } else if (mouseX < width/2 && mouseY<height) {
    myPort.write('Y');
  } else if (mouseX < width && mouseY<height/2) {
    myPort.write('G');
  }else {
    myPort.write('W');
  }
}

// Arduino Part 
int valueFromProcessing;



void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);  
}


void loop() {
  // to receive a value from Processing
  while (Serial.available()) {
    valueFromProcessing = Serial.read();
  }
  
  if (valueFromProcessing == 'R') {
    digitalWrite(13, HIGH);
    digitalWrite(8, LOW);
    digitalWrite(7, LOW);
  } else if (valueFromProcessing == 'G') {
    digitalWrite(8, HIGH);
    digitalWrite(13, LOW);
    digitalWrite(7, LOW);
  } else if (valueFromProcessing == 'Y'){
    digitalWrite(7, HIGH);
    digitalWrite(8, LOW);
    digitalWrite(13, LOW);
  } else{
    digitalWrite(7, LOW);
    digitalWrite(8, LOW);
    digitalWrite(13, LOW);
  }
  delay(10);
}

//Exercise 2
//Processing part
int x;
int y;
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()[ 1 ], 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.
  
  x = width/2;
  y= height/2;
}


void draw() {
  // to read the value from the Arduino
  while ( myPort.available() > 0) {
    valueFromArduino = myPort.read();
  }
   println(valueFromArduino);
  
  ellipse(x,y,50,50);
  if(valueFromArduino==1){
    x++;
  }else if(valueFromArduino==2){
    x--;
  }else if(valueFromArduino==3){
    y++;
  }else if(valueFromArduino==4){
    y--;
  }else if(valueFromArduino==5){
  }
}

// Arduino part
void setup() {
  Serial.begin(9600);
  pinMode(6,INPUT);
  pinMode(7,INPUT);
  pinMode(8,INPUT);
  pinMode(8,INPUT);

}

void loop() {
if(digitalRead(6) == HIGH ){
  Serial.write(1);
  delay(10);
}else if (digitalRead(7) == HIGH ){
  Serial.write(2);
  delay(10);
}else if (digitalRead(8) == HIGH ){
  Serial.write(3);
  delay(10);
}else if (digitalRead(9) == HIGH ){
  Serial.write(4);
  delay(10);
}else{
  Serial.write(5);
  delay(10);
}


}

Stupid Pet Trick Show

Date: 10 March 2017

Instructor: JH Moon

Goal: Using Arduino to create some interesting project

Material used: Arduino, breadboard, buzzer, Sharp GP2Y0A710K Distance Sensor, wires (and a useless doll).

Idea:

My initially idea is creating a circuit on a doll which would play different music when the distance between you and the doll is different. Eventually, the doll would “scream” if you touch it.

Process:

The very first obstacle I ran into is choosing the distance sensor with proper sensor. Since the range of the distance sensor should be relatively wide to make it possible to play various music, I chose the Grove Ultrasonic Ranger 26, which ranges from 3cm to 4m at first. However, when I went to rent it, I found that, unfortunately, the only distance sensor I can use is the one ranges from 1m to 5.5m. So the improper sensor causes that my project doesn’t work as I expected. Then when it comes to play the music, I first looked up online that I can change the tone of buzzer to make it play music. However, then I found out that there is a MP3 player which can play music directly. However, both Moon and Jiwon didn’t suggest me to use that since the player is too complex to code and put in the circuit. So I still ended up with using the buzzer and changing the tone of it. But I am always looking forward to use the Player to improve my project. Here is my final circuit. Continue reading

#include <Ultrasonic.h>

int sensorValue;
int distance;
int tonePin = 7;
int a = 400;

int countHorn = 0;
int countHuluwa = 0;
int countGirl = 0;
int countAlarm = 0;

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

void loop() {
  sensorValue = analogRead(0);
  if (sensorValue >= 280 && sensorValue <= 512) {
    Serial.print("The distance is: ");
    distance = 28250 / (sensorValue - 229.5);
    Serial.print(distance);
    Serial.println("cm");

    if (distance > 300 && distance <= 500) {
      if (countHorn < 2) {
        horn();
      }
      // update counts
      countHorn++;
      countHuluwa = 0;
      countGirl = 0;
      countAlarm = 0;
    } else if (distance >= 200 && distance < 300) {
      if (countHuluwa < 2) {
        huluwa();
      }
      // update counts
      countHorn = 0;
      countHuluwa ++;
      countGirl = 0;
      countAlarm = 0;
    } else if (distance >= 150 && distance < 200) {
      if (countGirl < 2) {
        girl();
      }
      // update counts
      countHorn = 0;
      countHuluwa = 0;
      countGirl++;
      countAlarm = 0;
    } else if (distance >= 100 && distance < 150) {
      if (countAlarm < 2) {
        alarm();
      }
      // update counts
      countHorn = 0;
      countHuluwa = 0;
      countGirl = 0;
      countAlarm ++;
    }
  }
  delay(100);
}


void horn() {
  //horn
  Serial.println("A");
  tone(tonePin, 294, a * 0.5);
  delay(a *  0.5);
  noTone(tonePin);//6-_
  tone(tonePin, 441, a * 0.5);
  delay(a *  0.5);
  noTone(tonePin);//3_
  tone(tonePin, 441, a * 1);
  delay(a *  1);
  noTone(tonePin);//3
  tone(tonePin, 294, a * 0.5);
  delay(a *  0.5);
  noTone(tonePin);//6-
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 441, a * 1);
  delay(a *  1);
  noTone(tonePin);//3
  tone(tonePin, 624, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//6__
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 556, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//5__
  tone(tonePin, 441, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//3__
  tone(tonePin, 393, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//2__
  tone(tonePin, 441, a * 1);
  delay(a * 1);
  noTone(tonePin);//3
}


void huluwa() {
  //huluwa
  Serial.println("B");
  tone(tonePin, 294, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 294, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 350, a * 2);
  delay(a * 2);
  noTone(tonePin);
  tone(tonePin, 294, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);
  tone(tonePin, 294, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 350, a * 1.5);
  delay(a * 1.5);
  noTone(tonePin);
  tone(tonePin, -1, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 495, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 495, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 495, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);
  tone(tonePin, 441, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);
  tone(tonePin, 495, a * 1);
  delay(a * 1);
  noTone(tonePin);
  tone(tonePin, 441, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);
  tone(tonePin, 294, a * 1);
  delay(a * 1);
  noTone(tonePin);
}

void girl() {
  //girl
  Serial.println("C");
  tone(tonePin, 294, a * 1);
  delay(a * 1);
  noTone(tonePin);//6-
  tone(tonePin, 441, a * 1);
  delay(a * 1);
  noTone(tonePin);//3
  tone(tonePin, 441, a * 1);
  delay(a * 1);
  noTone(tonePin);//3
  tone(tonePin, 441, a * 1);
  delay(a * 1);
  noTone(tonePin);//3
  tone(tonePin, 441, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);//3_
  tone(tonePin, 441, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);//2_
  tone(tonePin, 350, a * 1);
  delay(a * 1);
  noTone(tonePin);//1
  tone(tonePin, 393, a * 1);
  delay(a * 1);
  noTone(tonePin);//2
  tone(tonePin, -1, a * 1);
  delay(a * 1);
  noTone(tonePin);//0
  tone(tonePin, 393, a * 1.5);
  delay(a * 1.5);
  noTone(tonePin);//2.
  tone(tonePin, 441, a * 1);
  delay(a * 1);
  noTone(tonePin);//3
  tone(tonePin, 393, a * 1);
  delay(a * 1);
  noTone(tonePin);//2
  tone(tonePin, 350, a * 1);
  delay(a * 1);
  noTone(tonePin);//1
  tone(tonePin, 393, a * 1);
  delay(a * 1);
  noTone(tonePin);//2
  tone(tonePin, 350, a * 1);
  delay(a * 1);
  noTone(tonePin);//1
  tone(tonePin, 624, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);//6_
  tone(tonePin, 556, a * 0.5);
  delay(a * 0.5);
  noTone(tonePin);//5_
  tone(tonePin, 624, a * 1);
  delay(a * 1);
  noTone(tonePin);//6
  tone(tonePin, -1, a * 1);
  delay(a * 1);
  noTone(tonePin);//0
}

void alarm() {
  //alarm
  Serial.println("D");
  tone(tonePin, 262, a * 0.25);
  delay(a *  0.25);
  noTone(tonePin);//1
  tone(tonePin, 294, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 330, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 350, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 393, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 441, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 495, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 495, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 441, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 393, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 350, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 330, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 294, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
  tone(tonePin, 262, a *  0.25);
  delay(a *  0.25);
  noTone(tonePin);
}