Abraham and Caseysimone

From BenningtonWiki
Jump to: navigation, search

<<< class wiki

Ideas

Brainstormed

Abe and I discovered upon discussing this project that we are both interested in motion sensors and thought that we wanted to use the mid-term project as a way of exploring the coding and potential of motion sensors and arduinos. Abe emailed Tim about the technology we have on hand and we hope that the differing capacities of the technologies will help to further determine how we will use the input variables to affect and output -- as of now are hope is to use the input variables of x,y, (as gathered from the motion sensor) to affect three outputs that correspond to the x,y,z variables.

The Technologies at the Pod

PING))) Ultrasonic Distance Sensor

"The Ping sensor measures distance using sonar; an ultrasonic (well above human hearing) pulse is transmitted from the unit and distance-to-target is determined by measuring the time required for the echo return. Output from the PING))) sensor is a variable-width pulse that corresponds to the distance to the target." http://www.parallax.com/tabid/768/productid/92/default.aspx

!!!!! PIR Sensor (Rev A)  !!!!!

"The PIR (Passive Infra-Red) Sensor is a pyroelectric device that detects motion by measuring changes in the infrared (heat) levels emitted by surrounding objects. When motion is detected the PIR Sensor outputs a high signal on its output pin. This logic signal can be read by a microcontroller or used to drive an external load. Dual output modes and a sensible design that performs within stated datasheet specifications are a few reasons over 100,000 units are in use around the world."

Based on a quick dig, this seems like the best motion sensor to use for the midterm project because there is lots of accesible code already written for the device, as such it will make hacking a bit easier and allow us to focus on the concept! http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/pir/List/0/SortField/4/ProductID/793/Default.aspx

Sharp GP2D12 Distance Measuring Sensor

"Infrared distance measuring sensor. Accurately determines range to target between 10cm and 80cm. Can be used as a proximity detector to detect objects between 0cm and 130cm." http://www.junun.org/MarkIII/Info.jsp?item=9

Devantech SRF10 Ranger

"This small sonar ranger offers a wide sensing range from 3 cm to 6 m (1.18 in to 19.69 ft). The SRF10 is interfaced using an I2C bus." http://www.acroname.com/robotics/parts/R241-SRF10.html

Decided Project

After a conversation about how perceptions of an environment change based on proximity to the environment We came up with the following concept:

The project is an installation that will take place in a corridor/staircase/hallway (some linear physical space), the space is divided into three sections based on the signal from the motion sensor (there will be no visual boundaries) .

The viewer's location, in one of three sections, will trigger a loop of a recorded interview. The interview will be based on three prompts based on the idea of proximity, such as: "tell us about a time when someone was close to you", "tell us about a time when someone was far away from you", "tell us about a time when someone was kind of near to you".

We are designing an experience, as people move through the space they will be confronted with a relationship between space and expressions of proximity.

CD Player Hack

We found a CD player through the powers of Facebook, thanks Flo!

     "Hiya ! Do any of you lovelies have a Compact CD Player Abraham Edelman and I can borrow for an art project? Thanks a bunch!"

http://www.vvank.com/09/make-a-muji-wall-mounted-cd-player/ -- shows step by step how to disassemble a portable dic player and control the play function.

http://davidfindlay.org/weblog/files/2010_03_02_ipod_remote.php -- using ipod.


Final Outcome

Abe and I had some technical issues with the CD hack, once the cd player was taken apart it would no longer power on, so we modified the project to reflect our ability to control the ping and decided to use a servo to help animate a mouth on the front of our sound box.

Ping Code Only:

const int pingPin = 2;
const int servo = 13;

#include <Servo.h> 
 
Servo myservo;
int pos = 13;   
 
void setup() {
  
  myservo.attach(13);  // attaches the servo on pin 9 to the servo object  
 
  pinMode (pos, OUTPUT);
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
 

  long duration, inches;

  
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  
  Serial.print(inches);
  Serial.print("in, ");
  Serial.println();
  
  delay(10);

}

long microsecondsToInches(long microseconds)
{
 
  return microseconds / 74 / 2;
}

Above is our ping code, which works delightfully, and when paired with LEDs works flawlessly, however, when we added the servo as the output, things started to go wrong and the ping would stop registering once the object was less than about 5 inches away. The code below is out full code, and with servo and all.

Ping and Servo Code:


const int pingPin = 2;
const int servo = 13;

#include <Servo.h> 
 
Servo myservo;
int pos = 13;   
 
void setup() {
  
  myservo.attach(13);  // attaches the servo on pin 9 to the servo object  
 
  pinMode (pos, OUTPUT);
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
 

  long duration, inches, cm;

  
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  
  Serial.print(inches);
  Serial.print("in, ");
  Serial.println();
  
  delay(10);
  
  if (inches > 30) {
     for(pos = 0; pos < 180; pos += 1)  
     {                                  
        myservo.write(pos);             
        delay(5);                      
     } 
     for(pos = 180; pos>=1; pos-=1)
     {                                
       myservo.write(pos);            
       delay(5);                    
     } 

}
}



long microsecondsToInches(long microseconds)
{
 
  return microseconds / 74 / 2;
}

Because of this glitch, all of our if statements, which would have modified the pace of the movement, and as such reflected a type of affectation or energy that went along with the recorded interview material about proximity, were never activated.

So, as the project works, the mouth will move when an object is father than 30 inches away from our sound box, but not once it gets closer than that.

FINAL

YES!! It finally works as it should! The bug was in the for loop within the if function (thank you Tim!)

So now we have a fully functioning two-part mouth that moves with more or less drama and energy depending on how close the viewer is. The narratives that are heard from within the box have to do with proximity -- in accordance, the movement of the mouth changes with proximity. Here is the final code:


Proximity Ping and 2 Servo Code:


const int pingPin = 2;
const int servo = 13;
const int servo2 = 7;
#include <Servo.h> 
 
Servo myservo; 
int pos = 0; 

Servo myservo2;
 
void setup() {
  
  myservo.attach(13);  // attaches the servo on pin 9 to the servo object  
  myservo2.attach(7);
 
  pinMode (0, OUTPUT);
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
 

  long duration, inches;

  
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  
  Serial.print(inches);
  Serial.print("in, ");
  Serial.println();
  
  delay(10);
  
  if (inches < 15) {
                                 
        myservo.write(0);             
        delay(1000);                      
                              
       myservo.write(90);            
       delay(1000);   

      myservo2.write(100);
      delay(1000); 
      
      myservo2.write(105);
      delay(1000); 
            
  }
  if (inches < 144 && inches > 15)  {
                                 
        myservo.write(0);             
        delay(500);                      
                              
       myservo.write(90);            
       delay(500);  
       
        myservo.write(0);             
        delay(500);                      
                              
       myservo.write(30);            
       delay(500);
       
        myservo2.write(110);
        delay(500); 
      
        myservo2.write(105);
        delay(500); 
  }
}



long microsecondsToInches(long microseconds)
{
 
  return microseconds / 74 / 2;
}