Overview of Stepper Motor
Stepper motor is a brushless DC motor that divides the full rotation angle of 360° into a number of equal steps.
The motor is rotated by applying a certain sequence of control signals. The speed of rotation can be changed by changing the rate at which the control signals are applied.
For more information about Stepper Motor and how to use it, refer the topic Stepper Motor in the sensors and modules section.
Connection Diagram of Stepper Motor with ARM MBED (LPC1768)
Example
Let’s write a program to rotate a contentious stepper motor stepwise in a forward direction.
Stepper Motor Code for ARM MBED (LPC1768)
#include "mbed.h"
DigitalOut D_1(p16);
DigitalOut D_2(p17);
DigitalOut D_3(p18);
DigitalOut D_4(p19);
int main(){
while(1){
for(int i = 0; i<12; i++)
{
D_1 = 1; D_2 = 0; D_3 = 0; D_4 = 0;
wait(0.1);
D_1 = 1; D_2 = 1; D_3 = 0; D_4 = 0;
wait(0.1);
D_1 = 0; D_2 = 1; D_3 = 0; D_4 = 0;
wait(0.1);
D_1 = 0; D_2 = 1; D_3 = 1; D_4 = 0;
wait(0.1);
D_1 = 0; D_2 = 0; D_3 = 1; D_4 = 0;
wait(0.5);
D_1 = 0; D_2 = 0; D_3 = 1; D_4 = 1;
wait(0.1);
D_1 = 0; D_2 = 0; D_3 = 0; D_4 = 1;
wait(0.1);
D_1 = 1; D_2 = 0; D_3 = 0; D_4 = 1;
wait(0.1);
}
}
}
Components Used |
||
---|---|---|
ARM mbed 1768 LPC1768 Board ARM mbed 1768 Board |
X 1 | |
ULN2003 Motor Driver ULN2003A is a high-voltage, high-current Darlington transistor array. |
X 1 |
Downloads |
||
---|---|---|
|
stepper_motor_mbed_uvision5_lpc1768 | Download |