Stepper motor - how it works
The main types of stepper motors:
- Variable magnet motors (rarely used);
- Permanent magnet motors;
- Hybrid motors (more difficult to manufacture, more expensive, but the most common type of stepper motor).
Where to buy a stepper motor
The simplest engines Options on the AliExpress website:
Stepper motor driver
Operating the motor in bipolar mode has several advantages:
- Increase in torque by 40% compared to unipolar motors;
- Possibility of using motors with any configuration of the phase winding.
Stepper motor driver based on L298N

L298N motor driver
Stepper motor driver ULN2003

Description of UNL2003 stepper motor driver
Other drivers
- They allow you to stabilize phase currents;
- Possibility of setting microstepping mode;
- Providing protection of the key from closing;
- Overheat protection;
- Opto-isolation of the control signal, high immunity from interference.
STEP / DIR drivers use 3 signals:
- STEP is an impulse that initiates a turn by a step / part of a step, depending on the mode. The engine speed will be determined from the pulse repetition rate.
- DIR is a signal that sets the direction of rotation. Typically clockwise rotation is performed when a high signal is applied. This type of signal is generated before the STEP pulse.
- ENABLE - enable / disable the driver. This signal can be used to stop the motor running without holding current.
Connecting a stepper motor to Arduino

Connecting a stepper motor to Arduino
Another variant of the circuit using the L298:

Connecting a stepper motor to Arduino based on L298

Connecting a stepper motor to Arduino

Schematic diagram of connecting a stepper motor
Overview of the main models of stepper motors for arduino
Main characteristics of the engine:
- The angular step is 1.8 °, that is, there are 200 steps per 1 revolution;
- The engine is two-phase;
- Working temperatures from -20C to 85C;
- Rated current 1.7A;
- Holding moment 2.8 kg x cm;
- Equipped with 42 mm flange for easy and quality installation;
- High torque - 5.5 kg x cm.
- Rated power supply - 5V;
- 4-phase motor, 5 wires;
- Number of steps: 64;
- Step angle 5.625 °;
- Rotation speed: 15 revolutions per second
- Torque 450 g / cm;
- DC resistance 50Ω ± 7% (25 ℃).
Description of the library for working with a stepper motor
- Stepper (number of steps, contact numbers). This function creates a Stepper object that corresponds to the motor connected to the Arduino board. The argument is the contacts on the board to which the motor is connected, and the number of steps that are taken to complete a revolution around its axis. Information on the number of steps can be found in the documentation for the motor. Instead of the number of steps, an angle can be specified, which is one step. To determine the number of steps, you need to divide 360 degrees by this number.
- Set Speed (long rpms) - a function that specifies the rotation speed. The argument is a positive integer that specifies the number of revolutions per minute. Set after the Step () function.
- Step (Steps) –Rotate the specified number of steps. The argument can be either a positive number - clockwise rotation of the engine, or negative - counterclockwise.
Example sketch for control
#include <Stepper.h> const int stepsPerRevolution = 200; Stepper myStepper (stepsPerRevolution, 8,9,10,11); // connect to pins 8 ... 11 on Arduino void setup() { myStepper.setSpeed (60); // setting the rotor speed Serial.begin(9600); } void loop() { // The function waits for a command to come in, transforms the text and sends a signal to the motor to rotate it the specified number of steps. Serial.println ("Move right"); //clockwise myStepper.step(stepsPerRevolution); delay(1000); Serial.println ("Move left"); //counterclock-wise myStepper.step(-stepsPerRevolution); delay(1000); }
Conclusion
In this article, we learned what a stepper motor is, how you can connect it to an arduino, what a stepper motor driver is. We also looked at an example of writing a sketch using the built-in Stepper library. As you can see, there is nothing particularly difficult in working with stepper motors, and we recommend that you definitely experiment on your own and try to include it in your Arduino projects .
Social Plugin