Canon CHDK and intervalometer script

Posted on

One of the cameras used is a Canon A590IS

  • 15€ (second hand)
  • 8 MegaPixels / 3264x2448
  • Quite heavy
  • Used with 2 Ultimate Lithium Energizer
  • Loaded with CHDK firmware

CHDK installation

CHDK for Canon Hack Development Kit. This is an open source alternative firmware installed on the SD card that let the user load custom scripts. In our case we want an intervalometer script.

Check instructions for your own camera.

What I did:

  • Use gparted or similar to create a 16 MB partition
  • Use gparted or similar to create another FAT32 partition
  • echo -n BOOTDISK | sudo dd bs=1 count=8 seek=64 of=/dev/mmcblk0p1
  • unzip a590-101b-1.2.0-3347-full.zip
  • For dual partition cards, all the files and folders from the CHDK distribution file belong on the large second partition except for the files DISKBOOT.BIN and either PS.FIR or PS.FI2, which belong on the smaller FAT16 bootable partition.
  • Enable the “lock” switch of the SD card

Other ramdom useful informations

  • Disable RAW
  • Disable Flash
  • Disable Automatic shutdown
  • Change numerotation order
  • Set date/time
  • Test it in freezer
  • Was able to take ~ 1500 pictures with the battery (low temperature)
  • Set the script to take a picture every 7 seconds (~3 hours)

Script

I reviewed several scripts available on Internet and found the one from Stratodean the easiest to understand.

The original Stratodean script is available here.

I modified it a bit with set_lcd_display parameter

My script version:

    -- Uggy Camera Control for CHDK written in Lua
    --
    --
    --Author: Mark Ireland
    --Modified: Uggy 

    --[[
    @title Uggy Camera Control
    @param s Interval (seconds)
    @default s 10
    @param d Initial Delay (seconds)
    @default d 10
    @param c LCDdisplay (0 se coupera)
    @default c 0
    ]]
    --Functions
    --Get the 
date and time
    function timeStamp()
        return string.format("%02d/%02d/%4d,%02d:%02d:%02d",
        get_time("D"),
        get_time("M"),
        get_time("Y"),
        get_time("h"),
        get_time("m"),
        get_time("s"))
    end

    --Get the time, iteration, temperatures and voltage and print it in a nice string
    function logData(o)
        return string.format("%s,%i,%i,%i,%i",
        timeStamp(),
        o,
        get_temperature(0),
        get_temperature(1),
        get_vbatt())
    end

    --Setup

    print_screen(1)
    print("Uggy Camera Control")
    print(timeStamp())
    print("Interval: ",s)
    print("Initial Delay:",d)

    sleep(5000)

    set_lcd_display(c)


    --Convert seconds into milliseconds and ensure that params are sensible
    if s<1 then s=1 end
    if d<1 then d=1 end
    if c<0 then c=0 end
    if c>1 then c=1 end
    s = s*1000
    d = d*1000


    --Initial delay
    sleep(d)

    print("Starting picture capture")
    print("Date,Time,Iteration,LensTemperature,CCDTemperature,BatteryVoltage")
    i = 0

    --endless loop for picture capture - will run until space full or battery empty
    while(1) do
        set_lcd_display(c) 
        --Take the picture
        shoot()
        --Log the info to the file
        print(logData(i))
        --Add 1 to iteration
        i = i
+++
1
        --Sleep iteration delay
        sleep(s)

    end