Shooting while transferring over USB

  • 45 Replies
  • 7911 Views
Shooting while transferring over USB
« on: 04 / December / 2013, 23:32:15 »
Advertisements
I'm working on a school project and we've been having some trouble figuring this out, so I was hoping some members of this forum could help us figure out how to transfer pictures over USB while the camera is shooting.

We used to be able to do this easily with a DSLR that had tethering capabilities, but now we need to do it with either a G15 or PowerShot S110. Since the cameras don't support tethering by default, the remote trigger doesn't do anything when the camera is connected through USB.

Without going into the project details, here are some restrictions we need to work with:

  • The shooting needs to be triggered from either the USB 5V trigger, or the separate remote trigger on the G15. Basically we can't trigger it from the computer connected by USB (but we can initiate picture transfer from the computer if needed). As a last resort we can have the camera triggering itself at an interval, but we'd like to avoid that.
  • The shooting triggers will be between 500-1000ms apart (possibly inconsistent) and the camera needs to be fairly responsive to the triggers (something like 50 ms delay is fine).
  • The USB transfer will be slower than normal, so it's almost guaranteed there will be a backlog of pictures waiting to transfer.
  • The pictures have to be taken consistently, so we can't alternate between shooting and transferring.

We've been fiddling with CHDK and CHDKPTP, but we can't find a way to get the shooting and transferring to happen concurrently. We haven't found a way to monitor the non-USB trigger on the G15 through a script, and it seems we can't monitor the USB 5V trigger and do USB data transfer at the same time.

Any help or ideas would be appreciated.
« Last Edit: 04 / December / 2013, 23:44:43 by sfike »

Re: Shooting while transferring over USB
« Reply #1 on: 04 / December / 2013, 23:50:34 »
We've been fiddling with CHDK and CHDKPTP, but we can't find a way to get the shooting and transferring to happen concurrently. We haven't found a way to monitor the non-USB trigger on the G15 through a script, and it seems we can't monitor the USB 5V trigger and do USB data transfer at the same time.
You're probably not going to be able to do what you what with a CHDK script. But if you are willing  (and allowed) to modify the actual CHDK C code,  you can probably separate the USB remote /  External Remote logic from the USB ptp logic.  Currently,  CHDK intercepts key presses and either uses them itself or passes them on to the Canon firmware.   You should be able to rewrite that code (my_kbd_read_keys() in kbd.c for each camera) to initiate shooting directly while still leaving the camera thinking that it has a permanent USB connection.

Hint :  http://chdk.setepontos.com/index.php?topic=8769.msg106146#msg106146
« Last Edit: 04 / December / 2013, 23:58:13 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11487
Re: Shooting while transferring over USB
« Reply #2 on: 04 / December / 2013, 23:58:57 »
The shooting needs to be triggered from either the USB 5V trigger, or the separate remote trigger on the G15. Basically we can't trigger it from the computer connected by USB (but we can initiate picture transfer from the computer if needed). As a last resort we can have the camera triggering itself at an interval, but we'd like to avoid that.
If you could find a way to make triggering form the computer acceptable, you could use the "remote shoot" function in chdkptp shoot and download immediately. On a PC, this is generally about as fast as saving the to the SD card. Shooting and downloading would still be sequential (unless you use the cameras continuous mode) but it should take no longer than regular shoot.

Quote
The shooting triggers will be between 500-1000ms apart (possibly inconsistent) and the camera needs to be fairly responsive to the triggers (something like 50 ms delay is fine).
According to http://www.usa.canon.com/cusa/support/professional/professional_cameras/digcameras/powershot_g15?selectedName=Specifications continuous shooting on G15 is good for 2.1 shots/sec, so it is extremely unlikely you will get 500ms between non-continuous shots.

50 ms trigger time is also likely to be optimistic, although it may be possible with the USB remote.

Quote
The USB transfer will be slower than normal, so it's almost guaranteed there will be a backlog of pictures waiting to transfer.
Leaving aside whether there is a practical way to do it, shooting in parallel to downloading would not be a good idea. The camera allows only a very limited number of file handles to be open at a given time, so it's likely you would encounter crashes.
 
Quote
The pictures have to be taken consistently, so we can't alternate between shooting and transferring.
Have you considered using and eye-fi or similar card? AFAIK modern Canon cameras disable it while shooting, but this can be overridden with the eye-fi code in CHDK 1.3. See http://chdk.setepontos.com/index.php?topic=10750.0 and http://chdk.setepontos.com/index.php?topic=6753.80

Quote
We haven't found a way to monitor the non-USB trigger on the G15 through a script
I don't know anything about the Canon remote, but it's quite likely that you could see it's state in physw_status.

Quote
and it seems we can't monitor the USB 5V trigger and do USB data transfer at the same time.
Correct. The USB remote trigger relies on the USB power signal. If you have a real connection, this is on all the time. The normal USB remote modes hide status of the of the USB power signal, otherwise the camera would switch to PTP mode when you power it on, and switch back when you power it off. A possible workaround is discussed in http://chdk.setepontos.com/index.php?topic=8769.80

Don't forget what the H stands for.

Re: Shooting while transferring over USB
« Reply #3 on: 07 / December / 2013, 00:06:17 »
Thanks for the responses. We have the non-usb trigger working with ptp downloads now. The issue we had was that we were testing it with a ptp gui, which locked the camera up for some reason. Using the ptpcam console to download files works fine concurrently. The triggering works in normal mode where it automatically shoots, as well as in alt mode where it can run a script.

The 5v hacks look interesting, but it might be awhile until we try those since the regular trigger might be good enough for our needs.

Our main issue now is the intervals between triggering shots. We don't need 500 ms now, but under 2s is a necessity. I've been messing with autofocus and shutter speeds, but I'm not really sure how to reduce the time it takes to shoot. I'm not an expert on cameras, but I don't see why we can't get functionality close to continuous shooting mode. Right now it's a bit inconsistent, but it ranges from 1-3 seconds between shots.

Any ideas on how to get fast and responsive triggering?


Re: Shooting while transferring over USB
« Reply #4 on: 07 / December / 2013, 00:33:50 »
Our main issue now is the intervals between triggering shots. We don't need 500 ms now, but under 2s is a necessity. I've been messing with autofocus and shutter speeds, but I'm not really sure how to reduce the time it takes to shoot. I'm not an expert on cameras, but I don't see why we can't get functionality close to continuous shooting mode. Right now it's a bit inconsistent, but it ranges from 1-3 seconds between shots.

Any ideas on how to get fast and responsive triggering?
Assuming you are doing these tests with a G15 or S110 then you already have a high end camera.

FWIW .. things that affect shot speed most include :

1) Time to focus and set exposure :  if you can lock both of those with CHDK or Canon menus that helps a lot.
2) Time to write to SD card :  faster cards are better .. in many cases a lot better.

Quite frankly,  anything below 2 seconds per shot is pretty good with a Canon P&S not in continuous mode.   Continuous shooting modes play Canon tricks with streaming stuff to the SD card and using memory buffers.  CHDK can't help you a lot with that unless you first put the camera in continuous mode.  There are a couple of recent forum threads where CHDK user lapser works with continuous mode shooting and hacks the core CHDK code. Maybe that approach would help ?
« Last Edit: 07 / December / 2013, 00:36:37 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11487
Re: Shooting while transferring over USB
« Reply #5 on: 07 / December / 2013, 03:01:46 »
Any ideas on how to get fast and responsive triggering?
You may find some of the discussion starting here http://chdk.setepontos.com/index.php?topic=6231.msg98677#msg98677 useful.

Note if you want more responsive shooting, you can create a script that uses the USB message system to got to half shoot, and then wait for a message to go to full shoot. This isn't as good as the hardware remote, but will be a big improvement over doing a full shoot cycle. The chdkptp multicam.lua has an example. This will not improve the overall shot to shot time.

If you are shooting and downloading each shot, using the remoteshoot functions should be better than saving to the card and then downloading.
Don't forget what the H stands for.

Re: Shooting while transferring over USB
« Reply #6 on: 20 / December / 2013, 08:30:51 »
Almost started a new thread for what I want, but maybe it fits in here. I have the idea that maybe one could get this thing to work with CHDK-cameras:

SD-Card with inbuilt USB in conjunction with a sd card extension cable

Now I suppose that only one of each feature - usb or sd - could be used at the same time. So my question is: Is there any chance to completely disable the cameras access to the SD card, so one could then use the USB-feature to download/upload files to the card and afterwards enable the sd-card for the camera again?

My idea is that maybe one could download from multiple cameras at the same time, because the cards could be mapped as drives. This would be in contrast to use PTP, which - as far as I understood - only allows to download from the cameras one after one. Is that right?

What do you think? Is this an idea or is it a dead end?


Re: Shooting while transferring over USB
« Reply #7 on: 20 / December / 2013, 08:46:47 »
Almost started a new thread for what I want, but maybe it fits in here. I have the idea that maybe one could get this thing to work with CHDK-cameras:
SD-Card with inbuilt USB in conjunction with a sd card extension cable
That SD card looks very cool - I've never seen one of those before.  As its only 1G it makes me suspect it might be an old discontinued model? 

Edit :  found a 4G one here : http://www.amazon.co.uk/SanDisk-Ultra-Plus-4GB-15MBS/dp/B001131NQU

I don't think the cable adapter would work to connect it to a PC though.  I believe that you want the four USB pins connected to the computer.  That would quite possible with a little hacking of a standard USB cable and some soldering - along with the CHDK hack to let you leave the battery door open while the camera is running.

Quote
Now I suppose that only one of each feature - usb or sd - could be used at the same time. So my question is: Is there any chance to completely disable the cameras access to the SD card, so one could then use the USB-feature to download/upload files to the card and afterwards enable the sd-card for the camera again?
The loader code for many CHDK camera has a few lines that say something like :
Code: [Select]
// Turn OFF SD Card power
// to support autostart
LDR     R3, =0xC0220018 // @FF86E8DC S90
MOV     R2, #0x44
STR     R2, [R3]
So its seems possible.  I have no idea how the camera would handle that if you did while running rather than booting.  Or what happens if you try to access the USB side of the card while the SD card side was powered.  Would be fun to find out though.

Quote
My idea is that maybe one could download from multiple cameras at the same time, because the cards could be mapped as drives. This would be in contrast to use PTP, which - as far as I understood - only allows to download from the cameras one after one. Is that right? What do you think? Is this an idea or is it a dead end?
Seems possible.  You'd have to experiment with one of those cards to see I guess.  You never know what other limitation might be waiting for you there.

IIRC, the PTP limitation you mention is more a limitation of the current implementation of the PC side of the ptp code.   Communicating with multiple USB connected devices is technically possible,  its just not something that has been done for CHDK enabled cameras yet.
« Last Edit: 20 / December / 2013, 08:56:10 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Shooting while transferring over USB
« Reply #8 on: 20 / December / 2013, 09:52:38 »
I did not mean the extension cable to be plugged into the computer, but directly into the camera. On the other end, the slot side, I would put the Sandisk card, so one could have the USB-cable on that which then goes into the PC.

The cards aren't old, I suppose they don't have so much data space on them because they have to be both speedy and have two different controllers on them.

I have ordered two cards of them now, one sandisk and another brand which actually has only 512 MB. I am awaiting also the cable, though.

Now as you already know I am no inside CHDK-coder. Could you give me a hint how to encapsulate such "SD Card on/off funtionality" into functions and make them usable in CHDK?

I'll take the risk to try with one of my cams...  :)

« Last Edit: 20 / December / 2013, 09:56:12 by Karmaschinken »

Re: Shooting while transferring over USB
« Reply #9 on: 20 / December / 2013, 10:02:51 »
I did not mean the extension cable to be plugged into the computer, but directly into the camera. On the other end, the slot side, I would put the Sandisk card, so one could have the USB-cable on that which then goes into the PC.
Okay - got it now.

Quote
The cards aren't old, I suppose they don't have so much data space on them because they have to be both speedy and have two different controllers on them.
If you can transfer the data from them "on the fly",  then I guess size does not matter.

Quote
Now as you already know I am no inside CHDK-coder. Could you give me a hint how to encapsulate such "SD Card on/off funtionality" into functions and make them usable in CHDK?  I'll take the risk to try with one of my cams...  :)
I have some ideas but its probably better to wait for reyalp or srsa_4c to comment.

BTW, would it not be easier to just use one of the various wifi SD cards ( eye-fi, Toshiba, Transcend etc ) ?  Does that not give you the same thing without messing with multiple USB devices ?

Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics