Controlling Canon Powershot cameras with Arduino

Canon A640 shooting Arduino board

Canon A640 shooting Arduino board

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.

The screenshot of PSRemote Program

The screenshot of PSRemote Program

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 PSRemote utility 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 PTPDevInfo and PSDevProp from cameras not listed here.


8 comments to Controlling Canon Powershot cameras with Arduino

  • karsten

    Hello Oleg,

    wow, great project. I started taking HDR pictures again and was looking for a remote control solution. First i took a laptop and gphoto2, then I thinking about sniffing and replaying the usb-communication. Wihle looking for a suitiable ideas I stumbled upon your controller. Well done!!! Now It seems I have to dive into the arduino world. Would it be possible to obtain a kind of a minimal shopping list to get a clone of your controller?

  • My guess is you´ld need at least a USB host controller from this site (I bought the mini version) and an arduino.

    Good luck, Jan.

  • Steve

    Can I use your PTP library to transfer the JPG object from my Canon 500D to the Uno with the Host Shield? Will this functionality be coming soon?

  • Steve

    Which camera models will support this? Powershot?

  • florent


    i write because, i spent lots of time working with PSCapture with my arduino.
    i have many problems to understand how work this example.

    what i want is very simple, i am loocking for an instruction to simple take a picture in the loop. PSCapture work with inturuption, the result is my camera take picture each secondes but i can’t find a way to manage the shooting.

    in the loop i have those instruction,


    i m looking for an instruction to take a picture according to button on my arduino.

    Best regards,

  • florent


    i can’t find a way to make PSRemote works due to file issue.
    what i want to find is to find a code to put in my project to simply take thr pic. Why PSCapture i have a pic by second. When i use the code in the interruption

    Ps.SetDevicePropValue(PS_DPC_CaptureTransferMode, (uint16_t)0x0D);
    uint16_t rc = Ps.Capture();

    i don’t have result, i tried to put simply Ps.capture() in my loop, but the program freeze.

    best regards;