Wikia

CHDK Wiki

UBASIC/Scripts: Ultra Intervalometer

Talk75
571pages on
this wiki

< UBASIC

Revision as of 12:21, November 29, 2012 by 86.141.214.157 (Talk)

Introduction

This intervalometer script includes a few features that should fit most any need that arises. You can set a delay in minutes and seconds to the first shot of your intervalometer sequence, the number of shots for the intervalometer sequence, as well as allowing you to flag a Yes or No "Endless" option to repeat the sequence endlessly until you interrupt it manually by pressing the shutter button or your [print]/[shortcut] button.

My BASIC programming is 30-years rusty, and while I tested this for each option and it seems to be working just fine, if anyone runs into a problem please post about it in the DISCUSSION section (tab above), and I'll try to sort out what I did wrong.

Documentation & Help

This interval shooting script allows you to set a delay until the first shot in your intervalometer sequence as well as allowing the sequence to repeat endlessly. Use the "Endless" repeat with caution! If that flag is set it repeats non-stop until you interrupt it by pressing the shutter-button (or exit the <ALT> mode with other button presses). Word of Warning: If you are running off of an AC power-supply and going to set the endless-repeat flag do so at your own risk. All Canon manuals warn against allowing their cameras to run for many hours or days at a time. Having said that, the shutter mechanism on SLR cameras is typically reported as lasting at least 100,000 images. In field tests, we've run a Canon A-series camera for more than 4 months taking 2 pictures a minute without any apparent harm to the camera (more than 300,000 images).

Hint: if needing an endless intervalometer sequence of one shot per interval, it is easier to set number of shots to 1, turn on the "Endless" option, and then use the "Delay 1st Shot" as your time between shots -- instead of cranking up the number of shots to a very high number and using the "Interval" time settings (WARNING: As of July 2, 2009, these instructions are incorrect. Setting the number of shots to 1 will cause the below script to ignore the "endless" option).

These intervalometer scripts that use the "shoot" command (as opposed to the 'click "shoot_full"' command) also set focus and exposure before each shot (if the camera is not in Manual mode). Unlike the camera's own built-in intervalometer where exposure and focus is set for just the first shot. This allows it to compensate for all the varying conditions that can take place over the course of many minutes and hours, far surpassing Canon's concept of a useful intervalometer.

Note 1: The count-down timer for the "Delay to 1st Shot" phase won't display beyond the time you have set for your Power Saving / Display Off settings. On the S3 IS this is a maximum count-down display of 3 minutes. The script will continue running however. You just won't have a running tally of how long until the next intervalometer sequence or shot.

Note 2: The total time shown for each cycle does not take into account the shutter-speed time (at this time, but may in a future version). So if you are using long exposure times of 1 to 15 seconds, be aware that the total time for 1 Cycle will be much greater than what is displayed when first running the script. Exposures of 1.3 seconds or greater also add in a dark-frame subtraction to reduce image noise. In effect, a 15 second shutter speed actually takes 30 seconds to elapse. Until this can be figured into the script you'll just have to do some mental arithmetic if knowing a more accurate cycle time is important to you for long shutter-speeds.

IMPORTANT: In CHDK versions BEFORE "test1-pre12-xxxx-100a-65" (changeset 149), it has been found that lengthy intervalometer sessions with shutter speeds greater than 1 second (1.3 to 15 seconds) will cause your camera to show an error code or just shut down after 2 to 12 exposures. This has been traced down the noise reduction routine in the camera (whenever you see the "busy" in the viewfinder after a long exposure). Solutions: use shutter-speeds 1-second or faster. This problem seems to be fixed now in version test1-pre12-xxxx-100a-65 (changeset 149).

Note 3: When Using ult_intrvl.bas with a A720IS and turning the "endless" option ON regardless of options specified 2 pictures in sequence would be taken. This modification/fix was made by Maka45 (http://chdk.setepontos.com/index.php?action=profile;u=2814)It corrects that problem and adds an accurate counter to the "Endless" option as well. Simply copy and paste into the script at the appropiate area.

Note 4 : <Modification from Maka45> If you want an endless-mode counter you have to add a line 'h=1' after the line 'y=p+z':

y=p+z 
h=1

...and modify the "interval" this way:

if p>0 then gosub "pause"
 for n=1 to c
 if g=1 then print "shot", h else print "shot", n, "of", c
 shoot
 sleep t
 next n
 h=h+1
 if g=1 then goto "interval" else end

Script Version 1

(save as "ult_intrvl.bas" to your /SCRIPTS/ folder)

 rem Author - Keoeeit
 rem Written for S-Series
 rem Should be okay on others
 rem Use Endless mode with caution
 rem See documentation for important info
 rem first version
 @title Ultra Intervalometer
 @param a Delay 1st Shot (Mins)
 @default a 0
 @param b Delay 1st Shot (Secs)
 @default b 0
 @param c Number of Shots
 @default c 5
 @param d Interval (Minutes)
 @default d 0
 @param e Interval (Seconds)
 @default e 0
 @param f Interval (10th Seconds)
 @default f 5
 @param g Endless? No=0 Yes=1
 @default g 0
 p=a*60000+b*1000
 t=d*60000+e*1000+f*100
 if c<1 then let c=5
 if t<100 then let t=100
 if g<0 then let g=0
 if g>1 then let g=1
 if p<0 then let p=0
 z=t*c
 y=p+z
 print "1 Cycle Time:", y/60000; "min", y%60000/1000; "sec"
 goto "interval"
 :interval
   if p>0 then gosub "pause"
   print "Shot 1 of", c
   shoot      
   if c=1 then end
   for n=2 to c
   sleep t
   print "Shot", n, "of", c
   shoot
   next n
   if g=1 then goto "interval" else end
 :pause
   n=(a*60)+b
   for m=1 to n
   q=n-m
   print "Intvl Begins:", q/60; "min", q%60; "sec"
   sleep 930
   next m
   return

I timed the pause subroutine and tweaked the sleep to 930 milliseconds to be about as accurate as possible for that loop to span 1 second for the for/print/next execution time. This was calculated on an S3 IS, your camera's uBASIC speed may vary, tweak "sleep 930" accordingly if you need more precision. (Accuracy testing hint: put your camera's display-on time to 3 minutes, set the script's Delay 1st Shot for 4 minutes, see what count-down timer line it ends on just before the screen goes blank (don't jiggle the camera or it resets the display-on time). On my S3 IS the screen went blank just as it was to start counting the 4th minute.) Refer to the listing below for user recommended sleep values.

Sleep Values

  • S3 IS - 930ms
  • A720 IS - 910ms
  • A590 IS - 910ms

NOTE: Updated for remapped shutter-speed values in CHDK Build 119 or later. If using earlier CHDK Builds the only thing that will be off is the cycle-time displayed being 6 seconds longer per cycle than actual time if using shutter-speeds from 10 to 15 seconds . Otherwise it is still fully functional.

Script Version 2

Well, here's "Take 2" on the subject. I included a table of values that will help compensate for the extended dark-frame subtraction times for exposures over 1 second, and a few of the longer shutter times from 1/4 second to 1 second. So that the total cycle time is more representative. I timed these dark-frame shutter times using a stopwatch so they are prone to human error and reaction-time on my part, but they are all within 1/4th second. I was surprised to find that a 15" exposure actually took 33" to cycle. (The dark-frame exposure times used here for value h are in 10ths of a second, 210 = 21 seconds, in case you are curious how each one panned-out in timing tests.) These delays of longer than "shutter speed X 2" shows there's more going on under the hood than first suspected. But in all cases, even when shutter speeds are much faster there still seems to be a bit of a 1 to 2 second lag when you figure-in for camera processing overhead for each exposure. Use the "Cycle Time" as a general guideline, nothing more. It'll be close to within a few seconds at least. (Because I wasn't sure how much space would be taken up by the dark-frame shutter table, I tightened up the code a bit to make extra room. You might want to compare equivalent strings between this and the older version in case you want to edit the original Ultra Intervalometer for more compact code.)

v1.1 (updated 2007-05-30 c.e.) I forgot to separate the interval delay variable from the calculated time variable with the new black-frame delay times figured in. The interval delay will be accurate again if you use a shutter speed slower than 1/4th second. And a bug with 1 shot, a startup delay, and "endless" is fixed.

caution:
The value returned by the get_tv command is not accurate unless the script is run while the cam's ModeDial is set to "M" (Manual). Reliance on that value renders useless the script shown below, as a general-purpose (any ModeDial setting) intervalometer. If you're on a PowerShot SD950 IS or similar compact camera with aperture (ND filter instead), the get_tv command will probably crash the script requiring a power-cycle. Use the original script above instead.

rem Author - Keoeeit
rem Written for S-Series
rem Should be okay on others
rem Use Endless mode with caution
rem See documentation for important info
rem updated version
@title Ultra Intervalometer
@param a Delay 1st Shot (Mins)
@default a 0
@param b Delay 1st Shot (Secs)
@default b 0
@param c Number of Shots
@default c 5
@param d Interval (Minutes)
@default d 0
@param e Interval (Seconds)
@default e 0
@param f Interval (10th Seconds)
@default f 5
@param g Endless? No=0 Yes=1
@default g 0

p=a*600+b*10
t=d*600+e*10+f
if c<1 then c=5
if t<1 then t=1
if g<0 then g=0
if g>1 then g=1
if p<0 then p=0
u=t
get_tv h
if h=-12 then t=t+330
if h=-11 then t=t+270
if h=-10 then t=t+210
if h=-9 then t=t+170
if h=-8 then t=t+130
if h=-7 then t=t+110
if h=-6 then t=t+90
if h=-5 then t=t+70
if h=-4 then t=t+60
if h=-3 then t=t+50
if h=-2 then t=t+40
if h=-1 then t=t+35
if h=0 then t=t+18
if h=1 then t=t+15
if h=2 then t=t+13
if h=3 then t=t+11
if h=4 then t=t+10
if h=5 then t=t+8
if h=6 then t=t+6
x=p+(t*(c-1))

print "1 Cycle Time:", x/600; "min", x%600/10; "sec"

goto "interval"

:interval 
  if p>0 then gosub "pause"
  for n=1 to c
  print "Shot", n, "of", c
  if n>1 then sleep u*100
  shoot
  next n
  if g=1 then goto "interval" else end

:pause 
  n=(a*60)+b
  for m=1 to n
  q=n-m
  print "Intvl Begins:", q/60; "min", q%60; "sec"
  sleep 930
  next m
  return


Script Version 3

The previous versions have a bug that will screw up the unlimited interval shooting if you are using a starting delay. Here is a cleaned up version that really allow unlimited interval shooting. Just set number of shots to 0 and it will go on until interrupted. Hope U guys like it. ;-)

 rem Author - Keoeeit
 rem Upgraded by Mika Tanninen
 @title Ultra Intervalometer
 @param a Delay 1st Shot (Mins)
 @default a 0
 @param b Delay 1st Shot (Secs)
 @default b 0
 @param c Number of Shots (0 inf)
 @default c 0
 @param d Interval (Minutes)
 @default d 0
 @param e Interval (Seconds)
 @default e 10
 @param f Interval (10th Seconds)
 @default f 0
 n=0
 t=(d*600+e*10+f)*100
 if c<1 then let c=0
 if t<100 then let t=100
 g=(a*60)+b
 if g<=0 then goto "interval"
 for m=1 to g
  print "Intvl Begins:", (g-m)/60; "min", (g-m)%60; "sec"
  sleep 930
  next m
 :interval
   n=n+1
   if c=0 then print "Shot", n else print "Shot", n, "of", c
   shoot
   if n=c then end
   sleep t
   goto "interval"

Script Version 4

Next upgrade for time accuracy and shutdown: ;-)

 rem Author - Keoeeit
 rem Upgraded by Mika Tanninen
 rem Time accuracy and shutdown for a710is by Viktoras Stanaitis
 rem h-accuracy for delay, j-accuracy for interval
 h=-1
 j=-1755
 @title Ultra Intervalometer
 @param a Delay 1st Shot (Mins)
 @default a 0
 @param b Delay 1st Shot (Secs)
 @default b 0
 @param c Number of Shots (0 inf)
 @default c 0
 @param d Interval (Minutes)
 @default d 0
 @param e Interval (Seconds)
 @default e 10
 @param f Interval (10th Seconds)
 @default f 0
 n=0
 t=(d*600+e*10+f)*100+j
 if c<1 then let c=0
 if t<100 then let t=100
 g=(a*60)+b+h
 if g<=0 then goto "interval"
 for m=1 to g
  print "Intvl Begins:", (g-m)/60; "min", (g-m)%60; "sec"
  sleep 930
  next m
 :interval
   n=n+1
   if c=0 then print "Shot", n else print "Shot", n, "of", c
   shoot
   if n=c then shut_down
   sleep t
   goto "interval"


Testing Information

  • Written for: Powershot S3 IS
  • Testing/Works:
    • A430 (02 April 2010)
    • A460 (11 September 2010)
    • A480 (01 July 2010)
    • A495 (20 June 2011)
    • A530 (02 Jul 2009)
    • A540
    • A550 (05 Jul 2011)
    • A560 (01 Jan 2011)
    • A570IS
    • A590
    • A610
    • A620
    • A630
    • A650IS (15 April 2011)
    • A700 (25 July 2011)
    • A710IS (1st script only)
    • A720IS
    • A2000IS
    • A2200 (29 November 2012)
    • S2IS (09/Nov/2009)
    • S90 (23/Apr/2011)
    • S95 (31/Jan/2011 v1.00E w/ beta CHDK)
    • SD300 (17/Jul/2010)
    • SD550 (14/Sep/2009)
    • SD600 (06/Apr/2009)
    • SD630 (20/Apr/2009)
    • SD750 (03/Jan/2010)
    • SD770 (17/Jun/2010)
    • SD800 (2/Feb/2012)
    • SD850 (20/Feb/2009)
    • SD880 (10/Oct/2009)
    • SD900 (23/Jul/2010 v1.00c BETA)
    • SD950 (only first script)
    • SD990 (26/Oct/2010)
    • SD1000 (16/Sep/2009)
    • SD1100 (09/Jul/2009)   
    • SX100IS(1st script only)
    • SX10IS (30/sept/2009)
    • SX110IS (29/May/2009)
    • SX120IS (10/April/2010)
    • SX130IS (26/August/2011)
    • SX150IS (30/September/2012)
    • SX1 IS (23/March/2012)
    • SX20IS
    • SX210IS (03/May/2012)
    • PowerShot S5IS (vers B of CHDK)
    • IXUS860IS (28/July/2009)
    • TX1 (28/Sept/2009 v1.01b)
    • G9 (March/2011 v.1.01d)
    • G10 (September/2011 v.1.02A;January/2012 v.1.04A)
    • G11 (July/2010)
    • G12 (May/2011 v1.0.0e)
    • SX30IS (15/Julio/2011 v1.0.1 M)
  • problems:
    • A710IS - 2nd script - no pictures taken, (camera apparently turns itself off) *Check to make sure that you've formatted correctly to fat16, this is a common problem if your card is not formatted correctly. Camera goes thru the motions till the very last second, then shuts down, often times without closing the lens. Try Cardtricks to format easily, and hopefully, help remedy the issue.

Around Wikia's network

Random Wiki