Make a Time Lapse Camera with a Pi Zero

Shaun TaylorFeatured, Play0 Comments

Pi Zero camera on tripod

I participated in the 2016 Diabetes Walk at the NCSU Centennial Campus. I had this vision of walking with an LED matrix strapped to me so that my sponsors could update the display in real-time as I walked. I figured I would archive the whole thing with a time lapse video recorded on a homemade device. That was a bit too grand a vision for the time I had available, but the time lapse camera idea lived on, so I recently tackled that project.

Project Description

This project uses one of the super cheap and diminutive Raspberry Pi Zeros, a 3-D printed case, and some electronic components to make a dedicated time lapse camera. Adafruit has complete (and I mean complete) build instructions for this camera.

Materials List for the Camera

  • Raspberry Pi Zero, $5 from adafruit (seriously, only $5!)Materials required for the camera
  • Raspberry Pi Zero camera cable, $5.95 from adafruit
  • Raspberry Pi camera, price varies depending on bundle, but expect about $30
  • MicroSD card, 4GB+ Class 10 (I used a 16GB): technically, class doesn’t matter much, as it measures a sustained write rate, which doesn’t correlate well to requirements of a Pi. But as a rule of thumb, spring for a name brand, class 10 card to increase your confidence level.
  • PowerBoost 500 charger, $14.95 from adafruit. You can optionally power the camera with a normal power supply if you have an outlet handy. For applications longer than 2 hours, you’ll need an external power supply anyway. I’ve been using a Gorilla Gadgets brick I got from Woot a few years ago.
  • 500 mAh lithium-ion battery, $5.95 from adafruit
  • 6mm slim tactile push button, about $0.25
  • Slide switch, about $0.50
  • LED sequin, about $0.75

Note: you can get many of these items (especially components) much cheaper from places other than adafruit, but adafruit offers some of the most detailed and straightforward learning materials and projects available, and I prefer to support their work by paying full price for everything from them. And you should, too. 🙂

Materials List for the Camera Build

  • Soldering iron and solderMaterials required for the build
  • Desoldering wick or solder sucker
  • Third hand tool
  • 8 lengths of stranded hookup wire (2.5-3.5″)
  • Wire cutters / strippers
  • 3D printer and PLA filament
  • Raspberry Pi (any model except Zero)
  • Raspberry Pi power supply
  • Wireless dongle or Ethernet cable
  • Monitor
  • USB keyboard and mouse (wireless sets will also work)
  • MicroSD card reader
  • Win32DiskImager
  • Craft glue / hot glue
  • Mounting putty

Printing the Time Lapse Camera Case

You can 3D print the camera case with the model available from Thingiverse. I printed mine in PLA, and the fit was perfect. You can also print in ABS, but you’ll need to increase the model size by 2% to allow for shrinkage. If you don’t have access to a 3D printer, check out 3D Hubs, a network of hobbyists and print shops where you can send items for printing. There are several good hobbyists in Raleigh that offer great service and prices that put larger printers like Shapeways to shame. While they don’t offer the same breadth of materials, you should be able to find someone nearby who can get you up and running quickly.

Configuring the Pi Zero Software

There’s an easy way to configure the software, and a hard way. The easy way is inflexible, and allows you only about 2.5GB of space to store your time lapse photos, but all it requires is downloading a pre-configured image and loading it on your microSD card. At the default resolution (you can configure this), this likely gives you much more room than you need, with enough space to capture over a days’ worth of photos snapped every 15 seconds. But I like flexibility, and I figure that an 8-megapixel camera is wasted at low resolution, so I wanted the option to capture high-resolution photos for extended periods of time. So I took the long approach, which consists of the below broad steps:

  1. Download the latest Raspbian Jessie Lite image, and burn it to your microSD card.
  2. Insert the SD card into your non-Zero Pi for easier configuration. Boot the Pi, expand the filesystem, enable the camera, enable SSH, enable networking, and change your default password.
  3. Reboot and install the WiringPi library.
  4. Load the timelapse camera script, and configure the Pi to launch the script at startup.
  5. Resize the boot partition. This is a fairly detailed process that involves configuring a setup system with Raspbian Jessie (full version), editing partitions with gparted, moving boot partition contents around, resizing partitions, and backing up / restoring data. Adafruit has step-by-step instructions for the entire process.

Constructing the Camera

I did a terrible job of documenting each step with photographs, but the general procedure is:

  1. Solder two wires to the EN and GND pins on the PowerBoost. Solder the other two ends to your slide switch.
  2. Solder two wires to the + and – pins on the PowerBoost. Solder the other two ends to the 5V and GND pins on the Pi Zero.
  3. Solder two wires to the LED sequin, and solder the other ends to the GPIO5 and GND pins on the Pi Zero.
  4. Solder two wires to the tactile button, and solder the other ends to the GPIO21 and GND pins on the Pi Zero.
  5. Connect the Pi Zero and the Pi camera with the Pi Zero camera cable.
  6. Install the tactile button, PowerBoost, and battery into one side of the case.
  7. Install the LED sequin, camera, cable, and Pi Zero into the other side of the case.
  8. Install the slide switch and snap the case parts together.

Adding these components to the case proved much more difficult than I expected. After a large number of false starts, I ended up tacking the switches and LED sequin in place with mounting putty, and then securing each piece with craft glue from a detail glue gun (the thin sticks, not the larger, standard ones).

This slideshow requires JavaScript.

Using the Camera

When a power supply is connected to the Pi, or when you turn the slide switch “on,” the Pi Zero will wake and begin happily snapping photos according to your settings. You can adjust resolution, time intervals, and image quality by editing the timelapse script added to your Pi Zero during software setup. When you’re done snapping photos, press and hold the tactile button until it turns off (it will light as you press it, then dim to indicate that it is shutting down). When the light goes out, turn the slide switch “off” and remove the SD card to review your images.

Demo of time lapse camera: my home-built He3D printer spitting out its second-ever print.

Leave a Reply

Your email address will not be published. Required fields are marked *