Posts Tagged ‘D80’

Arduino – motion triggered camera

Nikon D80 Motion sensor trigger

So having worked out that I can make a remote for my Nikon D80 to do some timelapse photography. I started thinking of things I can do to trigger the remote, below video shows it working but you’ll need sound to hear the shutter going.

First of all check out my tutorial for making the remote as this builds on that tutorial – also saves me having to recap and explain that. Arduino Nikon intervalometer infrared remote for timelapse photography.

Ok so now you know how I’m going to trigger the camera to take pictures. So now we need the sensor, for this I’m going to use a PIR (Pyroelectric InfraRed sensor) IC that works like a switch turning on when motion is detected, the one I’m using is basically a couple of IR emitters and sensors under a Fresnel lens – word of warning make sure you get the power supply right as they tend to smoke otherwise!. It works by measuring any difference to the background temperature and infrared radiation. I’ve also added an LED to signal when the PIR is on or off.

The biggest challenge for this was making sure the camera didn’t keep triggering for the length of time the PIR was active – sometimes it would be active for 5 or seconds after initial movement, so I wanted to capture say 2 photos for each time it was triggered.

For lazyness I’ve left my camera in auto setting so that it *should* autofocus along with everything else – e.g. exposure times and apertures.

Arduino Motion Tracker Parts

220 Ohm resistor (Red, Red, Brown, Gold)
10K Ohm resistor (Brown, Black, Orange, Gold)
PIR sensor
Infrared emitting diode
LED
Arduino Deumilanove w/ ATMEGA328
Breadboard / Prototyping board
Jumper/ Connector wires
Optional 9V power supply (here) or use the USB power for the Arduino
You will also need a soldering iron and solder if you use the same PIR as myself.

The Arduino Motion Detector Circuit

You may not be able to see but I’ve used the power supply from the Arduino to power the breadboard. The PIR gets its supply from this and there’s a 10k Ohm resistor between its output pin and pin 4 on the Arduino. The LED has a 220 Ohm resistor between that and the digital pin 9. The IR LED I’ve left in pin 13 and grounded – for a better system I would solder on a couple of wires to allow more flexibility with transmitting the signal. Also for the PIR, the one I have I had to solder a few jumper wires into the back of it just so you know.

arduino-camera-motion-trigger

Arduino Motion Sketch / Code

Based off of my remote tutorial I’ve just added in a few extra things really. An output for the LED, an input for the PIR and a chunk of code to limit the taking of photos.
[ad#Google Ad in content]

/*

LUCKYLARRY.CO.UK - IR Remote control for Nikon using Arduino with motion trigger

Uses a PIR sensor to trigger the camera remote/ IR led if a change in background
temperature is detected.

*/

int currentState = 0;                                   // set a variable to store a count.
int pinPIR = 4;                                         // digital pin 4 for PIR
int pinLED = 9;                                         // digital pin 9 for LED
int pinIRLED = 13;                                      // assign the Infrared emitter/ diode to pin 13

void setup() {
  pinMode(pinIRLED, OUTPUT);                            // set the pin as an output
  pinMode(pinLED, OUTPUT);                              // set the LED pin as ouput
  pinMode(pinPIR, INPUT);                               // set the PIR pin as an input
}

// sets the pulse of the IR signal.
void pulseON(int pulseTime) {
  unsigned long endPulse = micros() + pulseTime;        // create the microseconds to pulse for
  while( micros() < endPulse) {
    digitalWrite(pinIRLED, HIGH);                       // turn IR on
    delayMicroseconds(13);                              // half the clock cycle for 38Khz (26.32×10-6s) - e.g. the 'on' part of our wave
    digitalWrite(pinIRLED, LOW);                        // turn IR off
    delayMicroseconds(13);                              // delay for the other half of the cycle to generate wave/ oscillation
  }

}

void pulseOFF(unsigned long startDelay) {
  unsigned long endDelay = micros() + startDelay;       // create the microseconds to delay for
  while(micros() < endDelay);
}

void takePicture() {
  for (int i=0; i < 2; i++) {
    pulseON(2000);                                      // pulse for 2000 uS (Microseconds)
    pulseOFF(27850);                                    // turn pulse off for 27850 us
    pulseON(390);                                       // and so on
    pulseOFF(1580);
    pulseON(410);
    pulseOFF(3580);
    pulseON(400);
    pulseOFF(63200);
  }                                                     // loop the signal twice.
}

void loop() {

  if ((digitalRead(pinPIR) == LOW) && (currentState <= 2)) { // count to limit the taking of photos
    takePicture();                                      // take the picture
    digitalWrite(pinLED, HIGH);                         // turn LED on
  } else {
    digitalWrite(pinLED, LOW);
    currentState = 0;                                   //reset the count when the PIR is off.
  }

  currentState++;
  delay(2000);                                          // delay for 2 seconds - 2 seconds between taking photos if the PIR is active for more than 2 seconds.
}

[ad#Google Ad in content]

I think adding in another PIR would help me make some kind of turret system. Also you could use the ultrasonic range finder jobby, the SRF-05, to detect the distance and if less than say 3 metres take the photo etc.. I'm also going to try and setup a trip-wire system to trigger the camera :)

Arduino – IR remote/ intervalometer for Nikon D80 DSLR (that means timelapse photography yarrr!)

Nikon D80 + Arduino remote trigger/ intervalometer

I’m cheap and skint, yet I want to do timelapse photography with my Nikon D80 DSLR. Unfortnately that requires spending some cash on an intervalometer for time lapse photography which will set me back a sizeable chunk of cash. Or I could get a remote or get the trigger system then create a delay mechanism to do the timelapse. But again it’d cost a few quid to even get a remote…

Thankfully I already have an Arduino board and a bag of Infrared emitter diodes which I was wondering what I could use them for. So I had a quick scout round the interweb and saw various projects where people had written programs to allow Arduino to work as a TV remote etc.. and I stumbled up on this site: http://www.bigmike.it/ircontrol/ which listed the very IR timing sequence and frequency I would need to trigger my camera. I’m guessing you can find other sequences/ frequencies for other bits of hardware too.

There is no point in me writing up a circuit diagram or parts list for this as you just need an IR diode and an Arduino board. Oh and check that your camera has an Infrared remote port on it or else this is pointless!

Arduino Nikon Intervalometer Remote Code

You will see that basically we blink an IR LED for a set time, wait and repeat to create our signal. The only complicated bits are working out the delays to create the pulse cycle/ wave. Turns out Arduino isn’t so hot at measuring delays in Microseconds so we need to give it a hand keeping track using the micros() function – so we just create a counter to do this and specify an end time for it to count up to.
[ad#Google Ad in content]

/*

LUCKYLARRY.CO.UK - IR Remote control for Nikon using Arduino

Mimics the infrared signal to trigger the remote for any Nikon camera
which can use the ML-L1 and ML-L3 remotes. Can be used as an intervalometer
for time lapse photography.

The IR sequence I used is originally taken from: http://www.bigmike.it/ircontrol/

You should be able to use my pulse methods to alter to suit other cameras/ hardware.

micros() is an Arduino function that calls the time in Microseconds since your program
first ran. Arduino doesn't reliably work with microseconds so we work our timings by
taking the current reading and then adding our delay on to the end of it rather than rely
on the in built timer.

*/

int pinIRLED = 13;                                      // assign the Infrared emitter/ diode to pin 13

void setup() {
  pinMode(pinIRLED, OUTPUT);                            // set the pin as an output
}

// sets the pulse of the IR signal.
void pulseON(int pulseTime) {
  unsigned long endPulse = micros() + pulseTime;        // create the microseconds to pulse for
  while( micros() < endPulse) {
    digitalWrite(pinIRLED, HIGH);                       // turn IR on
    delayMicroseconds(13);                              // half the clock cycle for 38Khz (26.32×10-6s) - e.g. the 'on' part of our wave
    digitalWrite(pinIRLED, LOW);                        // turn IR off
    delayMicroseconds(13);                              // delay for the other half of the cycle to generate wave/ oscillation
  }

}

void pulseOFF(unsigned long startDelay) {
  unsigned long endDelay = micros() + startDelay;       // create the microseconds to delay for
  while(micros() < endDelay);
}

void takePicture() {
  for (int i=0; i < 2; i++) {
    pulseON(2000);                                      // pulse for 2000 uS (Microseconds)
    pulseOFF(27850);                                    // turn pulse off for 27850 us
    pulseON(390);                                       // and so on
    pulseOFF(1580);
    pulseON(410);
    pulseOFF(3580);
    pulseON(400);
    pulseOFF(63200);
  }                                                     // loop the signal twice.
}

void loop() {
  takePicture();                                        // take the picture
  delay(5000);                                          // delay in milliseconds which allows us to do timelapse photography - 1 second = 1000 milliseconds
}

[ad#Google Ad in content]

Ok, so one other thing when using your camera and thats a quick modification to the remote timer, if like mine your infrared camera remote port is set to be active for less than a minute then you'll need to edit the settings accordingly - just check your owner manual. For me it's in the menu screen, custom setting menu, then option 30: Remote on duration.

Now I just got to take some cool timelapse stuff like my friends here:

Which also reminds me to look into CHDK and my Canon Powershot A530 and see what I can do there. :)