CHDK - multiple functions via USB

There's so much to read in the CHDK Wiki and Forum that I've only just stumbled across this. It appears that not only can scripts detect when power is applied via the USB port, but there's a neat function, get_usb_power, that returns (in units of 10ms) how long power was applied. Some cunning CHDKers have used this to implement multiple functions via a sort of Morse code. Thus a short burst of power does one thing (clicks the shutter), a longer burst does something else (e.g. takes a shot with the flash) etc.

It struck me that the microprogrammers among us here could tweak their KAP gizmos to give you control over e.g zooming as well as shutter control, all via the USB port. In other words a multi-function GentLED for cameras with no IR capability.

Here's a (updated) test script. If you've got a CHDK camera, you can try it out just by plugging the camera into a USB cable from your computer (which will apply power to the USB port of the camera).

When you run it it will wait until USB power is applied, then when power is removed display how long it was present (in 10ms units). If power was on for more than a second, it will zoom in and out. If not it will take a photo. Then it will go back to waiting until you press the Shutter to end the script.

@title test remote
do
do
a = get_usb_power
until a>0
if a>0 then print a
if a < 100 then gosub "shootpic" else gosub "dozooms"
until is_key "set"
end
:shootpic
shoot
sleep 1500
:dozooms
for n=1 to 3
click"zoom_in"
sleep 800
next n
for n=1 to 3
click "zoom_out"
sleep 800
next n
return

Comments

  • Just seen your post Dave, have you tried any of this yet? How reliable is it? Keep us posted. I've just acquired a used G7 which now has CHDK installed.

    Peter.
  • I've been playing with CHDK ever since I got my A570 just over a month ago, but the A570 shape won't fit in my current rigs so it's not yet been airborne. I plan to remedy that in the next couple of weeks. It will probably be a simple AutoKAp rig using a Tucit to trigger the A570 via the USB port.

    All the scripts I've tried have worked fine (just spent a happy couple of hours taking timelapse movies using a simple intervalometer script).
  • DuneCam does that now with software version 2.5 (to be widely released soon).

    My personal setup uses a CHDK script with these remote-controllable functions:
    * shutter press and release
    * shutter half-press and hold
    * shutter half-press release
    * shutter full-press without releasing half-press
    * Set EV to any 2 values (right now I'm using -1/3 and -1 1/3)
    * Select Raw mode
    * Select JPEG mode

    The "shutter press and release" can be mapped to the Shutter button on the ground controller. In addition, any of these eight functions can be activated using DuneCam scripts. For example, you can make a one-line DuneCam script that turns on Raw mode and another script to switch to JPEG mode. CHDK lets you adjust almost anything else on the camera as well. I have also made a DuneCam/CHDK script combination that does a four-image panorama in 5 seconds total, including the time needed to slew the servos. This may be the fastest single-camera panorama possible with KAP (important if your kite is moving around).
  • I added several CHDK functions to CAMremote-1 too.
  • How fast can the response be for USB triggering and what you can you do to maximize speed? Manual focus to infinity? Half press and hold prior to full press? choosing a short pulse length? Cable length?

    I couldn't find a discussion on the topic on the CHDK forums.
  • Currently timings in CHDK are limited by a 10 millisecond timer tick. Thus uBasic scripts get control each tick and execute just one statement. In turn this means that the resolution of timing USB power pulses is also 10ms. That's why James made the Gentledchdk use pulse lengths of 30ms, 60ms, 90ms etc - much shorter and the ability to discriminate would be compromised.

    So there will be a minimum 10ms for any usb trigger mechanism.
  • edited March 2009
    Thanks Dave!
  • I hope I don't clutter this thread with very pedestrian questions, but I'm hoping someone has some insight on video out and USB remote.

    I own a Canon G11 and use some CHDK functions. I have yet to try out the USB remote, but I'm concerned about the feasibility of doing this and retaining a video signal. I'm looking to build a PAP rig that has video out, remote shutter, and remote zoom. I already own a DuneCam KAP rig (which is wonderful) and I'm hoping to incorporate another aerial controller into the PAP rig.

    Scott Armitage tells me that the DuneCam supports zoom via the CHDK remote. However, on my KAP rig the USB port is used to get video and the G11 camera shutter is controlled by a GentLED Focus plugged into the stereo jack. Because the USB port is used to get video, I cant use the CHDK USB remote functions. For my PAP rig, I'd really like to have both video and zoom.

    From various conversations, it seems that since video is transmitted over the USB it is not possible to get video out and run USB remote functions. Am I correct? Anyone else have experience with this issue?

    Can anyone suggest a higher end Canon Powershot that does not send video out of the USB port? Where I'm presently located, it is not possible to physically inspect these cameras. However, based on some internet searches it looks like the the G9 might fit the bill. Does anyone have thoughts on this?
  • Looking at the G11 and its manual again, I remembered the HDMI output. I wonder if this would be a workaround to get video out while still making use of the USB CHDK remote? Anyone have experience with this?

    Regards,
    Nathan
  • Nathan, not fully certain what you are looking for. I use the G9 (and A570IS) with CHDK and I use scripts to zoom in and out and switch to take video and still shots (all within the script). All of the above without the need for the CHDK USB Remote (i.e., Auto KAP).

    I currently do not zoom while taking video.

    See details here (long CHDK post from the early days ;-)

    WW
  • Hi WW,

    Sorry if my note was not clear. By video out, I'm referring to "seeing what the camera sees" instead of recording a moving image. Particularly in the context of zooming, feedback on the camera's field of view is really useful. I'm wondering if it would be possible to get the video out from the HDMI port. This might free up the USB to use for zoom and shutter.

    Regards,
    Nathan
  • Have you looked at the pinouts for the video cable and compared them to the USB cable? It may be possible to make a cable that can plug into the port on the G11 and split to USB and video.

    I did something similar with my EP1. The EP1 has a single connector that can be used for a wired shutter release or a USB connection or a Video connection. I managed to get a custom cable that would handle video and shutter release functions. Perhaps the G11 is as flexible with the USB and Video?
  • Hello Nathan
    If you use the HDMI (digital signal) to your camera's LCD screen, for example, in PAL or NTSC (analog) converter must DIGITAL / ANA integrated into your cable because transmission is impossible, unless Am I wrong ???????

    Patrick
  • edited April 2010
    Nathan

    I'm certain that Scott Dunn is right - the socket on the G11 is dual-purpose that has separate pins for USB and Video. You can verify this by noting that plugging in the AV cable disables the LCD screen, but plugging in a USB cable does not.

    So it should be possible to come up with a combined cable that plugs into the G11 and has two separate sockets on the other end - a standard USB one for a USB plug and a standard socket for a video jack plug. To make such a cable you'll need to find a plug that connects with ALL the pins inside the G11 socket. I admit that's the difficult part! However others here may know more - see this thread!
  • For me, the issue is not so much whether it is possible to make such a cable - I do this on my camera. But this is a fairly delicate connection and is not one I would offer to other people until I can find a more robust connector or cable to cut up.
  • edited April 2010
    in the link to the thread that Dave mentioned, Scott posted information indicating that it is possible to obtain video out and shutter by means of a HTC ExtUSB.

    Scott was kind enough to provide the pinout. It seems really useful so I'm re-posting that graphic here.

    11 pin Canon Pinout

    If I'm correct, the best route is to obtain a version of the HTC ExtUSB with a breakout board. This board makes it easier to solder the wires. The video wire would be connected to pin 11 and the connection for the USB shutter controls are pins 2 and 3. I would be grateful if anyone can confirm or reject this.

    Thank you all for sharing your knowledge.
    Nathan
  • edited April 2010
    For CHDK/SDM all you have to do is apply power to the USB socket - that means applying 5v across pins 1 and 5. The uBasic get_usb_power function returns the time (in 10ms ticks) that power was applied. The USB data pins are not used by CHDK or SDM.

    As for video, I think you'll need to connect to pin 10 (the video signal) and pin 6 (ground).
  • Scott Dunn
    Do you know if your modified e-p1 cable would work for an e-pl1. Where did you get the cable and how did you do to get it to work. If you don't want to give up any secrets, would you be willing to sell one?

    Thanks, Mike
  • Not sure about the epl1, but it seems likely that the same cable would work.
    I worked with Scott Armitage to get the cable made to work with his dunecam system.
    A cheap shutter release cable/switch can be purchased on eBay.
  • According to the Olympus site, the e-pl1 does not have remote cable release but it does have the usb / av out and hdmi. Wonder if there is nothing connected to the remote shutter pins or if it would still work.
  • Hard to say. Best to try before you buy...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion