Got an Old Canon Point-and-Shoot Camera? Hack It

Add new features and write scripts with CHDK firmware

4 min read
Photo showing a Raspberry Pi and an old digital camera.
Photo: Randi Klett

Photo showing a Raspberry Pi and an old digital camera. Resurrected Tech: With a Raspberry Pi and the right software, an old digital camera can be network enabled and used for projects unsuitable for either a smartphone camera or an expensive DSLR. Photo: Randi Klett

A decade is a long time in technology—long enough for a technology to go from hot product to conspicuously obsolete to retro cool. In 2010, IEEE Spectrum’s David Schneider wrote about a hack to supplant the firmware in Canon point-and-shoot cameras and add new features, such as motion detection. As it turns out, at the time point-and-shoot cameras were near their zenith of popularity. Since then, while compact stand-alone digital cameras are still being made, their sales have shrunk dramatically. As the smartphone camera became the most ubiquitous type of camera on the planet, point-and-shoot cameras found themselves relegated to the back of the closet.

That was certainly the case with our Canon PowerShot S80. My wife bought it in 2008 primarily to document her paintings in between professional photo shoots, and a few years later we replaced it with a mirrorless Nikon 1 J-1 with interchangeable lenses. So when I found the S80 while decluttering recently, I wondered: Was it just e-waste now, or could it be combined with today’s technology to do interesting things?

img

img

img Empire States: A program triggered the S80 at different rates to capture slow changes during the day and more rapid changes at dusk. Photos: Stephen Cass

I decided the perfect test case for my S80 was variable time-lapse photography. This is a task for which even an 11-year-old digital camera, with its larger optics, can compete with today’s smartphones on image quality. This scenario makes mobility a moot point, but the task also requires more sophistication than even CHDK—the open-source firmware replacement David Schneider wrote about in 2010—can easily offer alone.

My S80’s original firmware had a function that would take a photograph at fixed intervals of between 1 and 60 minutes, in 1-minute increments. CHDK provides a script that allows a more fine-grained increment of 1 second, but I wanted to try time-lapse photography of the Empire State Building, which we happen to have a good view of from Spectrum’s New York office. During the day, the light changes slowly, so I wanted to shoot one photo every few minutes. At dusk, however, the lighting on and around the building changes more dramatically, so I wanted photos taken at a faster rate.

The first thing was to test my camera. It’s a credit to Canon that despite years of disuse, all the parts sprang to life. The only problem was on the battery side. I had three batteries, one of which refused to charge at all, and two others I no longer trusted for a long-duration experiment, so I found a DC adapter on eBay that powers the camera from a wall socket.

Then I installed CHDK. Fortunately, this is one of those rare pieces of open-source software for which the documentation is a comprehensive and intelligible wiki. Looking up the instructions for my S80, I determined its current firmware, which turned out to be 1.00f. Only the 1.00g version is compatible with CHDK, so I followed the instructions to upgrade the factory firmware, the biggest obstacle to which was finding the right utility software to open the 7z format that the firmware file was compressed with.

A cross-platform tool called Stick makes finishing the CHDK install easy: Drop a photo taken with a camera onto the tool’s interface and it analyzes the metadata and downloads the exact version of CHDK required onto a SD card. Launching CHDK on my camera just requires putting the prepared card in and pressing the S80’s “shortcut” button.

CHDK provides an interface for remote control of the camera via the USB link normally used to download photographs directly to a PC. A number of programs can use this PTP standard, including chdkptp, which offers both a command line version and a graphical user interface (GUI) version that lets you see what is being displayed in the viewfinder screen live. One of the nice things about chdkptp is that a precompiled binary, bundled with required supporting libraries, is available for the Raspberry Pi, thus eliminating dependency hell.

I ran into two problems, which were resolved after searches of CHDK’s user forums. The first was that chdkptp couldn’t connect to the S80—a helper process on the Pi was grabbing the connection, assuming I wanted to download photos. The simplest solution was to find the offending process using a “ps -ax | grep gphoto2” command, and “kill -9” it. (This works only on a per-session basis; if you want to permanently disable the helper, you’ll have to edit some deep configuration files.)

My camera and chdkptp could now connect, but I still couldn’t actually take a photo. This was solved by writing a script with some mode commands I found on a forum. CHDK runs the script when I press the camera’s shutter, and then it is happy to accept remote commands.

Screen shot of new features added by CHDK. UI Upgrade: CHDK adds many other features to old cameras. Photo: Stephen Cass

To implement my variable time-lapse schedule, I wrote a short Python program on the Pi. I looked up the time of the sunset and set the Python program to check the clock. Outside a half-hour window around sunset it would take a photo every 10 minutes, and one every 30 seconds inside the window. To control the S80, I just issued an OS call to the chdkptp command line tool that connected and triggered the shutter—that is, os.system(“./chdkptp.sh -c -eshoot”).

I left the system running from the early afternoon till dusk, and when I returned I had 113 images, which I dumped into iMovie to make a time-lapse video. Ta-da!

Now that I have my proof of concept, it would be a straightforward task to write a Python script that could download the times of sunrise and sunset and adjust itself automatically. I can also save images directly to the Pi. Then I could access and download these images remotely over a wireless network, allowing for the option of leaving the camera and Pi in place for long periods of time for truly epic time-lapse movies.

This article appears in the December 2019 print issue as “Hack Your Old Point-and-Shoot.”

The Conversation (0)

From WinZips to Cat GIFs, Jacob Ziv’s Algorithms Have Powered Decades of Compression

The lossless-compression pioneer received the 2021 IEEE Medal of Honor

11 min read
Horizontal
Photo: Rami Shlush
Yellow

Lossless data compression seems a bit like a magic trick. Its cousin, lossy compression, is easier to comprehend. Lossy algorithms are used to get music into the popular MP3 format and turn a digital image into a standard JPEG file. They do this by selectively removing bits, taking what scientists know about the way we see and hear to determine which bits we'd least miss. But no one can make the case that the resulting file is a perfect replica of the original.

Not so with lossless data compression. Bits do disappear, making the data file dramatically smaller and thus easier to store and transmit. The important difference is that the bits reappear on command. It's as if the bits are rabbits in a magician's act, disappearing and then reappearing from inside a hat at the wave of a wand.

Keep Reading ↓ Show less