Final Project – Searcher

Searcher 

Created by Patrick Wang, Instructor: Eric Parren 

Hello, this post will document my IMA Final Projects and the process I went through

  1. CONCEPTION AND DESIGN:

For the IMA final project, we are given the task to create a project that combines both Adurino and Processing to show how intreaction works. We first have to build a prototype for user testing and a better version for presentations. Through my previous projects and learning from lectures, I learned that a good interaction should be where there is a communication between users and the object. To incorporate this notion in my project, I want it to be engaging as well as unusual. I first did a brainstorm on how to connect Adurino with Processing. I thought it would be cool to have created a radar that can detect physical objects. The following is my idea of the game.

The Searcher Game:

It is a two player game where one player serves as the radar operator and the other serves as the attacker.

Attacker : place wood “spacecrafts” and “asteroids”within the detection area (within tape area), your goal is to preserve “spacecrafts” to win. Don’t let Defender see where you place the “spacecrafts” or “asteroids”.

Once attacker is finished the Game start

Defender: Use radar to detect the location of “spacecrafts” and destroy all of them with the missile (rubber bullets) within time limits. You can not look over this cardboard screen. There are 3 spaceships and 2 asteroids. You only have 5 missiles!

Posters with instructions that I wrote for the game:

Adapation: 

A major adaptation I did to the project is to change the detection sensor. At the beginning of the project, I was using an ultrasonic sensor to detect. The problem with ultrasonic is the detection distance was too small for my project. Then after talking to LA about a method to increase distance, they suggest infrared. After switching to infrared, I had to redo my code and wire. This change was beneficial since it created a bigger area for users to place wood props in and compete with.

Another adaption is the suggestions from User Testing. During User Testing, many testers suggested a way to destroy the enemy wood “spaceships” since before there was no way to show how the user had actually detected the enemy “spaceships”.  I added a rubber bullet gun so when the user detected the enemy “spaceships”, they can simply use the gun to shoot it to remove it from the game. This allow the user to be more immersive into the interaction.

2. FABRICATION AND PRODUCTION:

The first step is to create a rough sketch of the project. The picture below is a sketch of my beginning idea of what the project is like:

To make the game function: I created the project with four main components: The Control Box, The Rotation Radar, The Detection Screen and The Wood Props.

The Rotation Radar:

An infrared sensor is attached to the servo which will turn based on the input from the Control Box. Infrared sensor will give serial communication of the distance to the Detection screen. I designed it so that it will only turn 110 degrees to fit the detection range within a table. For the material that builds up the outer components, I use 1.5mm wood that was lazer cut by laser cutter. I chose this method because it is clean and easy to assemble. I then glued them together using a hot glue gun. 

Changes I made to this component is that at first I used ultrasonic sensors to detect objects, however its detection range is too small for my project. I then switch to Infrared sensors. This is where I encounter a problem: the wire from the Infrared sensor was too thin to fit into the breadboard for Adurino. I had to solder each one of them to a jump cable. After this was done, I had to redo the coding in Arduino to fit the new sensors. 

Building the radar box and the solder connection:

Finish Product: 

The Conrtol Box:

To make it simple for users to interact with, the “radar” is attached to a servo which is turned by a slider within the Control Box. Through sliding, the “radar” can change its angle of detection. The box is designed in simplicity so the user will know where to interact. The reason why I chose slider is because it is the most straightforward method for users to interact with the servo. Users when they see a slider will know immediately it is to slide and control the servo. By adding it to the box, users will be knowledgeable about how the servo turns after a few tries. 

For this component, I choose 1.5mm wood as well. I did a design on Cuttle then performed a laser cutting to produce the parts that needed to be assembled. I also use laser cutting to etched on wood parts to make this component more realistic and attractive.

The finish wiring:

Finish Product:

 

The Detecton Screen:

The serial communication form Audnrio is forward to Processing. The distance of the detection is displayed visually as a continuous line, when an object is detected there will be a spike. When there is nothing but the background, there will be a low value displayed. To make this component interesting, users can see when an object is detected or not. On the user interface, the continuous changing line will give the user the desire to discover the interaction of infrared sensors. Furthermore I also added a repeating sonar sound and a sonar range image background into Process, this makes the user further immersive themself into the game.

This part is where I spent the most time in designing and editing. I first tried to build a serial communication between Audnrio and Processing. This was relatively easy since I had to only follow the code in recition I did. The difficult part is how to display this input as a continuous line. I tried various methods yet they did not work. Professor Parren helped me with the coding and after editing for half an hour the input data is displayed as a continuous graph. I then added lines and numbers onto the screen through “text” and “line” to mark whether the changing line is in the range of background (Cosmic Background) or an object detection (Value: 0-500). Lastly I added a timer that will do a countdown for the user. This made the game more intense and fun.

Wood Props:

I designed 5 wood props on Cuttle and did laser cutting to make them. 3 of them are enemy spaceships and 2 of them are small asteroids that are used to fake detection signals for the radar operator (As on the detection screen, the two asteroids will have a similar appearance as enemy spacecrafts). One of the two Users who act as the attacker will place them randomly before the game starts.

Laser cuting and gluing them togther 

Finish Product:

The Final Product: 

 

Radar detecting enemy spaceships with a cosmic background

Virtual displaying the serial inputs and the Control Box

Video of playing the game:

Turning the radar with a slider 

Detecting whether there is a spaceships or not (Cosmic Background range is nothing, spaceship detection: Value from 0-500.)

Shooting the wooden props with the rubber bullet gun when a player discover where it is

3. CONCLUSIONS:

The goal of this project is to create interactive experiences through Audrino and Processing. I hoped that through the game I created using Processing and ultrasonic, I could create an immersive experience for users to interact with. I believe that my project did meet that goal yet it requires the user to play the game a few times to understand how every components work before they can truly enjoy the interactive experiences. Based on my expectations, ultimately the audience will interact with my project through rotating the servo with a slider to read the distance of detection on Processing. 

If I had more time to improve my project, I would like to make the diagram on detection screen from the 1D line into a 2D map of the table. This way the user will have a clear understanding of the location and what is displaying on the screen. This was a problem that I encountered in the final presentation where users don’t understand what is being displayed on Processing when they first try the game. I think if this is achieved, my game will be more immersive and easy to get hands on. 

I think my project aligns with my definition of interaction quite well. Apart from Processing, the interaction is very simple and easy to understand. Users only have to slide a slider to control the servo. The game is very immersive and will make users stick to this project and immersive themselves into it. Lastly, by using infrared, it creates a new experience for users. This brand new experience will hook users to try this game themselves. 

From this experience, the mistake I learned is that for users, there should be clear feedback or instruction. It is very hard for them to understand a complex interaction quickly. By making the game simpler, in fact it increases their likely chance of being immersive. A take away from my accomplishment is that people really like competitive games. By creating a game that requires two users to compete with each other, it can make the whole experience more interactive for both users. 

In summary, my project delivers to users an interactive experience with the combination of Processing and Adurino. Users through interacting with my project can walk away with not only a joyful experience, but a deeper understanding of what interaction can be.

4. APPENDIX:

Adurnio Code: 

int IRpin = 1;
#include <Servo.h>
Servo myservo; // Creates a servo object for controlling the servo motor
int val;
void setup() {
  Serial.begin(9600);
 myservo.attach(9);  
}
void loop() {
  // to send values to Processing assign the values you want to send
  // this is an example:
  int sensor0 = analogRead(A0);
  int sensor1 = analogRead(A1);
   val = analogRead(A0);
  val = map(val, 0, 1023, 0, 110);
  myservo.write(val);
 float volts = analogRead(IRpin)*0.0048828125;  
  float distance = 65*pow(volts, -1.10);  
  Serial.println(distance);    
  // Serial.println(” cm”);
  delay(100);  
}
 

Processing Code: 

import processing.serial.*;
PFont font;
String time = "023";
int t;
int interval = 43;

import processing.sound.*;

Serial serialPort;


SoundFile sound;
int xPos = 1;   
float inByte = 0;


int NUM_OF_VALUES_FROM_ARDUINO = 1;  /* CHANGE THIS ACCORDING TO YOUR PROJECT */
PImage photo;
/* This array stores values from Arduino */
int arduino_values[] = new int[NUM_OF_VALUES_FROM_ARDUINO];

float lineLength = 0;
float lineElements[] = new float[200];

void setup() {
  size(1162, 900);
  background(0);
  photo = loadImage("image.png");   
  println("Loading mp3...");
  sound = new SoundFile(this,"Sonar1.mp3");
  sound.loop();






  printArray(Serial.list());
  // put the name of the serial port your Arduino is connected
  // to in the line below - this should be the same as you're
  // using in the "Port" menu in the Arduino IDE
  serialPort = new Serial(this, Serial.list()[0], 9600);
  
  serialPort.bufferUntil('\n');
  
  for(int i=0; i<lineElements.length; i++) {
    lineElements[i] = 0;
  }
}

void draw() {
getSerialData();
 
  image(photo, 0,0);
   stroke(255,0,0);
   strokeWeight(3);
   
   t = interval-int(millis()/1000);
    time = nf(t , 3);
    if(t == 0){
      println("GAME OVER");
    interval+=0;}
   
textSize(30);
 strokeWeight(3);
   fill(0, 255, 255);
text("Value:250", 50, 230); 
  
  
  textSize(30);
 strokeWeight(3);
   fill(0, 255, 255);
text("Value:500", 50, 470); 

   stroke(0,200,255);
 strokeWeight(3);
 line(0,250,1162,250);
  

  stroke(0,0,255);
   strokeWeight(3);
  line(0,750,1162,750);
     strokeWeight(3);
  line(0,500,1162,500);
  
 

textSize(30);
 strokeWeight(3);
 fill(255,200,0);
text("Cosmic Background", 50, 600);
text("Radiation", 50, 660);

textSize(50);
 strokeWeight(3);
 fill(255,0,0);
   text(time, 1000, 50);
     fill(0, 255, 0);

textSize(50);
 strokeWeight(3);
 fill(255,0,0);
 text("Timer", 850, 50);
   
  line(xPos, height, xPos, height - inByte);

  // at the edge of the screen, go back to the beginning:
  if (xPos >= width) {
    xPos = 0;
    background(0);
  } else {
    // increment the horizontal position:
    xPos++;
  }
  
  if(arduino_values[0] < 150) {
    lineLength = map(arduino_values[0], 0, 150, 0, height);  /// THIS MAPS DISTANCE IN CM TO SCREEN COORDINATES
    float lineElementsCopy[] = new float[lineElements.length];
    arrayCopy(lineElements, lineElementsCopy);
    printArray(lineElements);
    lineElementsCopy = append(lineElementsCopy, lineLength);
    printArray(lineElementsCopy);
    lineElements = subset(lineElementsCopy, 1);
  }
  stroke(0,255,0);
  strokeWeight(3);
  for(int i=0; i<lineElements.length-1; i++) {
    line((width/lineElements.length)*i,lineElements[i], (width/lineElements.length)*(i+1),lineElements[i+1]);    
  }
  
}

void getSerialData() {
  while (serialPort.available() > 0) {
    String in = serialPort.readStringUntil( 10 );  // 10 = '\n'  Linefeed in ASCII
    if (in != null) {
      print("From Arduino: " + in);
      String[] serialInArray = split(trim(in), ",");
      if (serialInArray.length == NUM_OF_VALUES_FROM_ARDUINO) {
        for (int i=0; i<serialInArray.length; i++) {
          arduino_values[i] = int(serialInArray[i]);
        }
      }
    }
  }
}

The Gripper – Pratirck Wang – Instructor: Eric Parren

The gripper – Pratirck Wang/Justin Lau – Instructor: Eric Parren 

Welcome, this blog is to report me and my teamate Justin collaboration work for IMA Midterm project.

  1. CONTEXT AND SIGNIFICANCE

After we submitted our proposal, we decided to stay with Jason’s idea. He wanted to create a robotic arm that when attached to the left arm can be moved by itself. It can help the wearer to pick up or hold items. It can be helpful to seniors or people with disabilities to grab an item. The interaction is that through the button and slider, the arm can rotate 360 degrees and can grip on to the item. The interaction is that humans give input to the machine, and the machine gives feedback by moving its arm or grip. During past recitation, we know the most difficult part of the Arduino project is coding. Furthermore as we have just learned how to use servos, we decided to implement it in this project. Therefore we want to create a project that is simple and easy to use. There should be no confusing interaction or components. 

 2. CONCEPTION AND DESIGN

We knew that this project must be made durable as it is built for users wearing and testing. Furthermore in order to make the project functionable, we decided that it has to be lightweight. This eliminated any heavy material like metal or wood.  Therefore we pick cardboard to be the main components of the build. The upper arm, forearm and grip will also be made of cardboard. Since we have gained experience working with servo in recitations and the group project, we picked it to serve as the part for movement of the arm and grip. This ont only saves time but also is more practical compared to other components.

Here is a rough sketch of our idea: 

The machine is attached to the upper arm. The button and slider is placed perpendicular to the arm and after pressing it can be moved and grip by itself.

Material lists:

  1. Cardboard
  2. Duct tape 
  3. Hot glue 
  4. Two Arduinos 
  5. Two Arduino cables
  6. Two breadboards 
  7. Three servos (This later changed to two servos and one stepper motor)
  8. One button 
  9. One slider 
  10. Some M/M and F/M Wires 
  1. FABRICATION AND PRODUCTION

First: Our goal is to create a prototype for user testing. 

I started to cut the cut cardboard to form the shape while Jason connected the wire. Jason tried to use a 5 pack battery supply to power the servo (We originally designed that there is no need for the arduino cable). However it did not work and LA told us that the 5 pack battery can not power the servo. Therefore we changed the design back to using arduino cable. Jason progarmed the servo in the picture that controls the arm movements.  

 

Afterward I tried to program the two servos that control the grip. I encountered a problem as the two servos had to be connected to one button. I tried to code it for two hours and it came out fruitless. I asked a professor to help me with coding (I don’t have any experience with coding, this is really difficult for me). After some trying the, the grip worked.

Then we started to tape everything together:

This is where we started to encounter the problem that will last through the entire project. The forearm, even being built of cardboard, is to heavy for the servo to lift. We planned so that if we push the slider the forearm can rotate 360 degree. But when we tried it can only move 20-30 degrees from the positions of forearms pointing to the ground. We tried to solve it by sticking wires through the servo. Although it is shaky it can now move almost 360 degrees. We were happy with the result and present it for user testing to get feedback.

Second: User testing and Feedback 

 

We presented our project to many students and most are impressed by our design. They really liked how the arm can rotate 360 degrees. Some feedback is to create some props for the grip to pick up. This can make it more interesting and interactive. Another suggestion is to change the location of the slider and the button. The location on the protype is perpendicular to the arm. They suggest moving it parallel to the arm and also place them together. After some discussions with Jasons, we decided to listen to their suggestions and move it. This modifications later become successful as it is more friendly for user to interact with. 

Third: Building the final products 

For the final product, we want to build a brand new one since the prototype is crude and fragile.  Jason thought that by replacing the servo with a stepper motor on the upper arm, it can hold the forearm completely. I agreed with him and we started working on that. A stepper motor is very different from a servo. I had to redo the wire and cricut to make it work.

I encounter the issue of coding again since I have no experience with sliders being the input to control the stepper motor. I asked for help again and with clarification from the professor and the problem was solved.  

Jason and I taping the upper arm and forearm 

   

Just as we thought all the problem was solved, the issues of the heaviness of the forearms come back again. Even with the stepper motor replacing servo, it still can not rotate. We tried to increase the motor rotate speed and it was still useless. In the end we just give up with the notion of the rotation of the forearm by a stepper motor. We added a handle to the forearm for the user to hold and rotate. This solves the issue of the stepper motor not being able to rotate. (It is a failure since our original design is that the forearm can rotate 360 degrees by itself, now it has to be held up by the user’s forearm.)

We also move the button and slider to the positions that was suggested in user testing

Finished product: 

Video of trying the product out: 

 

Code for controlling stepper motor with a slider: 

//
#include <AccelStepper.h>

const int potPin = A0;
int DIR_PIN = 2;
int STEP_PIN = 3;
int EN_PIN = 4;

// Define a stepper and the pins it will use
// AccelStepper::DRIVER means a stepper driver (with step and direction pins)
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);

int pos = 0;  // variable to store the servo position

void setup() {
  pinMode(potPin, INPUT);
  pinMode(EN_PIN, OUTPUT);
  digitalWrite(EN_PIN, LOW);
  // The run() function will accelerate up to
  // the speed set here
  stepper.setMaxSpeed(2000);
  stepper.setAcceleration(2000);
  // Set the desired constant speed for use with
  // runSpeed()
  stepper.setSpeed(2000);
  stepper.setCurrentPosition(0);
  stepper.runToNewPosition(0);
  Serial.begin(9600);
}

void loop() {
  int sensorVal = analogRead(potPin);
  int motorAngle = map(sensorVal, 0, 1023, 0, 100);
  // Serial.println(motorAngle);

  stepper.moveTo(motorAngle);
  stepper.run();
  delay(1);

}

Code for controlling two servos with one button: 

#include <Servo.h>

Servo myservo;
Servo myservo1;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;  // variable to store the servo position
// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;
int prevButtonState = 1;

void setup() {
  myservo.attach(8);  // attaches the servo on pin 9 to the servo object
  myservo.write(pos);
  myservo1.attach(12);  // attaches the servo on pin 9 to the servo object
  myservo1.write(pos);
  pinMode(pushButton, INPUT);
  Serial.begin(9600);
}

void loop() {

  int buttonState = digitalRead(pushButton);

  if((buttonState == 0 && prevButtonState == 1) && pos == 0) {
    pos = 90;
    myservo.write(pos);
    myservo1.write(pos);
  } else if((buttonState == 0 && prevButtonState == 1) && pos == 90) {
    pos = 0;
    myservo.write(pos);
    myservo1.write(180);
  }

  prevButtonState = buttonState;

  delay(10);

  1. Conclusions: 

The goal of our project is to demonstrate our idea of a machine that can aid humans in the work environment in life by acting like a third arm. Furthermore it can give people with arm disability the chance to have an “arm” like function to improve their life quality. I think even though our end product is unsatisfactory compared to our original idea, I think it still showcased to our audiences that our idea could pave the way for it to be invented. The project we created demonstrated clearly to the audience how it functioned and what it could do. Although its interaction is simple, it fits my definition of interaction. Users send a signal through a slider or button to the machine. The machine give feedback to the user through movement. The machine is simple for users to understand, its function is similar to things they have used before and it is easy to master. Ultimately, our audience interacts with it through buttons and sliders. The machine responds by moving it and gripping things they desire. 

I think if we had more time to improve the project, we would have found a way to solve the issues of rotation of the forearm. We later learned that another team used two stepper motors to move its arm. If we have time to use two stepper motors, our project forearm might be functionable. I think the biggest setback I learned from this project is don’t be overconfident. After user testing, we thought that by replacing servo with stepper motor, we can increase the forearm size and weight. We are too confident that nothing will go wrong and did not test the ability of the stepper motor until it was finished which resulted in the project being unsatisfactory. The take away from our accomplishments for me is to not give up. When we encountered the issue of the forearm being unliftable, we almost wanted to rage quit as we thought that there was no way to even lift the forearm by an inch. Then I gave the idea that we can attach the machine forearm to the real forearm. During the presentations, with some explaining to the user its original intentions and the difficulties we encounter, this problem was solved. If we gived up and stopped thinking of the alternatives, we would have failed the project. This is a very valuable thing I learned!

Hello world!

Welcome to Web Publishing @ NYU. This is your first post. Edit or delete it, then start creating your site!

Online help is available via the Web Publishing Knowledge Site (wp.nyu.edu/knowledge) and the ServiceLink knowledge base (www.nyu.edu/servicelink). Through ServiceLink, you can find step-by-step instructions, as well as tutorials.

Digital Accessibility

As content creators who create and publish text, images, video, and audio, you must adhere to the NYU Website Accessibility Policy (https://www.nyu.edu/digitalaccessibility/policy) when creating and publishing digital content.

Web Publishing-specific Digital Accessibility Best Practices and examples of how to ensure your content are compliant are available at https://wp.nyu.edu/digitalaccessibility

If you have additional questions, contact the IT Service Desk for assistance. Support is available 24/7/365. For more details, visit www.nyu.edu/it/servicedesk.