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.

36 comments:

  1. Could you make 3 extra ones for a price? My email is turbovids at pandora.be I really would love this camera but that 4GB thing makes it almost pointless for me.

    ReplyDelete
  2. Hi Phil, I don't have the time to build this for others but it should be possible to find someone in your region to make it for you. Its very simple to make. Any electronics hobbiest should be able to do it.

    ReplyDelete
  3. Thanks for this, works like a charm on a 500D.

    Some notes:
    - although the pause is 1 sec the camera may not start recording again until it finishes writing the file (1.3 to 1.6 sec)
    - reducing the pause to less than 1 sec seems to cause problems since the camera does not start to record after stopping
    - an LED plugged into the board without a resistor seems to be ok (I guess since it is on for such a short time)
    - an LED only works if it is plugged in correctly (reverse the contacts if it doesn't work)
    - for a bare bones version (10 min chunks, an LED plugged directly in as shown in photo above) without a switch (so it starts recording as soon as power is connected) replace loop() with:

    void loop() { //run again and again
    shoot(video); //start video recording
    delay(600000); //record for 10 min * 60 s * 1000 ms
    shoot(video); //stop video recording
    delay(1000); //1 s delay between stop and start of next clip
    }

    ReplyDelete
  4. Hi Phil,
    I tried the circuit, but the system only works in photo mode, not in video mode.
    I have a canon 550d T2i
    You know where I find the code for the RC-6 IR

    Grateful
    Carlos Simões

    ReplyDelete
  5. Carlos, the code above simulates a RC-6 IR remote so it should start video on your 550D. I don't have the camera but make sure Live View is on when you send the video start stop signal.

    ReplyDelete
  6. Hello Martin;
    Sorry I called you Phil.

    I teste again the two software "Infrared controlled timelapse" and the "Automatically resume video shooting".

    Immediate and 2s delayed works well in photo mode in the Canon 350D or in 550D.

    In video mode does not work, probably Canon changed something in the Canon 550D video mode.

    For now is ok because I want to place the IR R/C only for photo in Photoduino system, "It's almost ready".

    you know this device with the arduino?
    http://code.google.com/p/photoduino/

    Any questions send email

    Thanks
    carlos-simoes@iol.pt
    Carlos Simões

    ReplyDelete
  7. Carlos, I'm sorry to hear that it doesn't work with the 550D. I noticed that I made a mistake my code simulates the RC-1 or RC-5 remote not the RC-6.
    Thanks for the link to the Photoduino project. Please feel free to use my code. I'm glad if it's useful.

    ReplyDelete
  8. Hello Martin,
    My sincere apologies
    Canon 550D has on the video menu option to enable remote control
    Now works on any of the video modes:
    Live mode
    Face live mode
    Quick mode

    unsigned int pulseDuration = 12; //microseconds 10 dont work in photo or video mode

    Now I have to implement this mode on my Photoduino_Arduino_Mega

    My Photoduino
    http://picasaweb.google.com/carlossimoesfotos

    Sorry again

    Everything works fine when it works :):):)

    Thanks again
    Carlos Simões

    ReplyDelete
  9. Has anyone tried attaching two LEDs in parallel connected by wires as a method of synchronously shooting off two cameras?

    ReplyDelete
  10. Nathan, it's worth a try. I can confirm that this method works excellent with two Canon HF100 camcorders.

    ReplyDelete
  11. Thanks a lot for this post. I was able to use this information on my research. I was wondering if there are screen shots too of the other components needed in the instruction? Thanks again. Wonderful website!

    ReplyDelete
  12. Hi Martin,

    Based on your Arduino code sample I have been able to create a remote record button attached to a handle of my shoulder rig. I added a status led and some more logic to create an automatic record mode with start / stop functions. The led will blink when in autoRecording mode. The code is here, feel free to use it: http://chainsaw.phrog.nl/uitwissel/tweakers/IRremote/Canon_7D_record_trigger.zip
    Regards!

    ReplyDelete
  13. Great work Sander, thanks for sharing.

    ReplyDelete
  14. Hi - really appreciate all your hard work on this. Any idea if this code can be modified to work with the Canon 60D?

    ReplyDelete
  15. Hi Martin
    I am going to try this as I shoot docs and not having to remember to restart camera will be nice.

    I was looking through the code and was wondering if this is correct

    if (digitalRead(SWITCH) == LOW) { //read switch input
    shoot(video); //start video recording
    delay(3000); //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

    shouldn't that delay be 660000 instead of 3000?

    I may try this this afternoon.

    Thanks

    ReplyDelete
  16. Well I put this together starts the camera but won't restart after the first 11 min. Any ideas?

    ReplyDelete
  17. Hi Martin
    I also forgot to mention I am working with a Canon 7D. Works great at starting the camera but won't restart after the 11 min.

    Thanks

    ReplyDelete
  18. Robert, yes the delay should be 660000 . I used 3000 for testing purposes and left it in the code. I'll update it.

    If you can start and stop the camera I see no reason why your code shouldn't work. It must be a simple error and I hope you find it.

    ReplyDelete
  19. I did find the problem. I used a momentary contact switch, changed to a toggle switch and now it works great. I may try Sander's version because of the status LED. Now to package the circuit into a small box, using a Mini Pro, to use. This should make shooting interviews so much easier. Have you found a point at which the sensor overheats and the camera shuts down during continuos recording?

    Thanks again this is awesome.

    ReplyDelete
  20. Great. I published this project without having a need for such a solution. When I had the 5D I only shot short clips so I have no experience with long shooting periods but I think in normal temperatures you shouldn't have any problems.

    ReplyDelete
  21. Would it be feasible to create a count down timer display triggered by the camera to the Arduino board - perhaps by the hdmi signal?

    ReplyDelete
  22. Jeffmurray, sorry I can't help in this case.

    ReplyDelete
  23. Have a look at the Pclix XT. You can easily set the duration of the clip and also set the interval between clips. Want to shoot time-lapse too? You can. Plus there's support for dozens and dozens of other stills and video cameras. Using both infrared and camera control cables.

    www.pclix.com

    ReplyDelete
  24. Paul, yes Pclix looks great and I have already mentioned it here:
    http://controlyourcamera.blogspot.com/2010/01/pclix-lt-universal-timelapse-controller.html
    You should add your comment there too.

    ReplyDelete
  25. Hi Martin,
    I would like to thank you for providing everyone this post, I am very excited to get this thing working, but I am having a couple of problems.

    I have an "Arduino Uno", and I noticed in the picture you have the "Arduino Diecimila". Also, the led in the picture is plugged into the GND and D13, but on the schematic it shows D12, should I go off the schematic or does it not matter?

    Lastly, with the switch, do I just make sure that it is touching GND AND D12 (or D13), or do I need to touch the GND and somewhere else on the board?

    Thank you so much for your help, I look forward to hearing back and does anybody have a picture of this thing completed?

    -Jeff

    ReplyDelete
  26. Hi Jeff, the UNO replaces the Diecimila 1:1. Pleae wire the whole thing exactly as shown in the schematic. Enjoy!

    ReplyDelete
  27. Hi there Martin, thanks a lot for this post, or this website in fact. I'am currently developing an integrated time lapse control (ServoMotor, and Camera intervalometer control) based on your codes! I'll send you the code right after I finished it. Can I have your e-mail?

    ReplyDelete
  28. unfortunately it doesn't work well on 60D and also 600D, is there a way or to change something?
    Now it start, but it stop immediately for 2/3 times, and if in auto mode not restart the shooting.

    ReplyDelete
  29. Very informative article which is about the filmmaking and i must bookmark it, keep posting interesting articles.
    filmmaking

    ReplyDelete
  30. Great Blog!! That was amazing. Your thought processing is wonderful. The way
    you tell the thing is awesome. You are really a master.
    Video resumes website

    ReplyDelete
  31. This really is my very first time i visit here. I discovered so many entertaining stuff in your blog, especially its discussion. From the tons of comments in your articles, I suppose I am not the only person having most of the leisure here! Keep up the superb work.Spanish Translator Milwaukee

    ReplyDelete
  32. Informative post. Create a Video Resume with StaffMerge Platform and have the quicker way to get hire.

    ReplyDelete
  33. The Article your wrote is well written and provide the enough information on the topic. Thanks for sharing
    Christopher

    ReplyDelete
  34. Thank you so much for taking the time to put together the best guide out there..I agree that all guides should look like this. Cheers to you!!!
    Mail Order Marijuana

    ReplyDelete