DIY Arduino Camera Phone Slider

Written by: Brandon Tsuge



Time to read min

In this tutorial, I will document how I built an Arduino controlled camera phone slider without power tools or equipment. Fundamentally, this device is simply a linear actuator with a second motor attached.

Parts Needed

Below is a list of parts that I used to build the project:

Any Camera Tripod with 1/4"-20 Thread

Stepper Motors - Sparkfun

NEMA 17 Motor Mount - Amazon / Servo City / Sparkfun

Stepper Motor Drivers - Amazon / Sparkfun

M3, 6mm Length Machine Screws - Amazon / Servo City / McMaster-Carr

5mm to 6mm Flexible Clamping Shaft Coupler - Amazon / Servo City

6mm Lead Screw Clamping Collar - Servo City

6mm ID x 12mm OD Flanged Ball Bearing - Amazon / Servo City

6mm ID x 14mm OD, 5mm Thickness Thrust Ball Bearing - Amazon / Servo City

650mm, 6mm Lead Screw - Amazon / Servo City

24" Extruded Rail - Amazon / Servo City

6mm Lead Screw Nut - Amazon / Servo City

Extruded Rail Nut - Servo City

Limit Switch - Amazon / Servo City / Sparkfun

Limit Switch Mount - Servo City

Extruded Rail Screw Plate - Amazon / Servo City

1/4"-20 Screw Plate - Servo City

3 Hole Pattern Plate - Amazon / Servo City

6-32, 1/4" OD, 1.75" Length Round Standoff - Servo City

Number 6 Washers - Servo City / McMaster-Carr

Low Profile 6-32, 1/4" Length Screw - McMaster-Carr

5mm to 1/4" Clamping Coupler - Servo City

1/4"-20 partially threaded rod - McMaster-Carr

11.1V, 1.0Ah LiPo Battery - Amazon

XT60 Power Distribution Board - Amazon

Arduino Nano Terminal Board - Amazon

Arduino Nano - Amazon

Circuit Boards and Header Pins - Amazon

Screw Terminals - Amazon

220Ω Resistors - Amazon

Stranded wire - Amazon

Solid Core Wire - Amazon

Cell Phone Mount - Amazon

Drag Chain - Amazon

The links to Amazon are affiliate links. This means that if you click on the link and purchase the item, I receive a small percentage of the purchase for advertising the product.


I receive no commission for links directed to any other sites. They are only listed for your convenience.


To start, I soldered male header pins to the stepper motor drivers. I also soldered female header pins and screw terminal blocks to a prototyping circuit board that will directly connect to each of the pins of the motor driver. This allows me to remove the motor driver for other projects, but it also makes it easier to make the connections to the board.

Soldering Header Pins

I also purchased an off the shelf board that serves the same function for an Arduino Nano and a power distribution board to distribute power from a battery with an XT60 connector to the rest of the components that need power.

Arduino Nano and Stepper Motor Driver
Power Distribution Board

I had two custom 3D printed parts that hold the electrical components. One of them serves as a mount for the stepper motor responsible for the sliding motion. It also holds one of the stepper motor drivers. The other 3D printed part, shown above, holds the Arduino Nano, power distribution board, battery, and the other stepper motor driver.

Stepper Motor and Driver

The main structure of the device is built on an extruded rail that has an open channel on one side. This allows for the insertion of a lead screw. I also used a lead screw nut had slides inside of the extruded rail and it has threaded holes on top to mount additional hardware. I first start by mounting the hardware that is compatible with my camera tripod hardware. I use the extruded rail screw plate, 1/4"-20 screw plate, number six washers, and low profile 6-32 screws to attach these components.

Tripod Mounting Hardware

Next I attached the limit switches to one of the sides of the extruded rail. The limit switches are attached to the rail using extruded rail nuts and off the shelf limit switch mounting kits.

Circuit Holder and Limit Switch

Next, I attached a 3 hole pattern plate to the lead screw nut with 6-32 screws. I fastened four round standoffs to the pattern plate with more washers and 6-32 screws, and thread the lead screw through the nut.

Lead Screw and Nut

Then, I slid the lead screw nut assembly into the extruded rail, with the open channel facing towards the standoffs.

Insert Lead Screw

On the end of the rail that didn't have the stepper motor attached, I secure the 3D printed part that will eventually hold the Arduino Nano, power distribution board, battery , and stepper motor driver circuit. The part is secured with 6-32 screws with a flanged ball bearing in the center.

Insert Bearings

After securing the 3D printed component, I slid a thrust bearing on to the lead screw and secured the end of the assembly with a clamping collar.

Shaft Collar

On the other end of the rail, I attached the other 3D printed component that will hold the other stepper motor driver. This part is also secured with 6-32 screws, a ball bearing, a thrust bearing and clamping collar. A stepper motor also secures to 3D printed component with M3 screws. The shaft of the stepper motor is coupled to the lead screw with a flexible shaft coupler.

Stepper Motor Shaft Coupling

For the second stepper motor that will control the panning motion, I attached a NEMA 17 stepper motor mount.

NEMA Motor Mount

For the final step, I fastened another 3 hole pattern plate to the top of the stepper motor mount. I then attached this assembly to the four round standoffs that were connected to the lead screw nut. I use a clamping coupler to couple the shaft of the motor to a partially threaded 1/4"-20 rod. This can directly screw into my camera phone mount. Lastly, after wiring all of the electrical components, I used a drag chain to keep of the wiring organized.

Mount Phone on to Stepper Motor

Circuit Diagram

The circuit for this project involves wiring two stepper motors and corresponding motor drivers to the Arduino Uno. Two limit switches will change the direction of the stepper motors, and a battery will power the stepper motor drivers. The hookup guide for the stepper motors drivers that I used can be found on Sparkfun's website.

  • Start by wiring the 4 stepper motor wires to the "A" and "B" pins on the motor driver.

  • Connect the "STEP" pin on the motor driver to digital pin 2 on the Arduino.

  • Connect "DIR" to digital pin 3.

  • Connect "MS1" to digital pin 4.

  • Connect "MS2" to digital pin 5.

  • Connect "ENABLE" to digital pin 6.

  • Wire the battery to "PWR IN."

  • Repeat these connections for the second motor driver, and use one of the motor drivers to power the Arduino by wiring the 5V output to Vin on the Arduino. Also GND the Arduino to the GND on the driver.

At this point, all of the digital pins except for digital pin 12 should be used. For this reason, the two limit switches have to be wired on the same circuit. If either of the switches is triggered, then digital pin 12 will read a positive value.

  • Wire one lead on each of the two switches to 5V.

  • On the other leads connect 220Ω resistors to ground.

  • Connect digital pin 12 in between the resistor and the switch for both switches.

Stepper Motor Wiring Diagram
Wiring Diagram

Arduino Code

The goal of the Arduino sketch is to get the two stepper motors to move simultaneously, but at different speeds. I also set up the code so that anytime a limit switch is triggered, the motor responsible for the sliding motion will change direction. 

Stepper Motors on Camera Slider

The first step of the sketch is to define the pins associated the stepper motor drivers. As mentioned shown in the circuit diagram, the stepper motor drivers are connected to pins 2-11. Pin 12 is also wired to the limit switches.

#define Slide_stp 2 
#define Slide_dir 3 //Direction
#define Slide_MS1 4 //MS1 and MS2 are logic pins from step size
#define Slide_MS2 5 
#define Slide_EN  6 //Enable

#define Pan_stp 7
#define Pan_dir 8
#define Pan_MS1 9
#define Pan_MS2 10
#define Pan_EN  11

#define Button1 12 //pin for limit switches

I then use the millis() function to keep track of the time of when the Arduino started running. I keep track of this separately for the panning and sliding motors. For my particular example, I would like the sliding motor to take one step every one millisecond and the panning motor every 75 milliseconds. I also initialize variables for the sliding and panning motor directions.

unsigned long previousSlide = millis();
unsigned long previousPan = millis();
long slideInterval = 1;
long panInterval = 75;

bool SlideDirVal = HIGH;
bool PanDirVal = LOW;

In the setup, set all of the pins 2-11 to outputs, and pin 13 to an input. I also call a function called resetEDPins() to set all of the motor driver pins to their default values. The serial port baud rate is set to 9600 as well.

void setup() {
  //define EasyDriver Pins on Arduino
  pinMode(Slide_stp, OUTPUT);
  pinMode(Slide_dir, OUTPUT);
  pinMode(Slide_MS1, OUTPUT);
  pinMode(Slide_MS2, OUTPUT);
  pinMode(Slide_EN, OUTPUT);

  pinMode(Pan_stp, OUTPUT);
  pinMode(Pan_dir, OUTPUT);
  pinMode(Pan_MS1, OUTPUT);
  pinMode(Pan_MS2, OUTPUT);
  pinMode(Pan_EN, OUTPUT);

  //define button
  pinMode(Button1, INPUT);
  resetEDPins(); //Set default states
  Serial.begin(9600); //Open Serial connection for debugging
//Reset Easy Driver pins to default states
void resetEDPins()
  digitalWrite(Slide_stp, LOW);
  digitalWrite(Slide_dir, LOW);
  digitalWrite(Slide_MS1, LOW);
  digitalWrite(Slide_MS2, LOW);
  digitalWrite(Slide_EN, HIGH);

  digitalWrite(Pan_stp, LOW);
  digitalWrite(Pan_dir, LOW);
  digitalWrite(Pan_MS1, LOW);
  digitalWrite(Pan_MS2, LOW);
  digitalWrite(Pan_EN, HIGH);

In the loop, use the millis() function to measure the time to determine when to step the panning and sliding motors. Set the "ENABLE" pins to LOW to enable the motor drivers. Set the directions with a HIGH or LOW depending on the desired motor direction. "MS1" and "MS2" are responsible for the step size, and the "STEP" pins should initially be set to LOW. For a full explanation of the logic for each of these pins, take a look at the documentation from Sparkfun.

  unsigned long currentSlide = millis();
  unsigned long currentPan = millis();
  digitalWrite(Slide_EN, LOW);
  digitalWrite(Slide_dir, SlideDirVal);
  digitalWrite(Slide_MS1, LOW);
  digitalWrite(Slide_MS2, LOW);
  digitalWrite(Slide_stp, LOW);

  digitalWrite(Pan_EN, LOW);
  digitalWrite(Pan_dir, PanDirVal);
  digitalWrite(Pan_MS1, HIGH);
  digitalWrite(Pan_MS2, HIGH);
  digitalWrite(Pan_stp, LOW);

Next, I use two "if" statements to check whether the limit switch is pressed and the direction of the sliding motor. If the switch is in a "HIGH" state, then the sliding motor reverses direction and moves until the switch is in a "LOW" state.

  if (digitalRead(Button1) == HIGH && SlideDirVal == HIGH){
    SlideDirVal = LOW;
    digitalWrite(Slide_dir, SlideDirVal);
    while (digitalRead(Button1) == HIGH){
      digitalWrite(Slide_stp, HIGH);
      digitalWrite(Slide_stp, LOW);

  if (digitalRead(Button1) == HIGH && SlideDirVal == LOW){
    SlideDirVal = HIGH;
    digitalWrite(Slide_dir, SlideDirVal);
    while (digitalRead(Button1) == HIGH){
      digitalWrite(Slide_stp, HIGH);
      digitalWrite(Slide_stp, LOW);

In the last part of the loop, "if" statements are used to check if 1 ms has passed for the sliding motor and 75 ms has passed for the panning motor. If so, the motors are stepped forward.

    if(currentSlide - previousSlide > slideInterval){
    digitalWrite(Slide_stp, HIGH);
    previousSlide = currentSlide;
  else if(currentPan - previousPan > panInterval){
    digitalWrite(Pan_stp, HIGH);
    previousPan = currentPan;

The code for this example can be found here.


I found that the design keeps things compact and simple. However, I did find that there is a significant amount of vibration when the slider is moving too fast. This makes it less than ideal for video footage. For longer, extended time lapse video, where slower speeds are required, this design works just fine.

The Bored Robot LLC is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to