# 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.

Canonical: https://roboticsengineering.in/projects/motorised-camera-slider-nema17-a4988-arduino/ | Published: 2026-11-04 | Updated: 2026-11-04

**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

| Part | Qty | Unit | Total |
| --- | --- | --- | --- |
| Arduino Uno R3 (or compatible) | 1 | ₹550 | ₹550 |
| NEMA 17 stepper motor | 1 | ₹700 | ₹700 |
| A4988 stepper driver module | 1 | ₹150 | ₹150 |
| GT2 belt, 20-tooth pulley and idler set | 1 | ₹350 | ₹350 |
| Aluminium profile rail, 500 mm | 1 | ₹400 | ₹400 |
| Carriage plate and mounting hardware | 1 | ₹300 | ₹300 |
| 12 V 2 A power supply | 1 | ₹300 | ₹300 |
| 100 µF capacitor, 25 V | 1 | ₹10 | ₹10 |
| Limit switches | 2 | ₹30 | ₹60 |
| Breadboard | 1 | ₹60 | ₹60 |
| Jumper wires | 1 | ₹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 mm | Step rate | Pulse interval |
| --- | --- | --- |
| 10 s | 3200.0 steps/s | 312.5 µs |
| 60 s | 533.3 steps/s | 1875.0 µs |
| 600 s | 53.3 steps/s | 18750.0 µs |
| 3600 s | 8.9 steps/s | 112500.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

| Part | Connects to | Note |
| --- | --- | --- |
| A4988 STEP / DIR / EN | D3 / D4 / D5 | EN is active low |
| A4988 MS1, MS2, MS3 | All to 5V | 1/16 microstepping |
| A4988 VMOT and GND | 12 V supply, with the 100 µF capacitor across it | Add the capacitor close to the board |
| A4988 VDD and GND | 5V and GND | Join the grounds |
| A4988 RESET and SLEEP | Tied together | Required for the board to run |
| Motor coils | 1A, 1B, 2A, 2B | Identify the two coils with a meter |
| Home / far limit switch | D2 / D6 to GND | Internal 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

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| Motor hums but does not move | Coils wired wrongly or current too low | Check the coil pairs and raise the current slightly |
| Skips steps at speed | Too fast or current too low | Lower the speed or raise the current limit |
| Distance off | Wrong pulley or microstep setting | Measure and correct STEPS_PER_MM |
| Driver overheats | Current too high or no cooling | Lower the reference and add a heatsink |
| Judders at the start | No acceleration ramp | Add acceleration |
| Driver damaged at power-up | Motor connected or disconnected live | Always 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](https://roboticsengineering.in/robotics-project-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.
