As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Tuesday, June 11, 2013

Hummingbirds in Motion - Ashley and Amy's Final Product

We all know that nature has a life of its own that unfolds when you're not looking. We wanted to make a way for people to enjoy the birds and other wildlife that frequent their home when they are not around.

We did this by choosing the smallest and fastest of the creatures in the typical backyard: the Hummingbird. Their speed provides a challenge to even the best of photographers. With our Arduino, we put speedy, motion-sensing photography into the hands of even the most amateur of photographers.

Our "Birdhouse" contains a DSLR camera, the motion sensor, and our Arduino. The Infrared Motion Sensor peers out and detects the hummingbird's motion. When motion is detected, the Arduino tells an Infrared LED to flash a pattern that mimics a camera remote control. This pattern tells the camera to take a picture.

Due to some limitations within the camera's programming, we had to add a few lines in the code that made it take a picture after 14 minutes of inactivity (to keep it from shutting off).

The camera contains an "Eye-Fi" SD card that uploads the images automatically via WiFi to a computer which then posts the photos to a Flickr account. (http://www.flickr.com/photos/97290453@N03/)


We would like to thank Andrew Hood of ArduinoDilettante and the Infrared Library of Sebastian for their significant help with our final solution.



Our final code is as follows:

iint motion_1 = 2; //put the sensor on pin 2
int light_1 = 9; //this used to be pin 13

unsigned long timecheck;

void wait(unsigned int time){
  unsigned long start = micros();
  while(micros()-start<=time){
  }
}

void high(unsigned int time, int freq, int pinLED){
  int pause = (1000/freq/2)-4;
  unsigned long start = micros();
  while(micros()-start<=time){
    digitalWrite(pinLED,HIGH);
    delayMicroseconds(pause);
    digitalWrite(pinLED,LOW);
    delayMicroseconds(pause);
  }
}

void take_picture() { 
    int _freq = 40;
    high(2000,_freq,light_1);
    wait(27830);
    high(390,_freq,light_1);
    wait(1580);
    high(410,_freq,light_1);
    wait(3580);
    high(400,_freq,light_1);
    timecheck = millis();
}

void setup(){
  // This runs once on boot up.  Put stuff here that runs at 
  // start up and then not again
  pinMode (motion_1,INPUT);
  pinMode (light_1, OUTPUT);
  take_picture();
  delay(1000); // allow motion sensor to settle down
}

void loop (){
  if ( HIGH == digitalRead(motion_1)){
    take_picture();
    delay(5000);
  } else {
    delay(500);  // wait a half second between checks of motion sensor
  }

  if (millis() - timecheck > 840000) { //14 minutes=840000
    take_picture();
  }
}

No comments:

Post a Comment