how can I achieve 16+ commands using USB Remote & SDM? - Script Writing - CHDK Forum supplierdeeply

how can I achieve 16+ commands using USB Remote & SDM?

  • 6 Replies
  • 2640 Views
how can I achieve 16+ commands using USB Remote & SDM?
« on: 22 / October / 2009, 19:28:06 »
Advertisements
I've seen people talk about using SIX different pulse widths (e.g. 60ms, 90, 120 etc). I count that as 6 commands so to speak. Then also there is method to take USB high and steady (take pic on going LOW or at 10 sec timeout). That's all great. I want more.

I plan to have 8-CH RF Remote to a Receiver plus a microcontroller, then out to Canon G9 on USB mini.

I am thinking to use the first 4 momentary Buttons (say A, B, C, D) 'multiplied' by the last 4 Buttons (say '1', '2', '3', '4'). Gives me 16 commands to issue... theoretically. So I think these combinations will work as Input to Arduino or Pic circuit, and use one Pin for the pulse/voltage output to camera's USB wire.

So here's the question. How do you recommend I structure this? 1) what pulse patterns (msec's High and also timing for Low) or pulse sequences to use? and 2) how do I 'branch' to CHDK/SDM scripted functions ('branch' meaning A or B or C or D as condition sets )?  Of course, just point me in a direction to get me started.


For example, pressing 'A' Button would enable buttons 1 to 4 to be simple focusing and shooting/release routines. 'B' Button pressed would set-up buttons 1-4 to control exposure settings (or other options). 'C' might be for changing the Mode Dial. Etc, etc. FYI, later I will possibly add a 2-axis Joystick probably for Zoom function and for nudging EV+/-, (joystick likely to tie-in to Arduino using interrupt commands).

I am just starting this project... so am starting from scratch with all the electronics and scripts. I have some amateur level experience other types of scripting. Learning curve on every aspect but I'm fairly confident the pieces will come together.

Thx. Hope is clear.

Re: how can I achieve 16+ commands using USB Remote & SDM?
« Reply #1 on: 23 / October / 2009, 17:49:37 »
How do you recommend I structure this?

I have played with generating LED pulses from the camera to microcontroller.
See http://stereo.jpn.org/eng/sdm/serial.htm
The shortest pulse-width in some more recent experiments was 10msec.
Problem is, the pulse-generation code can be randomly interrupted by the Canon firmware so you have to allow for some variation.

Going from the PIC to the camera, at present you have to rely on a script command detecting the pulse.
The command is executed every 10msec but I would set a minimum pulse of 30 msec.
The pulses could increment by 20 or 30msec to ensure they can be distinguished from each other.
With 16 commands you will be using quite long pulses.
That may or may not be a problem.

Quote
how do I 'branch' to CHDK/SDM scripted functions ('branch' meaning A or B or C or D as condition sets )?

See these examples using a commercial RC receiver : http://stereo.jpn.org/eng/sdm/kap.htm

Quote

I am just starting this project... so am starting from scratch with all the electronics and scripts.

The more clever way of doing this is to send coded commands to the camera.
Someone has done this using an ATtiny, he has even sent me a programmed device.
The software is quite complex and even though he intended to publish it, his work will be keeping him busy until December or even February.

Anyway, for now I would just play around with simple pulse-widths and if that is not sufficient we can look at the more complex method.

Thanks microfunguy.

I think you've confirmed some methods for me. And 'yes', that branching example does help... it makes a little bit of sense after I 'looped' myself to reread it.

Quote
So I think these combinations will work as Input to Arduino or Pic circuit
you said:
Quote
played with generating LED pulses from the camera to microcontroller
Sorry to mislead you. While that blue-LED communication method may come in handy for expanding set-up later, what I meant and should clarify is this:  I will have keyfob buttons that will issue the '16 commands' (what should I call them?) by RF tx/rx to the Pic/Ardu.

Thanks to your help, I conclude that on the microcontroller output I will only need 8 diff pulse widths. I was unsure of the timing and limitations up to now, about the range of pulses I could use. So now I know how uBasic will branch on that information,I will use 150ms, 180, 210, 240 pulses uC output to tell SDM script that I pressed which remote button  A/B/C/D as mutually exclusive 'cases'.

Then I'll use the shorter pulses (but >30ms) out of uC for executing camera settings or actions, using my 4 'numbered' RF buttons.  Pressing '2' after 'A' was previously pressed... would be say 'focus' action.  But same button '2' after 'B' had been pressed... would be to increase shutter speed for example... (multiple presses probably). I'm thinking to add a timeout would set things back to Case 'A', so always ready to shoot.

Quote
See these examples using a commercial RC receiver
The R/C switches and controllers/receivers won't help me here, but I appreciate the pointer to the code and how the conditional branching is implemented. It seems the test values are stepped (mentally multiply by 10msec?).

Quote
more clever way of doing this is to send coded commands... using an ATtiny
'Yes', would be neat to send specify settings/parameters and get things executed in SDM. But that's beyond my scope to due patience, knowledge, ~ADD limitations.   ;)

All-in-all... a big thanks. I was afraid I'd have to do some fancy button-pressing, like A>>D>>B, just to set up one branch case. This is going to be much more manageable and also somewhat predictable as to what 'state' the camera gets to.

Look forward to your blinking LED in future maybe... could be good to 'hear' remotely what setting was set.

*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: how can I achieve 16+ commands using USB Remote & SDM?
« Reply #3 on: 24 / October / 2009, 06:42:57 »
I am thinking to use the first 4 momentary Buttons (say A, B, C, D) 'multiplied' by the last 4 Buttons (say '1', '2', '3', '4'). Gives me 16 commands to issue... theoretically.

I am not really sure I understood what you mean, but maybe it would be faster to send out two pulses, each pulse encodng a single button.

I mean, if you only use pulse length and you want to encode 16 commands, you will need a pulse with 16 different lengths (duration  = 16 x minimum-T )

If you send out a first pulse encoding buttons A-B, followed by a second button encoding buttons 1-4, then you only need two pulses with 4 different legthd (duration = 2*4 minimum-T )

( if you only use pulse length, if you encode serially that's quite the opposite! )


Re: how can I achieve 16+ commands using USB Remote & SDM?
« Reply #4 on: 24 / October / 2009, 12:09:46 »
I think he is saying that the first pulse codes for the keyboard row and the second pulse codes for the keyboard column.


Re: how can I achieve 16+ commands using USB Remote & SDM?
« Reply #5 on: 24 / October / 2009, 12:24:54 »
Quote
I am not really sure I understood what you mean, but maybe it would be faster to send out two pulses, each pulse encodng a single button.
Do not need 16 different pulse widths now. See my follow-on post just above.

What I don't want to do is push 2 buttons to focus and then 2 buttons (eg, A&2) to shoot. If that's not what you meant, then maybe we're in-synch. This will be cool... press 'D' and the nums 1-4 can change Mode Dial. When it reverts back to 'A', I'm ready for shooting and more using same 1-4 buttons.

Now I'm going to go build some electronics. No fancy or formal encoding though. Thanks.

Re: how can I achieve 16+ commands using USB Remote & SDM?
« Reply #6 on: 24 / October / 2009, 12:42:10 »

for others interested, I think it's possible to modify this approach rather simply to have 28 'things' instead of 16 (still using only 8 diff pulse widths and simple ubasic branching --- but with some user discipline in the pressing of buttons).

I guess I could say 'things' here means 16 or 28 direct pointers to called functions... that are initiated directly by remote control buttons. Of course each scripted function will execute several actions (and call other functions) if desired.

I think my wording here may confuse some. Not to worry, I'm sure it will get sorted if anyone else gets interested and we start pouring concrete.

 

Related Topics