Basic Intervalometer
Jun 2017
So here is a command line to use gphoto2 as a basic intervalometer. You can type this in at the terminal, or you could use a python script to generate this command line based on user input.
gphoto2 --interval=10 --frames=10 --capture-image-and-download
So in this example, we are going to capture 10 frames, at an interval of 10 seconds, and download each file.
Time-lapse mode enabled (interval: 10s). Capturing frame #1/10... Waiting for next capture slot 9 seconds... New file is in location /store_00020001/DCIM/100CANON/IMG_5934.CR2 on the camera Downloading 'IMG_5934.CR2' from folder '/store_00020001/DCIM/100CANON'... Saving file as IMG_5934.CR2 Deleting file /store_00020001/DCIM/100CANON/IMG_5934.CR2 on the camera Deleting 'IMG_5934.CR2' from folder '/store_00020001/DCIM/100CANON'... Capturing frame #2/10... Waiting for next capture slot 9 seconds... New file is in location /store_00020001/DCIM/100CANON/IMG_5935.CR2 on the camera Downloading 'IMG_5935.CR2' from folder '/store_00020001/DCIM/100CANON'... Saving file as IMG_5935.CR2 Deleting file /store_00020001/DCIM/100CANON/IMG_5935.CR2 on the camera Deleting 'IMG_5935.CR2' from folder '/store_00020001/DCIM/100CANON'... Capturing frame #3/10... Waiting for next capture slot 9 seconds... New file is in location /store_00020001/DCIM/100CANON/IMG_5936.CR2 on the camera Downloading 'IMG_5936.CR2' from folder '/store_00020001/DCIM/100CANON'... Saving file as IMG_5936.CR2 Deleting file /store_00020001/DCIM/100CANON/IMG_5936.CR2 on the camera Deleting 'IMG_5936.CR2' from folder '/store_00020001/DCIM/100CANON'... etc..
It can be see that after the image is downloaded, it is deleted also. If you don't want the files deleted, use the following syntax.
gphoto2 --interval=10 --frames=10 --capture-image-and-download --keep
Here are the 10 files I captured
IMG_5934.CR2 IMG_5936.CR2 IMG_5938.CR2 IMG_5940.CR2 IMG_5942.CR2 IMG_5935.CR2 IMG_5937.CR2 IMG_5939.CR2 IMG_5941.CR2 IMG_5943.CR2
WARNING!!! If you pick a short interval (say 3 or 4 seconds) then the Raspberry Pi may not be able to write the files fast enough, and you may end up with dropped frames (if you use the –keep switch, they will still be on the camera memory card though).
If you need a relatively short interval, then just use the following syntax to capture the files, then download them at the end of the capture.
gphoto2 --interval=3 --frames=10 --capture-image
Here you can see the files are captured, but not copied or deleted (you don't have to use the –keep switch if you are not downloading at the same time).
Time-lapse mode enabled (interval: 3s). Capturing frame #1/10... Waiting for next capture slot 2 seconds... New file is in location /store_00020001/DCIM/100CANON/IMG_5964.CR2 on the camera Capturing frame #2/10... Waiting for next capture slot 2 seconds... New file is in location /store_00020001/DCIM/100CANON/IMG_5965.CR2 on the camera Capturing frame #3/10... Waiting for next capture slot 2 seconds... New file is in location /store_00020001/DCIM/100CANON/IMG_5966.CR2 on the camera