Canon DSLR time lapse controller with adjustable delay on LCD

Hi all. I want to make a controller for my Canon camera. The hardware side should be fairly straight forward, I'm going to use a couple of opto-couplers for the camera control.

The bit which is baffling me is that I want to be able to set the interval time without having to edit the code. I have found the following code to use as a base starting point, but I really would like to be able to set the interval via buttons and an LCD display? I can hook up the LCD but I'm really at a loss as to how I can have the interval time as a variable?

Any help would be excellent :grin:

/*
 * TimeLapseController
 *
 * Create amazing time-lapse movie sequences using an Arduino and a
 * digital camera.
 *
 * Copyright 2009 Jonathan Oxer <jon@oxer.com.au>
 *
 * http://www.practicalarduino.com/projects/easy/time-lapse-controller
 */

int frameInterval = 300;          // Delay between pictures (in seconds)
int focusPin = 5;                 // Reed relay on digital pin 5
int shutterPin = 6;               // Reed relay on digital pin 6
int ledPin = 13;                  // LED connected to digital pin 13

void setup()
{

  pinMode(focusPin, OUTPUT);      // Set the focus pin as an output
  digitalWrite(focusPin, LOW);
  pinMode(shutterPin, OUTPUT);    // Set the shutter pin as an output
  digitalWrite(shutterPin, LOW);
  pinMode(ledPin, OUTPUT);        // Set the LED pin as an output
  digitalWrite(ledPin, LOW);
}

void loop()
{
  digitalWrite(ledPin, HIGH);     // Turn on activity LED
  digitalWrite(focusPin, HIGH);   // Turn on focus relay
  digitalWrite(shutterPin, HIGH); // Turn on shutter relay
  delay(500);                     // Hold the button for 1/2 second
  digitalWrite(ledPin, LOW);      // Turn off activity LED
  digitalWrite(shutterPin, LOW);  // Turn off shutter relay
  digitalWrite(focusPin, LOW);    // Turn off focus relay
  delay(1000 * frameInterval);    // Wait the required interval before repeating
}

The interval time is a variable.

Hi Awol.

So how would one be able to adjust that variable without having to re-compile the code?

You can't.
There is no mechanism in the code you posted to change the value of frameInterval.
A simple analog read and a pot might fix that, but you'd have no feedback of the actual value set.

I have seen a Arduino project in which the operator could select the required time frame via buttons, with visual feedback on a LCD display. How is this done?

Thanks for the help

With an LCD display, some buttons and some more software.
If you look around the Playground, you will find examples of how to do this.

How about a rotary encoder switch with pre-defined time intervals between clicks?

Have a look at the code developed by Glacial Wanderer: http://www.cameraaxe.com/wiki/index.php?title=Main_Page.

I have had a brief look around but I'm pretty new to the arduino environment, and programming itself to be honest lol. Maybe I haven't looked had enough, I will try again.

a rotary encoder sounds like it could work quite nicely for the application - how do they work is it a pot with notches or something?

the camera axe looks amazing, thanks for that link. The product and the software look very complicated though! I think my requirements could be met with a far more simple solution though :~

No, a rotary encoder is not a pot.

What does "honest lol" mean, please?

Honest, as in, 'honest' and lol as in 'laugh out loud' :smiley:

I'm not sure which camera you have but chdk (assuming it supports your camera) is great for this
kind of stuff.
It is a camera software extension to provide all kinds of new and additional functionality.
You can create scripts to have all kinds of control over the camera functions.
People have done all kinds of things from time lapse, to photographing water drops, to
taking photos of birds using the motion detection capabilities.

Here is the link: http://chdk.wikia.com/wiki/CHDK

I use it on my sd850.

--- bill

Thanks for the link Bperrybap, looks like a vast improvement on the standard firmware! Unfortuniately though I have a EOS 400 so it won't work for me.

Can anyone point me in the direction of some help with implementing selectable variables on a screen?

Thanks all :astonished:

I have had a brief look around but I'm pretty new to the arduino environment, and programming itself to be honest lol. Maybe I haven't looked had enough, I will try again.

Its actually a project like this that introduced me to Arduino. I pretty much searched the internet until I was blue in the face to get things right. I am glad some posted glacialwanderer's Camera Axe, that was a huge help to me.
Here is his blog :

http://www.glacialwanderer.com/hobbyrobotics/?p=11

Lots of useful info and code regarding this project on here too. I am pretty interested in how you are controlling your camera? (From the hardware side)

Hi GregN :slight_smile:

Thanks for the link, I will take a read through when I have some spare time :slight_smile:

How did you get on with your project in the end?

Here is the PCB I'm working on at the moment, the camera will be controlled via a simple Opto-coupler (only shutter control). The Big IC is a RF600D decoder IC because it will be wireless, the arduino will sit at the tx end.

That is very interesting! I went with an IR LED that functions much like a remote to trigger the shutter when needed. I set the camera to BULB mode and the shutter speed depends on how fast the LED sequences are triggered ( there is an OPEN sequence and a CLOSE sequence). So my shutter speed depends on the time between the OPEN and CLOSE sequence.

Another idea for your LCD display, it might also be helpful to read up on some tutorials involving displays and check the playground for projects that need similar types of control and read their code.

I have seen some examples using IR control they look pretty cool! Mine will be good enough with a cable control though as the rx end will be mounted on the tripod :slight_smile:

I have just found the following example, using a 10k pot as the analogue input. I guess it would be possible to display the time on an LCD with some tweaking? I have set up LCD's before but I'm not sure how I could adapt this code yet. Also I would be nicer if select the time with buttons instead of a pot for more precise increments :roll_eyes:

/*
DSLR Intervalometer
 */

//setup variables
int sensorPin = A0;
int sensorValue = 0;
int lapsePeriod = 0;
int x = 0;

void setup() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  
  
    //determines how many seconds it should wait between pictures.
    sensorValue = analogRead(sensorPin); 
    if (sensorValue >= 20) {
      lapsePeriod = 10 + (sensorValue / 20);
    }
    else {
       lapsePeriod = 10;
    }


  //blink 3 times to indicate it has started
  digitalWrite(7, HIGH);
  delay(250);
  digitalWrite(7, LOW);
  delay(250);
  digitalWrite(7, HIGH);
  delay(250);
  digitalWrite(7, LOW);
  delay(250);
  digitalWrite(7, HIGH);
  delay(250);
  digitalWrite(7, LOW);
  delay(250);
}


void loop() {
  
  //waits however many seconds you have chosen
  while (x < lapsePeriod) {
    delay(1000);
    x++;
  }
  x = 0;
  
  //focus and blink focus LED for one second
  digitalWrite(3, HIGH);
  digitalWrite(8, HIGH);
  delay(1000);
  digitalWrite(3, LOW);
  digitalWrite(8, LOW);
  delay(100);
  
  //shoot and blink shoot LED for one second 
  digitalWrite(2, HIGH);
  digitalWrite(7, HIGH);
  delay(1000);
  digitalWrite(2, LOW);
  digitalWrite(7, LOW);

}

Can anyone offer some advice on the programming side for my project?

Many thanks

Have you seen glacialwanderer's controller project?

I have had a look through all the camera axe stuff, but unfortunately its a bit to in depth for me and I struggle to follow most of the code :relaxed:
I'm sure the outcome that I want will have a fairlys simple solution but I'm really struggling :astonished: