CHDK Wiki
Register
Advertisement

Please note that all contributions to Scratchpad are considered to be released under the GNU Free Documentation License (see Project:Copyrights for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here. You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.

DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!

This means: YOU SHOULD ONLY SUBMIT PHOTOS WHICH ARE YOURS
(AND THAT YOU ARE RELEASING THEM INTO THE PUBLIC DOMAIN)

Lightning Photography with Motion Detection?[]

MX3 and others who have used this method. I have read some information about modifying the md_test2.bas script to optimize it for shooting lightning with it. But after reading that suggested information I'm still confused about some things.

Here's how I modified that script (to start off with):

@title Lightning Detection
@param a Columns
@default a 8
@param b Rows
@default b 6
@param f Threshold
@default f 10
@param e Measure Interval (msec)
@default e 0
@param i Start Delay (sec.)
@default i 1

if a<1 then let a=1
if b<1 then let b=1
if c<0 then let c=0

let i=i*1000
 
print "Use in Manual Mode"
print "and Manual Focus for"
print "fastest response."

sleep i
cls

print_screen 1

for j=0 to 100000

	let h=0
	md_detect_motion a, b, 1, 30000, e, f, 0, h

 	if h>0 then click "shoot_full" else print "Timeout"

next j

end

I changed the variables so it was easier for me to keep track of which ones were being used in that long list of variables, a,b,c,d,e,f,g,h and to know which ones were changing which functions. Just a personal preference to make my understanding things more easily.

I understand most of the variable settings. But I don't understand why variable position d is set to 30 seconds. This is listed in the commands as "timeout". Is it set this long to account for a 15 second exposure with dark-frame subtraction, after it detects lightning and takes a shot? Or can that be greatly reduced? I would think that if the motion detection can shoot fast enough to capture the first bolt of lightning, then you wouldn't need to keep the shutter open that long to try to catch more flashes of light. You could use a shutter speed of 1 second and capture many lightning bolts in a 30 second time span if enough flashes were occuring.

Since no one else has replied, I'll jump in, even though I've not used the MD function yet. My reading of the command is that the 30 secs is how long it will wait trying to detect a "motion" (or in this case, a flash of light) before it will return control to your script. In essence, the "md_detect_motion" command will continue to look for motion for 30 sec; if it detects motion, it will return immediately, but if it doesn't, it returns after 30 secs. The variable h will = 0 if it did not detect motion. If it is not =0 (i.e., it *did* detect motion), then the next line in the script will activate the shutter. Since it's in manual mode, the exposure will be for however long you set it.
Regarding the shutter speed: the lightning will last only a short time, but you nonetheless may want a longer exposure to bring out the background. I suppose you should play with the exposure time to get something acceptable. (I have not done this type of photography yet, but I'd guess that the lightning will be very bright, so you'd probably want a small aperture and low ISO to to keep the bolt from saturating the sensor. But you may want to check the exif info on actual exposures to see what others used)

And would it help to get rid of that else print "timeout" to help speed up response time?

probably takes a total of 10-20 msec max to do the print. No big deal

Thanks if you can shed any light(ning) on this subject. :-) I'm very impressed by the photos that Vitaly and others have been able to capture using this method. I'd like to have it work the first time I'm standing out in the rain instead of running back inside to tweak some script lines.

maybe do some trial shots with different shutter speeds to see what you need to bring out the background before running the script (but the lightning will also light up things...)

Perhaps I should have used the md_demo_v1.bas script instead for the foundation of this one? But I wanted to keep the script as short as possible to have the fastest cycling times. Are there important parameters being set in md_demo_v1.bas that need to be set that aren't being set with this one?

I can't comment on the parameters used (not haveing used it). However, I note a couple of things: 1) the "print_screen 1" command tells CHDK to copy all "print" output to a file (so that the continual "timeout" that is printed every 30 sec when it fails to see a strike will also go into that txt file). You probably don't need it. 2) Regarding the timing: the delay from detection to shot is basically the uBasic execution time between the "md_detect_motion" command and the click shoot_full in the immediately following conditional command. It is only on the order of 10-20 msec. The shot will take whatever it takes (plus a sec or so for processing/writing), and then maybe 50 msec to cycle back through the loop. It will be plenty fast. A suggestion: why not set it up in a dark room and use a lamp or flashlight to simulate a stike?

md code analysis

Topic is being discussed at the new CHDK Forum[]

There has been some excellent discussion concerning this issue lately. Apparently not all camera models are created equally when it comes to motion-detection speed and being fast enough to respond in time to lightning-strike behaviors.

Please see this thread at the CHDK forum titled "Motion Detection Too Slow?" for further information. As well as many hints and tips on the best way to tweak and set values for the MD (motion-detection) scripts for speed. This thread also includes links to some fast-response sample images from MX3 himself (he can throw toys and have the camera capture an image of them before they even land, and for his next trick ... :-) ). But also extremely important, a member there by the name of jonnythe has written a small and simple program whereby you can emulate the pre-strike leader-flash of a lightning bolt to determine if your camera and script settings will be fast enough. Now you can test in advance if you're camera, CHDK scripts, and methods will be ready for that once-in-a-lifetime thunderstorm when it finally happens. You can find his motion-detection speed testing program in this post in that thread.

Advertisement