CHDK/uBASIC/Scripts: Lightning Photography

Lightning Photography

 * Written for/on: Powershot S3 IS, CHDK Build 106 Changeset 159, or later, required.


 * Also works on: Should work on all of them.
 * Version 1.1 Updated 2007-06-03 c.e.(Fixed auto-set 1-sec exp. time.)

Trying to capture lightning from thunderstorms is a unique situation in that the lightning is bright enough to capture during a very very brief exposure. Yet due to the nearly random nature of lightning-strikes you have to keep the shutter open for many minutes sometimes to capture a good bolt or two. Since these cameras do not have a BULB setting on them, where you would usually keep the shutter open until you saw a good lightning-bolt, then close it before the next try at capturing one, we have to find a way to keep the shutter open as much as possible with as little shutter-closed time as possible. Using a shutter-speed of 1 second in high-speed burst mode will be the best possible scenario to accomplish this because it doesn't sit there working on a dark-frame subtraction (as happens on shutter speeds slower than 1 second). When using a fast SD card and a High-Speed Continuous mode, you'll get up to 42 seconds of open shutter time for every minute (42 1-second shots per minute). This means your shutter is open 70% of the time, greatly improving your chances of a lightning-flash occurring during the open-shutter time. Every time you see a lightning flash while this script is running means you'll have a 70% chance of it showing up on one of the frames. Best-case scenario using shutter speeds with dark-frame subtraction (more than 1") and that lowers to a 45% chance of capturing a lightning-flash during each exposure. (A 15" exposure on an S3 IS timed-out to 33" long with dark-frame cycle included.)

I also included a short half_press pause to allow the camera to set auto-focus if ambient lighting is bright enough, otherwise use MF at infinity, and if in Tv mode then also auto-aperture for any ambient lighting, in case you don't do these manually beforehand.

When shooting in daylight conditions (not quite as spectacular for lightning shots), you'll have to use ND-Filters (neutral density filters) or two crossed polarizers to cut down the amount of available ambient light -- if an aperture of f/8.0 and lowest possible ISO isn't enough, the same way that film photographers used to accomplish this. If that is not possible, then you can delete the set_tv 0 command so you may adjust your shutter-speed higher. Keeping in mind that this will VASTLY increase the number of shots saved to your SD card and to sort through in trying to find ones with lightning on them. Doing so will also decrease the shutter-open time to camera-busy time, lessening your chances at getting a strike.

Documentation/Help (save as a small "lightning.txt" file to your /CHDK/SCRIPTS/ folder)

Set your camera to Tv or M(anual) mode and to Continuous mode, use "High-Speed Continuous" if you have it. If ambient light is bright enough it will auto-focus, if conditions are dark use Manual Focus mode set at infinity. When run the script will automatically set your shutter-speed to 1 second. If using Tv mode it will help you to properly expose for any ambient light during each exposure, otherwise adjust your aperture accordingly in M mode. Choose how many minutes and seconds that you'd like the camera to take exposures, keeping in mind that there will be up to 42 individual frames per minute.

Script Code (save as "lightning.bas" to your /CHDK/SCRIPTS/ folder) rem Author ~Keoeeit~ rem Written for S-series cameras rem Should work okay on others

@title Lightning Photos @param a Duration Minutes @default a 1 @param b Duration Seconds @default b 0

t=60000*a+1000*b

if t<1000 then let t=1000

print "Use Tv or M mode." print "Use Continuous (burst) &" print "High-Speed if available." print "Use MF mode at infinity." sleep 2000

set_tv 0 press "shoot_half" sleep 1500 press "shoot_full" sleep t release "shoot_full" release "shoot_half"

end