Tutorial: Stepper Motor + Easy Driver + Arduino

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;

void setup()
{
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available()>0)
  {
    c=Serial.read();
    if(c=='a')
    {
      dir = HIGH;
    }
    if(c=='z')
    {
      dir = LOW;
    }
  }
  if(currentMillis - previousMillis > steptime)
  {
    previousMillis = currentMillis;
    if(stepp==LOW)
    {
      stepp = HIGH;
    }
    else
    {
      stepp = LOW;
    }
    digitalWrite(2,dir);
    digitalWrite(3,stepp);
  }
}

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.

References:
http://arduino.cc/playground/

Views: 18241

Comment by CMH on April 15, 2012 at 11:05am

Great tutorial.  Simple and to the point.  One suggestion:  for beginners, you may want to include some comments in the code so that they can better understand the purpose of each part of the code.  Thanks for posting.

Comment by jay ar belen on June 5, 2012 at 10:20pm

i want to make invention using arduino,, but the problem is,, there is no arduino here in my country,, can any tell me where i can buy that item...

Comment by Elac on June 6, 2012 at 4:35am

E-bay has many Arduino clones, Amazon has Original Arduino Uno R3 Uno R3 for $21.95 (as of 6/6/12)

Or you can make your own Hackduino

Comment by Gustavo Rodriguez on August 6, 2012 at 3:16pm

Zen Toolworks CNC Carving Machine DIY Kit 7x7

Pienso controlar esta cnc con

Product Details

y

EasyDriver Stepper Motor Driver

Como conecto todo esto para que funcione.soy nuevo en esto, pero quiero aprender mas sobre cnc. por favor.

mi mail.    garslive@gmail.com          Gracias por la ayuda

Gracias

Comment

You need to be a member of GarageLab (arduino, electronics, robotics, hacking) to add comments!

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

Paul Denton updated their profile
yesterday
GarageLab posted a blog post
yesterday
Profile IconRichard Coplan and Juan V. Sanchez-Andres joined GarageLab (arduino, electronics, robotics, hacking)
yesterday
Kshitij Dadhekar commented on GarageLab's blog post Tutorial: How to use the Cellular Shield (SM5100B) with Arduino
"Hello,       Can you tell me what is the resistance of the speaker to be…"
Wednesday
GarageLab posted a blog post
Wednesday
Profile IconKshitij Dadhekar, Marvellous Mark and Enrico M. joined GarageLab (arduino, electronics, robotics, hacking)
Wednesday
david chan commented on GarageLab's blog post Tutorial: Humidity and Temperature Sensor with Arduino
"How do you see the output "
Wednesday
Enrico M. posted a discussion

Power supply circuit

Hi guys,I'm building some sort of wood case to arduino mega with LCD, keypad, LED's ...I also want…See More
Tuesday
GarageLab posted blog posts
Tuesday
Profile Icondavid chan, uday harihar, CVassiliou and 4 more joined GarageLab (arduino, electronics, robotics, hacking)
Tuesday
Jeff Bowen updated their profile
Tuesday
Michael Shaw replied to Jean-Guillaume LALANNE's discussion Smallest Arduino with BLE stack and push button integrated
"Check out Tiny circuits for open source: https://tiny-circuits.com/"
Nov 16
rozzers commented on rozzers's video
Nov 14
rozzers commented on rozzers's video
Thumbnail

20141108 150539

"this is a really simple instructable courtesy of NXTprograms. Build and programming instructions at…"
Nov 14
rozzers posted videos
Nov 14
Profile IconJEAN FRANCOIS ROY, Paul Turner, Jadson Santos Silva and 2 more joined GarageLab (arduino, electronics, robotics, hacking)
Nov 14
GarageLab posted a blog post
Nov 14
GarageLab posted blog posts
Nov 13
Profile IconHareRam Yadav and Ankan Biswas joined GarageLab (arduino, electronics, robotics, hacking)
Nov 12
GarageLab posted a blog post
Nov 11

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service