Shopping Cart


Digital camera control using Arduino USB Host Shield. Part 2 – Canon EOS Cameras.

New version of PTP Library for Arduino USB Host Shield has been posted on GitHub. In this version, PTP::Task() has been completely rewritten to provide for non-blocking state machine-type execution. Another major addition is comprehensive support for Canon EOS cameras – many camera functions including changes of shooting parameters, Live View, focus move, are now well understood and supported. The library is released under GNU General Public License version 2.

In addition to the code library, a manual page has been created outlining EOS-specific extensions to PTP protocol, a code example, and library reference. Similar page for basic PTP functions is planned also.

The code is stable (more or less) and no application interface changes are planned at this moment. It is, however, incompatible with an old version, which is preserved in “legacy” branch of GitHub repo. The camera interface has not changed much and migration of old projects should be easy. If you have issues with migration, comment below and I will try to help.


Related posts:

  1. Digital camera control from Arduino-hosted webpage
  2. PS3 and Wiimote Game Controllers on the Arduino Host Shield: Part 1
  3. PS3 and Wiimote Game Controllers on the Arduino Host Shield: Part 3
  4. Arduino USB Host Shield build log. Part 3.
  5. PS3 and Wiimote Game Controllers on the Arduino Host Shield: Part 2
  6. USB Host Shield for Arduino – first prototype.
  7. Arduino USB Host Shield build log. Part 2.
  8. Arduino USB Host Shield build log. Part 4.
  9. Arduino USB Host Shield build log. Part 1.
  10. Towards an FT232 Driver for the USB Host Shield- Part 0

24 comments to Digital camera control using Arduino USB Host Shield. Part 2 – Canon EOS Cameras.

  • Vincent

    Sorry for my english, but i try:
    I want to connect wireless my Canon 500D with a PC. I bought 2 XBEE pro serie 2 with 2 Droids USB adapter. What Hardware I need to make a digital camera control with xbee (Arduino card, Arduino USD Host Shield, Arduino xbee adapter????)

    Thanks for your help,


  • serankko

    Please somebody help me…

    In the camera sample sketch, what would be the code to take a photo with exposure compensation -1 ?

    I want to take the photo every 5 seconds buy instead of been “actual conditions”
    uint16_t rc = Eos.Capture();
    I would like to be -1.

    Thanks a lot,


  • serankko

    Never mind… I’m not as dumb as I thought… I know how it works…

  • czuryk

    Олег, приветствую!

    Не мог бы ты немного поподробней о своей конструкции рассказать – Я в Arduino пока новичек, но хочу активно заняться. Друг просто попросил помочь сделать синхронизатор для стереокамеры – а для этого твой способ вполне походит.
    Вопроса пока три: какую плату Arduino приобрести и как подключить к фотоаппарату (я так понимаю что штатным USB – тем что есть на плате Arduino) и последний – можно заменить IPHONE обычными кнопками, что убрать нужно в коде?

    Буду благодарен за любую помощь! Чтобы здесь не офтопить, можно написать мне на мейл:

  • Ryan

    Do you have any suggestions on how to emulate your USB host stuff on a desktop? The reason I’m asking is that I have a few ideas for applications – particularly using it for EOS camera control, but I’d like to code it up and test it on my desktop and prove the concept will work before I take the plunge and get it working on the arduino platform.

    I don’t even care so much about emulating the processor arch – I’m fine just running it in x86 but having it use my USB port as the host… (does this make any sense?)

  • Nils

    Hi Oleg,

    you recently added a new example for the camera control.
    In this example you have the following include:

    Where can I download the package? Is this from the site ?
    Which package do you use or have you a modified version?

    Are you going to write more comments into the source code? This might be very helpful. Maybe I can do this also and send it for updating / checking back to you?

    Best regards and thank you for the nice work,

    • Hi Nils,

      I am writing an article about it right now, hoping to finish it by the end of the week. It’s a camera controller. You are correct about QEP component from, you will need C++ version of the framework plus qep-port.h file from AVR-GCC QDK.

      Thank you for offering help with code commenting, this would be very helpful! Send me your source with comments and I’ll incorporate them into the code.


  • Oleg,

    I have a DIY Arduino-based timelapse controller that currently operates two step motors to move/rotate camera and pretends to be a remote release to trigger cameras.

    I’m thinking to modify it to make it a bit more intelligent to automatically compensate for exposure changes. I see that I can use your library to control almost all features of the camera, but I’m wondering if it is possible to retrieve current metering details such as “exposure level indicator” ? My plan is to track current exposure level and adjust shutter to compensate changes.


    • In manual mode meter value is not transmitted. You can shoot in auto mode, simulate “half-press”, get, say shutter value which will be used if you do “full-press” and then correct it using Ev compensation. I’m playing with an idea to combine my camcontroller with external meter – they are cheap and easy to use and should also give more consistent results.

      • Oleg,

        Thanks for the tip to use external meter, theoretically this approach will also provide better granularity.

        Еще раз спасибо,

      • Oleg,

        As you suggested I’m now using external sensor to adjust exposure interval, and it works quite well. So many thanks for the idea!

        I’m now trying to adjust camera’s ISO settings using your library and having difficulties understanding how to use PTPReadParser for CanonEOS::GetProperty method. Could you post an example for that method? I couldn’t figure it out from examples on github.


        BTW, your library doesn’t work with Canon 20D, it can’t get into initialised state – generates response block errors. Probably incompatible protocols. Canon 5dMk2 works fine.

  • Yegor,

    I’m interested in your implementation of an external meter. Biggest problem I see is that if you have the external meter next to your camera, you are measuring the light at your camera – not of the scene you wish to take (classic problem of external meters). And you clearly can’t have the external meter in the scene you wish to take or it would spoil the photo. So what have you done?



  • ennekappa

    Hello, I’m trying with the EOS 6D, but all the examples files freeze with “session opened”.
    Anyone noticed of this?

  • ennekappa

    Sorry: EOSCapture works but EOSFocus gives some errors.

    Fatal USB Error
    Transaction: Response recieve error: 0004
    Fatal USB Error
    Transaction: Response recieve error: 0004
    MoveFocus error: : 2002
    Transaction: Command block send error: 0004

  • Ash

    I haven’t really looked at the code but I saw you wrote Live View is supported. Does that mean you can send Live View command and somehow use the returned data and the arduino to send the live view data over a network? Will it be slow (laggy)?

    • Camera needs to be in LiveView mode to execute focus move commands. This is supported in the code. It is possible to read data sent back but I haven’t tried it – a single frame is ~250K, you have nowhere to put it on Arduino.

  • Diego


    I want to add some information to a picture or at least read the filename, at the capture time, and associate this name to other informations out of the camera, is that possible?


  • kkbuddy

    Anybody any experience with Bulb mode on EOS cameras and how quickly StartBulb and StopBulb can be asserted?
    I’ve written a bulp ramping sketch, simple time controlled state machine sequence, where I do StartBulb and StopBulb
    at different states, it works actually quite ok, even down to 10ms, but sometimes, after multiple shots it slips a Stop, or delays a Stop by a longer time, sometimes stuck completely, or recovers. I’m not sure if the USB interface is doing something in background from time to time and blocking the communication.



    • kkbuddy

      I had a closer look now and measured the duration of Eos.StartBulb() itself, and it fluctuates pretty much, sometimes 40ms, sometimes 150ms, and duration from Start to Stop is not always constant, which you can see as flickeer later on. No idea where to look and how to debug further. Guess this is not really suitable for very accurate bulb mode.

      • I once measured Bulb mode precision on several low and high end cameras. My results were 10 – 50ms shot to shot difference from shutter press to PC sync signal on 1D, 5D and about extra 20 ms on Rebels. The closest shot to shot numbers (10-20ms) were obtained when shots were 10 minutes or more apart with sleep turned on. I was using cable release for those tests, I could imagine USB will only add latency.

        Now, PC sync is not a good test signal, it could jitter as well. But still, Bulb is pretty sloppy.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">