Motorised camera slider for time-lapse
Build it step by step
0 of 7 doneBuild the rail and carriage
It should glide by hand.
Fit the belt and motor
Tension it lightly.
Set the driver current
Start low.
Test a short move
Check the direction.
Set length and time
From the menu.
Run a 10 minute pass
Check smoothness.
Add end stops
If you want safety margin.
How do you build a motorised camera slider for time-lapse?
A stepper moves a phone or camera slowly along a rail for smooth time-lapse and video shots, set from an OLED menu. You need Arduino Nano, NEMA 17 stepper motor, TMC2209 stepper driver, GT2 timing belt and pulley set, Aluminium extrusion 2020 (500 mm), Rotary encoder module (KY-040), SSD1306 OLED Display and 12 V 2 A DC adapter. It takes 7 steps and about 300 minutes.
- Level
- Intermediate
- Time
- About 300 min
- Parts
- 8
Wiring
| From | To | Why |
|---|---|---|
| TMC2209 STEP, DIR, EN | Nano D2, D3, D4 | Step signals (EN low enables) |
| TMC2209 VIO and GND | Nano 5V and GND | Logic |
| TMC2209 VM and GND | 12 V adapter plus and minus, with a 100 uF capacitor close by | Motor power |
| NEMA 17 coils | TMC2209 2B, 2A, 1A, 1B | Motor (never connect or disconnect with power on) |
| Encoder CLK, DT, SW | Nano D5, D6, D7 | Menu (internal pull-ups) |
| OLED SDA and SCL | Nano A4 and A5 | I2C display |
| OLED VCC and GND | Nano 5V and GND | Power |
Code
For smooth time-lapse the carriage must move very slowly and evenly, and that is what microstepping and a quiet driver such as the TMC2209 do. With a 20-tooth GT2 pulley, one turn moves the belt 40 mm, and at 8 microsteps there are 40 steps for every millimetre. The sketch works out the total steps and the time between steps from your length and duration, for example 200 mm in 10 minutes is a step every 75 microseconds. Set the driver's current with its small pot or the Vref value for your motor: start low and raise it only if the motor loses steps, because too high makes motor and driver hot. Never connect or disconnect the motor with power on, since that can destroy the driver. Fit end stops or leave a few centimetres spare at each end, because the sketch has no limit switch and relies on you starting from the home end. Keep the camera or phone strapped on, balance the carriage so it does not tilt, and keep fingers out of the belt. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Camera slider: set length and duration with the encoder, press to start, steps evenly, returns at the end.
// Libraries: Adafruit SSD1306, Adafruit GFX. Board: Arduino Nano. Assumes 8 microsteps, 20 tooth GT2 pulley: 40 steps per mm.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const uint8_t STEP = 2, DIR = 3, EN = 4, ENC_A = 5, ENC_B = 6, ENC_SW = 7;
const long STEPS_PER_MM = 40; // 200 full steps x 8 microsteps / 40 mm per turn; match your driver's settings
int lengthMm = 200, durationMin = 10, page = 0;
int lastA;
void show(const char* a, long b, const char* unit) {
oled.clearDisplay(); oled.setTextColor(SSD1306_WHITE); oled.setTextSize(1);
oled.setCursor(0, 0); oled.print(a);
oled.setTextSize(3); oled.setCursor(0, 24); oled.print(b); oled.setTextSize(1); oled.print(unit);
oled.display();
}
bool pressed() {
if (digitalRead(ENC_SW) == LOW) { delay(30); while (digitalRead(ENC_SW) == LOW) {} return true; }
return false;
}
void moveSteps(long n, bool forward, unsigned long intervalUs) {
digitalWrite(DIR, forward ? HIGH : LOW);
unsigned long t = micros();
for (long i = 0; i < n; i++) {
digitalWrite(STEP, HIGH); delayMicroseconds(3); digitalWrite(STEP, LOW);
t += intervalUs;
while ((long)(micros() - t) < 0) {}
}
}
void setup() {
pinMode(STEP, OUTPUT); pinMode(DIR, OUTPUT); pinMode(EN, OUTPUT);
digitalWrite(EN, HIGH); // driver off until a run
pinMode(ENC_A, INPUT_PULLUP); pinMode(ENC_B, INPUT_PULLUP); pinMode(ENC_SW, INPUT_PULLUP);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
lastA = digitalRead(ENC_A);
}
void loop() {
int a = digitalRead(ENC_A);
if (a != lastA && a == LOW) {
int d = digitalRead(ENC_B) == HIGH ? 1 : -1;
if (page == 0) lengthMm = constrain(lengthMm + 10 * d, 50, 450);
else durationMin = constrain(durationMin + d, 1, 120);
}
lastA = a;
if (page == 0) show("Length", lengthMm, " mm"); else show("Duration", durationMin, " min");
if (pressed()) {
if (page == 0) page = 1;
else {
long total = (long)lengthMm * STEPS_PER_MM;
unsigned long interval = (unsigned long)durationMin * 60000000UL / total;
digitalWrite(EN, LOW);
show("Running", durationMin, " min");
moveSteps(total, true, interval);
delay(1000);
moveSteps(total, false, 600); // quick return, ramp down if the motor stalls
digitalWrite(EN, HIGH);
page = 0;
}
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Set 200 mm for 10 min | Carriage covers 200 mm in 10 minutes |
| Return move | Quick, no skipped steps |
| Motor off between runs | Cool and quiet |
| Footage | No visible steps or jerks |
If it does not work
Motor hums, no motion
Swap one coil pair or raise the current a little.
Travel is the wrong length
Check the steps per millimetre and driver settings.
Jerky movement
Reduce belt tension and check the pulley grub screw.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the motorised camera slider for time-lapse?
Arduino Nano, NEMA 17 stepper motor, TMC2209 stepper driver, GT2 timing belt and pulley set, Aluminium extrusion 2020 (500 mm), Rotary encoder module (KY-040), SSD1306 OLED Display and 12 V 2 A DC adapter.
How long does the motorised camera slider for time-lapse take to build?
About 300 minutes for a intermediate maker, in 7 steps.
How do I know the motorised camera slider for time-lapse works?
Set 200 mm for 10 min: Carriage covers 200 mm in 10 minutes. Return move: Quick, no skipped steps. Motor off between runs: Cool and quiet.
Motor hums, no motion: what should I check?
Swap one coil pair or raise the current a little.
Travel is the wrong length: what should I check?
Check the steps per millimetre and driver settings.
Jerky movement: what should I check?
Reduce belt tension and check the pulley grub screw.
