A Simple Intervalometer Script
- Written for/on: Canon S3
- Also works on: unknown (but probably others, although timing might be off)
This simple intervalometer script was written for use on an S3 using version 148, and tested (and configured) in "P" mode.
It was loosely based on the OMNI intervalometer script written by Keoeeit
I've attempted to get the timing as exact as possible, with a minimum of user variables.
[Ideally, the intervalometer would use the system timer to space the shots. Until that function is available, we are forced to estimate things/]
Note: the minimum interval time I've been able to acheive is ~1.6 sec, so don't expect to do things faster than that (with an S3, in P mode, CHDK v148).
It works best in optimum light conditions, in P mode. If you intend to use other modes, or low light (long exposure) conditions, you might want to experiment with the timing and adjust the script accordingly.
PLEASE NOTE: there is a Global Script variable named "script shoot delay". Please set this to 1 (for 0.1 seconds), as the timing scheme assumes that this will be the case. (and, I've seen some funny display behavior if it's 0).
Like all intervalometer scripts, the user will specify the number of images, and the interval time. I've followed the convention Keoeeit used, which is to use 3 variables to specify the interval time: Min, sec, and 0.1 sec.
In addition, this script allows the user to tell the script what you *estimate* the exposure time will be (note: this does *not* set the exposure time; it just allows the script to factor the exposure time into its estimate of what the interval should be). For most daylight shots (exposure faster than 1/10 sec) this can be set to 0 (since units are 0.1 sec). But if doing longer exposures, you need to estimate it as best you can (with the understanding that any errors affect the actual time), and an additional complication is that with longer shutter times the camera may do a dark frame subtraction, with roughly doubles the time. (To be honest, I've have not tested this with exposures where the camera would also do dark frame subtractions, so I don't know if any additional time is consumed by the extra processing. However, with CHDK you can disable dark frame subtraction (look elsewhere in this Wikia to find out how).)
The script has a preset variable called the "lag" that is my best estimate of the interval time when the script-induced delay is 1 msec (the smallest it can be), tested under optimum light conditions with exposure times in the 1/60 or less range. If you use a different camera, or a different version of the CHDK (other than 148), or a different mode (Manual, Av, or TV) the lag parameter may have to be adjusted. The only one I've tested is Manual Focus, and I've found that it is (very) roughly 0.1 sec faster. For most purposes, you could just specify an interval time 0.1 sec longer to compensate.
To MODIFY for other cameras, or other versions of CHDK, or for different operating modes, you will want to test the timing and then adjust the "lag" variable embedded in the script. My suggestion for doing this is to set the camera to do a 2 second interval, and 50 shots or so under optimum (fast shutter) conditions. Examine the EXIF info for the 1st and the last one, and divide the total elapsed time by the number of intervals (so if you have 50 images, that's 49 intervals). Subtract 2 seconds from that time. If the result is positive, increase the "lag" variable by that time difference in msec. (so if you got 2.153 secs average interval, add 153 to the lag.) If its a negative number, subtract the difference from the lag (so if you got 1.900 sec, subtract 100 from the lag). A SUGGESTION: don't adjust the lag by the full amount: instead, go about 2/3rds of the way, then test again. (In otherwords, in the example above where you want to increase the lag by 153, instead increase it only by 100, then retest and adjust again based on the new results).
Finally: some advice for using the script: I shoot in 640x480 mode and use a quick-n-dirty freeware program called JPGVideo to assemble the results into an .AVI file (google "JPGVideo" to find it).
HELP documents: sorry, I haven't written one. You could copy the above text and save as "smpl_intv.txt" file to your /CHDK/SCRIPTS/ folder if you want.
Divalent (email: add '2007' to the end of my handle, at gmail dot com)
Script Code (save as "smpl_intv.bas" to your /CHDK/SCRIPTS/ folder)
rem author Divalent, based on ONMI intervalometer of Keoeeit rem camera: S3, CHDK v148, Operating in P mode rem rem Save this file as "smpl_intv.bas" in the SCRIPTS directory rem rem This version calculates the "sleep time" for spacing the shots based on: rem - a user-specified desired interval, rem - the default 0.1 sec "script shoot delay" (a global script parameter) rem - an offset based on the user-estimated exposure time, and rem - an empirically determined "lag" time. rem (This lag time is, in theory, is supposed to represent the time it takes rem to shoot repetitive images when no delay is specified.) rem rem If used on other cameras or CHDK versions, or other than "P" mode, test the rem timing and adjust the variable "l" below. (In practice, I've found that you rem should best modify this by changing it only by 1/2 of what you think you need, rem and then repeat the test (and I don't know why that is so)). rem rem Also note: use the default value of 100 msec (i.e. 1 unit of 0.1 sec) for the rem global script variable "script shoot delay". The timing assumes this is the case. rem rem Note: if using exposure times where the camera will do a dark-image rem subtraction, then double the estimated exposure time. rem rem Note: this intervalometer only shoots in photo mode (not video or burst) rem @title Simple Intervalometer @param d Number of Shots @default d 99 @param e Interval (Mins) @default e 0 @param f Interval (Secs) @default f 0 @param g Interval (0.1 Secs) @default g 0 @param h est exposure time (sec) @default h 0 @param i est exposure time (0.1 s) @default i 0 rem rem You may have to adjust this "lag" variable 'l' if used on non-S3 cameras rem or for CHDK versions other than 148, or non-P mode. 1 unit = 1 msec rem set the minimum interval time (lag) (in msec!) l=1371 rem rem calculate the total user-specified interval time rem t = user specified interval time (in 0.1s units) t=e*600+f*10+g rem rem s = user estimated exposure time in 0.1 s units s= h*10+i rem now adjust t for estimated exposure time t=t-s rem now adjust t to sleep routine units (needs to be in msecs) t=t*100 rem now adjust T for known lag t=t-l rem now adjust for a 100 msec "script shoot delay" t=t-100 rem ensure T not < 1 (if so, interval will be greater than specified) if t<1 then t=1 rem ensure # of shots more than 2 if d<3 then d=3 rem Initial delay at start: set at a fixed 0.5 sec p=500 rem rem set initial value of n n=1 print "delay value ", t print "Shot", n, "of", d rem start with intial pause sleep p shoot rem now we've done the first shot :do_loop for n=2 to d print "Shot", n, "of", d sleep t shoot next n end