Build it step by step
0 of 7 doneBuild the slider
Mount the belt and carriage on the extrusion.
Find the motor coils
Pair the wires with a multimeter.
Wire the driver
Add the capacitor first.
Test the motion
Move 10 mm and check the distance.
Add the limit switches
Check each stops motion.
Home and run
Test a short sequence.
Run a real time-lapse
Set the camera interval to match.
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
Wiring
| From | To | Why |
|---|---|---|
| TMC2209 VM and GND | 12 V adapter plus and minus | Motor supply |
| 100 µF capacitor | Across VM and GND, close to the driver | Absorbs voltage spikes |
| TMC2209 VIO and GND | Nano 5V and GND | Logic supply |
| TMC2209 STEP | Nano D3 | Step pulses |
| TMC2209 DIR | Nano D4 | Direction |
| TMC2209 EN | Nano D8 | Enable (LOW = on) |
| TMC2209 MS1 and MS2 | GND | 1/8 microstepping |
| TMC2209 A1, A2, B1, B2 | Motor coils | Check coil pairs with a multimeter |
| Home switch | Nano D5 and GND | Start end |
| End switch | Nano D6 and GND | Far end |
| Start button | Nano D2 and GND | Start and stop |
| LCD SDA and SCL | Nano A4 and A5 | Status display |
| 12 V adapter minus | Nano GND | Common 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.
| Check | Expected |
|---|---|
| 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 |
| Move 400 mm total | Matches 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 →
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.
