Stepper Motors
Advantages and disadvantages of stepper motors
The basic advantages of a stepper motor include high accuracy, easy control of the rotor position and the speed of rotation of the rotor. The torque of the motor is very high at a low rotational speed. There are no brushes in the design of the motor, which contributes to high mechanical resistance and greater reliability. Another important feature is the simple motor control: quick start thanks to the high torque, easy stop thanks to the high holding torque and the ability to quickly change the direction of rotation.
One of the main disadvantages of a stepper motor is its energy requirement. This motor requires a power supply both when moving and when stationary. The torque of the motor is highest at a relatively low rotational speed and decreases at a higher rotational speed.
How does a stepper motor work?
A stepper motor is controlled by electrical pulses that are applied to the coils of the motor in the correct sequence. The motor then continues to rotate in small steps, which are determined by the pulse rate and the number of coils.
Wiring
Based on the model, a NEMA 17 stepper motor may have 4, 5, or 6 wires. The models with 5, and 6 wires are unipolar stepper motors, while the model which has 4 wires is a bipolar stepper motor.
A common problem is to find out which wires are connected to which coil of the motor:
Start by connecting two random motor wires together - you can just touch them together or twist them.
If the interconnected wires belong to one coil, they will create a magnetic field in the motor when you try
to manually rotate the shaft. This will be felt by the increased resistance to turning the shaft, or you
may have a slight bouncing sensation. However, if the shaft turns slightly and you do not feel the difference
between when the wires are connected together and when they are not, the pair of wires selected do not belong
to the same coil.
Motor Test - Software
The program offers the simplest conceivable test: the motor should rotate forwards for 1000 steps and then backwards for another 1000 steps.
/* Motorshield L293 Tutorial * Running a stepper-motor * * Stefan Hager 2024 */ #include <AFMotor.h> // Number of steps per output rotation // Change this as per your motor's specification // 200 is fine for Nema 17 since one step are 1,8 ° const int stepsPerRevolution = 200; // connect motor to port #1 (M1, M2), use port #2 for M3,M4 AF_Stepper motor(stepsPerRevolution, 1); void setup() { Serial.begin(9600); Serial.println("Stepper test is starting ..."); motor.setSpeed(100); // 100 rpm } void loop() { Serial.println("Single coil steps"); // run 1000 steps (5 rotations) forward, then backward Serial.println("Forward ..."); motor.step(1000, FORWARD, SINGLE); Serial.println("Backward ..."); motor.step(1000, BACKWARD, SINGLE); }