2 Years Timelapse during working hours - General Chat - CHDK Forum
supplierdeeply

2 Years Timelapse during working hours

  • 20 Replies
  • 9864 Views
2 Years Timelapse during working hours
« on: 13 / December / 2012, 10:43:46 »
Advertisements
Hi everybody

I join this community because I have somme question about scripts in CHDK.

I have to make a timelapse during 2 years (a building in construction).
I have a ixus 100 IS to do it with CHDK 1.1.0-2091

I want to make one photo every 15 minutes, between 8 am and 5 pm, from monday to friday. (36 pic a day, 180 pics a week)
Once the photo have been taken, I'll mount them on my computer.

I didn't find if I can do this by getting the hour of the camera. Instead, I wrote this, I have to start it on monday 8 a.m., but I hope it will work.
Could you confirm it ? It's the first script I do, and don't want to make my camera off.
I'll delete rem lines before using it on my camera, it's for readability

thank's a lot.

Code: [Select]
@title Timelapse
@param a Interval (Minutes)
@default a 15
@param b Night (hours)
@default b 15
@param c week end (hours)
@default c 48

rem Force the flash to OFF
set_prop 16 2

rem time in millisecond for interval between two pics
t=a*60000
rem time in millisecond for intervalle between 5 p.m. and 8 a.m.
s=15*60*60*1000
rem time in millisecond for the week end
u=48*60*60*1000
rem number of shoot a day
o=36
rem number of day a week
p=5

if t<100 then let t=5000

print "Interval shooting."
print "Until you interrupt it."
print "Use with caution."

sleep 1000

rem make a loop for 36 shots = 1 day

:week
  for m=0 to p
    :day
      for n=0 to o
        shoot
        sleep t
      next n
    sleep s
  next p
sleep u
goto "week"

Re: 2 Years Timelapse during working hours
« Reply #1 on: 13 / December / 2012, 11:06:03 »
I didn't find if I can do this by getting the hour of the camera. Instead, I wrote this, I have to start it on monday 8 a.m., but I hope it will work.
I think you might be expecting too much for the tic timer to stay accurate over 2 years.  But it might be okay.   

However,  if you have a power disruption at any point (even with a UPS, things happen) or if CHDK just resets (it is a hack after all) then getting sync'd again will be difficult. 

You might want to take a look at the get_time function :  http://chdk.wikia.com/wiki/Script_commands#get_time and base your timing on the minute and hour values.   

Unfortunately,  I don't know of an easy way to get the "day of week" so that you can avoid the weekends although you could use a big set of "if" statements to cover each of the next 24 months I guess.  Or your could use an @parameter to set the current day of week at script start and let the script count from there - at least that way you can occasionally take out the card and backup your pictures or do other maintenance.

Here's the script function reference guide link >  http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page#All_Scripting_Functions
« Last Edit: 13 / December / 2012, 11:13:13 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: 2 Years Timelapse during working hours
« Reply #2 on: 13 / December / 2012, 11:23:16 »
Thank's for the link. I'll get an eye on it.

For the accuracy over two years, actually, I don't count on it ;) but within a month, I think that can be ok, and I will get all the pictures every month (making a backup, begginning to see how it's doing on video). If there's a slight mistakes with the ticks, it won't be a disaster (after all, it's human working, they can start at 8 o'clock, or 7:59 and so on. I don't care if there are few second or even minutes lag

I think it will be a too heavy and complex script to get time, set a table of hours when to takes photo (and if the CHDK don't take the date "at time" ???) so, I think's it's better to start with this (after all, i'm on the ground every day, and can leave an eye on the camera). I might, in a distant future, work again on this script... but I'll begin with the basis.

For the moment, I try to make it working... I discover this langage, and have a bunch of syntax error... need to walk step by step.

Stay tuned. I'll inform you when it will work, and show you the result.

I'm still intersted in tips  :xmas

Re: 2 Years Timelapse during working hours
« Reply #3 on: 13 / December / 2012, 11:33:36 »
For the accuracy over two years, actually, I don't count on it ;) but within a month, I think that can be ok, and I will get all the pictures every month (making a backup, beginning to see how it's doing on video). If there's a slight mistakes with the ticks, it won't be a disaster (after all, it's human working, they can start at 8 o'clock, or 7:59 and so on. I don't care if there are few second or even minutes lag
  Thanks for the clarification - that makes a lot more sense.  Your original message left the impression that you hoped the camera would run "unattended" for two years.

Quote
I think it will be a too heavy and complex script to get time, set a table of hours when to takes photo (and if the CHDK don't take the date "at time" ???) so, I think's it's better to start with this (after all, i'm on the ground every day, and can leave an eye on the camera). I might, in a distant future, work again on this script... but I'll begin with the basis.
I'm still intersted in tips  :xmas
Agreed.   Its up to you but it would be fairly easy to sync the hours & minutes to the real time in your loop and that would let you work on the camera at any time of day - you would not need to reset at 7:59 AM exactly.

Quote
For the moment, I try to make it working... I discover this langage, and have a bunch of syntax error... need to walk step by step.
Your posted script appears to load and run.  I set the shot interval to one minute and let it run for a couple of shots only.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline lapser

  • *****
  • 1093
Re: 2 Years Timelapse during working hours
« Reply #4 on: 13 / December / 2012, 11:36:40 »
If you want to start taking pictures at a specific time of day, the best way is with the function:
get_day_seconds

http://chdk.wikia.com/wiki/Get_day_seconds_example

get_tick_time can only last for about 24 days until it overflows and becomes a negative number. You don't need msec accuracy, so get_day_seconds would be much better to use.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: 2 Years Timelapse during working hours
« Reply #5 on: 13 / December / 2012, 11:50:36 »
Thank's both of you. It appears it works on my camera too (I was near to launch my camera on the floor... before thinking to rename my script .bas instead of .lua  :-X it works much better with this. I think I will learn LUA later)

It's not perfect, but I think it'll be ok for the moment.

Next step :
- making a auto synch to launch the script whenever I want (get_time/get_day_seconds and setting the day in parameters is a good lead). Furthermore, it will be better this way when we change the hour in summer or winter...
- Insert a command to stop it on demand whithout turning the camera of :D
- Making a 3.7V DC alimentation to avoid battery failure (do someone know if it exists, but not expansive, maybe 10€ ?)
- Making a support and fixing the camera to begin the timelapse (mini headball + some screw, plexiglass to avoid wind coming in)

« Last Edit: 13 / December / 2012, 11:53:26 by BZHades »

Re: 2 Years Timelapse during working hours
« Reply #6 on: 13 / December / 2012, 12:01:32 »
- Making a 3.7V DC alimentation to avoid battery failure (do someone know if it exists, but not expansive, maybe 10€ ?)
Look on eBay or Amazon.com for Canon power supply.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: 2 Years Timelapse during working hours
« Reply #7 on: 13 / December / 2012, 12:20:50 »
If you want to start taking pictures at a specific time of day, the best way is with the function:
get_day_seconds

http://chdk.wikia.com/wiki/Get_day_seconds_example

get_tick_time can only last for about 24 days until it overflows and becomes a negative number. You don't need msec accuracy, so get_day_seconds would be much better to use.

When you're speaking about "get_tick_time" , you mean "Get_time" ? how can it overflow if I erase the previously get_time ?
or do you mean "sleep t" that can overflow after a bunch of time ?

I should start at 8'oclock, and make a pic every 15 minutes. But If it crash during the day, I want it to start immédiately until 5 pm, and restart at 8 am next morning.

what could be the best solution ?

:initiate
get_day_seconds
test if it is between 8 am and 5 pm
take a pic
store the time in "a"
sleep one minute

:routine
get_day_seconds
test if it is between 8 am and 5 pm
test if it is > a+15 minutes
take a pic
store the time of the new last picture in a
sleep 1 minute
go to "routine"

 ? (and add a system to avoid week ends)


For the AC adapter, I found some copy at 10$ (... but 10more $ for shipping  :lol it costs more to ship than the package)... I didn't thought to look on eaby, I had just see the original ACK-DC10 at 80$...  :o


Re: 2 Years Timelapse during working hours
« Reply #8 on: 13 / December / 2012, 12:28:36 »
When you're speaking about "get_tick_time" , you mean "Get_time" ? how can it overflow if I erase the previously get_time ?
or do you mean "sleep t" that can overflow after a bunch of time ?
get_tick_count (rather than get_tic_time)  returns the number of milliseconds since the camera was turned on. If you run the camera long enough it will overflow the 32 bit integer value.

Quote
what could be the best solution ?
something like this is a start (not tested ..sorry)
Code: [Select]
    do
      h=get_time 2
      if h >7 then
        t=get_time 1
        if t%15 = 0 then shoot
        sleep 60000
      end
      sleep 1000
    while h < 17

Update : fixed per lapster's comments
« Last Edit: 13 / December / 2012, 19:41:04 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: 2 Years Timelapse during working hours
« Reply #9 on: 13 / December / 2012, 14:07:08 »
what could be the best solution ?

You can try a Lua script with os.date . That offers more possibilities.

untested examble:
Code: (lua) [Select]
--[[
@title tl test
]]

while true do
    if os.date("%w") > 0 and os.date("%w") < 6 then -- only mo - fr
        if os.date("%H") >= 8 and os.date("%H") < 17 then -- only 8 - 17
            if os.date("%M")%15 == 0 then -- every 15 minutes a shoot
                shoot()
            end
        end
    end
    sleep(60000)
end

msl
CHDK-DE:  CHDK-DE links

 

Related Topics