Projects / Time-lapse slider

Time-lapse slider

Intermediate6 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANOGT2ALUMIN

    Build the slider

    Mount the belt and carriage on the extrusion.

  2. NANO

    Find the motor coils

    Pair the wires with a multimeter.

  3. NANO

    Wire the driver

    Add the capacitor first.

  4. NANOGT2

    Test the motion

    Move 10 mm and check the distance.

  5. NANO

    Add the limit switches

    Check each stops motion.

  6. NANOGT2

    Home and run

    Test a short sequence.

  7. NANOGT2

    Run a real time-lapse

    Set the camera interval to match.

In short

How do you build a time-lapse slider?

A NEMA 17 slider moves a camera a few millimetres between photos for smooth time-lapses. You need Arduino Nano, NEMA 17 stepper motor, TMC2209 stepper driver, GT2 timing belt and pulley set, Aluminium extrusion 2020 (500 mm), Limit switch (micro switch with lever) × 2, 12 V 2 A DC adapter, 16x2 LCD with I2C backpack (PCF8574), Tactile push button 6 mm and Electrolytic Capacitor 100 µF. It takes 7 steps and about 360 minutes.

Level
Intermediate
Time
About 360 min
Parts
10

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
TMC2209 VM and GND12 V adapter plus and minusMotor supply
100 µF capacitorAcross VM and GND, close to the driverAbsorbs voltage spikes
TMC2209 VIO and GNDNano 5V and GNDLogic supply
TMC2209 STEPNano D3Step pulses
TMC2209 DIRNano D4Direction
TMC2209 ENNano D8Enable (LOW = on)
TMC2209 MS1 and MS2GND1/8 microstepping
TMC2209 A1, A2, B1, B2Motor coilsCheck coil pairs with a multimeter
Home switchNano D5 and GNDStart end
End switchNano D6 and GNDFar end
Start buttonNano D2 and GNDStart and stop
LCD SDA and SCLNano A4 and A5Status display
12 V adapter minusNano GNDCommon ground

Code

The slider moves the camera carriage 2 mm each interval, so the total move is spread over all the photos for smooth motion. The sketch homes against a switch at the start, backs off, then steps to a new target before each photo; your camera takes the pictures with its own interval timer set to the same interval, which keeps this build simple and avoids wiring the camera. Check the belt pitch and pulley teeth and change STEPS_PER_MM to suit (a 20-tooth pulley on a 2 mm belt moves 40 mm per turn). Set the driver's current to the motor's rating or below using the driver module's documentation, starting low, and never connect or disconnect the motor while the supply is on, as that can destroy the driver. The capacitor near the driver and a common ground prevent random resets. Keep the camera mounted securely so it cannot fall, and keep fingers clear of the belt and carriage. 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).

// Time-lapse slider: homes, then moves a small step every interval. Library: AccelStepper, LiquidCrystal_I2C.
// Set your camera to take a photo every INTERVAL seconds with its own intervalometer.
#include <AccelStepper.h>
#include <LiquidCrystal_I2C.h>

const int STEP_PIN = 3, DIR_PIN = 4, EN_PIN = 8, HOME_PIN = 5, END_PIN = 6, BTN = 2;
const float STEPS_PER_MM = 200.0 * 8 / 40.0;     // 200 steps x 8 microsteps / (20 teeth x 2 mm belt pitch) = 40 mm per turn
const float TRAVEL_MM = 400.0;                    // total move
const int SHOTS = 200;                            // photos in the sequence
const unsigned long INTERVAL_MS = 5000;           // time between photos

AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
LiquidCrystal_I2C lcd(0x27, 16, 2);
int shot = 0; unsigned long lastMove = 0; bool running = false;

void home() {
  stepper.setMaxSpeed(2000); stepper.setSpeed(-800);
  while (digitalRead(HOME_PIN) == HIGH) stepper.runSpeed();     // run toward the home switch until it closes
  stepper.setCurrentPosition(0);
  stepper.moveTo((long)(2 * STEPS_PER_MM)); while (stepper.distanceToGo()) stepper.run();   // back off 2 mm
  stepper.setCurrentPosition(0);
}

void setup() {
  pinMode(HOME_PIN, INPUT_PULLUP); pinMode(END_PIN, INPUT_PULLUP); pinMode(BTN, INPUT_PULLUP);
  pinMode(EN_PIN, OUTPUT); digitalWrite(EN_PIN, LOW);
  lcd.init(); lcd.backlight(); lcd.print("Homing...");
  stepper.setAcceleration(1500);
  home();
  lcd.clear(); lcd.print("Press to start");
}

void loop() {
  static unsigned long lastBtn = 0;
  if (!digitalRead(BTN) && millis() - lastBtn > 400) { running = !running; lastBtn = millis(); lcd.clear(); }
  if (digitalRead(END_PIN) == LOW) { running = false; lcd.clear(); lcd.print("End switch hit"); }
  if (running && shot < SHOTS && millis() - lastMove >= INTERVAL_MS) {
    stepper.setMaxSpeed(1200);
    stepper.moveTo((long)(TRAVEL_MM * STEPS_PER_MM * (shot + 1) / SHOTS));
    shot++; lastMove = millis();
    lcd.setCursor(0, 0); lcd.print("Shot "); lcd.print(shot); lcd.print("/"); lcd.print(SHOTS); lcd.print("  ");
  }
  stepper.run();
  if (shot >= SHOTS && !stepper.distanceToGo()) { running = false; lcd.setCursor(0, 1); lcd.print("Done"); }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Power onCarriage goes to the home switch and backs off
Press startMoves a small step each interval
Press an end switchMotion stops
Move 400 mm totalMatches a ruler within 1 mm

If it does not work

Motor only buzzes

Check coil pairs; swap one pair's wires.

Wrong distance

Recalculate STEPS_PER_MM.

Skips steps

Lower the speed or raise the current slightly within the motor's rating.

Driver gets hot

Lower the current setting and add a heatsink.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the time-lapse slider?

Arduino Nano, NEMA 17 stepper motor, TMC2209 stepper driver, GT2 timing belt and pulley set, Aluminium extrusion 2020 (500 mm), Limit switch (micro switch with lever) × 2, 12 V 2 A DC adapter, 16x2 LCD with I2C backpack (PCF8574), Tactile push button 6 mm and Electrolytic Capacitor 100 µF.

How long does the time-lapse slider take to build?

About 360 minutes for a intermediate maker, in 7 steps.

How do I know the time-lapse slider works?

Power on: Carriage goes to the home switch and backs off. Press start: Moves a small step each interval. Press an end switch: Motion stops.

Motor only buzzes: what should I check?

Check coil pairs; swap one pair's wires.

Wrong distance: what should I check?

Recalculate STEPS_PER_MM.

Skips steps: what should I check?

Lower the speed or raise the current slightly within the motor's rating.

Driver gets hot: what should I check?

Lower the current setting and add a heatsink.