Triggering Nikon D80's shutter with Arduino

Tue 14 September 2010 // posts

Being able to trigger a photo shot programmatically opens up some cool possibilities, especially for time-lapse photography purposes.

Today I have started reading about infrared communications theory and experimenting a bit, after desoldering an IR LED from an old, old remote controller.

As this was only a proof that I could control the camera's shutter release, I came up with a simple circuit, but the most interesting part was coding. Thanks to this site, the waveform used by Nikon D80 is described.


const int IR_SEND_PIN = 13;

void setup() {  
    pinMode(IR_SEND_PIN, OUTPUT);  

void usleep(unsigned long interval) {  
    unsigned long start = micros();  
    while((micros() - start) < interval);  

void pulse(int pin, unsigned long usec) {  
    unsigned long start = micros();  
    boolean curr = 1;

    while((micros() - start) < usec) {  
        digitalWrite(pin, curr);  
        curr = !curr;  
        usleep(26); // calculated for IR 38.4Khz and processor 16Mhz  

void pause(int pin, unsigned long usec) {  
    digitalWrite(pin, LOW);  

void shoot_d80(int pin) {  
    for (int i = 0; i < 2; i++) {  
        pulse(pin, 2000);  
        pause(pin, 27830);  
        pulse(pin, 390);  
        pause(pin, 1580);  
        pulse(pin, 410);  
        pause(pin, 3580);  
        pulse(pin, 400);  
        pause(pin, 0);  
        if (i == 0) usleep(63200);  
    Serial.println("Photo requested");  

void loop() {  


Here is the video of the first time-lapse test. The shutter release was triggered every minute during the sunrise.