CotM: CHDK Scriptin’ a Zoomy – “YOUR SPEED RED TRUCK”

So, fiddlin’ around with CHDK on the Powershot, as one is wont to do, and I decided to automate a crashzoom timelapse of a sign down the hill that lights up every time a car passes. I knew you could script basically every operation the camera can do, so I figured that there prolly existed a CHDK script for looping through the possible zoom settings on the camera, then autofocusing and shooting a picture at each stop.

Turns out there was one that got halfway thereit would zoom in *one* direction and was meant to also sync to a motion gimbal via USB to do a dolly+zoom crash effect. I didn’t have the USB remote dealy so I modified the CHDK script to bypass that and do what I wanted – loop forward, *then* back, without jamming up the lens. Also fixed a bug that locked up the lens because a sanity check wasn’t done in the right place.

A Not-So-Still Life from Street Level: “YOUR SPEED RED TRUCK” – Street level because my tripod is 4″ tall. :D
Now I really kind of want a Powershot SX60 or SX70 HS, with the 65x Superzoom – 3 times the optical zoom and twice the megapixies of the SX10. That would be a *lot* of fun!
Busssss-TED! My own personal Flock camera, except theirs can do 37x optical zoom @ 48mp. Mine only does 20x optical zoom @ 10mp. ):

The modified CHDK Script (copy as “zoomy.lua” to your SD card’s /CHDK/SCRIPTS/ directory):

–[[
@title Zoomy v01.
@chdk_version 1.4.1
@param z zoom incr +/-
@default z 1
@param ev Exposure Value
@default ev 0
]]

— Enable Remote: false Enable script start: false
— (no conflict with USB usage)
— Press Shutter to start script

— switch to shooting node
if ( get_mode() == false ) then
print(“switching to shooting mode”)
set_record(1)
while ( get_mode() == false ) do sleep(200) end
end

set_zoom_speed(10)
zmax=get_zoom_steps()
print(“Max Steps:”,zmax )
zmax=zmax-1
direction=1

repeat
— wait for USB power
print(“Zoom Step:”,get_zoom() )
— repeat
— sleep(50)
— if ( is_pressed(“video”) ) then
— return
— end
— until is_pressed(“remote”)

press(“shoot_half”)
repeat
sleep(50)
until get_shooting() == true

av = get_av96()
if ( ev == 0 ) then
tv = get_tv96()
ev = av + tv
end

— print(“A:T:E:”,av,tv,ev)

— set TV
set_tv96(ev-av)

exp = get_exp_count()
— take exposure with “shoot”
shoot()

while (get_exp_count() == exp) do
sleep(50)
end

if ( direction > 0 ) then
znext=get_zoom()+z
else
znext=get_zoom()-z
end

if (znext < 0 ) then print(“zoom min”) return end if (znext > zmax) then
print(“zoom max – switching direction”)
znext=zmax
direction=0
— return
end

set_zoom(znext)

i=1
while (get_zoom() ~= znext) do
i = i + 1
if (zmax >= znext + i) then
set_zoom(znext+i)
else
if (znext – i >= 0 ) then
set_zoom(znext-i)
else
break
end
end
set_zoom(znext)
end

until is_pressed(“video”)

Everything super-green with the new rechargables! Now I can run battery-sucking projects like this and not fret about burning alkalines. Still can’t pull off an all-day timelapse, but that *always* needs mains power, or one heck of a Jackery. (:

Updated: September 19, 2026 — 9:34 pm

1 Comment

Add a Comment
  1. Nice effect. I’ve always been afraid to mess around with hacking my cameras for fear of screwing ’em up. I know myself too well to try it. I recently fried my Alphasmart Neo trying to get it to print on an IBM Action writer typewriter via serial port. Very stupid thing to try.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.