chdk
IMG 0998

This page describes an intervalometer script designed for use in KAP (Kite Aerial Photography) & UAV (Unmanned Aerial Vehicle) applications. It may also be useful for balloon photography.


Current Release : v4.0 (effective 2019APR17)

Download Link :   KAP & UAV Script Download Link

Download md5sum : 65e0edd5fa07987ccbc6f2085eb54a77

Forum Thread :    CHDK Forum Thread for KAP_UAV script

Release History :  Release History

As of October 2016, the script had been downloaded more than 6668 times.

Overview

The KAP Exposure Control Lua script in an intervalometer script that automatically controls shutter speed, aperture, ND filter, and ISO settings so as to maintain the fast shutter speeds needed in kite aerial photography (KAP) and unmanned aerial vehicle photography (UAV). With these applications, the camera is almost always moving, and resulting motion blur is often a big obstacle to getting sharp pictures. Simply setting the shutter speed to a fixed fast value may not allow enough flexibility when lighting conditions are variable. This script actively manages all exposure inputs in order to keep the shutter speed fast, but will allow slower speeds if necessary to get proper exposure. 

Features

On Screen Display

Kapuav3

Script startup showing initial values selected.

Kapuav2

Second shot - note metered vs calculated values used.

Camera Settings

The following are some recommended setting for the various options in the Canon menus (in shooting mode).  As each camera is a little different, some settings may not exist or may have slightly different wording.

  1. Camera mode in "P"  or Program (not Auto, M, SCN, or Live)
  2. ISO in Auto
  3. Continuous AF Off (setting the camera in P mode will automatically turn this off on cameras without this menu option)
  4. AF Frame not in Tracking AF
  5. Servo AF Off
  6. Safety MF Off
  7. IS Mode Off (may not be necessary for KAP but should be off for UAV)
  8. Review Off
  9. Lens retract 0 sec.

Setting Focus at Infinity

The script uses the latest manual focus capability released in CHDK 1.3.0 to automatically focus at infinity if so configured. Note that despite considerable effort, not every camera will focus well at infinity under script control. Some camera models are even reported to have variation between individual cameras. So some experimentation may be required to confirm how well this setting works on any particular camera. If the script option for "Focus at Infinity" does not work for your camera, you will need to deselect it and use your camera in autofocus mode.

Note :  if focus at infinity mode is selected,  the script onscreen log will display a warning message in red & white if the focus does not lock at infinity.

Application Notes

IMG 2131
  1. A loader program is available for cameras with low memory.  The loader script will load the kap_uav.lua script in approximately 1/2 of the memory needed to load the script directly. See the links below.
  2. The script assumes the cameras ND filter effect is the equivalent of three f-stops.  Change the value of the variable nd96offset in the script code if this is not the case.
  3. While the script is running,  you can stop it "cleanly" by pressing the MENU key.  Pressing any other key will cause the display/backlight to activate for about 10 seconds,  allowing you to check the script status.
  4. This script requires CHDK 1.3.0 (or higher) and build 3810 (or higher)
  5. As always, CHDK is experimental. It is very stable but it is not perfect.  Use at your own risk.

Parameter Setup

Shot Interval

Specifies the time between shots in seconds.

Shutdown

Defines how long the script will run before halting.
  • values 1 - 240 minutes ( 0 = forever)
    • default  0 (forever)

Total Shots

Defines how many shots the script will take before halting.

Power off when done?

Causes the camera to completely power off when the total shot count or time limit is reached. If not selected,  the camera will go into playback mode when the total shot count is reached ( and retract the lens if configured correctly in the Canon menus).

Display Off?

Turn off LCD display and backlight either on script start or after a 30 second delay. Press any keyboard key to re-enable.
Note : you must disable the Shot Review function in the Canon shooting menu for this to work properly!

Start Delay Time

Allows a delay at script start before shooting starts - giving time for the kite or UAV to reach a desired altitude.
  • values 0 - 10000 seconds
  • default  0

Exposure  Bracketing

Causes three exposures to be taken per shot with specified exposure offsets (in f-stops)

Exposure  Compensation

Works like the built-in Canon exposure compensation,  allowing the exposure reading to be offset by up to two f-stops.

Zoom position

Specifies the position to set the zoom lens at the start of shooting.

Focus @ Infinity

Script will attempt to set focus at infinity (using AF, AFL, or MF modes if available on the camera).  This function may not work with all cameras - some experimentation may be necessary

See the Setting Focus at Infinity section above.

Tv Min

Defines the lowest shutter speed that will be used. Note that the algorithm will not try to go below this value to get the correct exposure, possibly resulting in underexposed images that will need to be fixed in post processing.  Used to prevent motion blurr when the illumination is poor.

Target Tv

Defines the desired shutter speed - usually set to a fast shutter speed like 1/1000 sec
Note : selecting a Tv setting higher than your camera can achieve could  result in  over exposed pictures.

Tv Max

Defines the maximum shutter speed that will be used before the ND filter (if present) is inserted. Note that the algorithm may try to go above this value to get the correct exposure as a last resort, depending on CHDK's ability to extend the shutter speed.
Note : selecting a Tv setting higher than your camera can achieve could  result in  over exposed pictures.

Lowest Av

Used to define the lowest aperture setting to be used.

Target Av

Defines the desired Av setting (usually the lens sharpness "sweet spot")

Highest Av

Defines the maximum usable Av setting

ISO Min

Defines the lowest ISO sensitivity value to use

ISO Max1

Defines the maximum ISO to be used during "normal" shooting.

ISO Max2

Defines the ISO value to be used when the ISO Max1 value cannot be used to achieve correct exposure

Allow use of ND filter?

Enabled / disables the script's ability to use the ND filter (if available).

Video Interleave (shots)

When enabled, tells the script to switch modes every time the defined number of shots have occurred and record a video segment.

Video Duration (sec)

Sets the length of the video recorded in seconds when the Video Interleave option (above) has been selected.

USB Shot Control

Enables the camera's USB port to be used for shooting control.
  1. None causes the script to ignore the USB port.
  2. On/Off mode enables & disables intervalometer shooting when USB power is applied/removed.
  3. OneShot mode takes one picture each time the USB power is pulsed.
  4. GntWire works with the gentwire-usb2 device from Gentles (http://www.gentles.ltd.uk/gentwire/Manual-usbc2.pdf )
  5. Pixhawk works with UAV flight controllers like a Pixhawk (see http://tuffwing.com/support/pixhawk_camera_trigger_cable.html)

USB Timeout (secs 0=off)

A timeout value when using USB Shot Control.  If no USB activity happens after the specified duration, the camera will swith to playback mode (and immediately retract the lens in setup correctly in the Canon menus). Camera will return to shooting mode on the next USB port activity.

Logging

Specifies where log message go. 

Exposure Calculation Algorithm

For a camera with no ND filter and no adjustable iris (the "Tv-only" case), the script works as follows :

For a camera with an ND filter but no adjustable iris :

For a camera with an adjustable iris, but no ND filter, the script works as follows:

- If still more exposure is needed, it raises the ISO, up to your Max2 setting (800).
- If still more exposure is needed, it slows the shutter speed below target to get a good exposure.
- If exposure is still too high, it raises the f-stop, up to your Max setting (f/8.0).
- If exposure is still too high, it raises shutter speed above your Max setting to get a good exposure.

For a camera with both an adjustable iris and an ND filter, the script works as follows:

Note that in very high scene brightness, the algorithm may yield a shutter speed higher than your Max setting, and even higher than your camera's highest nominal setting. Under CHDK such fast shutter speeds may indeed work, but may not be reflected in the EXIF data for the picture (which may only go up to about 1/2000 second). If that occurs, the log data will reflect the actual settings at which the picture was taken.

Also remember that for cameras with an iris, if you use the zoom settings to zoom in to any amount, your camera's minimum f-stop will go up. The script will automatically adjust your minimum and target Av settings if needed. This may be the explanation if your EXIF aperture data shows higher f-stops than your settings call for and you are using zoom.

Release History

Links

link > Tuffwing UAV Setup Instructions : Pixhawk Setup to work with kap_uav.lua

link > KAP form thread for kap_uav.lua : KAP Forum Thread

links> DIY Drones Form

Using AUX pins as relays for CHDK
APM to CHDK Camera Link Tutorial
CHDK usb trigger
Canon S100 KAP_UAV Script settings?
CHDK, KAP Script and accurate timestamping
UAV camera setting
Pixhawk and CHDK

link > Article about Canon image stabilization issues : Lets Talk Canon Cameras

link > ecology drones setup video : Bixler 2 Photography Setup

link > Archived Script : kap_uav v3.6 Loader for Cameras with Low Memory

link > Archived Script :  KAP & UAV Exposure Control Script V1