Categories
english Hacking Hardware Gadgets photography

DIY time-lapse timer…

i did a time-lapse video a few month ago. back then i used the video function from my eos 7D. extracted 2 frames per second, did some image manipulations and put it all back together at 24 frames per second.

video takes a lot of space. since time-lapse videos are much more interesting if you cover a big time interval you either have to have a huge memory card or you manage to turn down the amount of data that comes in. i decided to do the latter. since canon cams don’t come with a time-lapse function built in, one has to find an external time that does the job. there are several cheap external cable timers available. they just have one problem. they just do time intervals from 1 to about 9999 seconds. i needed less. 300 ms (0,3 sec) should be my smallest interval. so i built my own.

the second try - opened box
since i didn’t want to put any solder on my camera i bought a cheap cable remote switch, which i took apart to get the cable.
the first iteration was set up in an old stopwatch. it used an arduino pro mini. one can push the buttons to increase or decrease the interval. since i was not able to use the internal display for timer feedback that was not the optimal solution. i do want to know what interval i’m using exactly.

the second iteration is built on an arduino diecimila. on top i use a prototyping board which holds a 16×2 display. as input there is a potentiometer that chooses the timing interval. the display shows exactly what interval is chosen.

final 2nd iteration

to reduce the risk of toasting my camera i separated the arduino circuit with an opto-isolator to the cable.

the next step is to reduce the size of the box by finding a smaller form factor and using the arduino pro mini.

here is the arduino code:

/*
  Time-lapse timer
  
Copyright 2011 Florian Klien. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice, this list of
      conditions and the following disclaimer.

   2. Redistributions in binary form must reproduce the above copyright notice, this list
      of conditions and the following disclaimer in the documentation and/or other materials
      provided with the distribution.

THIS SOFTWARE IS PROVIDED BY Florian Klien ``AS IS AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Florian Klien OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <LiquidCrystal.h>

#define LCDRS 11
#define LCDENABLE 10
#define LCDD4 7
#define LCDD5 6
#define LCDD6 5
#define LCDD7 4
#define POTPIN 2 // potentiometer pin
#define LEDPIN 12 // pin for an optional led
#define SWITCHPIN 8 
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(LCDRS, LCDENABLE, LCDD4, LCDD5, LCDD6, LCDD7);

double val = 0;
int ts = 0;
unsigned long int steps[] = {333,500,750,
               1000,1500,2000,
               2500,3000,4000,
               5000,6000,7000,
               8000,9000,10000,
               12000,15000,20000,
               25000,30000,35000,
               40000,45000,50000,
               55000,60000,90000,
               120000,240000,300000,
               360000,420000,480000,
               540000,600000,900000,
               1200000               
             }; // in ms

unsigned long lasttime = 0;

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("timer set to:");
  Serial.begin(9600);
  //lasttime = millis();
  pinMode(LEDPIN, OUTPUT);      
  pinMode(SWITCHPIN, OUTPUT);     
  digitalWrite(LEDPIN,HIGH);
  delay(500);
  digitalWrite(LEDPIN,LOW);
}

void loop() {
  val = analogRead(POTPIN);
  ts = map(val, 0, 1023, 0, 37);
  lcd.setCursor(0, 1);
  double time = (float)steps[ts]/1000;
  lcd.print(time);
  lcd.print(" sec ");
  lcd.print((float)(millis()-lasttime)/1000);
  lcd.print("    ");
  if((millis()-lasttime) > steps[ts]){
    digitalWrite(LEDPIN, HIGH);
    digitalWrite(SWITCHPIN,HIGH);
    delay(100);
    digitalWrite(LEDPIN, LOW);
    digitalWrite(SWITCHPIN,LOW);
    lasttime = millis();
  }
}

update:
here is a little testvideo:

Leave a Reply

Your email address will not be published. Required fields are marked *

verify you\'re human: * Time limit is exhausted. Please reload CAPTCHA.