Nema 17: all about the Arduino compatible stepper motor

Nema 17

We have already analyzed everything about the stepper motors that you can use with your Arduino projects, but there is one of those engines that stands out from the rest of the models like the Nema 17, since it is a very precise engine with several applications, among them replacing the broken engine of some 3D printers.

With this stepper motor you will be able to control very precisely the rotation of its axis to make precision movements and thus control the movement of your machine or robot. And in this guide you will get all the information you need to know it closely and start working with it.

Technical characteristics of Nema 17

The stepper motor Nema 17 is of the bipolar type, with a step angle of 1.8º, i.e. it can divide each of the revolutions or turns into 200 steps. Each winding inside it supports 1.2A of current at 4v of voltage, so it is able to develop a considerable force of 3.2 kg/cm.

In addition, this Nema 17 engine is robust, so it is used in applications such as home 3D printers and other robots that need to have considerable consistency. An example of printers that use this engine as the basis for their movements is the Prusa. It is also used in laser cutting machines, CNC machines, pick & place machines, etc.

However, not everything is wonders and advantages in this engine, since it is more powerful than reliable, therefore, it is not so balanced in this sense…

In short, the technical characteristics are:

  • Stepper motor.
  • Model NEMA 17
  • Weight 350 grams
  • Size 42.3x48mm without shaft
  • Shaft diameter 5mm D
  • Shaft length 25 mm
  • 200 steps per turn (1.8º/step)
  • Current 1.2A per winding
  • Supply voltage 4v
  • Resistance 3.3 Ohm per coil
  • Engine torque 3.2 kg/cm
  • Inductance 2.8 mH per coil

Pinout and datasheet pinout Nema 17

The pinout of these stepper motors is quite simple, as they don’t have too many wires for connection, plus they come with a connector so you can make them easier. In the NEMA 17 handle you will find a pinout like the one you can see in the picture above.

But if you need to know more technical and electrical details of the limits and ranges in which the NEMA 17 can work, you can look for a datasheet of this stepper motor and thus obtain all the complementary information you are looking for. Here you can download a PDF with an example.

Where to buy and price

You can find it ‘at a low price’ in several specialized electronics stores and also in online shops. For example, you can find it on Amazon. They are available from different manufacturers and in different sales formats, such as in packs of 3 or more units if you need several for a mobile robot, etc. Here are some good offers:

Accessories:

Example of how to start with Nema 17 and Arduino

stepper motor scheme Nema 17 and Arduino

A simple example to start using this NEMA 17 stepper motor with Arduino is this simple scheme you can mount. I have used a DRV8825 motor driver, but you can use a different one and even a different stepper motor if you want to vary the project and adapt it to your needs. The same happens with the sketch code, which you can modify as you like…

In the case of the driver used, it holds 45v and 2A of intensity, so it is ideal for stepper motors or small and medium size steppers as is the case of the bipolar NEMA 17. But if you need something “heavier”, a bigger motor like the NEMA 23, then you can use the TB6600 driver.

[highlighted]Remember that you can also use the AccelStepper library for better handling. A library written by Mike McCauley that is very practical for your projects, with support for acceleration and deceleration, a real advantage for many functions.

The summarized connections are as follows:

  • The NEMA 17 motor has its GND and VMOT connections to the power supply. Which in the picture appears with a component with a drawn beam and a capacitor. The power supply must have between 8 and 45v of supply, and the added capacitor I have added can be 100µF.
  • The two coils of the stepper are connected to A1, A2, and B1, B2 respectively.
  • The diver’s GND pin is connected to Arduino’s GND.
  • The driver’s VDD pin is connected to Arduino’s 5v.
  • STP and DIR for the step and direction are connected to digital pins 3 and 2 respectively. If you want to choose other Arduino pins you can, just modify the code accordingly.
  • RST and SLP for reset and sleep of the driver are connected to 5v of the Arduino board.
  • EN or activation pin can be disconnected, since that way the driver will be active. If set to HIGH instead of LOW the driver is disabled.
  • Other pins will be disconnected…

 

As for the sketch code, it can be as simple as this to run NEMA 17 and take the first steps, never better…


#Define dirPin 2
#define stepPin 3
#define stepsPerRevolution 200
void setup() {
  // Declare pins as output:
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}
void loop() {
  // Set the spinning direction clockwise:
  digitalWrite(dirPin, HIGH);
  // Spin the stepper motor 1 revolution slowly:
  for (int i = 0; i < stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
  delay(1000);
  // Set the spinning direction counterclockwise:
  digitalWrite(dirPin, LOW);
  // Spin the stepper motor 1 revolution quickly:
  for (int i = 0; i < stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
  delay(1000);
  // Set the spinning direction clockwise:
  digitalWrite(dirPin, HIGH);
  // Spin the stepper motor 5 revolutions fast:
  for (int i = 0; i < 5 * stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500);
  }
  delay(1000);
  // Set the spinning direction counterclockwise:
  digitalWrite(dirPin, LOW);
  // Spin the stepper motor 5 revolutions fast:
  for (int i = 0; i < 5 * stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500);
  }
  delay(1000);
}

More information, you can consult the programming course with Arduino IDE of Hwlibre.

Leave a Comment

*

*