New USB project for stereo cameras - Microfunguy's Builds - CHDK Forum  

New USB project for stereo cameras

  • 19 Replies
  • 6867 Views
New USB project for stereo cameras
« on: 26 / April / 2011, 05:25:45 »
Advertisements
Hi all,

I have some basic experience (thanks Microfunguy) in modifying the SDM source code.
I used that experience to modify my hardwired stereo cam rig (two IXUS860IS).
My cam rig does now following:

- On switching on the camera or switching from 'play' to 'rec' mode the zoom moves automatically to 46mm (typical stereo focal length)
- Since the cam is hardwired I can use the shutter button of the right cam to take synchronized photos (no external USB switch needed)
(pressing half: focus, pressing full: waiting for release, releasing: take SDM synchronized photo)

This gives me a quite comfortable stereo cam I used until now.
Now it is time to go one step ahead, since hardwiring the cam is difficult, time consuming, you loose warranty and sometimes you loose a whole cam if something went wrong ;)
Now I want to buy two S95 and link / synchronize them by SDM and USB.
My idea is to use the USB port of the cams to steer them, that means I want to create an external device (using a microcontroller) to send pulsed signals to the cams to change settings e.g. ISO, zoom, aperture, time, etc. - typical values for photography.
So hardwiring is not necessary anymore. Two cams can be manipulated synchronously using the external device.
I will implement a small LC-display to see the current status of the cams.
Hope it is clear what I mean.
I also want to add an hot-shoe for external flash to that device to make it easy to use external flash for cams without hot-shoe.
The device will synchronize the flash with SDM.

Does anyone have tried it before, are there any experiences?
Where is the best location in source code to read the USB for a pulsed signal and act on it?

Thanks for any ideas / pitfalls etc.
« Last Edit: 26 / April / 2011, 06:02:15 by mr.burns »
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: New USB project for stereo cameras
« Reply #1 on: 26 / April / 2011, 06:09:33 »
First of all, I am 'debugging' an application using an S95 and a CAMremote device for photography from a helicopter.

The script responds to nine different pulse widths.
It does not work properly, the measured pulse width varies widely.

I cannot believe the SDM uBasic is being interrupted by a Canon task to cause such large errors.
Maybe the CAMremote is faulty ?

I would vary the pulse widths by at least 30 msec.

I have tested a ATTiny-based device that does exactly what you want but the developer has not worked on it for months.

I could ask him if I could send you the microcontroller binary or you may be willing to continue development.

While you are at it, you could use a once-per-frame autofocus led pulse to measure assumed synch between the cameras in video mode, something needed for some time.

For external flash, you can enable 'slave flash' feature.
This suppresses the preflash, allowing any standard slave to work.
The main flash is dimmed and you could mount a slave receiver very close to it.

Problem is, it is a pop-up flash.

The other way is to detect USB switch release with your microcontroller and trigger an optically-isolated triac after a certain delay.


David
« Last Edit: 26 / April / 2011, 06:16:34 by Microfunguy »

Re: New USB project for stereo cameras
« Reply #2 on: 26 / April / 2011, 06:36:37 »
Hi David,

thanks for quick reply!
I don't want to use uBasic, I want directly modify the SDM source code.
What is the right place (source filename / function name) to wait for an incoming pulsed signal, detect/read the different pulses and do actions like change ISO, time, aperture, etc?

Regarding the flash I wanted to use the micro controller to trigger the external flash. Then I have the possibility to correct the delay (if needed) using the micro controller.

Quote
I have tested a ATTiny-based device that does exactly what you want but the developer has not worked on it for months.

I could ask him if I could send you the microcontroller binary or you may be willing to continue development.

So somebody else thinks this idea could work, this pushes me to go ahead ;)
Thanks but I want to start from scratch, using / reading / understanding somebodies source code not always is easy ;)

Quote
While you are at it, you could use a once-per-frame autofocus led pulse to measure assumed synch between the cameras in video mode, something needed for some time.
Sorry I don't know what you mean, can you explain again? Thanks!


2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: New USB project for stereo cameras
« Reply #3 on: 26 / April / 2011, 06:54:39 »

What is the right place (source filename / function name) to wait for an incoming pulsed signal

The keyboard task is called every 10 msec but I guess some calls will be missed.
The USB signal is already measured in \platform\[CAMERA]\kbd.c :-

http://tools.assembla.com/chdk/browser/trunk/platform/s95/kbd.c\my_kbd_read_keys()
Quote
So somebody else thinks this idea could work

It does work.

Quote
Sorry I don't know what you mean


SDM stereo users usually want to record synchronised movies.
That is not possible, as far as I can tell.
Unlike the still-image capture, the task cannot be paused, it is probably driven by a hardware timer.
Clever solutions involving changing clock frequencies have been suggested.

So, we need to measure synch instead and keep restarting cameras until it is acceptable.

On each camera, I can flash the AF led once per frame, a microcontroller can measure the time difference.
I am assuming that gives a good indication of video synch.

A suitable combination of flashing and steady bicolour led's can indicate the degree of synch.


Re: New USB project for stereo cameras
« Reply #4 on: 26 / April / 2011, 07:10:48 »
Hi David,

thanks again,

First of all I want to start with still images, following keep it simple, later on I can extend/improve...

Regarding movie, can you check please if I understand you correctly?:

Quote
SDM stereo users usually want to record synchronised movies.
What does it mean? I thought stereo video is not that big problem, one can start two video cams and then later on sync the film using SMM or similar. But does it mean you want each picture of the movie beeing synchroniozed? Similar to single image shot you want to have e.g. 24 synchronized images per second? Is that you mean saying synchronised movies?

Quote
Unlike the still-image capture, the task cannot be paused, it is probably driven by a hardware timer.
What you mean with 'the task'? You mean the original's firmware task taking videos? this one cannot be paused to sync?

Quote
o, we need to measure synch instead and keep restarting cameras until it is acceptable.
So you want to start the cam, start taking a video and measure the one 'pulse per frame' LED and if both cams are out of sync, you want to restart the cams until the sync is acceptable?

Quote
A suitable combination of flashing and steady bicolour led's can indicate the degree of synch.
Don't know what that means, 'flashing and steady bicolour led's' are they inside the cam?

Thanks ;-)
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: New USB project for stereo cameras
« Reply #5 on: 26 / April / 2011, 08:00:58 »
I thought stereo video is not that big problem

Stereo video is definitely a big problem.

Quote
one can start two video cams and then later on sync the film using SMM or similar.

Synch error could be up to 33msec, not remotely good enough for fast moving subjects.
Sub-millisecond synch is desirable.

Quote
You mean the original's firmware task taking videos?

Yes, it is copied to CHDK/SDM and patched for video quality, zoom during movie and mute sound.

Quote
this one cannot be paused to sync?

No, as far as I can tell.

Quote
you want to restart the cams until the sync is acceptable?
Yes, not very convenient.

Quote
Don't know what that means, 'flashing and steady bicolour led's' are they inside the cam?

No, they are in your microcontroller device.

For example :-

red, fast flash  - 20 to 33msec error
red, slow flash - 10 to 19 error
red, steady - 5 to 9 error
green, slow flash - 1 to 4 error
green, steady - less than 1 error.

Re: New USB project for stereo cameras
« Reply #6 on: 26 / April / 2011, 08:31:49 »
Hi David,

thanks, so basically I understand now. I can also place a foto diode on each cameras LED and let the microcontroller measure the delay of both cams, it can be shown on the LCD I plan to built in.

Is this true that I can also read the voltage of the USB? How precise is this? May it is more easy to put different voltage to the USB and the SDM can detect it and depending on the voltage value I can change settings?
E.g.:

Put 3.5 V: increase ISO
Put 3.6 V: decrease ISO

Put 4.0 V: increase aperture
Put 4.1 V decrease aperture

and so on?

What do you think? Is this possible?
If yes I think it is easier to implement compared to pulsing and pulse detecting mechanism.

What do you think?
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: New USB project for stereo cameras
« Reply #7 on: 26 / April / 2011, 08:36:19 »
I can also place a foto diode on each cameras LED

I can give details when you are ready.
It is not easy on the S95, the AF led is very close to the lens.

Quote
Is this true that I can also read the voltage of the USB?

No, it is a logic signal.

(later today I will give you a patch that replaces 'USB' displayed in ALT mode with pulse duration in msec)

David


Re: New USB project for stereo cameras
« Reply #8 on: 26 / April / 2011, 16:58:29 »
In \core\gui.c\ gui_draw_osd()

change

Code: [Select]
       else if(!get_usb_power(1) && usb_on)
       {
        usb_on = 0;
        draw_string(ovr_x,ovr_y,"   ",MAKE_COLOR(COLOR_TRANSPARENT,COLOR_TRANSPARENT),1);
       }

to

Code: [Select]
       else if(!get_usb_power(1) && usb_on)
       {
        usb_on = 0;
        sprintf(osd_buf,"%3d",get_usb_power(0)*10);
        draw_string(ovr_x,ovr_y,osd_buf,MAKE_COLOR(COLOR_BLUE,COLOR_WHITE),1);
       }

In ALT mode, it will display pulse width after signal finishes.

Re: New USB project for stereo cameras
« Reply #9 on: 30 / April / 2011, 04:46:13 »
Hi David,

thanks for that code snipped, I will start with that...
Can you do me a favor again please?
Can you tell me how the functions are called and where to find them to:

- Change ISO
- Change focus
- Change Aperture
- Change time

Andy may other cam functions which are interesting to handle remotely by that new device?

Thanks a lot...

One more thing to the synchronization of movie-mode.
Lets assume we have the device ready then we switched the cams off and on again until the LED's show green which will show both cams are in synch (movie mode).
Do you think the cams keep synchronized? I mean if we will take a movie for e.g. 5 minutes are they still in synch or can it be that the sync drifts away after a while? Hope you know what I mean.

Thanks for further support / discussion...
2 x IXUS 860IS 100c
2 x Powershot S110 103a

 

Related Topics