8 months ago

Motion time-lapse camera rig

Take stunning motion-controlled time-lapse frames with your Raspberry Pi and Arduino wherever you go

The small form factor, lower power use and the high-quality camera on the Raspberry Pi makes it an ideal platform for capturing time-lapse frames. In this project, we’ll use an Arduino Uno to control the motion of the Raspberry Pi Camera Module and to trigger the photos being taken.

The full article can be found in The MagPi 49 and was written by Spencer Organ.

You’ll need

Here's a Fritzing diagram you can refer to when building this project

Here’s a Fritzing diagram you can refer to when building this project

STEP-01 Connect pan-tilt kit

We start the project by connecting the Adafruit pan‑tilt kit to the Arduino. Use a breadboard to connect a common 5V and ground line from the Arduino. Connect the red power cables on each of the servos to the common 5V line, and the brown wire to the common ground. Use jumper cables to connect the orange signal wire of the pan servo to digital pin 9 on the Arduino, and the orange signal wire of the tilt servo to digital pin 8.

STEP-02 Connect the I2C display

Once we have connected the servos, we can add the I2C LCD display to the Arduino. For this, we’ll need four jumper cables. Connect the GND pin to the lower ground connector, then connect the VCC pin to the common 5V line we were using just now for the servo motors. Connect the SDA pin to the analogue A4 connector, and the SCL pin to the analogue A5 connector. We’ll need to download the libraries for the I2C LED display for the Arduino.

STEP-03 Connect the keypad

Connecting the keypad can be one of the trickiest parts of the build. There’s very good documentation for setting up and using a keypad. We’ll also need to download and install the keypad libraries from this page. We have connected the rows to digital pins 5, 4, 3, and 2, and the column pins to 13, 12, 11, and 10. If you find incorrect characters being displayed when you press the keys, you’ll need to try reversing the order of the row and column pins; with a bit of trial and error, this should be easy to fix.

STEP-04 Mount the Pi camera

Mount the Camera Module onto the pan-and-tilt mechanism. We have found that a longer camera connector cable works better and prevents the camera getting stuck. Connect the other end of the camera connector to the Raspberry Pi, with the printed side of the ribbon cable pointing towards the USB ports.

STEP-05 Connect the Nokia 5510 screen (optional)

This optional LCD display allows you to see how many pictures have been taken. There are two versions of this display, so we advise you to check the pin layout and adjust as necessary. Excellent documentation and links to the Python libraries can be found in the Adafruit guide.

  • LCC VCC is connected to 3.3V
  • LCD GND is connected to a ground pin
  • LCD D/C is connected to GPIO 23
  • LCD RST is connected to GPIO 24
  • LCD CS is connected to SPI CE0
  • LCD CLK is connected to SPI SCLK
  • LCD DIN is connected to SPI MOSI

There is an optional Backlight pin, which can be powered off the 5V from the Raspberry Pi or from the Arduino. If powering it from the Arduino, you’ll also need to connect the LCD GND to a ground pin on the Arduino.

STEP-06 Adding a relay and LED

We now come to the stage were we connect the Raspberry Pi and the Arduino together. The Arduino controls the movement of the servo motors, moving the camera as well as telling the Raspberry Pi when to take a photo. To ensure that the camera isn’t moving, we have included a three-second countdown and delay in the Arduino code before each photo is taken. The Raspberry Pi simply waits for a switch to be closed between GPIO 15 and ground. This switch is provided by a small 5V relay powered by digital pin 7 on the Arduino.

Depending on the relay you have purchased, you’ll first need to connect the coil to digital pin 7 and ground on the Arduino. The switch part of the relay can then be connected to ground and GPIO 15 on the Raspberry Pi. You should hear a satisfying click every time a photo is taken, as the relay closes and then opens again.

One final step is to add an LED to give a confirmation that a photo has been taken successfully. Connect the longer LED leg (positive) to a 270Ω resistor and then to GPIO 16, and the short leg to ground.

Here's the finished product as made by Spencer

Here’s the finished product as made by Spencer

  • Patrick Burns

    Why is the Arduino even needed? Why couldn’t the Raspi handle all tasks?

  • SOrgan

    Because it was a project designed to learn how to use an Arduino and program in c++