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

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

GarageLab posted blog posts
5 hours ago
GarageLab posted a blog post

Scientists Create a Real Hoverboard

Ever since the fictional hoverboards in 1989’s Back to the Future Part II children (and adults)…See More
Wednesday
Colin Goldberg posted a discussion

Can I use my Samsung Tab 4 tablet as a usb host to a beaglebone board black?

Hi,As a newbie to this space, I would like to know what to think about before I try to connect my…See More
Tuesday
Antonio Turner posted a status
Tuesday
GarageLab posted blog posts
Tuesday
Profile IconGeorge Ray Learmond, Steve Barnes and Diego Leite Mendes joined GarageLab (arduino, electronics, robotics, hacking)
Monday
GarageLab posted a blog post
Oct 17
Stu porley is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 16
GarageLab posted blog posts
Oct 16
Atari Punk Console posted a status
"I backed Garag Lab Kick Starter Project the Garagino, I can't wait till I get my Garagino! https://www.kickstarter.com/projects/931487098/g"
Oct 15
Profile IconDan bgarage and Joe Cannella joined GarageLab (arduino, electronics, robotics, hacking)
Oct 15
GarageLab posted blog posts
Oct 14
Profile IconSim Wilkins G. Entendez, Charles Hamilton and Colin Goldberg joined GarageLab (arduino, electronics, robotics, hacking)
Oct 13
GarageLab posted a blog post

Flexible 'Tentacle Robots' Could Aid Planetary Exploration

 Researchers are developing new types of robotic systems inspired by elephant trunks, octopus arms…See More
Oct 10
David Rios is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 10
GarageLab posted blog posts
Oct 9
Marcelo Rodrigues is now friends with Tharaka Madhusanka and Guruprasad Balaji
Oct 7
GarageLab posted a blog post
Oct 7
GarageLab posted a blog post
Oct 6
Profile IconScorpio Imran, Joaquim Moroni da Silva, Delan and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Oct 6

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service