Archive for March, 2009

DIY Outdoor Time-Lapse Photography

Update: Check out my latest Camera Axe project for a much more robust device that handles this.

There is a beautiful overlook of Worcester Massachusetts near my home.  I wanted to build a weatherproof camera box that automatically takes one picture an hour so I can make a time lapse video of the changing seasons.  One requirement was to keep it cheap and already had a Fuji F30 point and shoot camera.  If I had a Canon Powershot I would have used CHDK, but instead I hacked this together using an Arduino and my F30 camera.

The basic premise is to run an Arduino as a timer and once an hour it turns on a relay.  The reason for the relay is minimize power usage while the Arduino is running as a timer.  When the relay is powered up the servo and camera also get turned on. Then the Arduino uses a servo to turn on the camera and take a picture.  A 5 volt regulator is used to make sure the system could provide enough current to the servo and camera.  After seeing how little current my camera draws, I realized I could have used the 5 volt regulator on the Ardunio board, but the regulator is cheap so there is no harm in using it like I did.  You want to make sure the coil on the 5 volt relay you choose uses less than 40 mA or you will exceed the max current draw from an Arduino pin which could damage the Arduino after extended use.  If you want to use a relay with a greater than 40 mA current draw you should use a circuit like I described in this article.

This project only cost me $20 for the cheap lawn mower battery because I already had the camera, Ardunio, servo, 5v regulator, power plug, wire, wood, and paint. If you had just the camera and Arduino then a trip to Radio Shack and Home Depot would get you the parts you need for about $25.

Here is a block diagraph showing my system.

Here is a test video I made with it. The software I used to splice together the jpg images was the free JPGVideo. The video was just a quick indoor test of the system. I set it to take a picture every two minutes and it took about six hours for the ice to melt. This gave me about 180 images that I converted to this video. Next, I am going to use it to record a hardwood floor installation and then I’m going to setup outside to record the seasons. If I get any really cool videos I’ll try to update this article with them later.

Some of the most interesting data I collected during this project was the current use from the 12 volt battery.  The current draw when the relay is off is only around 0.07 mA.  I had no idea the Arduino used so little power (0.84 mW)!  The current draw when the relay and servo are on is around 210 mA.  The current draw with the relay, servo, and camera is around 300 mA. But remember these higher current draws only happens for a few seconds while you are taking a picture.

Below are some picture of the box I made. Note that these pictures were taken before I put on a plexiglass cover over the camera.  You can see I put a cheap lawnmower battery in there.  I’m not sure how long it will last, but I ran it for over 2 weeks and everything is still fine.  I suspect it would run much longer.  Just doing some napkin calculations yield 0.07 mA * 24 + 300 mA * 20/60/60*24 = 42 mA per day.  These batteries don’t say how many Amp hours they hold, but I’d be shocked if it’s under 10 which gives me 238 days of use.  This doesn’t matter to me though since my memory cards need to be swapped out every 2 weeks.  Another option for longer run times would be attaching a small solar panel to this system.

Here is the Arduino code I used:

// Maurice Ribble
// 3-5-2009
// http://www.glacialwanderer.com/hobbyrobotics
// This program uses a servo to triger a camera to take a picture every x minutes.
// The code depends on the built in servo library.  Arduino version 0013 has it.

#include 

// This is the pin you need to attach the servo to (only 9 and 10 are valid)
#define SERVO_PIN           9
#define RELAY_PIN           2

// These are the servo values that correspond to camera controls
// These will need adjusting for each setup
#define CAMERA_ON           100
#define CAMERA_PIC          80
#define CAMERA_NUEUTRAL     90

#define MINUTES_BETWEEN_PICS 1

Servo g_servo;

void setup()
{
  pinMode(SERVO_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);

  // Use serial to help debug
  //Serial.begin(9600);
  //Serial.println("Setup");
}

void loop()
{
  static int minutes = MINUTES_BETWEEN_PICS; // Start with a picture so we know it's working

  if (minutes >= MINUTES_BETWEEN_PICS)
  {
    digitalWrite(RELAY_PIN, HIGH);
    g_servo.attach(SERVO_PIN);
    g_servo.write(CAMERA_ON);
    delay(5000);
    g_servo.write(CAMERA_PIC);
    delay(5000);
    g_servo.write(CAMERA_ON);  // My camera turns off if you press on again
    delay(5000);
    g_servo.write(CAMERA_NUEUTRAL);
    delay(1000);
    g_servo.detach();
    digitalWrite(RELAY_PIN, LOW);

    delay(44000);
    minutes = 1;
  }
  else
  {
    delay(60000);
    ++minutes;
  }
}

One future improvement I might make is to add a light sensor so I can take pictures only during a sunset. Anyone else have other ides for improvements? Let a comment with your ideas.

I left out some of the details like the power plugs I used for my camera because every camera will be different, but if you have questions just ask and I’ll do my best to answer them.

Comments (11)