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.
S.NO. |
A4988 Pin |
Connection |
1 |
VMOT |
+ve Of Battery |
2 |
GND |
-ve of Battery |
3 |
VDD |
5V of Arduino |
4 |
GND |
GND of Arduino |
5 |
STP |
Pin 3 of Arduino |
6 |
DIR |
Pin 2 of Arduino |
7 |
1A, 1B, 2A, 2B |
Stepper Motor |
.
Code
#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:
stepper.setSpeed(1000);
}
void loop() {
potVal = map(analogRead(A0),0,1024,0,500);
if (potVal>Pval)
stepper.step(10);
if (potVal<Pval)
stepper.step(-10);
Pval = potVal;
}
Application:
- This sized motor is commonly used in household appliances .
- medical equipment
- stage lighting devices
- Various industrial control applications.
Advantages:
- 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
Reference:
https://www.amazon.in/slp/nema-17-stepper-motor/gxbnu4wdqud73gk