Trigger an Arduino board via USB - page 3 - General Help and Assistance on using CHDK stable releases - CHDK Forum

Trigger an Arduino board via USB

  • 42 Replies
  • 13983 Views
Re: Trigger an Arduino board via USB
« Reply #20 on: 13 / September / 2013, 01:40:22 »
Advertisements
Can you do remote sync in continuous mode at over 1 shot per second?
Can you do remote sync in continuous mode with a script holding the shutter down and processing the photos?
I'm not sure it makes any sense to even try.   But I'll try to describe what happens if you do.

When you have USB remote shooting and remote sync enabled, the shooting sequence "stops" just before the shutter actually opens if the USB power = 5V.   It waits there for the USB power to go to 0v. When that happens, it completes the shot.  It does not care how you got to that point in the shooting sequence (shutter button or USB switch or script) - it just looks at the 5V line and USB setup status.

AFAIK  (and have tested)  it does this in regular and continuous mode on most (all?) cameras.

So in theory, if you get the USB pulse train  (on-off-on-...) just right relative to the effective continuous shooting shot rate, it should work in continuous mode too.

YMMV.
« Last Edit: 13 / September / 2013, 01:41:58 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Trigger an Arduino board via USB
« Reply #21 on: 13 / September / 2013, 03:31:49 »
I tried in continuous mode and "burst" (standard remote shooting).
I applied different duty cicle (1750ms 5V - 250ms 0V / 1500ms 5V - 500ms 0V / 1250ms 5V - 750ms 0V / 1000ms 5V - 1000ms 0V) but the camera doesn't shot in the right way :-(

I'm shooting in:
- manual mode exposure (1/1000 sec)
- manual focus
- picture review OFF

Now I'll try again the usblapse script...

Re: Trigger an Arduino board via USB
« Reply #22 on: 13 / September / 2013, 03:47:53 »
I tested the last script of lapser.
The camera shoot every 1100ms without checking the USB port, it just shoot continuously...

*

Offline lapser

  • *****
  • 1093
Re: Trigger an Arduino board via USB
« Reply #23 on: 13 / September / 2013, 04:54:28 »
I tested the last script of lapser.
The camera shoot every 1100ms without checking the USB port, it just shoot continuously...
OK, try the script I posted here again:
http://chdk.setepontos.com/index.php?topic=8997.msg105064#msg105064

I think you need to be in continuous mode with Enable Remote checked on, and Enable Synch off. Try Switch Type and Control Mode None. I think you should hold 0 volts for 100 msec, and the rest of the interval at 5 volts, i.e. 1900 msec.
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 #24 on: 13 / September / 2013, 07:39:43 »
@lapser
The code in reply #400 or #404?

Thank you

*

Offline lapser

  • *****
  • 1093
Re: Trigger an Arduino board via USB
« Reply #25 on: 13 / September / 2013, 14:29:29 »
The code in reply #400 or #404?
It's #400, where the link goes. Here's the script. It waits for USB 5 volts, then waits for USB 0 volts, then triggers the shot. This is the method that was working for the previous user:

Code: [Select]
--[[
@title USBLapse
@param m Max Interval (msec)
@default m -1
--]]
--MUST BE IN CONTINUOUS MODE
if(m<0)then m=1234567890 end -- 2 week interval
set_shot_interval(m,0) --Maximum interval, no wait for script
nshot=1
print("Holding shoot_full")
print("Press <menu> to exit")
press("shoot_full") -- continuous mode
repeat
  repeat sleep(10) until get_shot_ready()
  print(nshot,get_shot_data(4)) -- time from last shutter open to this shutter open
  nshot=nshot+1
  repeat sleep(10) until get_usb_power(1)==1
  repeat sleep(10) until get_usb_power(1)==0
  if(is_pressed("menu"))then break end
  set_shot_interval(-1) --takes one shot immediately
until false
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 #26 on: 15 / September / 2013, 07:53:19 »
I'm sorry for the delay of the answer but yesterday I wasn't t home...

Now it works!!!
A shot every 2sec triggered from the Arduino

The setup on the camera is:
- firmware 1.20 build from lapser for SX230HS
- usblapse script (last post)
- manual mode (1/800)
- manual focus
- continuous shot

From Arduino:
- 1.800ms 5V - 200ms 0V

I'll do more test and I'll tell to you.
Thank you to everybody for the help.

luca






*

Offline lapser

  • *****
  • 1093
Re: Trigger an Arduino board via USB
« Reply #27 on: 15 / September / 2013, 12:35:31 »
Now it works!!!
1800ms 5V - 200ms 0V
Great! The 200 msec pulse at 0V should work for any interval. And, you should be able to go faster. The maximum rate should be a little slower than what you get by holding the shutter button down (continuous mode). For 1 shot per second, try:

800ms 5V - 200ms 0V

I've found that about a 650 msec interval is as fast as my G1X can go. You might get away with a 500 msec interval for smaller cameras. I think the SX260 can do that. The 5 volt pulse should be:  interval-200ms, or 300 msec for 2 shots per second.

A few issues to keep in mind:

If you're writing a log file, i.e. print_screen(1), the script will sometimes block and take a long time. This is because the camera is also saving large picture files at the same time. You can use print(...) to show data on the screen, but don't save it in a log file or you might miss the pulse from the Arduino.

If you're using an external battery in continuous mode and the external power shuts down, all the pictures will be lost. This doesn't happen with an internal battery shutdown, or in single shot mode.
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 #28 on: 15 / September / 2013, 13:51:01 »
Quote
If you're writing a log file, i.e. print_screen(1), the script will sometimes block and take a long time. This is because the camera is also saving large picture files at the same time. You can use print(...) to show data on the screen, but don't save it in a log file or you might miss the pulse from the Arduino.

Luckily I don't need to write a log on the camera. I write it on a SD on the Arduino.

Quote
If you're using an external battery in continuous mode and the external power shuts down, all the pictures will be lost. This doesn't happen with an internal battery shutdown, or in single shot mode.

How can i connect an external battery to the camera?

Another important question, if i want to use the same script on others canon cameras how can i implement your functions on them? Can you explain the process to build the custom firmware?

Thank you,
luca

PS: i'll try to shot faster and i'll tell you

*

Offline lapser

  • *****
  • 1093
Re: Trigger an Arduino board via USB
« Reply #29 on: 15 / September / 2013, 15:51:42 »
How can i connect an external battery to the camera?
I bought a cheap external power supply for the camera that includes a dummy battery, and cut off the DC power cable so I have a connection to the dummy battery. I then spliced this cable to a cable that connect to the external battery.

My cameras with 3.7 volt batteries work with a 5 volt USB external battery. I have a battery that puts out a little over 5 volts right after charging, and the camera just didn't come on, until the battery discharged a little. I even plugged 8.4 volts into the 3.7 volt camera, and it didn't come on, but didn't cause any damage. There seems to be pretty good over-voltage protection, although I wouldn't test that on purpose.

I've used a 50 watt hour lithium battery from Bix power that keeps the G1X running overnight. After 16 hours, I think there was still 1 bar left on the battery. Here's the link:

http://www.amazon.com/gp/product/B002QC3O2G/ref=ox_sc_sfl_title_2?ie=UTF8&psc=1&smid=A2OTUJ24ZUUY7H
 
Quote
Another important question, if i want to use the same script on others canon cameras how can i implement your functions on them? Can you explain the process to build the custom firmware?
I'll have to make a new build for each camera for now. However, I think it will work with the standard CHDK build, and the CHDK remote parameters set up correctly, if you use this script:
Code: [Select]
--[[
@title USBSync
--]]
--MUST BE IN CONTINUOUS MODE
nshot=1
print("Holding shoot_full")
print("Press <menu> to exit")
press("shoot_full") -- continuous mode
repeat
   sleep(10)
until is_pressed("menu")
This should also work with my build, for testing. I would start with the control parameters as:

Enable Remote: Check
Switch: OnePush
Control mode: None
Enable Synch: Check
Enable Script Start: Uncheck (try Check if this doesn't work)
Bracketing all off (don't change)
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics