Objective

To tether digital still camera to a GNU/Linux workstation with an USB cable and carry out time-lapse image capturing using free software. Only the very basic steps are described here for demonstration purpose.

Materials and tools

Install required softaware

    # apt-get install gphoto2
    # dpkg -l | grep gphoto2
    ii  gphoto2                     2.1.6-2.1                  The gphoto2 digital camera command-line clie
    ii  libgphoto2-2                2.1.6-6                    gphoto2 digital camera library
    ii  libgphoto2-2-dev            2.1.6-6                    gphoto2 digital camera library (development 
    ii  libgphoto2-port0            2.1.6-6                    gphoto2 digital camera port library

Configure software

Create capture script

Consider the following Bourne shell script saved to a file named `timelapse.sh'.
    # interrupt in any any command fails
    set -e

    # verbose execution
    set -x

    # gphoto2 binary executable
    GPHOTO=gphoto2

    # delta time between snapshots in seconds
    DELTA=15

    $GPHOTO --auto-detect
    $GPHOTO --delete-all-files

    while [ 1 ] ; do
        X1=`date +%s`
        X2=$(($DELTA+$X1))

        $GPHOTO --capture-image
        $GPHOTO --get-all-files
        $GPHOTO --delete-all-files

        X1=`date +%s`
        T=$(($X2-$X1))
        if [ $T -gt 0 ] ; then
            sleep $T
        else
            echo "WARNING: DELTA is too small"
        fi
    done

Configure camera settings

You probably want to override some default settings for camera. My choice was to use CSM (ie custom) mode with the following settings.

Test USB connectivity

Connect the camera to the workstation with the USB cable. Connect also the external power supply and turn power on. Then use the following command to test connectivity between camera and the worstation.
    % gphoto2 --auto-detect
    Model                          Port            
    ----------------------------------------------------------
    Nikon CoolPix 880              usb:            

Test run

    $ sh timelapse.sh 
Press CTRL-C anytime to finish the capturing. Sample test run images are here.

Summary

It is an easy and straightforward process to setup a time lapse imaging system using GNU/Linux, free software, and any globally available brand digital still camera. The demonstration here was carried out using Nikon Coolpix 880 but you could use also digital SLRs such as Nikon D70 body and optics of your choice, or any of the more than 600 cameras supported by gPhoto2. GPhoto2 is ported also to Mac OS X.

At its simplest, the described system is just a wired remote shutter release. It is not necessary even transfer the files over the USB if you use a memory card large enough. Nowadays you can have compact flash or micro drive cards up to 8GB which can store awfully many 3-megapixel images. For demanding imaging, you probably need to tune all the settings manually at camera side. Most importantly ISO sensitivity, focus, aperture, exposure metering and white balance. Note that some digital cameras, such as the Nikon D200, can perform time-lapse imaging without external control. See your camera manual for details.

See also

Time-Lapse Movies with iSight & BTVPro.

19 March 2006, Petteri Kettunen
Updated 4 May, 2006.