Sunday, October 28, 2012

CHDK coding on my IXY Digital 70

Decided to have a play around with CHDK scripts available for my camera, and saw that the coding was very easy to follow. So I decided to create my own using some minor pieces from the example scripts provided on the CHDK wiki.

CHDK Screen

I wanted a script that would continuously take photo's for the duration of the flight and would require minimal fiddling around to start. By this I wanted to reduce/remove  any button clicks that may result in a setting being changed pre-launch that could jeopardize the mission.

Below is the code I have started with. It has the following features.  Note that it works with my Canon IXY Digital 70 and may not suit all camera's.

  • Sets a 1st shot delay. No point going all snap happy with the box still on the ground.
  • Variable shot interval
  • Logging of camera internal temperature and battery voltage to SD card.
    • Saw this as a backup temp data logger for the flight
  • Disable flash.
    • Couldn't find a single command for this so had to create a loop that pressed the flash button until it was off.
  • Disables LCD screen.
    • Read in the script manual, that the screen automatically resumes when you take a picture. For the screen to be turned off you must also allow for the picture to be written to SD card otherwise the screen will just come back on again. I saw this happening so added the 'sleep 500' to give it enough time to save.

Happy for any comments and tips, as its my first CHDK script so I'm sure there may be improvements I can make.


<davCam.bas>


@title DavCam
@param a interval (sec)
@default a 12
@param d Delay 1st Shot (sec)
@default d 20
@param n fileNum
@default n 1

if a<5 then a=5
a=a*1000
if d<1 then d=1
d=d*1000

print "Script will run"
print "until interrupted"
gosub "disFlash"
playsound 1 
sleep d
cls

print_screen n
print get_time 4;"/";get_time 3;"/";get_time 5;" ";get_time 2;":";get_time 1;":";get_time 0
print " "
print "Time,Optics Temp,CCD Temp,BattmV"

o = get_day_seconds

:main
    gosub "getData"
    gosub "takePic"
    set_backlight 0
    sleep a
    rem set_backlight 1
goto "main"

:takePic
    set_zoom 0
    do
        get_zoom z
    until z = 0
    shoot
    sleep 500
    return

:getData
    print (get_day_seconds - o);",";get_temperature 0;",";get_temperature 1;",";get_vbatt;
    return

:disFlash
    f=get_flash_mode
    while f<1
    click "right"
f=get_flash_mode
sleep 500
    wend
    print get_flash_mode
    return

:restore
    set_backlight 1
    end

So far I have set the camera to launch the script when powered on. So hopefully when the launch commences its a matter of pressing one button and that's it.

I haven't looked into exposure settings yet, as I don't really know what will be best for high altitudes. So maybe people reading this may have some ideas.


No comments:

Post a Comment