↑ Return to Projects

Quick and dirty camera interval time

For some time now I’ve wanted to have an interval timer for my Nikon D80 so that I could experiment with time-lapse photograph. It’s a simple thing so I figured I could build one myself and save some cash.

The first problem is the connector for the electronic release on the Nikon. Talk about non-standard. What the heck is that thing? it looks like a firewire connector, but with a strange slot cut in the case. Here’s what it looks like:

Nikon D80 shutter release connector

After some searching, I determined I would not easily find a matching connector, so I opted to buy a knock-off electronic release for the Nikon. around $14 on Amazon. It makes that connector the most expensive part of the interval timer by a factor of 5, but no choice… Anyone know where to get that goofy Nikon connector cheap?

Next step, disassemble the electronic release and wire in a 3 pin connector. The interval timer connects to the 3 pin connector through the electronic release to the Nikon itself. This electronic release has 3 leaf springs that push together in order as the release button is depressed. After a little exploring with an Ohmmeter, I determined that the leaf closest to the release button is the focus control, the middle leaf is ground and the ‘bottom’ leaf is the shutter release. So, when the release button is depressed, first the focus leaf and ground leaf connect. pressing further all 3 leaves connect, grounding both the focus and shutter signals.

Interval Timer RemoteInside

At this point is was a simple matter to solder in a 3 pin connector and fit it into the electronic release with a bit of creative file work and super-glue. Ending up like this:

Interval Timer RemoteRewired

electronic release

Now the interval timer itself. Controlling the camera uses 2 pins on the ATTiny13. Both pins normally are tri-stated, which should in theory be the same as the unpressed electronic release button. To simulate the pressing of the electronics release button, the attiny13 first pulls the focus line to ground, then a short time later pulls the shutter line to ground. Then both lines are placed back into tri-state mode until the time for the next shot. This doesn’t completely isolate the ATtiny13 from the camera electronics, but should be close enough for this usage.

The UI for the timer is brain-dead simple. Just two shorting blocks to select 1 of 4 pre-programmed delay times. If you want any other than the 4 pre-programmed times, you’ll have to reprogram the chip.

Thus the total component list ended up being:

  • 1 – ATTiny13
  • 1 – 8 pin DIP socket
  • 1 – small piece of perf board
  • 1 – 2 pin header
  • 1 – 70mm battery holder (for CR3203)
  • X – various bits of wire
  • 5 – crimp on female connectors (3 to form connector to electronic release 2 for the delay selection)

Here’s the resulting circuit diagram

Interval Timer circuit v1.2

Building on the perfboard was extremely simple, the hardest thing was putting the female crimp-on connectors on the 2 wires for the delay select and the 3 wires for the connect to the electroinc release. The few wires are soldered to the 8 pin dip on the bottom of the perf board. The battery socket is then mounted on the bottom, with the solder points on the top side of the perf board so had to run some short wires through the perf board to connect the attiny13 ground and vcc pins to the battery + and –

Here’s the sloppy soldering job on the bottom of the perf board. Note that this picture doesn’t exactly match the circuit diagram, the circuit diagram is correct. I screwed up and put the jumpers on pins 1/2, rather than 2/3.

Interval timer BoardBottom

Here’s the whole unit after the battery holder is attached, connected to the electronic release. Everything necessary to take multiple shots with a Nikon. Once powered up, it will just keep going and going until you turn it off or the battery runs out (either on the interval timer or the Nikon…)

Completed Interval Timer

Here’s the code programmed into the ATTiny13


.include "tn13def.inc"

; set CKSEL fuses (lfuse 1,0) to 01 for 4.8Mhz clock
; and chdiv8 for .6Mhz

.equ Focus = 0 ; Focus line
.equ Shutter = 1 ; Shutter line
.equ Data0 = 3 ; bit 3 is low bit of control nibble
.equ Data1 = 4 ; bit 4 is high bit of control nibble
.equ LED = 2

.cseg
.org 0
rjmp rESET ; Reset handler
rjmp reset
rjmp reset
rjmp TIM0_OVF

TIM0_OVF: ; roughly .1067 seconds
; R16,17,18 make up a 3 byte unsigned int to go over 1 day time
; return R0 = 0 if 3 byte timer has expired
tst r16
breq OverFlow1
dec r16 ; lowest order byte
rjmp IntDone
OverFlow1:
dec r16 ; Decrement the 0
tst r17
breq OverFlow2
dec r17 ; middle byte
rjmp IntDone
OverFlow2:
dec r18
IntDone:
mov r0,r16
or r0,r17
or r0,r18 ; only returns 0 if all 3 bytes are 0
reti

;-------
; setup
;--------
Reset:
ldi r16, RAMEND
out spl, r16

; set up pins
; b0 = Focus, idle state = Tristate, active state = GND
; b1 = Shutter, idle state = Tristate, active state = GND
; b2 = LED, output, normal low
; b3 = input w/ pullup, time Bit0 select
; b4 = input w/ pullup, time Bit1 select

cbi DDRB, Focus ; as input
cbi PortB, Focus ; w/ no pullup, ie B0 tri-state
cbi DDRB, Shutter ; as input
cbi PortB, Shutter ; w/ no pullup, ie B1 tri-state

sbi ddrb, led ; as output
cbi portB, led ; off

; bit 4 input w/ pullup
; bit 3 input w/ pullup

cbi DDRB, Data1
sbi PortB, Data1
cbi DDRB, Data0
sbi PortB, Data0

ldi r16, 0b00000010
out TIMSK0, r16
ldi r16, 0b00000100 ; clkI/O/256 (From prescaler)
out TCCR0B, r16
ldi r16, 0b00100000 ; SE,
out MCUCR, r16

; determine where to jump based on setting of B4/B3
; ie goto L:

Loop:

sbic PinB,Data1 ; is upper bit clear?
rjmp L1X ; if not clear, then config is at least L1X
L0X:
sbic PinB,Data0 ; is low bit clear?
rjmp L01 ; nope, low bit set, so goto label L01
L00:
Rcall Delay0 ; input was 00
;rcall ShortDelay
rjmp Cont
L01:
rcall Delay1 ; input was 01
;rcall ShortDelay
;rcall ShortDelay
rjmp Cont
L1X: ;
sbic PinB,Data0 ; is low bit clear?
rjmp L11 ; nope, so goto label L11
L10:
rcall Delay2 ; input was 10
;rcall ShortDelay
;rcall ShortDelay
;rcall ShortDelay
rjmp Cont
L11:
rcall Delay3 ; input was 11
;rcall ShortDelay
;rcall ShortDelay
;rcall ShortDelay
;rcall ShortDelay
rjmp Cont

Cont:

rcall FocusEngage

rcall ShortDelay

rcall ShutterEngage

rcall ShortDelay

rcall Release

rjmp Loop

;
; approx 1/2 second
;
ShortDelay:
ldi r16,4
ldi r17,0
ldi r18,0 ; 2 * .106ms
sei
SH1:
sleep
tst r0
brne SH1
cli

ret

;
; depending on setting of b2/b3 choose
; 1 of 4 delays
;

; 5 second delay
Delay0:
ldi r16,47
ldi r17,0
ldi r18,0 ; 47 * .106ms
sei
D01:
sleep
tst r0
brne D01
cli
ret

; 10 second delay
Delay1:
ldi r16,94
ldi r17,0
ldi r18,0 ; 94 * .106ms
sei
D11:
sleep
tst r0
brne D11
cli
ret

; 15 second delay
Delay2:
ldi r16,141
ldi r17,0
ldi r18,0 ; 141 * .106ms
sei
D21:
sleep
tst r0
brne D21
cli
ret

; 1 min
Delay3:
ldi r16,51
ldi r17,2
ldi r18,0 ; 4 * .106ms
sei
D31:
sleep
tst r0
brne D31
cli
ret

FocusEngage:
sbi DDRB, Focus ; make it output, low
ret
ShutterEngage:
sbi DDRB, Shutter ; make it output low
sbi portb, led ; LED on
ret
Release:
cbi DDRB, Shutter ; make them both
cbi DDRB, Focus ; inputs / tristate again
cbi portb, led ; led off
ret

And that’s it. Use the two wires to select the delay you want, remove the paper from the battery clip, connect the electronic release connector to the Nikon and turn the camera on. Click, click, click…. some time later you end up with a series of images you can convert to a movie like this

Clouds

JPG to AVI conversion was really straight forward using VirtualDUB. Just open the first .jpg, it opens the rest, set the frame rate, the compression you want and save the AVI. Done!