My multi camera device - Creative Uses of CHDK - CHDK Forum

My multi camera device

  • 2 Replies
  • 2713 Views
My multi camera device
« on: 17 / May / 2016, 21:17:33 »
Advertisements
I had been using the SDM port of CHDK for a very long time in its simplest form for taking stereo photos.  Just having a simple USB shutter trigger and needing to maintain all of the camera settings on the cameras individually.  Last week I downloaded a current version of CHDK, learned lua and read the scripting pages and created a new setup.  After playing around a bit and trying a few different things I came up with the following system that seemed to work well for me:
  • For a remote I'm using an arduino nano reading inputs off of a cheap 4x4 keypad.
  • The nano can individually control the 5v line on 4 USB connectors attached to it.
  • I have a lua script running on the camera that reads single byte commands from the controller.
  • Most of the commands are just a direct mapping of a button on the keypad with a button on the camera, but zoom is controlled by sending one of 128 values and the shutter command goes into a separate mode that handles shutter sync and triggers the shutter on a second keypress
  • It takes about 50ms to transmit an encoded byte to one or more cameras (the code sends the data to each camera in parallel).
  • Assuming the cameras had all of their controls synced before hand things worked fairly well.  Occasionally I'd press a key before all of the cameras were ready and things would get out of sync but it was easy to see when that happened and wasn't too difficult to deal with.  I'd like to add a mode that only sends to one camera to deal with this easier.
  • On very rare occasions a camera would just miss a byte and the minimal error detection would discard it.  It's tempting to build a more robust encoding, possibly with an ECC scheme that can detect and correct one bit errors.
  • Another output of the arduino is dedicated to a flash sync and is set up to go to either a pc connection or a hot shoe (I long ago made these things so that they could be connected over USB cables so this port is yet another USB connector)
  • Four cameras and a hot shoe were mounted to a piece of aluminum 1" square tubing with a 1/4"-20 threaded hole for a tripod mount.
  • I'm fairly happy with how things went when I spent a day running around an abandoned steel mill on sunday
  • Definitely need to make battery dummies... I've been meaning to do this for a long time but 4 cameras plus already needing another power source for the microcontroller means it's silly not to do this.
  • I have one digital output left on my nano... what to do with that?  ;)
I'm still figuring out how to process the photos I've taken but hears a quick, largely unprocessed example:


Re: My multi camera device
« Reply #1 on: 17 / May / 2016, 21:38:38 »
Last week I downloaded a current version of CHDK, learned lua and read the scripting pages and created a new setup. 
Welcome.  Really nice project. And I think you'll find stepping up to Lua a significant improvement for your projects over uBASIC. 

I assume you've found this : Scripting Cross Reference ?

Quote
I have a lua script running on the camera that reads single byte commands from the controller.
..snip..  It takes about 50ms to transmit an encoded byte to one or more cameras ... On very rare occasions a camera would just miss a byte and the minimal error detection would discard it. 
Not having seen your code, but  having done a bit of serial comms "bit bashing" with CHDK, I thought I'd mention that you can bump the resolution and accuracy of the USB remote input. 

See : set_remote_timing()

I've found you can get reliably down to about 1 mSec resolution (10x the standard resolution).

This also helps remove a lot of the clock "jitter" that you get with the standard USB remote functions when the camera gets busy and does not run the script at exactly a 10 mSec interval.  This might explain your occasional com errors.

Quote
gears_sm.gif
Impressive.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: My multi camera device
« Reply #2 on: 17 / May / 2016, 22:16:23 »
I think you'll find stepping up to Lua a significant improvement for your projects over uBASIC.

I've never touched uBASIC (nor any other BASIC since I worked with Applesoft BASIC over 20 years ago). :)

I'm already using set_remote_timing().  I'm using a fairly simple encoding scheme that I could certainly make better but this worked and I wanted things up and running in a short time frame. I prefix each byte with three 0 bits and then send eight bits of data.  The very simple scheme I'm using is any state (low or high) shorter than 6 ms is a 0 and 6-10 ms is a 1 and longer than that is an error which resets the state machine.  The arduino sends bits as 3 and 8 ms.

for clarity, to send a 21 (low bit first) I'd set the port:

high for 3 ms,
low for 3 ms,
high for 3 ms (three 0 bit prefix),
low for 8 ms (1s bit), 
high for 3 ms (2s bit),
low for 8 ms (4s bit),
high for 3 ms (8s bit),
low for 8 ms (16s bit),
high for 3 ms (32s bit),
low for 3 ms (64s bit),
high for 3 ms (128s bit).
and then low.

This could certainly be much better but it does work and it could be much worse.  This is mostly a first pass that got my system up to functional quickly.  (and much easier to write than a 6-8 encoding or something similar)

 

Related Topics