Apr 4, 2011

Nikon Intervalometer using Nepaluino (Arduino)

Recently I got a chance to attend the first Nepaluino workshop (Sincere thanks to Ujwal Shrestha). It was real fun to program Nepaluino with hackers.
For those who don't know what Nepaluino is: its a Arduino clone. More on this from the founder of Nepaluino -> here

Few days after that we decided to build Intervalometer using Nepaluino. As I own a Nikon D90, I set myself to build one for it. Thanks for the help, Ujwal.

So lets start.
First connect the Circuit. Its pretty easy Just connect the Nepaluino digital pin-13, the IR transmitter, the resister and the Ground in series.

Next compile the following code in Arduino IDE and upload to Nepaluino.
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
}
Thats it. Now your Intervalometer is ready. It clicks the shutter every 5 secs. Notes: Compatible with: All Nikon Cameras supported by ML-L3

Ref: Arduino – IR remote/ intervalometer for Nikon D80 DSLR

2 comments:

Buck said...

Thank you. What is the value of the resistor wired between the ir LED and microprocessor - shown on the image?

Suraj Sapkota said...

@buck, its 320 ohm