Introduction: Waterproof Raspberry Pi Powered Wifi DSLR Webcam for Time Lapses

I'm a sucker for watching sunsets from home. So much so that I get a bit of FOMO when there's a good sunset and I'm not home to see it. IP webcams yielded disappointing image quality. I began looking into ways to repurpose my first DSLR: a 2007 Canon Rebel XTi that still takes decent photos. This Instructable covers building:

  • a waterproof Pelican Case enclosure
  • Raspberry Pi camera trigger and wifi uploader
  • simple web server to access the images from the web

There are several existing guides that show how to build a waterproof enclosure for time lapses, but they tend to focus on a set up that can survive In The Wild for 3-4 months. Because this project is at my house, the parameters are slightly different: power and wifi are both available. Not needing to worry about power freed my time to concentrate on utilizing the wifi to upload a new photo to the web every minute instead of pulling them off the card manually (as is common in more traditional long timelapse setups).

Note: this project was built in September 2017, and the Instructable draft soon after. The camera ran for a very solid 4 months until a power surge burned the Pi. I found the draft today and thought it still might be a fun read for folks.

Step 1: Raspberry Pi Captures Images and Uploads Them to the Web

This aspect had the most unknowns for me, so I started with here.

Initially, I connected my Rebel via USB to an extra laptop and used gphoto2 to capture images programatically. gphoto2 allows you to capture images in JPEG or RAW and transfer them immediately to the host computer after capture, which is important to quickly upload the photo to the web.

My proof of concept was a simple nodejs script for my Mac Mini that captured images once a minute and uploaded them to Amazon S3. To reach outdoors from the Mini, I bought the longest USB cord I could find--but it wasn't feasible. While I had heard that a Raspberry Pi would be useful for something like this, I didn't have much experience using them. I installed Raspbian and crossed my fingers and checked on gphoto2 support for the Raspberry Pi -- full support!

The next iteration called for a wifi-enabled Raspberry Pi to replace the Mac Mini completely. In broad strokes:

  1. Download the latest Raspbian image
  2. Insert a micro SD card and unmount it (`diskutil unmountDisk /dev/disk2`)
  3. Use `dd` command line utility to write the image to the card (`sudo dd if=2017-09-07-raspbian-stretch.img of=/dev/disk2 bs=4m` -- takes 30-60min)
  4. Touch `/ssh` on the file system to enable SSH on boot (detailed guide to SSH / Wifi)
  5. Install gphoto2 using the Raspberry Pi install script (takes 60-90 minutes)
  6. Set a cron job to run once a minute and use gphoto2 to capture a photo
  7. Use curl in that same cron job to upload the photo to a simple server running on Heroku

The cron config is very simple:

# m h  dom mon dow   command
* * * * * bash /home/pi/ 2&1 >> /home/pi/cron.log

set -e
gphoto2 --auto-detect --capture-image-and-download --force-overwrite
curl -F "image=@capt0000.jpg" <a href=""></a>

While the original proof of concept handled uploading to S3, I decided it was far easier* to simplify what the Raspberry Pi was in charge of and kick the S3 and post-processing steps to a simple web server running on Heroku. This curl command takes the captured image and posts it to that server.

* by easier, I mean I was sick of waiting for packages to compile on the Pi.

Step 2: Camera in Weatherproof Pelican Case

Now that the the camera/RPi solution was reliably able to take photos and upload them, I began working on a case that will keep all the electronics safe in the rain.

Load the photos one-by-one and hover over the outlined white box for a description of the part/step.

Step 3: Real World Setup

The final step was mounting the Pelican case on my back railing and verifying that everything worked.

First Time Author Contest

Participated in the
First Time Author Contest