Long-Exposure Continuous Shooting (for star trails or other uses) - Completed and Working Scripts - CHDK Forum  

Long-Exposure Continuous Shooting (for star trails or other uses)

  • 39 Replies
  • 11518 Views
Advertisements
Hello!
I have recently figured out how to write a script that I've been meaning to do for a while.
It allows you to take any number of pictures, each with an exposure between 1 and 60 seconds (you pick the number of seconds)

This is useful for star trails or other astrophotography uses.
It was tested on the SD960IS, firmware 1.01d, but it should work on any camera.
This is written in LUA, so if you want it, copy it, paste it into a text editor (not a word editor), and save it as "whatever_you_want_to_call_it.lua"
Or, you can download the attachment.

Code: [Select]
--[[
@title Long-Exposure Continous Shooting
@param a Exposure Time (Seconds)
@default a 10
@param b Number of Shots
@default b 10
]]

--This is an array of TV96 values for exposure tomes 1-60 seconds.
--It is indexed by the exposure time in seconds.
expVAL = {0, -96, -152, -192, -223, -248, -270, -288, -304, -319, -332, -344, -355, -366, -375, -384, -392, -400, -408, 415, -422, -428, -434, -440, -446, -451, -456, -462, -466, -471, -476, -480, -484, -488, -492, -496, -500, -504, -507, -511, -514, -518, -521, -524, -527, -530, -533, -536, -539, -542, -545, -547, -550, -552, -555, -558, -560, -562, -565, -567}

--This is the main part of the script.
for i = 1,b do
print( "Shot", i)
set_tv96_direct( expVAL[a] )
sleep( 100 )
shoot()
sleep( 1000 )
end

Hope you enjoy it!
« Last Edit: 20 / January / 2013, 16:38:36 by bananaman »

*

Offline lapser

  • *****
  • 1093
Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #1 on: 20 / January / 2013, 17:31:33 »
Great job! You solved the problem of converting seconds to tv96. Here's a couple of suggestions:

What happens if the user enters 61 seconds? How about -1 seconds?

If you indent blocks of code, i.e. between "for" and "end", it makes it easier to read.

By using shoot(), you'll be re-focusing for each shot. You'll need to be in aperture priority mode, and fixed ISO to get consistent exposure for all shots.

It will take several seconds between shots this way, where the shutter is closed. This will produce dotted or dashed line star trails.

To solve both of these problems, you could shoot in continuous mode with just press("shoot_full"). If you want to count the number of shots, try using the function: get_exp_count().
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #2 on: 20 / January / 2013, 17:37:48 »
What happens if the user enters 61 seconds? How about -1 seconds?
Looks like a great place to use the @value feature added in the 1.2.0 dev branch.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #3 on: 20 / January / 2013, 17:58:58 »
Looks like a great place to use the @value feature added in the 1.2.0 dev branch.
Good idea! I'll have to use it in the future. It looks like this option would do the trick:
@range x n m
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #4 on: 20 / January / 2013, 18:03:15 »
Looks like a great place to use the @value feature added in the 1.2.0 dev branch.
Good idea! I'll have to use it in the future. It looks like this option would do the trick:
@range x n m
Even better for this application.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #5 on: 20 / January / 2013, 22:38:30 »
I've re-done it with range, and setting ISO.
I don't need to screw with the aperture, as mine is one of the cameras that uses an ND filter.
Here is the new code:
Code: [Select]
--[[
@title Long-Exposure Continuous Shooting
@param a Exposure Time (Seconds)
@default a 10
@range a 1..60
@param b Number of Shots
@default b 10
]]

--This is an array of TV96 values for exposure times 1-60 seconds.
--It is indexed by the exposure time in seconds.
expVAL = {0, -96, -152, -192, -223, -248, -270, -288, -304, -319, -332, -344, -355, -366, -375, -384, -392, -400, -408, 415, -422, -428, -434, -440, -446, -451, -456, -462, -466, -471, -476, -480, -484, -488, -492, -496, -500, -504, -507, -511, -514, -518, -521, -524, -527, -530, -533, -536, -539, -542, -545, -547, -550, -552, -555, -558, -560, -562, -565, -567}

--This is the main part of the script.
for i = 1,b do
print( "Shot", i)
set_iso_real( 80 )
set_tv96_direct( expVAL[a] )
sleep( 100 )
shoot()
end

Hope you like it!
Thanks for the suggestions!

*

Offline lapser

  • *****
  • 1093
Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #6 on: 21 / January / 2013, 01:42:37 »
Code: [Select]
--[[
@title Long-Exposure Continuous Shooting
@param a Exposure Time (Seconds)
@default a 10
@range a 1..60
@param b Number of Shots
@default b 10
@range a 0..9999
]]

--This is an array of TV96 values for exposure times 1-60 seconds.
--It is indexed by the exposure time in seconds.
expVAL = {0, -96, -152, -192, -223, -248, -270, -288, -304, -319, -332, -344, -355, -366, -375, -384, -392, -400, -408, 415, -422, -428, -434, -440, -446, -451, -456, -462, -466, -471, -476, -480, -484, -488, -492, -496, -500, -504, -507, -511, -514, -518, -521, -524, -527, -530, -533, -536, -539, -542, -545, -547, -550, -552, -555, -558, -560, -562, -565, -567}
--This is the main part of the script.
--MUST BE IN CONTINUOUS DRIVE MODE
if(b>0)then
  b=b+get_exp_count()
end
if(b>9999)b=b-9999 -- starts from 1 again
set_iso_real( 80 )
set_tv96_direct( expVAL[a] )
press("shoot_full") -- holds shutter down in continuous mode
repeat sleep(10) until get_exp_count()==b

Hope you like it!
Looks good. I modified it slightly to work in continuous mode, but haven't tested it. Be sure the camera is in continuous mode before starting the script, or it will take one picture and hang. You can add a test for this if you like.

get_exp_count() goes from 1 to 9999 on my camera, and back to 1. It corresponds to the file name of the jpg, i.e. img_9999.  So if you set the number of shots to 0, it will take pictures until you interrupt the script by pressing the shutter button.

If you want a shorter script, you can skip the shot counting and just end with:

repeat sleep(100) until false
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #7 on: 22 / July / 2013, 10:05:09 »
Beware...first time poster here.   ;)

I stumbled upon CHDK a few weeks ago and it has breathed life into my lowly A1200. :)  My thanks to everyone who works and has worked on this project! 

I'm no computer expert but I did manage to load v1.00C onto a card and I'm figuring out how to use some of the different scripts.  I was wanting something to give me long exposure times and also continuous shooting for catching lightening strikes and possibly star trails and meteors.  I have managed to get bananaman's scripts working including the one where he adds the ISO statement. 

When I try to use lapsers script, though, I run into an error...
Code: [Select]
:19: 'then' expected near 'b'
PRESS SHUTTER TO CLOSE

Is the A1200 simply not a camera that can use this script or is something 'off' about the script?

Thanks,
Ed

ETA:  Ok, my camera had the 100c firmware and I installed CHDK onto it...I'm learning.  ::)
« Last Edit: 22 / July / 2013, 14:42:37 by Intheswamp »


*

Offline ahull

  • *****
  • 634
Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #8 on: 22 / July / 2013, 11:41:46 »
Looks like you may not have copied the whole script... can you post what you tried to run here, and let us know which post you fond the script in, so we can get  a better understanding of the issue.

Re: Long-Exposure Continuous Shooting (for star trails or other uses)
« Reply #9 on: 22 / July / 2013, 11:53:59 »
The reply just above my first post...#6 I believe, is where I got the non-working script.  Looking at it I don't see an "end" statement (I guess it needs one?) so it may just be a portion of a script that Lapser intended to post as an example to bananaman...I may have taken something as being a script, that wasn't.  :-[  I'm guessing from the error I received that a 'then' statement is needed in line #19.  I'm no code write...just an 'anklebone connected to legbone' kind of guy.  :-[  Thanks for your help.  Ed
 
Code: [Select]
--[[
@title Long-Exposure Continuous Shooting
@param a Exposure Time (Seconds)
@default a 10
@range a 1..60
@param b Number of Shots
@default b 10
@range a 0..9999
]]

--This is an array of TV96 values for exposure times 1-60 seconds.
--It is indexed by the exposure time in seconds.
expVAL = {0, -96, -152, -192, -223, -248, -270, -288, -304, -319, -332, -344, -355, -366, -375, -384, -392, -400, -408, 415, -422, -428, -434, -440, -446, -451, -456, -462, -466, -471, -476, -480, -484, -488, -492, -496, -500, -504, -507, -511, -514, -518, -521, -524, -527, -530, -533, -536, -539, -542, -545, -547, -550, -552, -555, -558, -560, -562, -565, -567}
--This is the main part of the script.
--MUST BE IN CONTINUOUS DRIVE MODE
if(b>0)then
  b=b+get_exp_count()
end
if(b>9999)b=b-9999 -- starts from 1 again
set_iso_real( 80 )
set_tv96_direct( expVAL[a] )
press("shoot_full") -- holds shutter down in continuous mode
repeat sleep(10) until get_exp_count()==b

 

Related Topics