DIY time-lapse photography

Time Travel

© Lead Image © 36clicks, 123RF.com

© Lead Image © 36clicks, 123RF.com

Article from Issue 173/2015
Author(s):

Using a few simple components and open source software, you can create impressive panoramic time-lapse photos. We guide you through the entire process, from building a simple panning rig to assembling photos into a time-lapse video.

Although time-lapse photography [1] is nothing new, it remains a popular genre with enthusiasts and amateur photographers alike. And it's easy to understand why: Time-lapse movies assembled from multiple photos can be beautiful and mesmerizing, offering a radically different view of the world around us.

Time-lapse photography is great as it is, but adding panning to the equation takes the concept to another level. The idea behind panoramic time-lapse photography is rather simple: Instead of remaining in a fixed position, the camera slowly pans in one direction (e.g., clockwise) while taking photos, which makes it possible to capture panoramic time-lapses of landscapes, city skylines, cityscapes, and so forth.

You may think that creating panoramic time-lapses requires expensive hardware and software. In fact, this type of photography is ideal for tinkering with hardware and putting open source software to creative use, so if you happen to have a Canon PowerShot compact camera or an Android smartphone, building a simple panning rig and creating time-lapse videos makes a perfect weekend project.

Building a Low-Tech Panning Rig

The first order of business is to build a panning rig. Although you can build a panning solution with Raspberry Pi or Arduino, you have a much simpler, cheaper, and decidedly low-tech alternative. The key component of this panning device is an Ordning egg timer [2] which can be procured at any IKEA store. When you wind up the timer, the top part slowly moves clockwise, which makes it an ideal panning platform.

Better still, the top plate of the timer is perfectly flat, so you can easily mount the camera on it (Figure 1). One way to do this is to attach a screw that fits the camera's tripod bush to the top plate. A common M6x16 flat-head (hexagon) screw, which can be found in many home improvement stores, will do the job. To attach it to the timer's top plate, use either strong glue or Sugru [3].

Figure 1: Building a panning rig requires only a few simple and inexpensive components.

Keep in mind, however, that the timer itself can support only a very light load and the entire solution is not very stable. This means that you can only mount a relatively lightweight camera like Canon PowerShot S90, and you should secure the entire setup during the capturing process.

Preparing the Camera

The main reason you need a Canon PowerShot series compact camera for this project is because this camera's capabilities can be extended using the CHDK open source firmware [4]. Among other things, CHDK lets you automate camera actions, like taking multiple photos at predefined intervals using uBasic and Lua scripts.

The simplest way to install CHDK on an SD card is to use the STICK tool [5], which can detect your camera's firmware version, fetch the appropriate CHDK build, prepare the SD card, and install CHDK on it. STICK is written in Java, so you need a Java Runtime Environment (JRE) installed on your machine. On Debian and Ubuntu, you can install OpenJDK JRE by running

apt-get install openjdk-7-jre

as root. Grab the latest version of STICK from the project's website and unpack the downloaded ZIP archive. In the terminal, switch to the resulting directory, and run the

java -jar stick.jar

command as root.

The process of installing CHDK on an SD card using STICK consists of a few simple steps. To find out the current firmware version of your camera and the appropriate CHDK build for it, drag and drop a photo taken with the camera onto the designated area in STICK (Figure 2). Then, press the Download? button to fetch the correct CHDK distribution and follow the rest of the steps to analyze and prepare the SD card. Lock the prepared card and insert it into the camera. When you power the camera on, you should see the CHDK overlay on top of the regular interface.

Figure 2: STICK makes it easy to install CHDK on an SD card.

Instead of using STICK, you can install CHDK manually, and load it when required. To do this, fetch the correct full CHDK distribution for your specific camera model and firmware [6], extract the downloaded archive, and move its content to the root of the SD card. Insert the card into the camera.

To activate CHDK, start the camera in the Play mode using the PLAY button. Press the MENU button, choose the Firm Update item, and press the FUNC.SET button. Press OK when prompted to update the firmware. This action doesn't actually update the firmware: It simply loads CHDK. Now press the shutter release button to turn the camera on, and you should see the CHDK overlay.

The next step is to create a uBasic intervalometer script for taking a specified number of photos at predefined intervals. The CHDK wiki offers a wide range of simple and advanced intervalometer scripts, including the one that is perfect for this project [7]. Listing 1 contains a slightly tweaked version of this script. Create a new text file, paste the code from Listing 1 into it, and save the file under the intrvl.bas name in the CHDK | SCRIPTS folder on the SD card.

Listing 1

Simple Intervalometer uBasic Script

01 rem Simple Intervalometer
02
03  @title Simple Intervalometer
04  @param a Interval (secs)
05  @default a 1
06  @param b Interval (1/100 sec)
07  @default b 0
08
09  i=a*1000 + b*10
10  if i<100 then let i=100
11  t=get_tick_count
12
13  rem Shot Counter
14  n=1
15
16  print "Time Lapse Photos"
17
18  sleep 1000
19  goto "shot"
20
21  :shot
22    t=get_tick_count
23    print "Shot", n
24    shoot
25    n=n+1
26    d= i - get_tick_count + t
27    if d<0 then let d=0
28    sleep d
29    goto "shot"

With all the pieces in place, mount the camera on the DIY panning rig. To launch the script and start the capturing sequence, turn on the camera and press the ALT button (usually it's the PRINT or SHORTCUT button), then FUNC.SET, choose Load Script from File, and use the file browser to select the INTRVL.BAS script. Then, specify the desired interval, wind up the timer, and press the shutter release button to start the time-lapse session (see the "Practicalities" box).

Practicalities

Before you start a time-lapse session, you might want to make some simple calculations to find out how many photos you need to take. For example, if you take 300 photos and you want the video to play at 30 frames per second, the length of the final movie will be 10 seconds (300/30=10). Provided you set the interval between shots to three seconds, the duration of the time-lapse session will be 15 minutes [(300*3)/60], and that's the value you need to use on the timer. Make sure you use a fully charged battery. If you have access to a wall outlet, you might want to use an AC adapter. Many Canon PowerShot models don't have an external power connector, but you can use a so-called adapter kit (e.g., ACK-DC30 [9] for PowerShot S90 and later models).

When it comes to exposure settings, shooting in the Aperture-priority mode and manual focus is the best option in most situations. This ensures that the final video has consistent depth of field and focus. Also, set your camera to shoot in the JPEG format only and select the medium image size (e.g., 2272x1704, or ~4MP).

Using an Android Camera for Time-Lapse Photography

That's all fine and dandy, but what if you don't have a Canon PowerShot camera? Open source software to the rescue: Using a simple Python script and the Scripting Layer for Android [8] software, you can turn practically any Android smartphone with a decent camera into a time-lapse photo device.

Use your Android smartphone to download the latest sl4a and Python For Android (Py4A) .apk packages from the project's website, then install both packages on your device. Open the Python For Android app and install Python by pressing the Install button.

On your machine, create a text file, enter the code in Listing 2, and save the file under the intervalometer.py name and move it to the sl4a | scripts folder on the Android device. To launch the script, start the sl4a app, select the intervalometer.py script, press the Run button, and specify the number of photos and interval between shots in seconds.

Listing 2

Python Intervalometer Script

01 import android, time, os
02
03 droid = android.Android()
04 counter = 1
05
06 title = "Number of Photos"
07 droid.dialogCreateAlert(title)
08 photoCount = int(droid.dialogGetInput("Specify number of photos to take:").result)
09
10 title = "Time interval"
11 droid.dialogCreateAlert(title)
12 interval = int(droid.dialogGetInput("Specify time interval is seconds:").result)
13
14 destDir = time.strftime("%Y%m%d-%H%M%S", time.localtime())
15
16 os.system("mkdir /sdcard/" + destDir)
17
18 droid.notify("Intervalometer", "Directory /sdcard/" + destDir + " created")
19 droid.dialogDismiss()
20
21 while counter <= photoCount:
22     captureTime = time.strftime("%Y%m%d-%H%M%S", time.localtime())
23     captureLocation = "/sdcard/"+destDir+"/"+str(captureTime)+".jpg"
24     print "Picture taken: "+captureLocation
25     counter = counter + 1
26     droid.cameraCapturePicture(captureLocation,True)
27     time.sleep(interval)

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Workspace: Netbook Photo Tools

    Find out how to turn your netbook into a fabulous photo tool.

  • gPhoto

    Commercial software that lets users remotely control their camera usually is not available for Linux. gPhoto gives users a free alternative.

  • Workspace: Photo Helpers

    Capture, transfer, process, and manage photos using the Entangle, Rapid Photo Downloader, and GTKRawGallery applications.

  • PiCam Surveillance

    The new PiCam camera for the Raspberry Pi delivers image data with very little overhead, making it ideal for video surveillance applications. We find the bumps in the road you'll encounter and show you how to smooth them out with a few Linux commands and pipes.

  • Workspace – Revive Old Netbooks

    Death, taxes, and hardware obsolescence are all inevitable, but at least you can mitigate the latter by squeezing more productive use from older desktop machines, notebooks, and netbooks.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia