Firstly, I need to mention that I am a bare neophyte when it comes to programming, which has been making my attempts at figuring this problem out much more difficult. So explanations and examples that work up from the very basics will be greatly appreciated.
I am a graduate student in ecology trying to build a stable, self-contained time-lapse camera system to monitor forest canopy leaf dynamics in the Brazilian Amazon. The barebones of what I need to do is:
1.) Capture .dng images at set intervals from a CHDK hacked camera (I'm currently working with the ELPH 500 HS).
2.) Insure that these images are accurately timestamped to time set by a GPS clock (for syncing to time series data from a PAR light sensor).
3.) Automatically transfer these images to a large hard drive. This transfer could be by directly saving to the hard drive, or periodically transferring from the SD card followed by removal of the images copied over (i.e. endless memory type setup).
The system will be housed in a waterproof enclosure with external power (already designed and implemented). It needs to be able to be left unattended for months at a time, so I need to make it as robust and stable as possible.
Preferably capture timing would be similar to that currently implemented in the Ultimate Intervalometer script (
http://chdk.wikia.com/wiki/Ultimate_Intervalometer ). My first approach has been to try to use the CHDKPTP (
https://www.assembla.com/spaces/chdkptp/wiki/Home ) running on a Raspberry Pi (Raspbian OS), and the ultimate.lua script. GPS time could then be also set on the Raspberry Pi, and which would then need to be used daily to set the camera clock.
However, I have not been able to figure out how to consistently start and stop ultimate.lua from the CLI interface of CHDKPTP. Nor is it clear to me whether it is possible to create an automatic and stable system to stop the script at the end of each day, copy .dng images to an external hard drive connected to the RPi, clear images from the SD card, then start the cycle again the next day.
It seems like a better approach may be to somehow use the remoteshoot functionality via the CLI interface of CHDKPTP, combined with Linux’s crontab scheduler. This would do away with the need to transfer images from the CF card to the external HD, as well as the GPS time stamp issue (as the RPi local time will be already set to a GPS clock).
However, I don’t know how to go about writing code for a fixed scheduler that would either:
a.) start CHDKPTP (via crontab), connect to the camera, specify the filepath to an external HD, take one .dng, disconnect the camera, then repeat this all day with one camera restart per day;
or:
b.) Once per day start a script via crontab and CHDKPTP that would run within the CHDKPTP CLI interface all day, taking images at a fixed interval, then shut down and restart the camera at the end of the day.
Any suggestions for how to most easily use CHDK and CHDKPTP to create a system with these functions will be greatly appreciated.