Automated Canon eos photography under linux.

6 years 11 months ago #97838 by martinus
A.K.A. yet another one of martinus' python scripts.

I'm sure some of you may have tried this. I've been playing with it on and off for a while now but I managed to figure out the specifics of taking longer-duration shots in bulb mode with the camera tethered to a laptop via USB.

This should work just fine on a raspberry pi though I've not tested it.
#!/usr/bin/env python

# Tested in an eos500D in gphoto2 2.4.14, should work with similar models.
# Camera must be switched to Manual mode, single shot and tethered via USB.
# There seems to be a one second variation in exposure times and a four second
# download delay.
# Free for anyone to use, copy and edit.

import commands

# ===========================================================================
# Set your shot parameters here:
target_name = "example"
save_to = "/home/user/photos/{target}_'%Y%m%d%H%M%S.jpg'".format(target = target_name) # See gphoto man page for timestamp formatting.
shutter = "bulb"    # Bulb mode on the camera.
shot_limit = 3      # Total number of photos you want to take.
shot_duration = 90  # length of time in seconds of the exposure keep it above 10 secs.
iso_speed = 100

# ===========================================================================

shot_duration = shot_duration - 4   # account for exposure delay

cmd = ("gphoto2 "
       "--set-config bulb=1 "
       "--wait-event={dur}s "
       "--set-config bulb=0 "
       "--wait-event-and-download=1s "
       "--filename {loc}".format(dur = shot_duration, loc = save_to))

s = commands.getoutput("gphoto2 --set-config shutterspeed={shu}".format(shu = shutter))
s = commands.getoutput("gphoto2 --set-config iso={iso}".format(iso = iso_speed))

shot = 0    # initialise shot counter
while shot != shot_limit:
    print("shot {this_shot} of {total}").format(this_shot=shot+1, total=shot_limit)
    s = commands.getoutput(cmd)
    #print(s)   # Can be useful to debug.
    shot += 1

All I need now is for the tracking on the EQ6 to behave. :)
The following user(s) said Thank You: johnflannery

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum