The Arduino board can be used for many applications, including driving DC motors, servos and Stepper Motors. A Stepper Motor is a kind of electric motor that can be used when we need perfect angular position.
On this tutorial, we will show how use an Arduino board to control a Stepper Motor. To control this motor, we need an H bridge or a control board, like the Easy Driver.
Put everyting together like the picture:
Now connect the Power Supply 1 to a 7V to 30V, 1A power supply.
Open the Arduino IDE and paste the code:
int dir = LOW;
int stepp = LOW;
long previousMillis = 0;
long currentMillis = millis();
long steptime = 500;
int x = 0;
char c = 0;
dir = HIGH;
dir = LOW;
if(currentMillis - previousMillis > steptime)
previousMillis = currentMillis;
stepp = HIGH;
stepp = LOW;
Upload the code and open the Serial Monitor.
In the Serial Monitor, type 'a' and press Enter. The motor will rotate to one side. Then type 'z' and the motor will rotate backwards.