Saturday, November 23, 2013

Arduino Time-Lapse Dolly Project Part 1

Let me preface this article by saying I am NOT an expert in electronics, or programming or the Arduino... I am pretty confident that I can hack something together, and perhaps my readers can help me along the way if I get stuck.

First I will briefly describe what I have in mind.  I have been taking a lot of Milky Way time-lapse movies recently and to add a little pizzazz to them I would like to have the camera move on a track.  So I can either I can stay up all night and move the camera manually - which sounds like work.  Or I could automate it with some programmable computer thingy.  Option two sounds way better.  The thought is I would have the Arduino trigger the camera for the appropriate amount of time.  When the shutter closes, move the camera on the track a short distance.  Then trigger the camera again and repeat until the sun comes up.  For those who are not aware of what is required to shoot Milky Way time lapse, it takes 300 individual pictures to make 10 seconds of video at 30 frames per second.  For each photo, the shutter is open for 30 seconds.  I prefer to try and shoot all night, which may be 8 hours worth of shooting and equals about 800 shots.  This is why I would like to automate it!  I would rather sleep all night than baby sit the camera. See my first video below:



Now, I am not very electronic savvy - most of my background is in car electronics so I am all about the relays and switches.  To me a transistor is something Harry Potter probably used.  I heard of something called a stepper motor which I think I need to move the camera dolly. After some research I know Arduinos have these shield things to control motors.

Step 1, buy and Arduino.  Check!  Actually I got the Mega because the shield I bought said it worked for the Mega but didn't explicitly say it worked for the Uno so I thought I would just get the Mega for now.

Step 2, buy a stepper motor shield. Check!  I got the SainSmart one off of Amazon.  Hopefully it does everything I need because I don't really know much about stepper motors and such.



The Arduino site suggests installing the "Blink" program.  Well when I plugged it in for the first time the LED was already blinking so that really doesn't help.  So what I did instead was take the standard blink program and change the blink interval.  Uploaded that and it worked great.

Here is the code I used:

int led = 13;

// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);  
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(250);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(300);
digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(250);
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); // wait for a second
}


I bought a cheap shutter release cable and opened it up to see how it triggered the camera and figure out how to wire it into the Arduino.  I cut the wires to the board (see photo below) and tried connecting different ones together to figure out what combination fired the camera.  What worked was connecting all three together.  If I connected the red and white together nothing happened, but if I connected the white and black it was like a half shutter press, and connecting the red and black did nothing.

See the cut wires in the black connector on the main board. 

With my simplified electronics background the firth thing I thought of was a relay.  Tie the red and white wires together, and use the Arduino to actuate a relay to connect the red and white wires to the black wire. So I wired one up like this:


Hooked up on a bread board it looks like this:


Now one special note - the Arduino can only support 40mA through each pin so you have to pick relay that doesn't draw more than that.  The first relay I got drew 90mA and though it worked, I think it will fry the Arduino over time. How do you figure it out?  Take the voltage, divide it by the resistance.   If its less than .04 then you are OK.  Since the Arduino puts out 5 volts, you take 5 and divide it by the resistance of the coil in the relay (expressed in Ohms).  You need a relay that can be triggered by 5v and has a coil resitance of 125 ohms or more.

As for the code I took the Blink code and changed the pin to 10 and wired the relay up as shown above.  Plugged the Arduino into the computer and listened for the click.  Then I plugged the wires from the shutter release to the camera and did the same thing this time the camere should fire at a regular interval.

Sure enough, it did!  Great success!

Stay tuned for more updates!