Setting G9 focus to infinity and locking it there during a timelapse - page 3 - General Help and Assistance on using CHDK stable releases - CHDK Forum

Setting G9 focus to infinity and locking it there during a timelapse

  • 31 Replies
  • 8500 Views
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #20 on: 07 / February / 2011, 23:38:48 »
Advertisements
I ran it from 8:30pm to 9:15pm with a 4 minute interval.  The start time at 7am and the end time at 9pm.  The last shot was taken at 8:57pm!  Woo Hoo!  I'll set it up to run tomorrow from 7 to 7 and let u know how it goes.  I'm expecting it to do just fine.

What does the "caution IS enabled" tell us?  Should I shut off the IS mode if it's used on a tripod?

Is there an easy way to keep the main info you place on the screen at the beginning and not have it scroll away due to the "Shot this of that" every time it takes a pic?  As a user, I'm finding that I'm not worried about terminating at a particular shot, just letting it run free is fine.  What I am needing to know while it's working is,  1. what are my start and finish times, 2. days activated, 3. interval and 4. maybe countdown time to next shot OR what the time of the last shot was.  Probably time of last shot would be easier than updating a clock each second.  I'm just thinking out loud, no need to do it unless you find it useful.  :D

Thanks! 

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #21 on: 08 / February / 2011, 00:31:13 »
What does the "caution IS enabled" tell us?  Should I shut off the IS mode if it's used on a tripod?
On cameras that have IS it is recommend that when using a tripod or setting the camera on a hard surface to take pictures, that the IS be set to OFF.

Is there an easy way to keep the main info you place on the screen at the beginning and not have it scroll away due to the "Shot this of that" every time it takes a pic?  As a user, I'm finding that I'm not worried about terminating at a particular shot, just letting it run free is fine.  What I am needing to know while it's working is,  1. what are my start and finish times, 2. days activated, 3. interval and 4. maybe countdown time to next shot OR what the time of the last shot was.  Probably time of last shot would be easier than updating a clock each second.  I'm just thinking out loud, no need to do it unless you find it useful.
Some good ideas here. I'll see what I can come up with. The limiting factor is that only 5 lines can be displayed in the script window, so the trick is to arrange the info to fit and still make sense.

PS. I tried to run my test at midnight and everything was going great. Unfortunately I forgot to set my camera's power saving function to Off, so the camera shut itself off before the scheduled restart. Looks like I'll be trying again tomorrow night.

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #22 on: 08 / February / 2011, 21:36:55 »
Is there an easy way to keep the main info you place on the screen at the beginning and not have it scroll away due to the "Shot this of that" every time it takes a pic?  As a user, I'm finding that I'm not worried about terminating at a particular shot, just letting it run free is fine.  What I am needing to know while it's working is,  1. what are my start and finish times, 2. days activated, 3. interval and 4. maybe countdown time to next shot OR what the time of the last shot was.  Probably time of last shot would be easier than updating a clock each second.  I'm just thinking out loud, no need to do it unless you find it useful.
..............
Some good ideas here. I'll see what I can come up with. The limiting factor is that only 5 lines can be displayed in the script window, so the trick is to arrange the info to fit and still make sense.
Here is an updated version (minor) with your last suggestions incorporated - I like the info displayed in this version better. Even though it required only minor changes, I've been putting it through the same battery of tests as before. Everything looks good so far. I noticed that if you start during an active day/hour occassionally a shot might get taken just outside the active window - one of mine was 3 seconds after the end time. I don't know if that will be something I'll be able to correct easily, but I'll check. I'll be trying a test with this script around midnight that I'm interested in.

Code: [Select]
rem Author SkyWalker9
@title Selective Intervalometer
@param a Number of Shots
@default a 180
@param e Interval (mins)
@default e 5
@param f Interval (secs)
@default f 0
@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 18
@param s Ending Minute
@default s 0
@param u Start DOW (0=Sun..6=Sat)
@default u 1
@param v End DOW (0=Sun..6=Sat)
@default v 6

rem Check input variables for proper values
  if a<2 then a=2
  if e<0 then e=0
  if f<0 then f=0
  if p<0 then p=0
  if p>23 then p=23
  if q<0 then q=0
  if q>59 then q=59
  if r<0 then r=0
  if r>23 then r=23
  if s<0 then s=0
  if s>59 then s=59
  if u<0 then u=0
  if u>6 then u=6
  if v<0 then v=0
  if v>6 then v=6

rem Calculate user specified cycle/interval time in ms
  d=(e*600+f*10)*100
  if d<1 then d=1

rem Next two statements combine "hour" and "minutes" (hour:11 minute:30 = 1130)
rem This reduces the number of "if" statements required in "check_time" subroutine
  P=p*100+q
  R=r*100+s

rem Print Error message if Start Time is after End Time print msg & exit
  if r>=p then goto "ok1"
    print "START Time after END"
    end
:ok1

rem Print message if Start Day of Week is after End Day of Week print msg & exit
  if v>=u then goto "ok2"
    print "START DOW after END"
    end
:ok2

rem Print a Caution message if Image Stabilization (IS) is enabled
  x=get_IS_mode
  if x<>3 then print "Caution: IS enabled"

rem Displays the disk space/free disk space in MB & percent
  x=get_disk_size
  x=x/1000
  y=get_free_disk_space
  y=y/1000
  z=(y*100)/x
  print "Free Space "y"MB ("z"%)"

rem Built in delay of 1000 ms to allow camera vibrations to stop plus 1000 ms
rem to temporaily display the Caution msg if needed.
  sleep 2000

rem Calculate length of total time period (1 min=60K "ticks"). This is done to
rem allow use of "tick_count" instead of "sleep" statements. This results in more
rem consistent/dependable/accurate interval cycles.
  N=((r*60+s)-(p*60+q))*60000

rem This calculation corrects the length of time period above if the user starts
rem the script during the DOWs & Start/End range they have selected
  O=N
  gosub "dayofweek"
  if w<u or w>v then goto "ok3"
  F=get_time 2
  Q=get_time 1
  x=F*100+Q
  if x>=P and x<R then O=((r*60+s)-(F*60+Q))*60000
:ok3

rem Initializes shot counter; script shutdown camera when n=a in the "take_shots" section
  n=1

rem -- Do not add comments after this point ---

  print a" Shots / DOW "u"-"v
  print "Hours "p":"q"-"r":"s
  print "Every "e" min "f" sec"
  print "Waiting..."
  
:check_day
  gosub "dayofweek"
  if w>=u and w<=v then goto "check_time"
  goto "check_day"

:check_time
  F=get_time 2
  Q=get_time 1
  F=F*100+Q
  if F>=P and F<R then goto "take_shots"
  goto "check_day"

:take_shots
    i=get_tick_count
    i=i+O
:more
    b=get_tick_count
    x=get_time 2
    y=get_time 1
    z=get_time 0
    shoot
    sleep 100
    W=w
    gosub "info"
    if n=a then shut_down
    n=n+1
    S=b+d
:wait_loop
    b=get_tick_count
    if b<S then goto "wait_loop"
    if b<i then goto "more"
    O=N
    goto "check_day"

:dayofweek
  D=get_time 3
  M=get_time 4
  Y=get_time 5
  A = (14-M)/12
  Y = Y-A
  M = M+12*A-2
  w = (D+Y+(Y/4)-(Y/100)+(Y/400)+(31*M/12))%7
  return

:info
  cls
  print a" Shots / DOW "u"-"v
  print "Hours "p":"q"-"r":"s
  print "Every "e" min "f" sec"
  print "Last Shot: "n
    select W
      case 0; print "  Sun at "x":"y":"z
      case 1; print "  Mon at "x":"y":"z
      case 2; print "  Tue at "x":"y":"z
      case 3; print "  Wed at "x":"y":"z
      case 4; print "  Thu at "x":"y":"z
      case 5; print "  Fri at "x":"y":"z
      case 6; print "  Sat at "x":"y":"z
  end_select
  return
end

Update: I mentioned above that I had noticed that "if you start during an active day/hour occassionally a shot might get taken just outside the active window - one of mine was 3 seconds after the end time". Because the script is now displaying the exact second the shot is taken, I found that the time indicated in the EXIF data of each JPG may indicate times that are from 1 to a few seconds later. This must be due to the exposure time, processing and time required to save to the SD Card. Therefore, the script doesn't need to changed because it is shooting the intervals at the correct time.

My final test at midnight was successful. This was the one to check taking a photo series that spanned over more than one day.
« Last Edit: 09 / February / 2011, 00:32:45 by SkyWalker9 »

Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #23 on: 09 / February / 2011, 00:46:15 »
I didn't get home from work till 8pm and it's now 11:35pm, first chance I've had to look at the data.  The script ended at 6:58pm so it was a success!  I'm excited to see the UI of your newest script; I'm loading it here in a bit. 

One thing I noticed when I first checked the camera...what I wanted to do, was leave the script running since it was "off" time and review the timestamps of the pictures to see if it stopped at 7PM.  I pressed the "alt" key to get out of the CHDK menu and then the Play button on the camera.  I used the display and left right buttons to see the time of each pic.  Then I pressed the shutter button to get back to a "camera view" mode and then the "alt" button to get back into the CHDK mode.  From here, there is indication that the script is running, at least I think it is because the title of the script is displaying, but all the information about the interval, time it will shoot, etc, etc is cleared from the screen.  There's no 'clear indication' that the script is still running in the background...can the info text be updated on a regular basis so that when you get out of the CHDK alt area and return that the info will come back up? 

I'll set up the camera and run tomorrow...Wednesday test! 

Thanks and can't wait to check out the new script!


*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #24 on: 09 / February / 2011, 10:28:17 »
...can the info text be updated on a regular basis so that when you get out of the CHDK alt area and return that the info will come back up?
Yes, the info could be redisplayed on a regular basis, but it could potentially impact the interval timing. I could have it do a redisplay during one of the wait steps (between days and hours - possibly if the intervals are greater than 5 minutes) while it is in a "hold" status, maybe redisplay once every 5 minutes. I'll create a test version and try a few tests to see if I can do it without impacting the interval, etc.

On my SX20 IS, the running script info gets displayed when I return to CHDK. I suspect that this might be due to the way CHDK is ported to the camera. After returning to CHDK you might try doing a simple background adjustment - on the SX20 IS the script window info for the running script gets redisplayed. I'm able to do this by adjusting the F-stop using my rotate dial - rotate right and then back.

Something that would be nice is to be able to stop CHDK while running and then restart the script where you left off. Using UBasic I don't know of any way. While the info can certainly be saved in a TXT file, I don't know of any UBasic commands that allow the file info to be read back in from the TXT file. Using LUA on the otherhand, I believe has this capabiliy. As I understand LUA capabilities, the TXT data can be read by a script to show the last run info - this could also be integrated into a LUA script (similar to the one I created using UBasic) and then you could continue on with the script if you wanted.

I designed this script in UBasic since that's what I have been using, but LUA is definitely something I want to try more in the future. I've only dabbled in some of it's capabilities, but certainly LUA has better/more capabilities. I wish I was proficient using LUA, but I'm not yet...
« Last Edit: 09 / February / 2011, 11:12:14 by SkyWalker9 »

Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #25 on: 09 / February / 2011, 22:18:08 »
You are awesome, Skywalker9!  I'm so happy with the script!  The "time of last shot" info is golden!  I think you've created a great script lots of people will find very useful!

I was thinking about how all this display feedback information would affect the speed of the program.  It probably wouldn't work out for people who need 1 or 2 second interval rates.  Then again, they could disable all the update information and speed it up...maybe that could be a setup option!  Jeez, I'm full of ideas. :D  Lots of ideas and too little knowledge to implement them.  Sign of a good project manager?  LOL!     

For some reason, my manual focus will go from infinity to 50 feet or somewhere in there...it's slightly over the 20' marker and I was sure that I locked it at infinity.  I start up the camera, it goes into CHDK automatically, I click the 'alt' button to get out of CHDK, I set the MF to infinity in Av mode and then press the "alt" key to get back into CHDK and click the shutter to start the script.  I'm never around when it refocuses...I'll have to monitor it closer.  Think I"m missing a button press? 

I think from here on out, I'm going to not touch the camera and let it do it's thing till Sunday night.  I will still let you know if it makes it through all 7 days for a complete test.  My demolition project will be starting in the next two weeks, so I'll be sure to post a link of the final product in here!  It's a 4 month project, so be looking for it in May or so. 

BTW, where are you located?  I'm in Wichita, KS, USA.

Thanks so much, I couldn't have done this on my own!

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #26 on: 10 / February / 2011, 18:53:34 »
...The "time of last shot" info is golden!  I think you've created a great script lots of people will find very useful!
Well...I'm in the final testing stages of a new capability for this script. I have one final test left for midnight tonight. If all goes well I should be able to post it in the "Completed scripts" forum tomorrow so that it will be easier for others to find.  Updated:  http://chdk.setepontos.com/index.php?topic=6105.msg61255#msg61255

The capability is the ability to select individual days of the week rather than a range of days. You'll still be able to select a "range of days" by selecting all of the days in the "range" you want shots. After thinking about the amount of space needed for photos and the need to avoid shooting on some days, I thought this would be something that would be useful to a lot of other people. For example, lets say you only wanted to shoot photos on Monday, Wednesday & Friday. If you used the range of days method you would have a series of photos from Tuesday & Thursday that wasted space on your SD card.

The trickiest part was being able to efficiently capture which days were picked and then figure out how to display them (for each shot) while keeping the interval times as short as possible. The answers came to me early in the morning. So far I'm pleased with the results & info displayed.

BTW, where are you located?  I'm in Wichita, KS, USA.
Near Niles, Michigan

On another note, I just realized I had seen one of your videos recently in this posting: http://chdk.setepontos.com/index.php?topic=5667.msg60299#msg60299
Well done!
« Last Edit: 11 / February / 2011, 18:32:08 by SkyWalker9 »

Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #27 on: 13 / February / 2011, 23:25:31 »
Hey, I'm back.  I've let the camera run for the past 4 days and it's worked like a charm.  I don't have your latest code in there, so I'm going to load it now and let it run for a week and check out the results.  Are there any specific long term tests you'd like me to try since I have a power adapter? 

Glad you liked my demolition timelapse, hopefully the one I'm doing of a large deserted building in my town will turn out as nice.  :D  Thanks to your code, I think it will be perfect!



*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #28 on: 14 / February / 2011, 00:42:43 »
Hey, I'm back.  I've let the camera run for the past 4 days and it's worked like a charm.  I don't have your latest code in there, so I'm going to load it now and let it run for a week and check out the results.  Are there any specific long term tests you'd like me to try since I have a power adapter?
Good to hear that testing has been good so far. I don't have any specific test scenarios, so I'd recommend you just set it the way you would normally like it to run and see what happens.

I ordered a power adapter and it should arrive this week sometime, so I'll be able to run "odd" tests to see if I can find any bugs. The last couple of days I've been testing another update to this script. This updated script provides the user with the capability to set the Start and End dates for the script to begin and end. It does this by setting the "Number of Shots" to 0. This tells the script to shoot the maximum number of shots using the interval, days of week, and the hours/minutes  selected during the dates indicated. This avoids having to calculate how many shots would fit in the days & times using the selected interval. It is left to the user to insure there will be enough free space available on the SD card.

Since there are only a limited number of parms available in UBasic, the dates are setup in a manner similar to the DOWs - in real time and using the Left, Right and Set buttons. I also integrated a "wrap-around" feature to make it easier to setup the day, month and years. For example, if you try to change the month beyond "Dec", then the script will wrap-around to "Jan"; if you attempt to decrease below "Jan", then it will wrap-around to "Dec". The years allowed are currently set from 2011-2020. The number of days in February allows for leap years. I have the Start & End dates begin with the current day/month/year of the camera.
« Last Edit: 14 / February / 2011, 10:53:41 by SkyWalker9 »

Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #29 on: 20 / February / 2011, 22:51:48 »
I've let the Feb 11th version of the script run for 9 days now and it's doing just fine.  I'm going to set up tomorrow or the next day at the demolition site!     

I see you've uploaded a final version of the code; I'll have to check that out soon. 

Thanks for all your help!

 

Related Topics