Trigger an Arduino board via USB

  • 42 Replies
  • 6054 Views
Trigger an Arduino board via USB
« on: 11 / September / 2013, 16:50:55 »
Advertisements
Hello,

  I need to receive a trigger on the USB port after a shot because I want to log infos (in synch) avaliable on a Arduino board. Probably I just need to send a byte on the port, can you help me to configure this PTP transmission?

Thank you,
luca

Re: Trigger an Arduino board via USB
« Reply #1 on: 11 / September / 2013, 17:11:24 »
can you help me to configure this PTP transmission?

No, the camera cannot initiate a PTP transaction.

An SDM user who does aerial mapping with a model aeroplane, blinks an led to indicate to the Arduino that a photo has just been taken.


David

*

Offline reyalp

  • ******
  • 11090
Re: Trigger an Arduino board via USB
« Reply #2 on: 11 / September / 2013, 17:22:12 »
  I need to receive a trigger on the USB port after a shot because I want to log infos (in synch) avaliable on a Arduino board. Probably I just need to send a byte on the port, can you help me to configure this PTP transmission?
In addition to what Microfunguy said, you cannot do anything with PTP unless there is a USB host on the other end with a reasonably complete PTP stack. You cannot (edit: oops, this originally said "can"... what a difference 3 letters makes :() just send a byte without caring what is on the other end like a traditional RS-232 serial port.

If you want to hack apart the camera, you could do that with the UART http://chdk.wikia.com/wiki/UART

It is also possible to run a full PTP stack on the Arduino, see http://chdk.setepontos.com/index.php?topic=6969.msg84799#msg84799
« Last Edit: 11 / September / 2013, 17:49:59 by reyalp »
Don't forget what the H stands for.

Re: Trigger an Arduino board via USB
« Reply #3 on: 11 / September / 2013, 17:32:12 »
Thank you David.
It's not a good news... :-)
To blink the led (which one? the green one connected to the SD writing?) on the camera is a good idea but I don't like so much to paste a photodiode on the canon...
Is there a way to send some signal in output after the shot?
Or is it possible to trigger the shot from the USB with a costant delay between the signal and the shot?
I tried with the standard remote synch but the delay is not costant (in manual mode and manual focus naturally).

luca


Re: Trigger an Arduino board via USB
« Reply #4 on: 11 / September / 2013, 17:39:39 »
Thank you Reyalp!

I just need to read a square wave on the data line of the Usb to know the picture was taken.
I'll read the thread on Arduino-PTP but if you have a suggestion to send a byte without caring on the USB I can do some test

luca

*

Offline reyalp

  • ******
  • 11090
Re: Trigger an Arduino board via USB
« Reply #5 on: 11 / September / 2013, 17:49:02 »
I just need to read a square wave on the data line of the Usb to know the picture was taken.
To have any chance of doing that, you would need to reverse engineer the low level USB driver code in the camera firmare. As far as I know, no one has done this, and it is likely to be non-trivial.

The PTP code operates at a much higher level, and as I said, cannot be used unless there is a fully functioning PTP stack on the other end.

Additionally, if you are triggering the camera with the "USB remote" functionality (using the usb +5v signal to trigger shots), you cannot combine this with any USB protocol communication. USB remote hides the status of the USB power bit from the rest of the firmware.

edit:
Oops, my previous post said "can" where it should have said "cannot". Sorry for the confusion.
« Last Edit: 11 / September / 2013, 17:51:01 by reyalp »
Don't forget what the H stands for.

Re: Trigger an Arduino board via USB
« Reply #6 on: 11 / September / 2013, 18:09:32 »
I tried with the standard remote synch but the delay is not costant (in manual mode and manual focus naturally).
Note :  this conversation seem to be split across at least two threads : http://chdk.setepontos.com/index.php?topic=8997.msg105170#msg105170

In any case,  reading both threads, it not clear to me how you are driving the USB shooting sequence and thus maybe why you cannot get the timing you desire.

The standard USB remote code is capable of very precise shutter release timing if you use the right sequence.  With the switch mode set to "One Press" and "Sync" enabled, have your Arduino assert the 5V line prior to when you need to release the shutter and hold it high.  When you want to shoot,  set the 5V line to 0V.  You should get a shot less than a few milliseconds later and that delay will be very consistent from shot to shot.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Trigger an Arduino board via USB
« Reply #7 on: 11 / September / 2013, 18:19:27 »

To blink the led (which one? the green one connected to the SD writing?)

The autofocus led at the front of the camera.
Quote
I don't like so much to paste a photodiode on the canon...

Ask this supplier http://www.gentles.ltd.uk/gentstereo/videosync.htm if he will sell you just the sensor without the tube over it or the USB cables.
I can tell you how to wire it up.

Quote
Is there a way to send some signal in output after the shot?

With the as yet not officially released SDM 1.86 that signal is a standard option.
No need for scripts.
If you want to try it I may be able to provide a build depending upon which camera you have.

(SDM 1.86 release just drags on-and-on, 90% of testers are selfish and unreliable, i am getting a little tired of it.).


David


*

Offline lapser

  • *****
  • 1093
Re: Trigger an Arduino board via USB
« Reply #8 on: 12 / September / 2013, 03:15:29 »
The standard USB remote code is capable of very precise shutter release timing if you use the right sequence.  With the switch mode set to "One Press" and "Sync" enabled, have your Arduino assert the 5V line prior to when you need to release the shutter and hold it high.  When you want to shoot,  set the 5V line to 0V.  You should get a shot less than a few milliseconds later and that delay will be very consistent from shot to shot.
Thanks waterwingz! I suspect he's not holding the 5 volt line high and dropping it to 0 long enough for my original USBLapse script to detect it. I'd suggest holding it at 0 for 100 msec. This will give the script time to process it.

The USBLapse script will take quite a bit longer, and a variable time to sense the voltage change. I'm thinking it could take 10 to 30 msec, and possibly much longer if the script is writing a log file while saving pictures in continuous mode.

Is it possible to use the CHDK remote sync capability with a scrip runningt? Then, you could just run my time lapse script, or any time lapse script, with a 1 msec interval (no interval delay) and let CHDK remote sync do the interval timing and sync by sensing the Arduino pulses.

EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Trigger an Arduino board via USB
« Reply #9 on: 12 / September / 2013, 07:11:56 »
First of all, thank you to everybody for the help.

Quote
Additionally, if you are triggering the camera with the "USB remote" functionality (using the usb +5v signal to trigger shots), you cannot combine this with any USB protocol communication. USB remote hides the status of the USB power bit from the rest of the firmware.

Ok, it's not possible to trigger with 5V and then receive a signal on the data line.

Quote
The standard USB remote code is capable of very precise shutter release timing if you use the right sequence.  With the switch mode set to "One Press" and "Sync" enabled, have your Arduino assert the 5V line prior to when you need to release the shutter and hold it high.  When you want to shoot,  set the 5V line to 0V.  You should get a shot less than a few milliseconds later and that delay will be very consistent from shot to shot.

I made many test with different interval between shots (2,3,4,5 sec) and different transition timing between 5 and 0V (100ms - 1 sec) but the range of the delays is always 100-300ms.

Quote
Ask this supplier http://www.gentles.ltd.uk/gentstereo/videosync.htm if he will sell you just the sensor without the tube over it or the USB cables.
I can tell you how to wire it up.

It's a good idea but as i said I don't like so much to "paste" a photodiode to read a diode on the camera... :-)

Quote
With the as yet not officially released SDM 1.86 that signal is a standard option.
No need for scripts.
If you want to try it I may be able to provide a build depending upon which camera you have.

My camera is a SX230HS 1.01b. If you think it can work I'll be happy to try!

Quote
Thanks waterwingz! I suspect he's not holding the 5 volt line high and dropping it to 0 long enough for my original USBLapse script to detect it. I'd suggest holding it at 0 for 100 msec. This will give the script time to process it.

I used many different intervals for the transition 0 and 5V in the Usblapse (100ms-1sec) but the delays are not costant. I recorded a little video to show the behavior (the timing was 3sec interval - 500ms transition 5-0V).

http://youtu.be/pVvO_sH2Bf8




 

Related Topics