Using a Raspberry Pi as an Intervalometer for an old DSLR
Recently, I've revived an old D60 to use for astrophotography, and the major bummer faced by me was the absence of an inbuilt intervalometer. This meant that I could not keep it out and capture a bunch of images at night and then process them in the morning to make a star trail or a time lapse or whatever. So, I decided to use an old raspberry pi as an intervalometer.
An intervalometer does 2 things -
(1) Controls the camera (to capture)
(2) Does (1) at specific intervals.
To accomplish these, we use a software called as gphotos2 (for (1)), and a python script for (2).
To set up gphotos2 on your rpi, just follow the link below.
Next, to set it to take an image once every so much time, we use a python script to run the image capture command.
import subprocess
import time
from datetime import datetime
CAPTURE_INTERVAL = 120 # 2 minutes in seconds
def capture_image():
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"image_{timestamp}.jpg"
cmd = [
"gphoto2",
"--set-config", f"/main/settings/filename={filename}",
"--capture-image"
]
try:
subprocess.run(cmd, check=True)
print(f"[OK] Captured {filename} (saved on camera)")
except subprocess.CalledProcessError as e:
print(f"[ERROR] Capture failed: {e}")
def main():
print("Starting capture (saving to camera every 2 minutes). Ctrl+C to stop.")
try:
while True:
capture_image()
time.sleep(CAPTURE_INTERVAL)
except KeyboardInterrupt:
print("\nStopped.")
if __name__ == "__main__":
main()
Now all you've got to do is edit the interval (line 5) to how much ever you want (in seconds) and run the python program.
One of the common errors you would face is the camera being out of focus, especially if you are doing astrophotography, so i would suggest you first focus the camera, and then put it on MF and then start the script.
Comments
Post a Comment