Author Topic: Intervalometer Script, uses Time of Day, and Day of Week  (Read 2251 times)

Offline DelSenno

  • Newbie
  • *
  • Posts: 1
Intervalometer Script, uses Time of Day, and Day of Week
« on: 16 / September / 2010, 19:24:51 »
Hello all,

This is my first script.  It is based heavily off of Keoeeit's Ultra Intervalometer script, but I've added code to tell the script to run only between defined times and between defined days of the week.  This seems to be working well on an A480.

The reason I made this is because I will be taking time-lapse photos of a construction project, and I only want the pictures being taken during hours that work is being done.

PROBLEMS:  I do not believe this script will work if the "ending" time is earlier than the "starting" time; i.e., if the script is told to start shooting at 9PM and stop at 7AM.  It also will not work if the "starting day" comes after the "ending day; i.e. start shooting Friday, end on Monday. 

I am not a programmer by profession, I've done some light scripting in other languages and that's it, so fixing these issues and streamlining the script isn't particularly easy for me... I would like to clean it up to work in all cases but I may not get around to it for a bit as the script does what I need it to do right now.

That being said, I would love to hear comments and suggestions for how to improve this!  I know there are some real programmers on this board for whom this would be a piece of cake...

Thanks - Joe

Code: [Select]
rem Author - JoeD, based on original script by Keoeeit
rem x-accuracy for delay, j-accuracy for interval
rem Day of week parameters determine what days the camera takes pictures
rem Proper values are from 0-6, with 0 being Sunday and 6 being Saturday
rem Script has not been optimized


x=-1
j=-1755

@title Ultra Intervalometer with Day of Week and Time
@param a Delay 1st Shot (Mins)
@default a 0
@param b Delay 1st Shot (Secs)
@default b 0
@param c Number of Shots (0 inf)
@default c 0
@param d Interval (Minutes)
@default d 0
@param e Interval (Seconds)
@default e 10
@param p Starting Hour (24 Hr time)
@default p 7
@param q Starting Minute
@default q 0
@param r Ending Hour (24 Hr time)
@default r 16
@param s Ending Minute
@default s 0
@param u Day of Week to Start (0 is Sunday, 6 is Saturday)
@default u 1
@param v Day of Week to End (0 is Sunday, 6 is Saturday)
@default v 6
@param

rem sets number of shots already taken to 0
n=0
rem calculates time in ms between each shot
t=(d*600+e*10)*100+j
if c<1 then let c=0
if t<100 then let t=100
rem calculates first shot delay in seconds
g=(a*60)+b+x
if g<=0 then goto "interval"
rem displays seconds left before shooting begins
for m=1 to g
 print "Intvl Begins:", (g-m)/60; "min", (g-m)%60; "sec"
 sleep 930
 next m
goto "interval"

:interval
  l=get_time 3
  o=get_time 4
  y=get_time 5
  rem following lines calculate current day of week in variable w, 0 is sunday
  if o<3 then gosub "change"
  k=(l+(2*o)+(6*(o+1)/10)+y+(y/4)-(y/100)+(y/400)+1)
  w=k%7
  if w<u or w>v then goto "weekend"
  rem calculate time of day, determine if it's in range
  i=get_day_seconds
  f=(p*3600)+(q*60)
  h=(r*3600)+(s*60)
  if i<f or i>h then gosub "rest"
     
  n=n+1
  if c=0 then print "Shot", n else print "Shot", n, "of", c
  shoot
  if n=c then shut_down
  sleep t
  goto "interval"
 
:change
  o=o+12
  y=y-1
  return
 
:rest
do
sleep 60000
i=get_day_seconds
until i>=f and i<=h
return

:weekend
i=get_day_seconds
z=(86400-i)
goto "interval"

Offline coding_hero

  • Newbie
  • *
  • Posts: 1
Re: Intervalometer Script, uses Time of Day, and Day of Week
« Reply #1 on: 17 / December / 2010, 23:45:40 »
Thank you for posting this.  I was actually looking for something just like this, also for a construction project.  I'm using a SD750, so I'm going to see if I can hack it further by detecting the Bv and inhibiting pictures when it's too dark.

Offline spe672

  • Rookie
  • *
  • Posts: 17
Re: Intervalometer Script, uses Time of Day, and Day of Week
« Reply #2 on: 27 / January / 2011, 11:05:25 »
First off, thanks for the idea and posting this code!  I'm new to all this hacking, but have been doing timelapses with my DSLR (rebel xti) for several years now.  I just installed this code on a G9 and have a couple of questions about how it works on your camera.

I'm hoping to use this script with some slight modifications for a 4 month building demolition timelapse here in my hometown.  I have about 3 weeks to get this working, or I'll just have to brute force it and tie up my rebel for that amount of time...not too crazy about that, but I know with that setup there won't be any issues. 

Does the camera have to be on with script started for it to run?  Seems as though it does, but I wondered if CHDK allowed for autostart from a powered off state.  Battery power will not be an issue during this project as I have a wall adapter that works in both my G9 and rebel.  I'll just leave it on the whole time if not.

The time between shots starts off to be 10 seconds, but after about a minute the time between pictures becomes erratic; usually about 5 seconds apart, but anywhere from 4 - 7 seconds.  Is the timing better on your camera model?  Do you have a newer tweak that addresses this that you haven't posted?   

I found another timelapse script that locks the focus to infinity, so I'm going to try to add that to this code.  If I let my rebel autofocus during a timelapse, the zoom is slightly different on each shot making for a jumpy timelapse; I can't use the G9 if it's going to do this. 

BTW, check out the latest timelapse I made of my fraternity being torn down.  There's both a 1 min and 15 min version...the 15 min version is for my fraternity brothers, not the average joe...it's got nice detail though if you decide to scan through it!




Thanks again!

Andy

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal