Tip 4. Time lapse slider – electronics

Updated April 15, 2017

Time lapse sliders make movies more dynamic. Several vendors make sliders commercially, but I figured it could be nice to make one myself. I have described the slider construction in a previous tech tip, and here follows the control part. I wanted to include control of the number of steps, the movement distance and duration of each step, and cable release for the camera shutter. I also wanted the use only one battery for the stepper motor, the electronics, and the camera.


The control of the slider is done by an Arduino Uno microcontroller. You may have to install standard headers on the Arduino circuit board.

Motor control shield

The Arduino Uno cannot supply the power to drive the stepper motor directly from the digital pins because of the high power consumption of the stepper motor. It is therefore necessary to use a motor control shield. The motor control shield must have power supply directly from the battery via the DC jack on the Arduino. I chose to use a stackable motor control shield from Adafruit (Motor Shield v 2.3, product ID 1438). This motor shield supports two stepper motors, but only one is used here.


The shield has 4 H-bridges. You can get cheaper motor drivers, but the Adafruit shield ($ 20) is well integrated with the Arduino Uno. Adafruit also provides good instructions and tutorials, which is important (for a beginner like me). Another good thing about the Adafruit Motor Shield is that it contains an experimental area in the middle for prototyping. This is very convenient because there is a need for an optocoupler to release the shutter of the camera. The optocoupler can be mounted in this prototyping area together with a couple of other parts. The whole setup is shown in Fig. 1. The electronic connections  are shown in Fig. 2.

Fig. 1. Arduino Uno and Adafruit Motor Shield in control box. Optocoupler mounted in prototyping area.

Fig. 2. The circuit for the stepper slider. The motor control shield shall sit on top of the Arduino Uno. Schematic done in Fritzing.

Shutter release

The shutter release is controlled by the Arduino sketch through digital pin 2. The small circuit is built into the prototyping area of the motor shield. Only two wires from the optocoupler contact the camera remote via a DIN-plug in the housing. The circuit diagram is shown in Fig. 2. In the original Sony cable release there are three signal wires:  Two leads (white and red) carry the signals for wake-up and autofocus. A metal screen carry the signal for shutter release . However, autofocus is not a preference in time lapse photography so the two leads for wake-up and focus can be connected together. This also saves time during shooting as the camera is always prepared for the next shot. The cross-connection can be done inside the female DIN-plug that connects to the male DIN-plug on the remote shutter release cable. The contact between all wires releases the shutter. Some third party cable releases has another lead instead of a metal screen. The camera should be set at manual exposure, preferably also with a manual lens (manual focus, manual aperture). See Gunther Wegner’s post about hacking an intervalometer/cable release here.

Red signal LED

The red LED that is connected to digital pin 13 on the Arduino and motor shield signals that the  shutter is activated and picture taken. It gives a short blink.


Since running a time lapse slider is power consuming it is wise to go for a well-sized battery. I chose a hand drill battery. The battery was an AEG 14.4 V Li-ion. The battery will be even at a higher voltage (exceeding 15 V) when fully charged. The Uno prefers 12 V but will handle up to 20 V. A 2-pole switch was inserted in the circuit to permit on-off. The plug to the Li-ion battery may cause problems since it has to be specially made for the battery (unless you are willing to sacrifice the drill). I made one specially by plywood that could fit into the groove of the battery contact.  I used two spring steel blades attached to the plywood that made electrical contact with the battery poles. A simple 2-pole DC plug  supplies the power directly to the Arduino DC Barrel Jack, which delivers power to both the Arduino, the motor shield, the optocoupler, and the stepper motor. To supply power through this route, remember to insert the VIN Jumper which looks like a tall black handle. It is placed next to the green Power LED on the motor shield.

The use of the same powerful Li-ion drill battery  is necessary for longer time lapse scenes to drive the camera. Sony a7 and a7r cameras are notorious for their small batteries. I included a voltage regulator LM2596 that could step down the voltage from 14.4 to 7.5 V. I chose a model with display to show the voltage to the camera. This voltage regulator is sold by Kjell & Company (http://www.kjell.com) in Norway (NOK 130). The output must be connected to a male 5 mm DC plug. A dummy battery (NP-FW50) for the Sony a7/a7r can be obtained at ebay, and this battery has a female DC plug. The other output at 14.4 V goes to the Arduino and motor shield. I also have a 5 mm DC plug on this output, so the plugs must be marked well to avoid wrong connection. The use of different plugs would probably be wiser.

Fig. 3. The voltage regulator display shows the output voltage to the Sony a7r dummy battery (7.5 V). The other output delivers 14.4 V to the Arduino. The switch turns both outputs on. The regulator was later enclosed in a plywood box.

Connecting the stepper motor

The stepper motor I used for slider movement was a bipolar SM-42BYG011-25 (12 V) (Fig. 4). It has 4 wires, color coded red, green, yellow, blue. The red and green must be connected to the first coil, the yellow and blue to the second. Connect the bipolar stepper motor (4 wires) to motor port 2 (M3, GND, M4) on the motor shield. The wire order is important. The middle pin (GND) on the motor port shall not be connected. Blue and yellow to M3, green and red to M4.

Fig. 4. Stepper motor for this project.

Changing the parameters of time lapse (number of images, distance and duration of each step)

Originally, I planned to use buttons and an LCD screen to control the number of images taken and the distance of travel between each image. But as I soon understood, this demands experience in programming the Arduino. So I went for a simpler solution. The program I came up with was assembled on a PC. To make changes to the program in the field it is possible to use a mobile phone. There is an app for Android phones called ArduinoDroid, made by a Russian guy called Anton Smirnov (thanks, Anton). This app can store and edit Arduino sketches (programs), and it can upload sketches to the Arduino. It can be downloaded from Google Play at a small cost. It is possible to edit the sketch (number of steps, distance and time) in this app and then upload the program to your Arduino. You need a USB-OTG cable (possibly with adapter) that connects your phone to the Arduino. I always bring the mobile phone on photo trips. It is possible to edit the program outdoors and upload to the Arduino. The edits to do in the field will normally be number of steps, distance of each step, and interval time.

Sketch for the stepper slider

There are three libraries that have to be included together with the sketch. They are stored in the “library” folder of the Arduino program. They are necessary to control the stepper motor from the Adafruit motor shield. Get them from Adafruit.

The sketch is based on the Adafruit sketch for the motor shield. It can be found in the Adafruit tutorial for the motor shield  (https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/using-dc-motors?view=all). I have only added a little bit of code for the camera remote shutter release.

Here is the sketch for the Stepper slider

The sketch code is set up for a 2 mm distance movement on the slider and a 15.3 seconds delay between each frame. The parameters that can be changed to adjust step distance and number of steps in the sketch is written in red text code. “while (i<425);” sets the number of steps (images) to 425. “MyMotor->step(10,FORWARD,MICROSTEP);” the number 10 sets the number of microsteps which gives a 2 mm distance movement on the slider. The delay between steps can also be adjusted “delay(15000);”. Be warned: The number of steps multiplied by the distance of each step must not be greater than allowed by the effective length of the slider (850 mm).

Sketch code begins here:

This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won’t work with v1.x motor shields! Only for the v2’s with built in PWM

For use with the Adafruit Motor Shield v2
—-> http://www.adafruit.com/products/1438
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include “utility/Adafruit_MS_PWMServoDriver.h”

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

int ledPin = 13;
int i = 0;
void setup() {
AFMS.begin(); // create with the default frequency 1.6KHz
myMotor->setSpeed(40); // 40 rpm, was originally at 10
pinMode(ledPin, OUTPUT);
pinMode(2, OUTPUT);
void loop() {
while (i < 425)
myMotor->step(10, FORWARD, MICROSTEP); //The motor turns 10 microsteps forward
// This corresponds to 2 mm on the slider
delay(100); // The motor stops for 0.1 seconds
digitalWrite(ledPin, HIGH); // Pin 13 (red LED) turns on
digitalWrite(2, HIGH); // Pin 2 turn on, releases shutter
delay(200); // The image is captured
digitalWrite(2, LOW); // Pin 2 turns off
digitalWrite(ledPin, LOW); // Pin 13 turns off
delay(15000); // The motor is delayed for 15 seconds, then starts the slider
i ++;