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: 12725

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

Shannon Bradley and Marcelo Rodrigues are now friends
yesterday
Terry Renner is now a member of GarageLab (arduino, electronics, robotics, hacking)
yesterday
Andy S posted a discussion

Arduino MEGA boolean?

Hi everyone,been banging my head against the wall a few days now.i have a small project, where i…See More
yesterday
Bobby Marshall posted a video

SELFIE Mirror

Meet the S.E.L.F.I.E., the "The Self Enhancing Live Feed Image Engine". Find out how it works: http://istrategylabs.com/2014/04/take-an-instant-selfie-with-t...
yesterday
GarageLab posted a blog post
Tuesday
pj jones posted a status
"Designing an Home Automation Project"
Monday
Profile Iconpj jones, Robert Kribel and Lars Goldschlager joined GarageLab (arduino, electronics, robotics, hacking)
Monday
Fontaine Pierre commented on GarageLab's blog post Tutorial: Using GPS Shield as an Anti-Theft Device
"Hi, Is it possible to make a car tracker with this GPS + GSM shield to send a message if limits…"
Friday
GarageLab posted a blog post
Friday
Profile Iconeslam mohamed haredy, Wesley Castillo and Lise Pape joined GarageLab (arduino, electronics, robotics, hacking)
Apr 10
Terry Dark left a comment for Beula Isaac
"Hi Beulah, Greetings from down under (Australia) Please tell me about yourself and your interests…"
Apr 9
Terry Dark and Beula Isaac are now friends
Apr 9
GarageLab posted blog posts
Apr 9
GarageLab posted a blog post

Festo's BionicKangaroo gets the hop on energy-efficiency

The BionicKangaroo features pneumatic actuators that provide the jumping power and at the same time…See More
Apr 7
Profile IconAnthony Parker, John Nicosia and Tom Devey joined GarageLab (arduino, electronics, robotics, hacking)
Apr 7
wani sageer posted photos
Apr 6
GarageLab posted a blog post

Using a 3D Printer to Draw Tattoos: InkD

 It’s one thing to allow a professional tattoo artist to ink your arm. It’s another thing…See More
Apr 4
GarageLab posted a blog post

Dispensing Solder Paste With A 3D Printer

There’s a strange middle ground in PCB production when it comes to making a few boards. Dispensing…See More
Apr 3
Duong Nguyen is now a member of GarageLab (arduino, electronics, robotics, hacking)
Apr 3
GarageLab posted blog posts
Apr 1

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service