I'm sure you all know what time lapses are. To take them you need an intervalometer, a device that triggers a camera at a desired interval. (There fairly expensive)
Anyway, I built one some time ago, a bulky Radio Shack project box with a bunch of wires, an Arduino Duemilanove w/ protosheild, a few buttons and knobs, flashy lights, and an LCD. It served me well, and it was never documented. This conspicuous-looking black box I could only imagine not to be the best thing to travel with at an airport.
So considering this, I built a small Altiods tin-sized intervalometer based around the Atmega328p and programmed through the Arduino IDE.
To set the interval, you need to set the 8 dip switches, each representing a single bit in a byte, to the desired interval time in seconds as represented in binary. It's simple if you understand binary.
The maximum interval time is 255 seconds or 4 minutes, 15 seconds.
Fully commented source (Great for beginners) -
// Binary Intervalometer
// By Physics_Dude
//
// Digi-pins 2 - 9 have dip switches
// Digi-pins 11 - 13 are for LED, focus, and shutter
// Set dip switch pins
const int buttonPin2 = 2;
const int buttonPin3 = 3;
const int buttonPin4 = 4;
const int buttonPin5 = 5;
const int buttonPin6 = 6;
const int buttonPin7 = 7;
const int buttonPin8 = 8;
const int buttonPin9 = 9;
// Set led, focus, and shutter pins
const int ledPin = 13;
const int focusPin = 12;
const int shutterPin = 11;
// Define default dip switch values
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
int buttonState7 = 0;
int buttonState8 = 0;
int buttonState9 = 0;
// Delays
long DelayVal = 0; // Starting delay value
int hold = 100; // Time shutter button is held down for
void setup() {
// Inputs
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
pinMode(buttonPin6, INPUT);
pinMode(buttonPin7, INPUT);
pinMode(buttonPin8, INPUT);
pinMode(buttonPin9, INPUT);
// Outputs
pinMode(ledPin, OUTPUT);
pinMode(focusPin, OUTPUT);
pinMode(shutterPin, OUTPUT);
}
void loop(){
// Turn all outputs off
digitalWrite(ledPin, LOW); // LED off
digitalWrite(focusPin, LOW); // Focus not pressed
digitalWrite(shutterPin, LOW); // Shutter not pressed
// Read the states of the dip switch values:
buttonState2 = digitalRead(buttonPin2);
buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);
buttonState5 = digitalRead(buttonPin5);
buttonState6 = digitalRead(buttonPin6);
buttonState7 = digitalRead(buttonPin7);
buttonState8 = digitalRead(buttonPin8);
buttonState9 = digitalRead(buttonPin9);
// Lazy math time!
// Bit 1
if (buttonState2 == HIGH) {
DelayVal = DelayVal + 1;
}
// Bit 2
if (buttonState3 == HIGH) {
DelayVal = DelayVal + 2;
}
// Bit 3
if (buttonState4 == HIGH) {
DelayVal = DelayVal + 4;
}
// Bit 4
if (buttonState5 == HIGH) {
DelayVal = DelayVal + 8;
}
// Bit 5
if (buttonState6 == HIGH) {
DelayVal = DelayVal + 16;
}
// Bit 6
if (buttonState7 == HIGH) {
DelayVal = DelayVal + 32;
}
// Bit 7
if (buttonState8 == HIGH) {
DelayVal = DelayVal + 64;
}
// Bit 8
if (buttonState9 == HIGH) {
DelayVal = DelayVal + 128;
}
// Full byte complete!
// Convert to milliseconds
DelayVal = DelayVal * 1000;
//Minimum Delay is 1 second
if (DelayVal < 1000)
{
DelayVal = 1000;
}
// Compensate for shutter press delay.
DelayVal = DelayVal - hold;
// Delay for "DelayVal" milliseconds
delay(DelayVal);
// Done? Now activate outputs!
digitalWrite(ledPin, HIGH); // LED on
digitalWrite(focusPin, HIGH); // Focus pressed
digitalWrite(shutterPin, HIGH); // Shutter pressed
delay(hold); // Time shutter is held down
// Reset DelayVal
DelayVal = 0;
}
Here is a short, uneventful demonstration of the device working.
~~My Binary Arduino Intervalometer - YouTube
Here is a proper sequence of time lapse clips I put together from my vacation to New York. All of which were recorded using this project.
Quick numerical binary lesson:
There are 8 bits in a byte
In order, each bit is equal to:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
To read or write numerical binary values you add the sum of each active bit, indicated by a "1", and ignore the "0"s
Lets take 00101010 for example.
The active (1) bits are 32, 8, and 2
Add them up and you get 42
And to distinguish the difference between a 1 and 0, find the nearest power switch with a line and circle printed on it. You'll see that 1 means on and 0 means off.