Total noob here, need help creating my script - General Discussion and Assistance - CHDK Forum

Total noob here, need help creating my script

  • 18 Replies
  • 3452 Views
Total noob here, need help creating my script
« on: 19 / November / 2012, 16:30:34 »
Advertisements
Hello all,

Thanks in advance for any help you can give me. I'm a teacher and I'm doing one of those near space weather balloon camera launches with my kids. I have a Powershot ELPH 300 HS. I've managed to install CHDK on it, but that's where my progress has stalled.

I want to create a script to use with the camera and the balloon, so the LCD doesn't need to be on, and after I start the script I want the camera to take pictures every five seconds with no flash. I've been looking through the documentation and I can't figure it out. Help...?


Re: Total noob here, need help creating my script
« Reply #1 on: 19 / November / 2012, 16:38:04 »
A good place to start would be using this forum's search function for the word  balloon.   There are quite a few thread and some really sophisticated applications.

For example, there is this thread from a Minnesota teacher doing the same thing at about this time last year :

http://chdk.setepontos.com/index.php?topic=6397.msg78330#msg78330

with a simple script file posted here :
http://chdk.setepontos.com/index.php?topic=6397.msg78414#msg78414

Unfortunately,  we never heard back from him but you might try to message him for advice ?

This might help too :  https://sites.google.com/site/ledzeppelinweatherballoon/home

Update :  just noticed your desire for a 5 second image rate.  That's going to eat battery power pretty fast - you might also look for an external power source / battery pack for your flight.
« Last Edit: 19 / November / 2012, 17:00:47 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Total noob here, need help creating my script
« Reply #2 on: 20 / November / 2012, 16:00:46 »
Thank you for your reply waterwingz! I can see from that other thread that you're very helpful.

I loaded the script up from the other thread and it seems to be working. I'm working with this code.


Quote
@title Intervalometer
@param a = interval (sec)
@default a 60
 
if get_mode = 0 then goto "in_rec"
  sleep 1000
  set_record 1
:wait_rec
  sleep 100
  if get_mode <> 0 then goto "wait_rec"
:in_rec

do
    s = (a*1000)+get_tick_count
    shoot
    sleep 2000
    set_backlight 0
    do
       sleep 500
    until (s <= get_tick_count)
until ( 0 )

:restore
    set_backlight 1
    sleep 1000
    end
 

I'd like to set the interval to 5 seconds. I'm assuming that's done by altering the first line of code to read "@default a 5" instead of 60? Also, how do I change it so the LCD display is shut off entirely when the camera is taking its pictures? I wont need that working at all as I won't be inside the cooler to look at the pictures as it goes up :)

Thanks again for your help!

edit: I'd also like to shut the flash off!
« Last Edit: 20 / November / 2012, 16:55:16 by RandomTeacher »

Re: Total noob here, need help creating my script
« Reply #3 on: 20 / November / 2012, 16:31:50 »
I'd like to set the interval to 5 seconds. I'm assuming that's done by altering the first line of code to read "@default a 5" instead of 60?
Yes.

Quote
Also, how do I change it so the LCD display is shut off entirely when the camera is taking its pictures? I wont need that working at all as I won't be inside the cooler to look at the pictures as it goes up :)
You can't do that from a script - what you see in my script is as good as it gets.   Lots of chatter about that over the years.  Canon P&S cameras with optical view finders can turn the display off with the DISP button but those without cannot.

One trick that does work on some cameras is to plug in a video connector (or a fake plug on some camera).
http://chdk.setepontos.com/index.php?topic=2075.msg19129#msg19129
The LCD display & backlight do not really cost you as much power as you might think though.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Total noob here, need help creating my script
« Reply #4 on: 20 / November / 2012, 16:58:57 »
Thank you for your reply. Is there a way to turn the flash off? I've been testing it, and sometimes the flash goes off when taking the pictures. I don't want it on at all when the  balloon goes up.

And I'll be sure to share my success or failure story with the board! I'm set to be launching on Friday of this week. Pretty much everything else is set for the project. Getting the script working for the camera (now pretty much done thanks to you!) and renting the helium are the last two things.

*

Offline lapser

  • *****
  • 1093
Re: Total noob here, need help creating my script
« Reply #5 on: 20 / November / 2012, 17:11:18 »
Yes, waterwingz is the greatest. I learned a lot of what I know about CHDK from his posts, and also how much I don't know!
Code: (basic) [Select]
@title Intervalometer
@param a = interval (sec)
@default a 5
 
if get_mode = 0 then goto "in_rec"
  sleep 1000
  set_record 1
:wait_rec
  sleep 100
  if get_mode <> 0 then goto "wait_rec"
:in_rec
a=a*1000
do
    s = a+get_tick_count
    shoot
    do
       set_backlight 0
       sleep 50
    until (s <= get_tick_count)
until ( 0 )

:restore
    set_backlight 1
    end
This should improve things a little as far as the backlight is concerned. Canon keeps turning the backlight back on with every shot, so you need to turn it off repeatedly to minimize the on time and battery drain. It still flashes briefly no matter what, which tells you that it's working at least.

One problem with this script is that it takes brightness measurements, changes exposure, and then sets the focus before each picture. This takes a lot of time, and drains the battery running the focus motors. Also, the time lapse may rapidly change exposure and "flash" as the camera swings around pointing at dark and light places.

I've been experimenting with doing time lapse all with "half_shoot" pressed. Try it without CHDK. Point the camera at something, press the shutter half way, then point the camera at something else. Press the shutter down full, but only let it up half way, not all the way. Then move the camera and take more pictures, always keeping the shutter half way down between pictures. It should hold the focus and exposure between shots.

What you're pointing at with the first half press is critical, since it sets the exposure and focus for the entire time lapse. For your balloon ascent, the focus would be set as close as possible, but with infinity still in focus. This is called the "hyperfocal distance."

If you're interested, I'll see if I can do a Lua program that does this. In the meantime, try my CShooter.lua script, which does this, but takes pictures in continuous drive mode at about 3 pictures per second for your camera. I can modify this script to take pictures at different rates.

You don't need to change the "default" in the script. After booting CHDK, press <alt> and then <set> twice. Load the desired script. Then scroll down to the parameter you want to change (down key), and use the left/right keys to set the value, i.e. 5 seconds.

Oops, here's the CShooter.lua link:
http://chdk.setepontos.com/index.php?topic=8971.msg93459#msg93459
« Last Edit: 20 / November / 2012, 17:18:04 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Total noob here, need help creating my script
« Reply #6 on: 20 / November / 2012, 17:15:42 »
Thank you for your reply. Is there a way to turn the flash off? I've been testing it, and sometimes the flash goes off when taking the pictures. I don't want it on at all when the  balloon goes up.
You pretty much have to turn it off with the Canon controls.  Use the flash symbol on the dial thingy in the center of the back of your camera.  One more thing to remember just before takeoff though ....  I assume you have been making a check list ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Total noob here, need help creating my script
« Reply #7 on: 20 / November / 2012, 17:21:21 »
This should improve things a little as far as the backlight is concerned. Canon keeps turning the backlight back on with every shot, so you need to turn it off repeatedly to minimize the on time and battery drain. It still flashes briefly no matter what, which tells you that it's working at least.
Unless I missed something,  my script does turn the backlight off after each shot.

Quote
One problem with this script is that it takes brightness measurements, changes exposure, and then sets the focus before each picture. This takes a lot of time, and drains the battery running the focus motors. Also, the time lapse may rapidly change exposure and "flash" as the camera swings around pointing at dark and light places.
Thanks for the reminder .. I was meaning to add something to set the focus to infinity ( i.e. greater than 10ft on a P&S) and then do an focus lock.

Quote
I've been experimenting with doing time lapse all with "half_shoot" pressed. Try it without CHDK. Point the camera at something, press the shutter half way, then point the camera at something else. Press the shutter down full, but only let it up half way, not all the way. Then move the camera and take more pictures, always keeping the shutter half way down between pictures. It should hold the focus and exposure between shots.

With a balloon shoot,  focus lock is good but you probably want the exposure to adjust.  Not much battery drain there anyway.

Quote
You don't need to change the "default" in the script. After booting CHDK, press <alt> and then <set> twice. Load the desired script. Then scroll down to the parameter you want to change (down key), and use the left/right keys to set the value, i.e. 5 seconds.
True - but that's one more thing to remember to do.  Setting the default is safer in this case.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline lapser

  • *****
  • 1093
Re: Total noob here, need help creating my script
« Reply #8 on: 20 / November / 2012, 17:26:23 »
Is there a way to turn the flash off? I've been testing it, and sometimes the flash goes off when taking the pictures. I don't want it on at all when the  balloon goes up.
You can turn the flash off with the camera buttons. I think it's the right button that goes to the flash menu. Check out page 85 in the manual:
http://gdlp01.c-wss.com/gds/6/0300004756/01/PSELPH300HS_IXUS220HS_CUG_EN_02.pdf
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Total noob here, need help creating my script
« Reply #9 on: 20 / November / 2012, 17:43:29 »
Yep  - I've been making a check list. It's getting pretty long now!

And yeah, I don't think the 5 second shot interval is going to cut it. I'm going to cut it to 30 and see how that goes. Worst case scenario I can revert to one shot per minute. I'm going to do some more endurance tests and let you guys know how it went later tonight or so.

 

Related Topics