Using the Canon Hack Development Kit

New firmware allows Canon cameras to perform some neat tricks

Back in the day, hands-on photography required you to be closeted away in a darkened room, where you dunked sheets of paper into solutions of smelly chemicals. Now we manipulate photographs with software, a much less messy and oppressive process. But wouldn't it be great to have more control still—even before the photo is taken? Many cameras allow you to adjust their exposure settings manually, but that's about it. What if you could have full command of your camera's hardware?

Such thoughts motivated an anonymous programmer going by the online name VitalyB to reverse engineer the firmware for Canon's PowerShot series of digital point-and-shoot cameras. With hacker-level control, he could do things the engineers at Canon had never thought of. In 2007, he made public the fruits of his labor: the Canon Hack Development Kit, or CHDK, which Andrei Gratchev, a programmer working for eASIC Corp., of Santa Clara, Calif., and other developers have since broadened. Now you can find a version for just about any one of the Canon PowerShot series.

The CHDK firmware resides on the camera's memory card, but the original Canon firmware remains on the camera's internal flash memory. So you're not likely to "brick" your camera by using CHDK inappropriately. Indeed, you can return your camera to its stock configuration merely by restarting it without CHDK on its memory card or by switching the locking tab on the card to its unlocked position. (CHDK loads only if the card is locked, and once this firmware is loaded, the camera can still record images.) The CHDK firmware is described fully on the wiki at, which includes a "CHDK for Dummies" section and plenty of pointers for getting up and running.

Just by loading CHDK, you'll be able to coax things out of your camera that you couldn't before—saving RAW images, for example, or getting the LCD to display the battery voltage or live histograms of pixel brightness before you shoot. But the real power of CHDK comes from its ability to run scripts on your camera. You can write your own or install ones that others have posted on the CHDK wiki.

I recently tried out one of several motion-detection scripts available there. It was written by Johan Van Barel in UBASIC. (CHDK also supports the LUA scripting language.) With it, I easily converted a Canon PowerShot A630 into what a wildlife biologist or deer hunter would call a camera trap.

Most camera traps use an infrared motion detector, but a CHDK-enhanced camera can itself detect motion. Van Barel's script gives you control of such things as the delay between the motion and the shot and whether the focus is fixed or variable. Without any tuning at all of the script's parameters, I was able to get some fascinating photos of birds cavorting around the family bird feeder [see "Shutter Flutter"]. Others have used similar scripts to produce some stunning photographs of lightning.

Using another script, written by a contributor to the CHDK wiki who goes only by the name Divalent, I added what's known as an intervalometer to one of Canon's smallest cameras, the 5-megapixel SD30. I mounted the diminutive (105-gram) camera onto a radio-controlled model airplane to take aerial photos during a recent vacation to the southwestern United States. The intervalometer script allows the camera to take pictures continually at a prescribed interval—with it set at two seconds, each flight yielded a few hundred images from which I could choose a few winners.

I've just begun to explore the wealth of scripts available for CHDK. There are ones that have each press of the shutter button take a series of photos while varying the exposure, flash, zoom, focus, or sensitivity. You can even convert the USB port on your camera into an electronic shutter release. Of course, you're free to modify these scripts or write completely new ones. And really ambitious camera hackers can create their very own versions of CHDK, because the CHDK wiki includes the source code (written in C) and instructions for modifying it. With CHDK the sky's the limit, you might say.

This article originally appeared in print as "Camera Hacking."