Motorised camera slider with a NEMA 17 and A4988 on Arduino: design worksheet and code

A ₹2,930 design worksheet for a belt-driven camera slider: steps per millimetre, timing for slow time-lapse and faster moves, the A4988 current setting and a homing routine.

About the author · Sources, testing and AI policy

  • Parts₹2,930
  • Bench time8–12 h
  • LevelIntermediate
  • ReviewedNov 2026

A ₹2,930 motorised slider that moves a camera smoothly along a rail. A NEMA 17 stepper pulls a belt, an A4988 driver sets the motor current and step size, and the sketch works out the pulse timing so a 400 mm move takes exactly as long as you ask, from 10 seconds to an hour. The page does the step maths so you can see where the numbers come from.

Scope: intermediate. This is a design worksheet with illustrative costs. It has not been bench-tested by this site. The step and timing table was computed by script. The mechanical parts (rail, carriage, belt tension) decide how smooth the result is and are not covered by arithmetic. The A4988 current setting depends on the board version; check the sense-resistor value on yours before setting the reference voltage, since a wrong setting can overheat the motor or driver.

How it works

A GT2 belt has a 2 mm pitch. A 20-tooth pulley therefore moves the belt 40 mm per turn. A NEMA 17 motor takes 200 full steps per turn, and with the A4988 set to 1/16 microstepping that is 3,200 steps per turn, so 3,200 / 40 = 80 steps per millimetre. A 400 mm move is 32,000 steps.

Time per move is just steps divided by time: for a move of T seconds the pulse interval is T / 32,000. A 60 second slide uses a pulse every 1.875 ms. The Uno can generate pulses down to a few hundred microseconds with this simple loop, which gives a top speed of roughly 40 to 50 mm/s; slow time-lapse moves of an hour use pulses 112.5 ms apart, which is easy.

Bill of materials

PartQtyUnitTotal
Arduino Uno R3 (or compatible)1₹550₹550
NEMA 17 stepper motor1₹700₹700
A4988 stepper driver module1₹150₹150
GT2 belt, 20-tooth pulley and idler set1₹350₹350
Aluminium profile rail, 500 mm1₹400₹400
Carriage plate and mounting hardware1₹300₹300
12 V 2 A power supply1₹300₹300
100 µF capacitor, 25 V1₹10₹10
Limit switches2₹30₹60
Breadboard1₹60₹60
Jumper wires1₹50₹50
Parts total₹2,930

Scroll the table sideways to see every column.

Prices checked Nov 2026. Shipping and tools are not included.

Prices are illustrative figures for Indian sellers in November 2026, before shipping, and have not been checked against current listings.

The numbers

Time for 400 mmStep ratePulse interval
10 s3200.0 steps/s312.5 µs
60 s533.3 steps/s1875.0 µs
600 s53.3 steps/s18750.0 µs
3600 s8.9 steps/s112500.0 µs
400 mm = 32,000 steps at 80 steps/mm (GT2, 20-tooth pulley, 1/16 microstepping). Interval = time / 32,000.

The A4988’s current limit is set with a small potentiometer and a reference voltage. On many Pololu-style boards with a 0.068 Ω sense resistor the limit is VREF ÷ (8 × 0.068) = VREF ÷ 0.544, so 1.0 A needs about 0.54 V; other boards use 0.1 Ω or 0.05 Ω and different formulas. Set it to a value at or below your motor’s rating, and never unplug the motor while the board is powered.

Power and wiring

PartConnects toNote
A4988 STEP / DIR / END3 / D4 / D5EN is active low
A4988 MS1, MS2, MS3All to 5V1/16 microstepping
A4988 VMOT and GND12 V supply, with the 100 µF capacitor across itAdd the capacitor close to the board
A4988 VDD and GND5V and GNDJoin the grounds
A4988 RESET and SLEEPTied togetherRequired for the board to run
Motor coils1A, 1B, 2A, 2BIdentify the two coils with a meter
Home / far limit switchD2 / D6 to GNDInternal pull-ups
Do not connect or disconnect the motor while the driver has power, and add a heatsink to the A4988.

The sketch

// Camera slider: Uno + A4988 + NEMA 17 + GT2 belt
// Design worksheet: set the A4988 current limit before running.

const int STEP = 3, DIR = 4, EN = 5;
const int HOME_SW = 2, FAR_SW = 6;
const float STEPS_PER_MM = 80.0;          // GT2, 20 teeth, 1/16 microstepping
const float TRAVEL_MM = 400.0;
const unsigned long MIN_INTERVAL_US = 300UL;   // about 40 mm/s

long position = 0;                          // in steps from home

bool stepOnce(bool forward, unsigned long interval) {
  if (forward && digitalRead(FAR_SW) == LOW) return false;    // far end stop
  digitalWrite(DIR, forward ? HIGH : LOW);
  digitalWrite(STEP, HIGH); delayMicroseconds(5);
  digitalWrite(STEP, LOW);
  position += forward ? 1 : -1;
  if (interval > 16000UL) delay(interval / 1000UL);
  else delayMicroseconds(interval);
  return true;
}

void slide(float mm, float seconds) {        // positive mm = away from home
  long steps = (long)(fabs(mm) * STEPS_PER_MM);
  unsigned long interval = (unsigned long)(seconds * 1e6 / steps);
  if (interval < MIN_INTERVAL_US) interval = MIN_INTERVAL_US;
  for (long i = 0; i < steps; i++) if (!stepOnce(mm > 0, interval)) break;
}

void homeIt() {
  while (digitalRead(HOME_SW) == HIGH) stepOnce(false, 1500);
  slide(5, 2);                                // back off 5 mm
  position = 0;
}

void setup() {
  pinMode(STEP, OUTPUT); pinMode(DIR, OUTPUT); pinMode(EN, OUTPUT);
  pinMode(HOME_SW, INPUT_PULLUP); pinMode(FAR_SW, INPUT_PULLUP);
  digitalWrite(EN, LOW);                      // enable the driver
  delay(2000);
  homeIt();
}

void loop() {
  slide(400, 60);                             // 400 mm in 60 seconds
  delay(2000);
  slide(-400, 20);                            // return in 20 seconds
  delay(2000);
}

This version always moves at a constant speed, with no ramp up or down. A camera on a belt slider can judder at the start and stop, and acceleration ramps, which libraries such as AccelStepper provide, make the move look smoother. The homing loop moves toward the home switch until it closes, so check the switch works before running unattended. The sketch has been proofread but not compiled on this site.

Test plan

  1. Direction: run a short move and confirm the carriage goes the way you expect.
  2. Distance: command 100 mm and measure how far it actually moves; correct STEPS_PER_MM if different.
  3. Current setting: measure the A4988 reference voltage, set it, and check the motor warms but does not get too hot to touch for long.
  4. Speed limits: try 10, 30 and 60 second slides and listen for skipped steps.
  5. End stops: trigger each switch by hand and confirm the carriage stops.
  6. Payload: add the camera and check the carriage stays level and smooth.

What usually goes wrong

SymptomLikely causeFix
Motor hums but does not moveCoils wired wrongly or current too lowCheck the coil pairs and raise the current slightly
Skips steps at speedToo fast or current too lowLower the speed or raise the current limit
Distance offWrong pulley or microstep settingMeasure and correct STEPS_PER_MM
Driver overheatsCurrent too high or no coolingLower the reference and add a heatsink
Judders at the startNo acceleration rampAdd acceleration
Driver damaged at power-upMotor connected or disconnected liveAlways power down first

Upgrades

  • Acceleration: use a stepper library with ramps.
  • Camera trigger: fire the shutter between small moves for stop-motion time-lapse.
  • Pan axis: add a second stepper for a rotating head.
  • Quieter drive: try a silent stepper driver.

Cost and parts notes

The ₹2,930 total is an illustration and does not include shipping. Use the cost calculator to compare sellers.

Common questions

How many steps per millimetre?

For a GT2 belt with a 20-tooth pulley and a 200-step motor at 1/16 microstepping, 80 steps per millimetre.

Why set the current limit?

Too little makes the motor skip steps, too much overheats it and the driver.

Can the Uno run it fast?

This simple loop manages roughly 40 to 50 mm/s here. Faster moves need a better step generator.

Do I need limit switches?

They stop the carriage from driving into the end of the rail if a move is mistimed.

Last reviewed: November 2026. This is a design worksheet with illustrative costs. It has not been bench-tested by this site; library names, pins and limits must be checked against your board and the current library versions, and measurements from your build are welcome.

More builds

Next builds to try

Free: the final-year project pack

A shortlist with BOMs, a report outline that matches the usual chapter scheme, a costing sheet and 40 viva questions. Built for the February–April submission season.

The Build Note

One short email when something is worth your bench time.

A new build sheet, a part price that moved, or a mistake worth avoiding. No daily drip, no recycled news.

One short email when a build or a price is worth your time. Unsubscribe in one click.