My first Raspberry Pi project was to use it for time lapse photography during a snowstorm this week. The storm dumped over a foot of snow on much of the northeast, and about 9 inches at my house. The video below was my second attempt (the first is here).
On the Raspberry Pi side, this was pretty simple. I was just using the Pi as a timed remote shutter trigger, nothing very fancy. I would have preferred to use gphoto2, because it would allow a lot more interesting things, like camera control, on-board processing, uploading photos in real time, and so on. It was not working for me, however. I got errors like this:
*** Error *** PTP I/O error *** Error *** An error occurred in the io-library ('Unspecified error'): No error description available
This is apparently a known issue, and may have to do with Raspberry Pi device support, though it also looks like this gphoto issue. This blog gets around it by resetting the serial connection, but I couldn’t get that to work consistently. I tried compiling the latest version of gphoto2 on the Raspberry Pi as well, but that didn’t fix my problem.
Some people have triggered the shutter release directly with the GPIO pins (or even embedded a Raspberry Pi in their camera), but I already had a serial port cable I had built, so I hooked it up to a USB-serial adapter and used that.
Triggering the pin is just a matter of setting RTS high. In python:
s = serial.Serial('/dev/ttyUSB0') s.setRTS(True) ; time.sleep(0.2); s.setRTS(False)
Timing seems to matter; sleeping 0.1 s does not trigger. For longer exposures, I had to sleep a bit longer to trigger consistently. (Here’s the simple script I actually used.)
Stitching the resulting images together into a movie is straightforward with ffmpeg or avconv. The only trick I found was that you need to renumber the images to start at 1, at least with the version of avconv I have on my Ubuntu machine. I used 10 frames per second, with the frames taken 5 minutes apart. A slower framerate than 10 fps seems too jumpy to my eyes. I would probably increase the shooting rate by a factor of 2 or more next time for more flexibility.
Another relevant site for shooting with linux is tethered shooting in Ubuntu. This has a bit about gphoto2 and uses Darktable as an interactive application. If I actually get photo2 working, I may try something like that.
Eventually, I am interested in using the Raspberry Pi for astrophotography. Triggering exposures is a start, but even more interesting would be using it to drive autoguiding and telescope control. It’s a great little platform, even if device support is sometimes frustrating.