The Canon Powershot support for Arduino PTP Library has been released. The library code, as well as several examples, is posted to GitHub. The code allows remote controlling shooting parameters of certain Canon Powershot cameras ( see gphoto and Canon SDK pages for the list of cameras) via USB using Arduino board equipped with USB Host Shield.
Every function of the camera available via buttons/menus can be initiated through PTP. This includes shutter button, shooting mode (Av, Tv, etc.), aperture and shutter speed values, zoom, focus, white balance, just to name a few. Code examples demonstrate control technique. In addition to examples, I added a static page with detailed description of Powershot library.
Most PowerShot cameras have two modes of operation – ‘shooting’ and ‘PC connect’, selected by a switch on camera body. Typically, USB is deactivated in shooting mode and communication with camera is not possible; for remote shooting, camera has to be switched to PC connect mode. Newer PowerShots switch to PC connect mode automatically when USB connection is detected.
Certain code examples use QP framework from Quantum Leaps. The Arduino version of the framework is due to be released any day, in the meantime, here is brief instruction how to make Arduino library of QEP component from source code.
First example sketch, called PSCapture, is a simple demonstration of running camera operation. The sketch starts and waits for camera to appear on USB bus. Then it takes picture and outputs technical data of the image. The process continues until camera disconnects. Here is sample output of this sketch.
The PSDevProp sketch is a companion to venerable
PTPDevInfo. It initializes and then queries the camera for PowerShot-specific properties. Some camera properties are mode-dependent, for example, shutter speed can’t be changed while in Av mode. In order to discover every possible property of the camera,
PSDevProp switches camera between supported shooting modes and repeats the process.
As you can see in sample output, which by the way, was obtained from A640 camera, featured on the title picture, the sketch throws a lot of errors. This is normal – every possible property is queried and if camera doesn’t support the property, an error is generated.
Last example, the PSRemote, is an utility, where you can see and change certain camera properties from serial terminal. It is possible to change shooting mode, aperture, shutter speed, white balance, ISO, exposure compensation and zoom. Also, you can set viewfinder output to AV out or LCD screen and turn the LCD on and off. The
PSRemoteutility has been designed to remotely control the camera using RF-to-serial converter, such as Xbee. It can also be used directly from a PC terminal.
The list of PowerShot cameras that are known to work with this library is currently very small – it is A640, S3 IS, and S5 IS. It should work with many other cameras, which support PTP operation
InitiateCapture(0x100e), Canon PowerShot-specific
PS_StartShootingMode (0×9008), or
PS_InitiateCaptureInMemory(0x901a). If you make the code work with other PowerShots, please let me know. I’d also appreciate outputs of
PSDevProp from cameras not listed here.
No related posts.