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!