timelapse script for specific times of day shooting

Started by Skurk, March 08, 2014, 11:11:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Skurk

First I'd like to thank the people behind ML for all the hard work. Its awesome.

I got a friend to write me this script for doing longterm timelapse where the camera a 550d would only take photos for a period of time every day. My friend is a bit rusty at writing scripts and not familiar with C. I'd really appreciate any feedback on the script. Are we anywhere close to something working here meaning is it safe to run? I have pasted the code in the bottom of this topic. Hope I have done it the right way. Be nice to me this is my very first forum topic ever though I'm a longtime lurker.

I've now stumbled on this thread http://www.magiclantern.fm/forum/index.php?topic=9379.msg89393#msg89393 which is pretty much what I wanted to be able to do. That brings me to dmilligans module adv_int.mo http://www.magiclantern.fm/forum/index.php?topic=8431.75 I can see how you might be able to make that module do that for you but I can not for the dim brain of mine make it turn the intervalometer on and off. I have poked and prodded that module to no avail. They other day I decided to install the newest nightly and adv_int.mo and was met with the wrong version thing:o That gave me some much needed spare time away from time-lapse pondering ;D I hope a working version becomes available soon.

In the meantime please have a look at the script.

And thanks again for making all this possible with ML.


/*
@title Timelapse Script
*/


     /* ALL TIMES ARE IN SECONDS!*/
int shooting_Interval = 300; /* The time between photos taken. 300 == five minutes */
int timelapse_Stop = 21600;  /* Timelapse stops X seconds before midnight. 21600 == 6 hours before midnight - 6 pm*/
int timelapse_Interval;      /* Seconds the timelapse should run. Gets defined in timelapse() to allow for a custom first day*/
int timelapse_Sleep = 43200; /* Seconds the camera should sleep between timelapses. 43200 == 12 hours. */
int days_To_Run = 3;      /* Number of days the Timelapse script should run. */

printf("The Timelapse script has started\n");
struct tm * get_time();
first_day();
run();

struct tm
{
int hour;
int minute;
int second;
int year;
int month;
int day;
}

first_day
{
int secondsLeft = 60-second;   /* Seconds left of this minute */
int minutesLeft = 60*(60-minute);   /*Minutes left of this hour (in seconds)*/
int hoursLeft = 60*(24-hour);   /*Hours left of this day (in minutes)*/
int secTillMn = secondsLeft + minutesLeft+(60*hoursLeft); /*Total seconds left till midnight*/
timeLapse_Interval = secTillMn - timelapse_Stop;          /* START THE SCRIPT BEFORE THE HOUR THE TIMELAPSE SHOULD STOP OR YOU WILL RUN INTO      PROBLEMS, SINCE THE SCRIPT DOESN'T ACCOUNT FOR NEGATIVE NUMBERS */
}

run {
for( int i = 0; i == days_To_Run; i++){
timelapse();
}
}

timelapse {
while (timelapse_Interval > 0) {
shoot();
}
timelapse_Interval = 43200;  /* The timelapse runs for: 43200 == 12 hours */
sleep(timelapse_Sleep);
}

shoot {
void takepic();
printf("Picture taken!\n");
timelapse_Interval = timelapse_Interval - shooting_Interval;
printf("There is now " + timelapse_Interval +" seconds till Timelapse stops.\n");
sleep(shooting_Interval);
}

dmilligan

I'm assuming you've got AC power. There's no way the camera would last more than a day or two on battery power if you left it on. ML cannot make the camera go to 'sleep' or wake the camera up from 'sleep', the sleep() functions are really more like a delay. For the script to keep running, the camera has to remain on.

I just updated adv_int so it should be working now. You can ramp interval time and the max interval time is 8 hours and you can loop keyframes so if you don't mind a single random picture in the middle of the night you could make it work. It would take a bit of calculating to make it work out, but it's certainly possible. Basically you would ramp the interval time up to 8 hours at night or whenever it is you don't want to take pictures, and then back down to normal during the day.

Still there's a lot that could go wrong. If you loose power you're pretty much screwed.

IMO long term timelapse is best done by external control. An arduino or something similar that would wake the camera up and tell it to take a picture every once in a while. That's a lot more robust and you don't have to rely on AC power b/c the camera can actually go to sleep.

Skurk

Thanks for making the updated version available. Nice work i really like the integration with the simple intervalometer.

I've made a box like this http://www.instructables.com/id/How-to-make-a-long-term-time-lapse/ and connected it to a leisure battery. My friend who wrote the script did mention that the sleep function is probably more like a delay function. I don't mind that the camera isn't turned off. The battery seems to last a very long time. As you say a lot can go wrong. My thinking was if you make it as simple as possible it would minimise chances of things going wrong. So it would just be a camera running ML intervalometer. No canon intervalometer, no arduino. Just ML running things. But I might be wrong. I have had ML intervalometer running for some weeks and its pretty steady. It did stop counting how many photos it had taken but it kept ticking away.

So if I wanted say to do a high and low tide time-lapse over a month. It would be great to make the camera only take photos in day time. Or like the thread mentioned before with construction time lapses where night photos are not needed. It would be great to have an "intervalometer on/off timer connected to global time" function in the intervalometer or adv_int.mo.

In the meantime I'd be happy to use my friends script. What do you think of it would it work? Am I to careful should I just get on with it and run it!



Cheers

dmilligan

that script is not going to run, you're going to get all kinds of syntax errors. Also, you're going to have to find an old build with scripting support, b/c right now there isn't any (I think maybe sometime around April/May 2013).

The way adv_int is designed, it doesn't make a lot of sense for an option to turn the intervalometer itself off and on, adv_int runs under the intervalometer and is 'subservient' to it. If you turned the intervalometer off, adv_int would also be off. Really all you need is a longer maximum for the interval time. So all you would do is change the interval time to say 12 hours and then change it back.