Skip to content

Instantly share code, notes, and snippets.

@mstahl
Last active December 14, 2015 12:48
Show Gist options
  • Save mstahl/5088374 to your computer and use it in GitHub Desktop.
Save mstahl/5088374 to your computer and use it in GitHub Desktop.
Camera intervalometer Arduino code
#define FOCUS 11
#define SHUTTER 13
/*
* Pins 11 and 13 go to two reed relays, which connect the ring pin of a
* headphone jack to the other two pins. These are connected to the camera via
* a 2.5mm phone patch cord. Set your camera ISO and aperture to expose well
* in the darkest conditions you anticipate occurring during the timelapse. The
* camera should be set to auto-expose on aperture-priority mode, so that the
* focus and depth of field remain constant from frame to frame. Delay is
* configured to take a little less than 3,000 frames in a 24 hour period
* (filling up a 16GiB SD card).
*/
void pulse(int pin, unsigned long ms) {
digitalWrite(pin, HIGH);
delay(ms);
digitalWrite(pin, LOW);
}
void setup() {
pinMode(FOCUS, OUTPUT);
pinMode(SHUTTER, OUTPUT);
digitalWrite(FOCUS, LOW);
digitalWrite(SHUTTER, LOW);
}
void loop() {
pulse(FOCUS, 2500);
for(;;) {
pulse(SHUTTER, 500);
delay(31046);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment