Posts Tagged ‘ir led’

Time-lapse using Arduino as DSLR remote trigger – v1

Saturday, January 17th, 2015

I’ve been wanting to create time-lapse animations for a while now.

Since I’ve finally started acquiring some electronics components (actually a awful lot thereof — according to my wife :p), I am finally able to actually build some things for myself.. :)

I’ve put together a simple circuit allowing me to trigger my DSLR camera every X units of time. For now the delay between shutters is hardcoded but I might add a potentiometer later on in order to be able to modify it without having to reprogram it. I could save the delay in the EEPROM so that I don’t have to re-enter it each time I start it up.

Since I didn’t want to touch my DSLR at all, I’ve decided to build a remote trigger leveraging the infrared (IR) sensors present on my Pentax K20D.

As this is a simple prototype, I’ve just used an Arduino Uno (5v) with a small breadboard. In the future, this project might be a good candidate for my first PCB.. but we’ll see about that later :p

Current features

  • Trigger my DSLR remotely every X (hardcoded delay) through infrared
  • Light up an LED before triggering the DSRL (just for fun)

Parts

  • 1 Arduino (e.g., Arduino Uno)
  • 1 high output IR LED (I bought this one, but see the issues list..)
  • 1 green LED
  • 1 27 ohm resistor (or more, or less depending on your test results :p)
  • 1 560 ohm resistor
  • 1 breadboard
  • jumper wires

Schematic:

As you can see, the circuit is veeeeery easy to pull together. The IR led is basically just like any other led.. with the distinction that you can’t directly see its output ;-)

Source code:

// Remote DSLR Trigger

// Libraries
#include <multiCameraIrControl.h> // Camera IR control

// Circuit-specifics
const int SENDING_LED_PIN = 13;

// IR Control
Pentax K20D(9); // IR Led on PIN 9

void setup(){   
  pinMode(SENDING_LED_PIN, OUTPUT); // LED = output
}

void loop(){
      digitalWrite(SENDING_LED_PIN, HIGH);
      delay(250);
      digitalWrite(SENDING_LED_PIN, LOW);
      
      K20D.shutterNow();
 }      
  
  delay(60000); // 1 min delay between shots
}

As you can see, the code is also very straightforward thanks to Sebastien Setz’s Arduino IR control library

The library takes care of the modulation necessary so that the DSLR gets the message clearly.. ;-)

Basically, it does the following for Pentax:

Note that the library supports other DSLRs such as Canon, Nikon, etc as well as other functions depending on the models.

Issues

  • One thing that sucks with my current build is the IR distance. It doesn’t work farther than 40-50cm, which, I guess, is due to the IR LED that I’m using. It might not be as powerful as it should (though I ordered a ‘high-output’ IR LED). Some or the library users mentioned removing the resistor did help. Others have used an NPN transistor. Although I’ve tried the NPN transistor, it didn’t help (at all)..

Ideas for a future version:

The project sources including the schematics are available on GitHub

Let’s go take some pictures now.. :)

Update #1:

Okay, I’ve made my two first tries.. Not great but hey, you always need to start somewhere right?

I’ve used AviDemux to create the video but the original was too fast. I didn’t want to bother now finding a clean solution so I hacked my way through by invoking ffmpeg to help me out slow it down:

ffmpeg -i input.mkv -filter:v "setpts=2.0*PTS" output.mkv

This isn’t great because it lowers the video quality but I’ll make better videos when I get better pictures that are worth the hassle =)

Here are the resulting videos:

Update #2 (2015-01-25):

I’ve spent a bit of time finding out how to generate higher quality time-lapse videos. Check out the next post for details :)