Need Script - Month of Time Lapse with A530 - Script Writing - CHDK Forum

Need Script - Month of Time Lapse with A530

  • 5 Replies
Need Script - Month of Time Lapse with A530
« on: 06 / March / 2010, 22:25:17 »

REWARD: A working script will get you acknowledgment in my Masters Thesis, as well as any peer-reviewed scientific journals that I end up publishing in.  I'm no programmer, I'm a plant ecologist! Here's what I need:

What I need: A script that takes one photo every 24 hours at noon. It would be best if I could start and run the script for an entire month (or longer) with the A530 camera running on AC power. Also, please rem: the parameters so I can understand how to modify the script for other intervals, fixed vs autofocus, etc.

Background: You would be helping a scientific study create time-lapse images of plants growing in response to submersion (many plants have adaptations to flooding or submersion that cause them to grow new shoots quickly, bend their leaves upwards towards the surface, etc).


« Last Edit: 07 / March / 2010, 00:05:30 by ranngerdavid »

Re: Need Script - Month of Time Lapse with A530
« Reply #1 on: 07 / March / 2010, 00:50:15 »

I did find this script:

I just wonder if this will work if I change the interval to 86400 seconds (60 seconds x 60 minutes x 24 hours), if I'll cook the camera's memory or something...

Code: [Select]
@title Photo every x seconds
@param a Interval
@default a 30

rem a = Delay in seconds
rem x = Mod of seconds for delay
rem y = Last get_day_seconds
rem z = Current get_day_seconds

sleep 100
z = get_day_seconds
if z = y then goto "main_loop"
y = z

rem Interpreter gets to this bit once per second
x = z % a
if x = 0 then goto "take_shot"
if z % 5 = 0 then goto "print_countdown"
goto "main_loop"

  print "Next shot is in",a - x,"sec"
  goto "main_loop"

  print "Shooting..."
  goto "main_loop"

It was posted here:,2174.0/prev_next,next.html#new

By johnburns;u=3236


Offline fudgey

  • *****
  • 1705
  • a570is
Re: Need Script - Month of Time Lapse with A530
« Reply #2 on: 07 / March / 2010, 04:21:55 »
You can do that, but you can also use the camera clock to trigger your shots, see,3886.msg36423.html

I'd have the camera shoot a whole lot more than once per day, though, since there's probably no reason not to.

A word of warning: we don't know for how long you can leave the camera powered on before it crashes or shuts down. There is an internal 10 ms ticker 31 or 32 bits wide, which will probably wrap around after 248 or 497 days after which either the camera or CHDK could do weird things such as shut down or freeze. So, it may be a good idea to periodically reboot the camera or at least to check that it still works. This ticker is just one thing that we know of, there could be other problems but other people are doing / have done slow timelapses like this before.

Anyway, there's currently no way to reboot the camera from a script (actually this has been done in mweerden's PTP stuff, but I believe the a530 is a vxworks camera like mine and his method doesn't easily port for them), meaning automatic rebooting requires some external hardware (example: set script autostart, mechanically fix the power button so that it's never released, use a cheap main timer to power off the camera external power supply for a little while each day). But for a month or few you shouldn't need that, especially if you're there to do it manually.

Also, shooting too many photos without rebooting will eventually cause a crash due to running out of RAM -- for my a570 this happens while entering the fifth (or sixth, can't remember right now) DCIM folder, setting a maximum of 8000 or 10000 frames when powering on with an empty card with photo numbering reset. Most cameras have more RAM than the a570 and may survive longer.

Re: Need Script - Month of Time Lapse with A530
« Reply #3 on: 07 / March / 2010, 17:35:58 »

Thanks, this is great help. I'm really please so far, this whole project has cost me:

$25 for an A530 from eBay
$15 for external AC/DC power, also ebay
$10 for 2 gig SD card
$0 Cheap little tripod I had sitting around.

I have it running that basic 1-shot-every-30-seconds, and it looks great. I just have to add in what you suggest for syncing to the camera's clock, and maybe something to set the focus manually so it doesn't auto-focus and change.

Thanks again,  D

Re: Need Script - Month of Time Lapse with A530
« Reply #4 on: 10 / March / 2010, 00:30:48 »
Hey you might want to contact the Borevitz lab at U Chicago ( They have a sweet greenhouse setup with like 30 CHDK enabled cameras doing timelapse using CHDK. All the cameras have wireless eye-fi cards so the timelapse images auto-magically end up on their servers.

Re: Need Script - Month of Time Lapse with A530
« Reply #5 on: 10 / March / 2010, 13:55:42 »
If you want to turn the camera off at night, you can put the power supply on a timer, either one of the old school kitchen timers you can get in a hardware store or you can use a digital timer like this (  To get the camera power button to stay you on, you can either epoxy the camera's power button down or use a clamp of some sort and it will turn on automatically in the morning when the power comes back on.
Here's a nice set up that uses CHDK:


Related Topics