Talking to the camera


One of the best things about designing hardware yourself is that you have full control over exactly what you want the devices to do. Lately we’ve been figuring out what to do with the one piece of complex hardware that we didn’t design – the Canon SX100IS digital camera. Let’s just say that Canon’s engineers never imagined that anyone would be controlling the camera remotely from a normal PC, let alone an embedded board within a capsule that’s going up into the edge of the atmosphere.. Lucky for us, there’s a really dedicated group of Canon camera hackers out there that run an open-source project called CHDK, which sits on top of the Canon camera firmware and executes scripts that you write beforehand. These scripts can do a lot more than what you can normally access on the camera’s front panel. For instance, you can write a script to take pictures at certain intervals, choose flash settings, ISO, shutter speed, monitor the battery voltage – basically anything you want.

It sounds amazing, but the only problem with the CHDK is it still expects users to be able to press buttons on the camera and turn the scripts on and off! Obviously up at 100,000 feet there’s not going to be a human up there to press buttons, so we need some way to get our flight computer to talk to the camera. Unfortunately the camera won’t accept commands over the USB cable (we were hoping the CHDK would support this, but unfortunately it doesn’t). The other option, ripping off all the buttons on the camera and soldering wires connected to GPIO pins on our board, requires a lot of work to implement and means that we have to physically program in the button presses that correspond to the right menu options. Not fun. So we found a third solution…

There’s a function you can call from within the scripts called get_usb_power. Interestingly, it returns how long (in ms) power was applied to the USB port on the camera. Now, even though we can’t actually communicate over USB, there’s nothing stopping us from sending bursts of “power” on the Vcc line over the USB cable… and transmit data as a sort of “morse code” based on the pulse length! Old-fashioned, sure – but it works, and it’s elegant enough that it doesn’t require us to do things like dismantle the camera and solder wires to every button on the camera’s front panel. So to test this, we threw together a quick circuit with the trusty 555 timer chip to generate pulses which we’ll send to the camera:

555 timer circuit for "Morse code"

It goes to show that no matter what, there’s always some way to get a message through, even if it means using the USB power wire as a serial data cable. :)

  1. No comments yet.
(will not be published)