Tuesday, October 22, 2013

What you need to know to interface stepper motor with a microcontroller?

General Description


Every revolution of the stepper motor is divided into a discrete number of steps, in many cases 200 steps, and the motor must be sent a separate pulse for each step. The stepper motor can only take one step at a time and each step is the same size. Since each pulse causes the motor to rotate a precise angle, typically 1.8°, the motor's position can be controlled without any feedback mechanism. As the digital pulses increase in frequency, the step movement changes into continuous rotation, with the speed of rotation directly proportional to the frequency of the pulses. Step motors are used every day in both industrial and commercial applications because of their low cost, high reliability, high torque at low speeds and a simple, rugged construction that operates in almost any environment. 


Motor instead of doing a single complete rotation on a single pulse does only a predefined rotation or rotates only one on a single applied pulse. So if a step angle is 1.8°, this means a motor can do 360/1.8 = 200 steps in a single rotation. Means one needs to provide 200 pulses to make the stepper motor cover 1 revolution. 

So for attaining a speed of 10 rpm one needs a square pulse train of frequency 10x200 cycles or 2000 cycles per minute or 33.33Hz. Here the speed of motor is directly proportional to frequency of applied pulse.


Step Modes
3 step modes. 

1) Full Step
Full step mode is achieved by energizing both windings while reversing the current alternately. Essentially one digital pulse from the driver is equivalent to one step.  
A normal 4 step sequence is like below.


Step #
Winding A
Winding B
Winding C
Winding D
1
1
0
0
1
2
1
1
0
0
3
0
1
1
0
4
0
0
1
1


Going from step 1 to 4 we rotate motor clockwise

Going from step 4 to 1 we rotate motor counter clockwise

 

2) Half Step
In this mode, one winding is energized and then two windings are energized alternately, causing the rotor to rotate at half the distance. Although it provides less torque, half-step mode produces a smoother motion than full-step mode.
Half Step Sequence


Step #
Winding A
Winding B
Winding C
Winding D
1
1
0
0
1
2
1
0
0
0
3
1
1
0
0
4
0
1
0
0
5
0
1
1
0
6
0
0
1
0
7
0
0
1
1
8
0
0
0
1
 
3) Micro Step
Out of Bounds. Will create a separate post for the same.



Choice of Stepper Motor
The choice depends on ones requirement of torque and speed in ones application. No one stepper motor is suitable for every application. But for prototyping purposes one can use any available stepper motor with required step angle that can be bought from nearby electronics store. There is also a confusion that stepper motor requires a completely new motor driver. This is usually not the case whatever variants you see are higher grade or lower grade variants of a classical motor controller like L293D. What changes is the number of channels, channel capacity and the switching frequency. Usually what i prefer is the mosfet based multi channel motor driver that is easily available everywhere and can be scaled up and down based on the needs and current capacity. 

Other thing that needs to be taken care in stepper motor is number of pole. The higher precision and torque you need the number of poles in the stepper motor will vary. So for same application you may come across 2pole, 4pole and even 8 pole stepper motor. With higher number of poles the only difference will be that you will require more channels in your motor driver. These are all general observation for free available stepper motor for generic applications. For more specific application one needs to dive deep into once requirement and find out a proper motor afterwards.



Advantages
  1. Energized winding at standstill provides full torque with no rotation.
  2. Provides precise positioning and repetability of the same position is very high and easy to attain.
  3. Very Responsive and reliable
  4. Responsd directly to digital pulses and provide open loop control, reducing cost of control and increases simplicity.
  5. A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input pulses.