Nema17 Stepper Motor



A stepper motor is a type of DC motor that works in discrete steps and used everywhere from a surveillance camera to sophisticated robots and machines. Stepper motors provide accurate controlling, and can be differentiated on the basis of torque, steps per revolution, and input voltage. In our previous project, we controlled 28-BYJ48 stepper motor using Arduino. 28-BYJ48 has relatively lower torque than the other stepper motors like NEMA 14, NEMA17.

Working Principle:



A stepper motor to satisfy all your robotics needs! This 4-wire bipolar stepper has 1.8° per step for smooth motion and a nice holding torque.

It is a four phase, unipolar, permanent magnet stepper motor. It is a standard size, 200-steps-per-revolution, NEMA 17 (1.7 in. square footprint, 5 mm shaft diameter), 12 V motor. This motor, like most stepper motors is a permanent magnet motor. The Mosaic stepper is typical of common high resolution motors – a full revolution requires 200 steps, while each step turns the shaft only 1.8° for a full step, or 0.9° in half-stepping mode. This sized motor is commonly used in household appliances, medical equipment, stage lighting devices, and in various industrial control applications.

As you can see that this motor has a Unipolar six-wire arrangement. These wire are connected in two split windings. Black, Yellow, Green wires are part of first winding where Black is center tap, and Yellow and Green are coil end while Red, White, and Blue is part of a second winding, in which White is center tap and Red and Blue are coil end wires. Normally center tap wires left disconnected.



Steps Per Revolution for NEMA17

Steps Per Revolution for a particular stepper motor is calculated using the step angle of that stepper motor. So in the case, NEMA 17 step angle is 1.8 deg.

Steps per Revolution = 360/ step angle

360/1.8 = 200 Steps Per Revolution

Specifications of NEMA17

  • Rated Voltage: 12V DC
  • Step Angle: 1.8 deg.
  • of Phases: 4
  • Motor Length: 1.54 inches
  • 4-wire, 8-inch lead
  • 200 steps per revolution, 1.8 degrees
  • Operating Temperature: -10 to 40 °C
  • Unipolar Holding Torque: 22.2 oz-in

Also check various stepper motor related projects here, which not only incudes basic interfacing with various microcontrollers but also have robotics projects which involves stepper motor.

Circuit Diagram

Circuit diagram to control Nema 17 stepper motor with Arduino is given in the above image. As A4988 module has a built-in translator that means we only need to connect the Step and Direction pins to Arduino. Step pin is used for controlling the steps while the direction pin is used to control the direction. Stepper motor is powered using a 12V power source, and the A4988 module is powered via Arduino. Potentiometer is used to control the direction of the motor.

If you turn the potentiometer clockwise, then stepper will rotate clockwise, and if you turn potentiometer anticlockwise, then it will rotate anticlockwise. A 47 µf capacitor is used to protect the board from voltage spikes. MS1, MS2, and MS3 pins left disconnected, that means the driver will operate in full-step mode.

Complete connections for Arduino Nema 17 A4988 given in below table.


A4988 Pin




+ve Of Battery



-ve of Battery



5V of Arduino



GND of Arduino



Pin 3 of Arduino



Pin 2 of Arduino


1A, 1B, 2A, 2B

Stepper Motor



#include <Stepper.h> 
#define STEPS 200

// Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver
Stepper stepper(STEPS, 2, 3); // Pin 2 connected to DIRECTION & Pin 3 connected to STEP Pin of Driver
#define motorInterfaceType 1
int Pval = 0;
int potVal = 0;

void setup() {
  // Set the maximum speed in steps per second:
void loop() {

  potVal = map(analogRead(A0),0,1024,0,500);
  if (potVal>Pval)
  if (potVal<Pval)

Pval = potVal;




  • This sized motor is commonly used in household appliances .
  • medical equipment
  • stage lighting devices
  • Various industrial control applications.



  • Low cost for control achieved
  • High torque at startup and low speeds
  • Ruggedness
  • Simplicity of construction
  • Can operate in an open loop control system
  • Low maintenance
  • Less likely to stall or slip
  • Will work in any environment
  • Can be used in robotics in a wide scale.
  • High reliability