MEGA DASBob AlsoneJLCPCB
Published © Apache-2.0

Large Stepper Motor Control A4988

Ultimate getting started guide to easily understand how stepper motor work and how to properly control using an Arduino board

BeginnerFull instructions provided12 hours1,791
Large Stepper Motor Control A4988

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
Control unit of our project
×1
Stepper motor driver board A4988
SparkFun Stepper motor driver board A4988
The stepper motor that we have used in our tutorial
×1
Stepper Motor
Digilent Stepper Motor
×1
Driver DRV8825 for Stepper Motors for Theremino System
Driver DRV8825 for Stepper Motors for Theremino System
Optional Driver to use instead of A4988
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1

Software apps and online services

EasyEDA
JLCPCB EasyEDA
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic PDF format

Download this file to acces the schematic PDF format

Code

Code snippet #1

Plain text
const int EN=2;         //ENABLE PIN
const int Step=3;       // STEP PIN
const int dir=4;        // DIRECTION PIN
/*----------------------------SETUP FUNCTION--------------------------*/
void setup() 
{
  pinMode(EN,OUTPUT);     // ENABLE AS OUTPUT
  pinMode(dir,OUTPUT);    // DIRECTION AS OUTPUT
  pinMode(Step,OUTPUT);   // STEP AS OUTPUT
  digitalWrite(EN,LOW);   // SET ENABLE TO LOW
}

/*----------------------------LOOP FUNCTION--------------------------*/
void loop() 
{
  digitalWrite(dir,LOW);        // SET DIRECTION LOW FOR FORWARD ROTATION
  for(int x = 0; x < 1000; x++) // LOOP 1000 TIMES FOR 1000 RISING EDGE ON STEP PIN
  {
    digitalWrite(Step,HIGH);    // STEP HIGH
    delay(1);                   // WAIT
    digitalWrite(Step,LOW);     // STEP LOW
    delay(1);                   // WAIT
  }
  delay(10);                    // DELAY BEFOR SWITCH DIRECTION
  digitalWrite(dir,HIGH);       // SET DIRECTION HIGH FOR BACKWARD ROTATION
  for(int x = 0; x < 1000; x++) // LOOP 1000 TIMES FOR 1000 RISING EDGE ON STEP PIN
  {
    digitalWrite(Step,HIGH);    // STEP HIGH
    delay(1);                   // WAIT
    digitalWrite(Step,LOW);     // STEP LOW
    delay(1);                   // WAIT
  }
  delay(10);                    // DELAY BEFOR SWITCH DIRECTION
}

Credits

MEGA DAS

MEGA DAS

23 projects • 203 followers
MEGA Development of Automated System is a free community responsible for creating automated systems standing on robotics engineering field
Bob Alsone

Bob Alsone

6 projects • 2 followers
JLCPCB

JLCPCB

0 projects • 2 followers
JLCPCB, is the largest PCB prototype enterprise in China creates this platform to Develop and Provide Worldwide with PCB and PCB assembly.
Thanks to EasyEDA .

Comments