Introduction The purpose of this script is to take pictures when motion is detected. The screen will be divided into a number of Rows and Columns. The Treshold value determines the treshold for detection. Recommended experimental values are 10=Lightning, 12=Sunshine, 24=Cloudy, 36=Dawn/Dusk. Motion can be detected in the following Modes: 0=U, 1=Y, 2=V, 3=R, 4=G, 5=B. The Pixel Blocksize determines how many pixels are seen as one block. Smaller blocks are more accurate but detection will be slower. An important parameter is the Triggering Delay value. A value of 0 is meant for ultrafast motion detection (fi. lightning). In this mode, the shoot-button will be pressed half before detection is started, so the actual shooting is very fast. Disadvantage is that (in Auto-mode) the focus/aperture/shutter will be fixed before the moving object is detected (except when using all manual settings like manual focus/aperture/shutter). If you choose a value > 0, the shoot-button will not be half-pressed before detection, so the moving object's focus/aperture/shutter will be set after motion is detected. Important: you should be careful that the value is big enough to avoid shoot-looping after first detection. A value of at least 16 (=1.6 secs) will be ok. If you want to motion-detect for longer periods, you should disable the power-save options of your camera, so that your camera will not power-off after a certain time. This can be done in the <ALT> menu. In the Miscellaneous Stuff menu item set the Disable LCD Off value to Script, so the display won't turn off while in <ALT> mode or while a script is running. Written for: Canon A640 Also works on: Other Canon AXXX (Not tested), Canon A720 (tested), Canon A710 (tested), Canon PowerShot S3 (tested), Canon A540 (tested), A620 (tested), Canon A610 (tested) Doesn't work on: Canon A650IS Parameters (Save as "MotionDetect.txt" file to your /CHDK/SCRIPTS/ folder) Select P, Tv, Av, M or C mode on your Canon A640.
Script Code (save as "MotionDetect.bas" to your /CHDK/SCRIPTS/ folder) Download and Installationrem Johan Van Barel 05-04-2008 rem Motion/Lightning-Detect for Canon A640 @title Motion Detect @param a Cols @default a 6 @param b Rows @default b 4 rem Treshold: 10=Lightning, 12=Sunshine, rem Treshold: 24=Cloudy, 36=Dawn/Dusk @param c Threshold (0-255) @default c 24 @param d Interval (mSec) @default d 1 rem Delay: 0=Ultrafast(Lightning), 16=Normal, 32=Slow @param e Delay (.1 Sec)(0=UltraFast) @default e 0 @param f BlockSize @default f 8 @param g Mode(U=0,Y=1,V=2) @default g 1 @param h Initial Delay (Sec) @default h 1 if a<1 then a=1 if b<1 then b=1 if c<0 then c=0 if e<0 then e=0 if f<1 then f=1 if g<0 then g=0 if g>5 then g=5 if r<0 then r=0 if h<0 then h=0 e=e*100 rem time in msecs md will detect x=5000 sleep h*1000 i=0 while 1 if e=0 then press "shoot_half" do get_prop 205 p until p=1 endif t=0 md_detect_motion a,b,g,x,d,c,1,t,0,1,1,a,b,0,f,e if t>0 then click "shoot_full" do get_prop 205 p until p<>1 i=i+1 print "Pic", i, "(blocks="; t; ")" endif wend This script is freeware. Before you can install it, you need to download and install the CHDK Firmware Extension for your specific Canon camera. CHDK is freeware and can be downloaded for a broad range of Canon PowerShot and Digital Ixus cameras here. If you own a Canon A640, you can download a specific build here, which already contains all the CHDK scripts from this site, including the one mentioned above. Copy all the files in this archive to the root of your SD card. If you have problems installing CHDK, please refer to the CHDK Wiki Pages. Disclaimer This software and the accompanying files are supplied "as is", without any express or implied warranty. In no event shall the author be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages from the use of this software. By using this software you agree with these conditions. Copyright © 2008 by Johan Van Barel. All Rights Reserved |