Introduction: DIY Intervalometer for Canon DLSRs

DIY Intervalometer: Hey guys !!.....

This is my first instructable, hope it goes well.

In This a tutorial for an Intervalometer for Canon DSLRs. In this Instructable you can build your own Intervalometer. Here with this design you can choose from Hours to Seconds in the range of 999 : 999 : 999 (H : M : S), and It will start clicking at intervals you set. This is a simple and yet easy to make, and yes this is accurate.

For connecting it to the camera I have used an 3.5mm Audio Cable (M2M), and to the camera I connected it through 2.5mm(F2M) converter. There are couple of LEDs to Indicate Actions like power on(red) and clicks(blue). You could use direct 2.5mm Aux Cable (M2M). I used an ATmega8 microcontroller, So you must have an AVR ISP programmer to download the HEX file to the ATmega8, OR you could use Arduino as an ISP to program your ATmega8.

If you have not worked on AVR before, then start from step 1. Otherwise you can avoid these steps and jump direclty to step 4 (prototyping step).

It is interfaced with an 16x2 LCD and 4 buttons. It is simple and easy to use. So arrange for the list of materials mentioned below,

List of Components:

1. ATmega8(28 pin) (ATMega8 Base Reqd) - 1
2. 4 MHz Crystal Oscillator - 1
3. 16x2 LCD - 1
4. Push Buttons (1 small, 4 large) - 5
5. Switch(small) - 1
6. 3.5/2.5 mm Jack(F) - 1
7. 3.5/2.5mm Aux Cable(M2M) - 1
NOTE: (3.5(F) to 2.5(M) mm connector is reqd if 3.5 mm cable jack is used) - 1
8. LM7805 Regulator - 1
9. Resistors
1K - 4
1.5/2K or (5K Trimmer / POT) - 1
10K - 1
10. Capacitors
10uF/100uF - 1
1uF/10uF - 1
22pF - 2
11. 2N2222A Transistor - 1
12. LEDs
RED, GREEN, BLUE All (3 mm) - 1
13. 9v Battery - 1
14. Connecting Wires
15. General PCB
16. AVR ISP programmer / Arduino as ISP.

Let's Start !!


Step 1: Basic AVR Setup

-->>To begin with the project, First let’s start with basic AVR setup.

First lets right a program for an LED blinking.
(Follow the Schematic in Pics.)
1. AVR Studio 4 & WinAvr --> http://mycomsats.com/blogs/download-atmel-avr-studio-4-free/
OR
2. Latest AVR Studio --> http://www.atmel.in/tools/ATMELSTUDIO.aspx

I am using AVR studio 4.

After opening the software,
Close the project wizard. goto project and select new project, project wizard opens again.
1. Select AVR GCC, Type in your Project name & give a name to the .c file, then Click Next.
2. Select Avr Simulator and look for ATmega8 and select, then click on finish.
3. Now we can Start programming.

Right Click on Header Files, then select Include Existing Header Files, and navigate to below specified location.
To include delay header file goto -> C:\WinAVR-20100110\avr\include\util and then select "delay" file.
CODE: ledblink.c
https://docs.google.com/document/d/1NYvzpxWCwri8UA...

4. Now save, Add all header files if not added. Then Right Click on ledblink.c and select compile or use alt + F7.
5. Rectify if any errors, you may ignore any warnings. Now Right Click on ledblink.c and select build or use F7.
6. If Success, you'll get 0 errors, Warnings if any.
7. Now Click on Play or goto Debug->Start Debugging.
Use Press ALT + F5, for Auto Step. OR Press F11 for step by step.
8. On right side you'll find IO View Window. In that Select PORTB and Expand it. You can observe the output
at PORTB Register.

Now to download the program to the microcontroller.
1. If you are using AVR ISP ->
For USBasp AVR ISP
Download Khazama AVR Programmer - > http://khazama.com/project/programmer/
Open HEX file in Khazama -> Auto Program.
(Just "Auto Program" after you select HEX FILE, No need to SET any bits for ATmega8)
OR
- > If you choose any AVR ISP programmer, you must get a guide with it just follow it.
2.If you are using Arduino as ISP - > https://www.instructables.com/id/How-to-program-a-A...
- > http://arduino.cc/en/Tutorial/ArduinoISP
(easy to understand) - > http://arduino.cc/en/Tutorial/ArduinoToBreadboard

(HEX file can be found in your project folder->Default folder->LEDblink.hex)

connect these pins, its this simple.
USB ISP/Arduino----------------------------------------ATMega8(Target)
MISO___________________________________MISO
MOSI___________________________________MOSI
SCK____________________________________SCK
VCC____________________________________VCC
GND____________________________________GND
RST____________________________________RST

3. After Successful programming you must see the LED Blinking.

Congrats !! You have completed Step1.

Step 2: LCD Interfacing

After Completion of LEDs, We can start with LCD interfacing.

I have defined a header file called mylcd.h for usage. You can download it.
You can use the schematic present in this section, to refers the pins configuration.
-> Image ->

The LCD that I have used JHD 162A, Its a 16x2 LCD.

Test with the sample code & follow the mylcd header files. It has function to write data to LCD.
Don't foget to include header file in project.

Sample Code:

https://docs.google.com/document/d/1KPNcEXaUaHzXGH...

Congrats ! You just completed step2.

Step 3: Button Detection Programming

The last thing to finally do is detect the button/key press.

Have a look at the schematic first. - > http://imageshack.us/photo/my-images/841/4kf1.jpg...

Logic to Detect.

1. First set DDR register to input. i.e., '0', Eg DDRB = 0x0F;
// First 4 pins (1111 -> F) are set as output pins.
// The remaining pins (0000 -> 0) are set as input pins.

2. To read a key/button, we first need to set the input pins to High and then pull it to low by connecting the other end of key/button to ground. So when ever a key is pressed, It gets connected to ground. The voltage across that particular pin goes from +5v to 0v. This change in voltage detects the key press.

7 6 5 4 3 2 1 0
1 1 1 1 0 0 0 0 - > F0 in hexadecimal
PB.0 = 0, O/P pin PB.5 = 1, I/P Pin
PB.1= 0, O/P pin PB.6 = 1, I/P Pin
PB.2= 0, O/P pin PB.7 = 1, I/P Pin
PB.3= 0, O/P pin PB.8 = 1, I/P Pin
Eg,
DDRB = 0x0F; //Lower Higher 4pins(0000) are directed as input pins.
PORTB = 0xFF; //Setting Input pins as high to detect a key press.
do
{
key = PINB && 0xF0; // key = F0 && F0 = F0 if no key pressed, loop continues until it detects.
// Assuming PB.7 is pressed then key = 0x70 && F0 = ox70, loop stops.
}while(key == 0xF0);

Sample Code:
I have defined this as an header file in my program.
mybutton.h -> https://docs.google.com/document/d/1MLIU19IGr1liBq...

Congrats ! You Completed step3, Now lets prototype and build it.

Step 4: Prototyping on Bread Board

You can find snapshots of prototyping it on breadboard.

Codes Download Link:
Download the entire RAR file. It contains the code, all required header files and complete HEX file. This project is ready to Burn on your AVR.
If you choose to start right from scratch, then you better include all header files that is included in this project.
It has been tested and works 100% Accurate.

https://drive.google.com/file/d/0B8WafHqPTeYCV1M0Slk2VzJ6R28/edit?usp=sharing

Take a look at the snaps for any references, I have encased it in a small box to get the feel of a remote.

All The Best ! Do build it. Start with TimeLapse.

TIPs:
Few tips to set intervals for your timelapse.
* For TL of 1s ->> (if interval = 5s), PICS = 24*1 or 30*1 = 24 or 30 pics, (at 24fps or 30fps respectively)
i.e., For a 24fps Video you will set 5s interval and click 24 pics, For a 30fps Video you will take 30 pics. (Time Consumed will be 24 pics * 5s = 120 Seconds or 30 pics * 5s = 150 Seconds )

* For TL of 10s ->> (if interval = 5s), PICS =24*10 or 30*10 = 240 or 300 pics, (at 24fps or 30fps respectively)
i.e., For a 24fps Video you will to set 10s interval and click 240 pics, For a 30fps Video you will take 300 pics. (Time Consumed will be 240 pics* 5s = 1200 seconds or 300 pics *5s = 1500 Seconds )

* For TL of 1min ->>(if interval = 5s), PICS = 24*60 or 30*60 = 1440 or 1800 pics, (at 24fps or 30fps respectively)
i.e., For a 24fps Video you will to set 10s interval and click 1440 pics, For a 30fps Video you will take 1800 pics. (Time Consumed will be 1440 pics * 5s = 7200 seconds or 1800 pics * 5s = 9000 Seconds )

In general,
At 24 fps, pics to be clicked, PICS = 24 * (Video Duration Reqd(s)), Applies to min and hrs also.
Time Consumption (s) = 24 * (Video Duration Reqd ()) * (Interval Set in s), Applies to min and hrs also.

At 30 fps, pics to be clicked, PICS = 30 * (Video Duration Reqd(s)), Applies to min and hrs also.
Time Consumption(s) = 30 * (Video Duration Reqd(s)) * (Interval Set in s), Applies to min and hrs also.