Go Down

Topic: USB Host controller (Read 26285 times) previous topic - next topic


And yes I think it would be a good solution to do this over the physics in blender so you get a realistic animation for it, but than you have to be care when you throw it to the IPO editor. Maybe it will be necessary to edit the IPO curves of this skirt to get a loop able animation (means with smooth overlay when it jumps back to start frame).


Which is the best way to animate it and export that to irrlicht?
Maybe somehow rig the rest of the body, set the skirt vertices to "Cloth" in the Physics menu and record their changes as shape keys (when playing the skeletal animation)?
the wire seasons 1-5 dvd boxset


PS3 controller code -> http://www.circuitsathome.com/mcu/programming/hook-up-ps3-controller-to-usb-host-shield


Jan 06, 2010, 09:43 am Last Edit: Jan 06, 2010, 09:50 am by derniwi Reason: 1

I'm looking for a little device to control my digital SLR camera. So I found this post. A few years ago I bought and reprogrammed an Atmel butterfly board, but this gave me not really the options I'd like to have, because some features are only available by using an USB connection.

I'd like to have a small box with some electronics, some keys for navigating through a menu (changing settings and starting communication) and a display.

So my question is:
what do I need to build such a system?
- an Arduino Pro 328 based board (3,3V or 5V?)
- FTDI Basic Breakout for proramming? (3.3V or 5V?)
- the USB host shield
- which kind of display? (just for design reason: yellow on blue looks great)
- some connectors for connecting the USB host shield to the Arduino Pro

I would use this device in a box and power it with a battery set.

@macegr: do you started to develop some software yet? I don't know pretty much about Atmega and USB programming, but if Felis have done the USB logic part and libgphoto2 the camera specific codes it should not be t odifficult to get a working system. How could I help?

Best regards, Nils.


libgphoto is not very useful as a software for Arduino; I'm now developing camera code from scratch using gphoto and other pieces of linux software as a reference. I'm hoping to get working camera code with some functionality in a month or two.


Sorry, I don't mean libgphoto as program itself. Crosscompiling should be a little bit to difficult, but I think they have found a lot of codes for calling camera functions, so libgphoto could be a look up reference.


Im working on a similar project to control my Canon DSLR. I have an Arduino Duemilenova connected to a FTDI Host Controller which then sends commands to the camera via USB. But I can't figure out at the moment how to format the information to the camera. I've been looking at the libgphoto as an example, but no dice so far.

I figure its gotta be sent in ascii, in a format such as

Camera Device ID , command , subcommand

Have you made any progress?

The following are codes for a canon camera:

my %canon_cmd = (
   "0x01 0x11 0x202" => "Get picture/thumbnail",
   "0x01 0x12 0x201" => "Identify camera",
   "0x03 0x12 0x201" => "Get time",
   "0x03 0x11 0x403" => "Upload data block",
   "0x04 0x12 0x201" => "Set time",
   "0x05 0x11 0x201" => "Make directory",
   "0x05 0x12 0x201" => "Change owner (old) or get owner (new)",
   "0x06 0x11 0x201" => "Remove directory",
   "0x06 0x12 0x201" => "Change owner (new)",
   "0x09 0x11 0x201" => "Disk info request",
   "0x0a 0x11 0x202" => "Flash device ID",
   "0x0a 0x11 0x201" => "Delete file (new)",
   "0x0a 0x12 0x201" => "Power supply status",
   "0x0b 0x11 0x202" => "Get directory",
   "0x0d 0x11 0x201" => "Delete file (old) or Disk info request (new)",
   "0x0e 0x11 0x201" => "Set file attribute",
   "0x0e 0x11 0x202" => "Flash Device ID (new)",
   "0x0f 0x11 0x201" => "Set file time",
   "0x13 0x12 0x201" => "Remote Camera control",
   "0x17 0x12 0x202" => "Download captured image",
   "0x18 0x12 0x202" => "Download captured preview",
   "0x1a 0x12 0x201" => "Unknown EOS D30 command",
   "0x1b 0x12 0x201" => "EOS lock keys",
   "0x1c 0x12 0x201" => "EOS unlock keys",
   "0x1d 0x12 0x201" => "EOS get body ID (old) or Get Custom Functions (new)",
   "0x1f 0x12 0x201" => "Get camera abilities",
   "0x20 0x12 0x201" => "Lock keys, turn off LCD",
   "0x21 0x12 0x201" => "Unknown newer command",
   "0x22 0x12 0x201" => "Unknown newer command",
   "0x23 0x12 0x201" => "Get EOS Body ID (new)",
   "0x24 0x12 0x201" => "Get camera abilities (new)",
   "0x25 0x12 0x201" => "Remote Camera control (new)",
   "0x26 0x12 0x202" => "Get captured image (new)",
   "0x35 0x12 0x201" => "Unknown newer command",
   "0x36 0x12 0x201" => "Unknown newer command"

my %control_subcmd = ( "0x00" => "Camera control init",
                  "0x01" => "Exit release control",
                  "0x02" => "Start viewfinder",
                  "0x03" => "Stop viewfinder",
                  "0x04" => "Release shutter",
                  "0x07" => "Set release params",
                  "0x09" => "Set transfer mode",
                  "0x0a" => "Get release params",
                  "0x0b" => "Get zoom position",
                  "0x0c" => "Set zoom position",
                  "0x0d" => "Get available shot",
                  "0x0e" => "Set custom func.",
                  "0x0f" => "Get custom func.",
                  "0x10" => "Get extended release params size",
                  "0x11" => "Get extended params version",
                  "0x12" => "Get extended release params",
                  "0x13" => "Set extended params",
                  "0x14" => "Select camera output",
                  "0x15" => "Do AE, AF, and AWB"


You need to follow PTP - open/close session, get object handle, and stuff. Commands, such as shutter release, are put in a data block, parameters, such as aperture/shutter speed change, go into data block. I'm planning on posting some camera control code for Canons (EOS and PS) in next couple of weeks.


Feb 25, 2010, 09:50 am Last Edit: Feb 25, 2010, 09:55 am by schmart Reason: 1
have you seen this post:


for nikon cameras (D50/D80/D90) it has been done and it is working (for me)

edit: i mean this post


Digital Camera Control Introduction -> http://www.circuitsathome.com/mcu/programming/digital-camera-control-using-arduino-usb-host-shield-part-1-basics


I hope this is the right thread to ask this question.
Would it be possible to connect a usb cam to this board and stream the picture via the ethernet port or even the WIFI sheild (are they all called sheilds?). By the look of the memory size and speeds I appreciate it wouldn't be able to do any processing and wouldn't need to for my project just pipe it straight out.


This is well within capabilities of the platform. The only issue would be transfer speed so don't plan on streaming 30fps at full resolution.


Thanks for the reply. I guess I would need a decent frame rate so perhaps it wouldn't be the best option. Maybe if someone builds one of these USB host boards and it didn't involve too much coding they could try it and see what kind of results are possible. As being able to get live cam feedback from your project has to be handy in many situations. I'm very new to this and thus I have loads of other questions but I won't hijack the thread I'll do some more searching to see if they have been asked before (probably many times). Thanks


Sep 25, 2010, 05:58 pm Last Edit: Sep 25, 2010, 07:00 pm by Camille29 Reason: 1
My Canon EOS 1000D allways NAK (Negative AcKnowledge handshake) on "long"(62229 ((972*64+21) bytes and not multiple of the 64 packet!!) GetEvent request
with MAX3421E and Felis Code PTP
I Never had the Problem on PC with Gphoto2
I hope there is a solution to cancel this situation beceause:
NAK is proper response.
NAK is not an error response.

A) Trace Program:
     PTP_OC_CANON_EOS_GetEvent 0x9116    /* 9116: no args, data phase, no resp data. */
      code: CANON_EOS_GetEvent (0x9116)
      length: 12
      type: Command (0x1)
      code: CANON_EOS_GetEvent (0x9116)
      length: 62229
      type: Data (0x2)
     LAST STEP (Normaly check RC code)
B)Solution tested:(No success)
     1)Cancellation Code Event 0x4001 not supported on my EOS
     2) GetDeviceInfo    //PTP_OC_GetDeviceInfo 0x1001
           CloseSession() //PTP_OC_CloseSession 0x1003
           OpenSession()  //PTP_OC_OpenSession 0x1002
     3) Hardware Reset arduino board and MAX3421E ( So as is the code can't prevent that sort of bugging)
     1) Is somebody has a solution?
     2) Is somebody has the same problem?
     3) Is somebody has the same problem on a VDIP1 from FTDI ?
     4) Is somebody can explain me on PC with libusb
           I used function usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout)
           size fixed to 130000 octets (very larger than the packet response data), and timeout=4000 (longer than embedded code)
           This function automatically return at the end of GetEvent READ OPERATION Data
           Even thought Last Step is a usb_bulk_read too (WRITE OPERATION CODE/READ DATA/READ RESPONSE)
           usb_bulk_read never catch the data packet and the response packet in the same time
           How usb_bulk_read done to know the send data packet is finish? Is there a USB Marker to flag end transmission?
     Is there a zero-length-packet EVENT to mark the end of a transmission?
     5) lenght bytes is not multiple of the 64 packet , is there a bug about MaxPktSize in Control Transfer (must be set in 8 bits)?
(Sorry for my bad english but it's not my first language)


The problem here is not in the long packet, but rather in the PTP parser/serial output speed - Arduino can't process 64K packet quick enough and camera goes to timeout. Set callback to parser function to NULL and this will go away.

Go Up