Introduction: Motion Control Slider for Time Lapse Rail

This instructable explains how to motorize a time lapse rail using a step motor driven by an Arduino. We will mainly focus on the Motion Controller that drives the step motor assuming you already have a rail you want to motorize.

For example when dismantling a machine I found two rails that I could convert into time lapse rails. One rail uses a belt to drive the slider and the other a screw. Pictures in this instructable show a screw driven rail but the same principles apply to a rail driven by a belt. There are just a few parameters that require changing during commissioning.

Step 1: Operating Principle:

For time lapse photography I use a Intervalometer called LRTimelapse Pro-Timer designed by Gunther Wegner. This is a high quality Open Source Intervalometer for time lapse, macro and astro photographers that you can build yourself. Gunther, thank you for this fantastic tool that you have made available to the time lapse community. (For more information see lrtimelapse-pro-timer-free)

I just added some code to control the stepper motor.

Operating principle: The Time Lapse Rail works on Slave mode. This method is quite reliable. It means that I am using the LRTimelapse Pro-Timer Intervalometer to setup the number of shots and the interval between the shots. The intervalometer sends a signal to the camera to fire the shutter. After a picture is taken the Camera sends a signal back to the motion controller to move the rail’s slider on a Move/Shoot/Move sequence. The signal to start the sequence comes from the camera’s flash hot shoe. The camera’s flash is set to Rear-curtain Synchro, so the signal is sent back to the motion controller when the camera’s curtain closes. This means that the slider will only move when the shutter is closed so will work regardless of exposure length.

Material: Two cables are required from the motion controller to the camera (camera model specific) 1) a Camera Shutter Release Cable with a 2.5 mm Jack and 2) a Hot Shoe Adapter with a Plug to Male Flash PC Sync Cable Cord with a 3.5 mm jack.

Step 2: The Motion Controller's Board

Hardware: Movement of the slider is by means of a screw connected to a NEMA 17 Stepper motor. The stepper motor is driven by an EasyDriver controlled by an Arduino UNO. To use the controller with a different power bank (from 9v to 30v) I added an LM2596 DC-DC Arduino compatible power supply module to adjust the voltage. See the “Arduino Wiring.PDF” attached.

The Camera Shutter Release Cable is plugged in to the controller using a 2.5 mm Jack. The jack is wired according to the schematic found in the attached “Shutter release.PDF”. The Hot Shoe Adapter’s Cable is plugged in to the controller using a 3.5 mm Jack. Having two different sizes avoids plugging a cables to the wrong port.

Step 3: Arduino Code

Before coding it is important to differentiate between the various actions you want to achieve. Arduino allows use of what is called void. A void is a section of program (line of code) that can be called at any time, as and when necessary. So having each action on a separate void keeps the code organised and simplifies coding.

Sketch Logics.pdf attached shows the actions I want to achieve and the logic behind them.

Step 4: Arduino Code 1 - Rail Home Position

The first void is used to send the rail to the Home position when starting the controller.

The controller has a direction toggle switch. On start-up the slider moves in the direction selected by the toggle until it hits the limit switch at the end of the rail; it then moves back by a distance defined by the user (This is 0 or the value that correspond to the opposite end of the rail). This is now the home position for the slider.

This void was tested using the code found in the attached file called BB_Stepper_Rail_ini.txt

Step 5: Arduino Code 2 - Dual Function Push Button

The second void is used to move the slider manually. This is useful when you set up your camera spanning before you start the time-lapse sequence.

The controller has a push button with two functions: 1) a short push (less than a second) moves the slider by a user defined amount. 2) a long push (more than a second) moves the slider to the middle or the end of the rail. Both functions send the slider in the direction selected by the toggle switch.

This void was tested using the code found in the attached file called BB_Dual-function-push-button.txt

Step 6: Arduino Code 3 – Slave Mode

The third void is used to move the slider by a certain amount after each shot. The cameras flash needs setting to “rear curtain”. At the end of the shot a flash signal is sent from the flash hot shoe to the controller. This starts the sequence and moves the slider by a certain amount. The distance for each move is calculated by dividing the length of the rail by the number of shots selected in LRTimelapse Pro-Timer. However a maximum distance can be defined to avoid a fast movement when the number of shots is low.

This void was tested using the code found in the attached file called Slave mode.txt

Step 7: Arduino Code 4 – Quad Ramping

The fourth void is a ramping option for smoother easing in and out. It means the distance of each move will gradually increase up to the set value and at the end of the rail will decrease in the same way. As a result when looking at the final time-lapse sequence the movement of the camera speed up at the beginning of the rail and slow down at the extremity of the rail. A typical Quad acceleration curve is shown in the attached picture (easing in and out). The distance of the ramping can be defined.

I tested the algorithm in Excel and have set-up the acceleration and deceleration curves as per the picture attached. This void was tested using the code found in the attached file called BB_Stepper_Quad-Ramping-calculation.txt

Note: This quad ramping is not to be confused with Bulb ramping where the exposure length changes or Interval ramping where the interval between shots is changed.

Step 8: Arduino Code 5 – Integration With LRTimelapse Pro-Timer

LRTimelapse Pro-Timer is a free Open Source DIY Intervalometer for time-lapse, macro and astro photographers made available to the time-lapse photographer’s community by Gunther Wegner. After building a unit for my camera I found it so good that I started to think about how to drive my rail with it. The attached LRTimelapse Pro-Timer 091_Logics.pdf is a short manual that shows how to navigate the program.

The attached BB_Timelapse_Arduino-code.pdf shows the structure of LRTimelapse Pro-Timer Free 0.91 and in green the lines of code I added to operate the slider.

BB_LRTimelapse_091_VIS.zip contains the Arduino code if you want to have a go.

The attached BB_LRTimer_Modif-Only.txt document lists the additions I have made to Pro-Timer. It makes it easier to integrate them to new versions of Pro-Timer when Gunther makes them available.

Step 9: Arduino Code 6 – Variables and Setting's Values

The pitch of the screw may vary or if using a belt the pitch of the belt and the number of teeth on the pulleys may also vary. In addition the number of steps per rotation of the stepper motor and the length of the rail may differ. As a result the quantity of steps to cross the length of the rail changes from one rail to another.

To adapt the controller to different rails some variables can be adjusted in the program:

  • Calculate the quantity of steps that correspond to the length of the rail between the limit switches. Enter the value in the variable: long endPos (i.e. this value is 126000 for the rail driven with a screw shown in this instructable)
  • To look at the frame composition at the start, middle and end of the rail when using the spanning effect, I used the long push option with the push button. Enter the number of steps that correspond to the middle of the rail in the variable: long midPos (i.e. this value is 63000 for the rail driven with a screw shown in this instructable)
  • In LRTimelapse Pro-Timer you have to enter how many pictures you want to take. The program divides the length of the rail by this number. If you take 400 picture and your rail is 1 meter each slider movement will be 1000:400= 2.5 mm. For 100 pictures the value would be 10 mm. This is too much for one move. So you may decide not to use the full length of you rail. Enter the maximum move allowed in the variable: const int maxLength (i.e. this value is 500 for the rail driven with a screw shown in this instructable)
  • When pressing the push button less than a second it moves the slider by a certain distance which can be set in the variable: int inchMoveval (i.e. this value is 400 for the rail driven with a screw shown in this instructable)
  • Quad Ramping allows a smooth easing in and out. You can decide what distance the ramping will last at the beginning and end of the rail. This value is entered as a percentage of the rail’s length in the variable: float ratio (i.e. 0.2 = 20% of the rail's length)

Step 10: A Few Words About the Rail

The rail is one meter long. It is made of a heavy load linear bearing slider bolted to a slotted Aluminium extrusion bar. I bought the extrusion bar and accessories from RS.com (see the picture rs items.jpg attached). The rail has four legs but can also be mounted on tripods with standard screws.

Spanning: A tripod’s ball head (as per the picture attached) is mounted on the slider. A little arm connects the head to the screw. If you move the screw away from the rail on one side you get an angle between the screw and the rail. When the slider moves along the rail it creates a rotation of the ball head. If you do not want spanning keep the screw parallel to the rail.

The controller is mounted on the slider. I chose that option - instead of the controller at one end of the rail - to avoid multiple cables running along the rail. I have only one cable between the power bank and the controller. All the other cables, to the step motor, to the limit switch, the shutter cable to the camera and the Synchro cable from the camera are all moving with the controller.

Screw versus Belt: For time-lapse photography both designs work well. The belt allows faster movements compared to the screw, this could be an advantage in case you want to turn the rail into a video slider. One advantage of the screw design is when you put the rail vertical or at an angle, in case of a power cut the slider stays still and will not fall. I would strongly suggest being careful when you do the same thing with a belt driven rail, in case of a power cut or if running out of power the camera will slide down to the bottom of the rail at your own risk!