[vc_row][vc_column width=”1/1″][vc_column_text]A stepper motor (or step motor) is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor’s position can then be commanded to move and hold at one of these steps without any feedback sensor (an open-loop controller), as long as the motor is carefully sized to the application.
In this post, we are going to look at how to use pcDuino to control stepper motor. The stepper motor and driver board are part of the advanced learning kit for Arduino.
[/vc_column_text][vc_tour][vc_tab title=”BOM” tab_id=”1384292575-1-81″][vc_column_text]1. pcDuino experimental package
2. 1 x stepper motor
3. 1 x stepper motor drive board[/vc_column_text][/vc_tab][vc_tab title=”Wire Diagram” tab_id=”1384292575-2-74″][vc_column_text]The pin mapping between pcDuino and driver board is as follows:
[table]
pcDuino pins, drive board pins
8, In1
9, In2
10, In3
11, In4
VCC, +
GND, –
[/table]
The following is a picture of the setup:
[/vc_column_text][/vc_tab][vc_tab title=”Explaination” tab_id=”1384293043770-2-4″][vc_column_text]When the code is running, we will observe that the stepper motor keeps rotating.[/vc_column_text][/vc_tab][vc_tab title=”Sample Code” tab_id=”1384293096326-3-6″][vc_column_text]
/*
Drive stepper motor
*/
void setup()
{
for(int i=8;i<=12;i++) //define pins D8~D11为 as output
{
pinMode(i,OUTPUT);
}
}
void loop()
{ //drive motor to rotate
for(int i=8;i<=12;i++)
{
digitalWrite(i,1);
delay(10);
digitalWrite(i,0);
}
}
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.