Stepper motor is a Brushless DC electric motor that divides the complete rotation into very small angles called steps. Usually, each step moves 1.8 degrees and therefore a total of 200 steps for a rotor to finish a single rotation. Unlike normal dc motors, it contains multiple Stator magnets used to trigger each step. Apart from 1.8 degrees, stepper motors with step angle 30, 15.5, 2.5, 2 and 0.9 are available. The highest resolution variant, with a 0.9-degree step angle, takes 400 steps for a complete rotation. The article discusses the details of stepper motor operation and interfacing of stepper motor with 8051 microcontrollers.
Working of Stepper motor
A stepper motor has a rotating part called a rotor and a static part termed Stator. The Stator and rotor have magnetic poles and by energizing the Stator poles, the rotor moves in order to align with the stator. A rotor is a central gear-shaped piece of iron. Stator is a set of toothed electromagnets arranged around the central gear.
When the phase winding of the stepper motor is provided with a current, corresponding magnetic flux will be developed in the stator in the direction perpendicular to the direction of the current flow. When one electromagnet is energized with the help of an external driver circuit or a microcontroller, the rotor shaft turns in such a way that it aligns itself with the stator in a position that minimizes the flux opposition. And when the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one. From there the process is repeated.
Each of those rotations is called a “step”, with an integer number of steps making a full rotation. In that way, the motor can be turned by a precise angle.
According to the winding arrangements of the electromagnetic coils in a two-phase stepper motor, they are classified as unipolar and bipolar stepper motors
Unipolar and Bipolar stepper motors
Unipolar stepper motor
Unipolar stepper motor works with one winding with a center tap per phase. The center tap divides the winding into two sections. each half of this winding is turned on for each of the magnetic field direction. Here the current flow through will be always in the same direction and hence the name, unidirectional stepper motor.
Since the current direction is not reversed in this type of stepper motors, they are quite easy to operate and are highly preferred among hobbyists. But, because the current travels only through half the winding, Torque achieved is less.
Bipolar stepper motor
In a Bipolar stepper motor, there is a single winding per phase. Therefore, it has easy wiring arrangement but its operation is little complex. In order to drive a bipolar stepper, we need a driver IC with an internal H bridge circuit. This is because, in order to reverse the polarity of stator poles, the current needs to be reversed. This can be done through an H bridge.
STEPPING MODES – Unipolar stepper motors
Mainly there are 3 types of stepping modes in a Unipolar stepper motor :
- Full step
- Half step
In full-step operation, each step has a movement of 1.8 degrees and hence it takes 200 steps to complete a full revolution. For this, either single-phase or two phases of the stator winding are energized.
According to the number of phases energized, Full step mode can be again classified as :
- Single-phase mode (one-step mode/wave step mode)
- Dual-phase mode
In a single-phase mode, also known as one-step mode/ wave step mode, The motor is operated with only one phase energized at a time. This mode of operation requires a small amount of power.
In the below table, each letter denotes each wire from the winding. A value of ‘1’ means it is connected to Positive voltage and a value of ’0’ denotes, it is connected to ground.
In dual-phase mode, the motor-operated in both phases get energized at the same time. This mode provides more torque and high-speed performance. But it requires twice the amount of power used in one-step mode.
In half step mode, The rotor moves through half the base angle in a single step which results in improved torque than single-phase full-step operation. It results in more precise motion control and smoother motor performance. The resolution is also increased. But in this mode, the motor produces lesser torque compared to Full step mode
In the micro-step mode, it divides the motor steps up to 256 times which improves the low-speed smoothness and low-speed resonance effects. But here, the motor produces lesser torque compared to other modes. Micro-step operation is preferred where increased smoothness of rotation is required.
Interfacing Stepper Motor with 8051 (AT89S52)
To interface stepper motor with 8051, All we have to do is; Give the value 0 and 1 to the four wires of stepper motor according to the provided tables, depending on which mode we want to run the stepper motor. We will connect the stepper motor to PORTD of the AT89S52, which is an 8051 based microcontroller.
Here we have used the unipolar stepper motor. We have connected four ends of the coils to the first four pins of port 3 of 8051 through a ULN2003A IC.
Program for interfacing Stepper motor with 8051
We have the code below for generating step sequences for different modes of operation. Refer to the table provided in the above section. Values for stepwise rotation are loaded into PORT 3 in a continuous while loop
Wave step mode
/* The beginning of the code should include header file reg51.h
which is common for 8051 controllers. */
void delayms(int time)
unsigned i,j ;
//By default, the ports of 8051 microcontrollers are configured as output
//Here we will use port3 as output
/* According to the table values for each step are loaded into Port 3
inside the While(1) loop. */
P3=0x08; // 1000
P3=0x04; // 0100
P3=0x02; // 0010
P3=0x01; // 0001
Firmware for Dual-phase mode
Firmware for Half Step mode