Monday, June 27, 2011

Intervalometer with CHDK

I wrote a script for Canon cameras with CHDK that works as an intervalometer. The script can take photos and videos alternately. The interval between photos, the number of pictures between videos, and the length of the videos in seconds can all be configured from the CHDK interface. It has other handy features like switching the LCD off to save power, or pre-focusing at the infinity so that the AF doesn't have to struggle with low contrast exposures at high altitudes.

CHDK is a firmware addition that enhances the camera functionality by giving more control over exposure, raw capture and display options, but most importantly for us, it allows scripted control of the camera. The scripts can be written in a derivative of BASIC called uBASIC, or Lua. You can control almost every aspect of the camera from a script, including filesystem manipulation, timed shooting, adjusting the flash or the exposure parameters, timed shots and even switching dial modes programatically. It's perfect for high altitude balloons because the camera can operate autonomously without any extra circuitry and does not require any attention from the tracker. Check out their web page for installation details. The firmware is fully reversible, you can remove CHDK by just reformatting the SD card and the camera will be back to normal.

The intervalometer script works quite nicely! I went to a fireworks display earlier today and captured 390 photos about 0.5 seconds apart from one another. The camera I used is a Canon A570IS set to manual mode, 0.4 seconds exposure, f/2.6 aperture, ISO 100, no zoom and pre-focused at the infinity with the intervalometer script. I assembled all the pictures together in a sort of time-lapse video and here is the result:

More on the intervalometer at the trackuino project's wiki. You can download the script (trackuino.lua) from the downloads area.

The script is largely based on CHDK's Accurate intervalometer with power saving and pre-focus and the Spacebits team's intervalometer. Most of the code is actually taken from them. I tried to make it compatible with other Digic III/IV cameras, but If the trackuino intervalometer doesn't work for you, make sure you check these out!


  1. Javi, is it possible to use the Arduino to initiate the script on the camera? I'd like to be able to have one "ready to fly" switch on my payload to turn on the arduino and start the camera and other sensors just before launch.

  2. +1 that :) Launches wouldn't be so stressful if the camera could be turned on just before the launch. Their batteries are usually the ones that die first. I haven't looked into it, though...

  3. @Javi What I do for launched is I got a external battery for my camera that allows the batteries on the camera to last much longer.

  4. Hi - I'm wondering if I could get a copy of your script?

  5. Hi - I'm wondering if I could get a copy of your script?

  6. Creating models and replicas at scale exhibits off your experience as a 3D professional printer. Follow this suggestion that you simply can|so as to|to find a way to} showcase your architectural imaginative and prescient or latest product design. This mannequin is functional for a client precision machining presentation or LCD in the real world.