Sunday, January 17, 2010

Pclix LT universal timelapse controller

The second best thing after having in-camera timelapse control seems to be the Pclix LT universal timelapse controller. Pclix offers cables for different camera model and even have an infrared option. How could I be so naiv to think I where the first thinking of infrared use for timelapse control. You'll find the user manual under support at the Pclix website.

Sunday, January 10, 2010

Powering the Arduino

USB
When the Arduino is connected to a computer via USB cable it is also powered by the 5 V USB line.
Alternatively you can use a plain USB charger to power the Arduino from a wall socket.

Power adapter or battery
The recommended voltage range for powering the Arduino via the VIN terminal or the 2.5 mm plug is 7 to 12 volts. Voltages above 12 volts are not recommended because the 5 V voltage regulator on the board will have to burn the additional voltage and become too hot. If possible use a voltage close to 7 volts e.g. some power adapters allow to set a 7.5 V output.
For low power applications a 9 V battery will work fine. Small 12 V lead batteries will also work fine.

Bhodilabs VPack battery packs
A nice option to power the Arduino board with 5 V coming from a single AA battery is a Bhodilabs VPack battery pack. Connect this battery pack to the 5V and GND terminals of the Arduino board. If your current rquirements are below 100 mA this works well e.g. with the infrared remote applications in previous posts. If you need more current there are two-batteries-pack available.
An advantage of the Bhodilabs VPack battery pack is that a alkaline AA battery has at least three times the capacity of a typical 9 V battery (1700 mAh to 3000 mAh compared to 500 mAh) and that there's no loss because of unneccessary high supply voltage.

Infrared controlled timelapse photography
with Canon DSLRs

I wished all digital cameras would allow timelapse shooting out of the box. Digital cameras with a selftimer are able to trigger a photo via it's software but for some odd marketing reasons timelapse is seldom added. And even if your camera has a timelapse option it is often limited to 999 shots.

You can find lots of remote cable based external timelapse solutions for Canon cameras on the web but I haven't yet seen one that works infrared based.



This solution is based on a previous post. A different code and a push button instead of a switch allows timelapse control of Canon DSLRs that are compatible with the Canon RC-1 infrared remote control.

The timelapse settings like interval and number of shots can be set in the code. Once the sketch is loaded to the Arduino board it can run standalone close-by to the cameras infrared receiver.


/*
Arduino sketch for simulating a Canon RC-1 IR remote control to do timelapse photography with a compatible Canon DSLR
2010, Martin Koch
http://controlyourcamera.blogspot.com/
Huge thanks go to http://www.doc-diy.net/photo/rc-1_hacked/index.php for figuring out the IR code.
*/

#define irLED 12
#define statusLED 13
#define pushBUTTON 7

int interval = 15; //seconds
int timelapseDuration = 60; //seconds
int numberOfShots = timelapseDuration / interval;

void setup() {
pinMode(irLED, OUTPUT);
pinMode(statusLED, OUTPUT);
pinMode(pushBUTTON, INPUT);
digitalWrite(pushBUTTON, HIGH);

}

void loop() {
if (digitalRead(pushBUTTON) == LOW) {
digitalWrite(statusLED, HIGH); //Timelapse active
for (int i=0; i <= numberOfShots; i++) {
sendInfraredSignal();
if (i < numberOfShots) delay(interval * 1000); //ms
}
digitalWrite(statusLED, LOW);
}
}

void sendInfraredSignal() {
for(int i=0; i<16; i++) {
digitalWrite(irLED, HIGH);
delayMicroseconds(11);
digitalWrite(irLED, LOW);
delayMicroseconds(11);
}
delayMicroseconds(7330);
for(int i=0; i<16; i++) {
digitalWrite(irLED, HIGH);
delayMicroseconds(11);
digitalWrite(irLED, LOW);
delayMicroseconds(11);
}
}


If the infrared timing is known the sendInfraredSignal() sub routine can be adapted to release other cameras.

Add a serial LCD and potentiometers for setting interval and number of shots for a simple to make luxury intervalometer that doesn't require to re-programming the Arduino every time you want to change settings. Multi turn precision potentiometers would allow very fine adjustments e.g. a voltage between 0 and 5 V could translate to an interval between 1 to 3600 seconds and to 1 to 5000 shots. Rotary encoders would give even more flexibility and accuracy.

Saturday, January 9, 2010

Automatically resume video shooting
on a Canon 5D Mark II

The Canon 5D Mark II has a video recording limit of roughly 12 minutes . I'm fine with that but some people need longer recording times and would like to have a solution that automatically starts a new video clip after 12 minutes. They rather loose one or two seconds than to loose everything because they forgot to restart the camera . Especially in multi camera productions the gap will be of no concern.

I've chosen a 11 minutes limit because the 5D video recording length is actually limited by the 4 GB file size limit of the FAT32 file system that the Compact Flash cards use. By using 11 minutes I make sure to stay below this file size limit so the camera is always controlled by the external device.

The current video DSLRs from Canon don't support video recording control over a remote cable. The only way to do that works via the built in infrared receiver e.g. when the camera is in Live View mode the 2-seconds-delay setting of the Canon RC-1 remote starts and stops video recording.

Thanks to very helpful info at doc-diy.net I was able to program an Arduino board to send the required IR signals for starting and stopping video recording. For Arduino board suppliers see arduino.cc/en/Main/Buy.

The IR signal code is quite straight forward. The delay between two IR bursts determines if the camera takes a picture immediately or with 2 seconds delay. If it is in Live View mode the 2 seconds delay setting records video.






You also need an infrared LED, a 180 ohms resistor and a switch. Any standard IR-LED from any electronics supplier will do. Connect one end of the resistor to digital pin 12 and the other to the longer lead (anode) of the IR-LED. Connect the shorter lead (cathode) to "GND". Finally wire a switch that shorts digital pin 7 to "GND" when activated.



Connect the Arduino board to your computer via USB cable and load the code below on the Arduino.



/*
Arduino sketch for simulating a Canon RC-1 IR remote control to start and stop video recording on a Canon 5D Mark II or 7D
2010, Martin Koch
http://controlyourcamera.blogspot.com/
Huge thanks go to http://www.doc-diy.net/photo/rc-1_hacked/index.php for figuring out the IR code.
*/

#define irLED 12 
#define SWITCH 7

unsigned int pulseDuration = 10; //microseconds 
//The required 15 microseconds pulseDuration didn't work since digitalWrite consumes some additional time
//thats adds to pulseDuration value. 10 to 12 microseconds worked for me.

unsigned int photo = 7330; //A 7330 microseconds delay between bursts shoots a photo.
unsigned int video = 5360; //A 5360 microseconds delay between bursts starts/stops video recording. 

void setup() {
pinMode(irLED, OUTPUT);
pinMode(SWITCH, INPUT);
digitalWrite(SWITCH, HIGH); //turn on internal 20 k pullup resistor so the open input state is HIGH.
}

void loop() { //run again and again 
if (digitalRead(SWITCH) == LOW) { //read switch input
shoot(video); //start video recording
delay(660000); //record for 11 min * 60 s * 1000 ms
shoot(video); //stop video recording
delay(1000); //1 s delay between stop and start of next clip
}
}

void shoot(unsigned int delayBetweenBursts) { //sends the IR signal

//send first 16 bursts
for(int i=0; i<16; i++) { 
digitalWrite(irLED, HIGH);
delayMicroseconds(pulseDuration);
digitalWrite(irLED, LOW);
delayMicroseconds(pulseDuration);
} 

delayMicroseconds(delayBetweenBursts); 

//send second 16 bursts
for(int i=0; i<16; i++) { 
digitalWrite(irLED, HIGH);
delayMicroseconds(pulseDuration);
digitalWrite(irLED, LOW);
delayMicroseconds(pulseDuration);
} 

return;
}
After the upload has completed you can test the program. Enable the IR receiver on the 5D Mark II using the AF-DRIVE button and the large wheel on the back. Turn on Live View. Aim the IR LED at the camera and flip the start switch to start the continuously repeating 11 minutes video recording. Note that the function depends on a light path. To avoid any interruption I recommend that you mount the IR-LED very close to the IR receiver of the camera. For standalone operation disconnect the USB cable and connect the VIN and GND terminals of the Arduino board to a 7-12 V DC power source (e.g. a 9 V block battery as shown in the diagram above or a DC adapter). A typical 9 V battery has a capacity of roughly 500 mAh. This should allow for about 25 hours operation of the Arduino interface assuming an average current consumption of 20 mA. The photo above shows my first try with the IR-LED connected directly to digital pin 13 without any resistor. It works but the recommended way is to use a current limiting resistor on any digital output when using a LED. I used this LED calculator to get the resistor value of 180 ohms. For a more compact package take a look at the Arduino Nano. I recommend the book Getting Started with Arduino.