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()

void loop()
      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.


Views: 18961

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


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



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

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

Profile IconDinko, Bukasa Tshilombo, simataempat and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
14 hours ago
ANGEL RUIZ replied to ANGEL RUIZ's discussion Can this Xyron be used as a CNC router
ANGEL RUIZ posted a discussion

Can this Xyron be used as a CNC router

I don't have the money to afford a CNC router so I was wondering if I can convert this into…See More
GarageLab posted a blog post

HAVOC: NASA’s proposed cloud city over Venus

The surface of Venus is a notorious hell-hole. If an atmospheric pressure roughly 90 times greater…See More
roberto premoli's photo was featured


premoboard+cubieboard+hdd2.5''features:-3LAN-5USB-2WIFI-500GB HDD…
Veritus's photo was featured

Battery Pack

Created a closed system of power in a wearable back pack. Back pack had 5 power outlets each at 220…
NELU NASTASOIU's photo was featured
wesley wortman's photo was featured
GarageLab posted blog posts
sunny lai left a comment for sunny lai
"thanks for hearing from you, it is my pleasure"
Enahoro Olori updated their profile
Profile IconRobert Sitton, Mr Abraham Akim and Magnus Nordin joined GarageLab (arduino, electronics, robotics, hacking)
GarageLab posted blog posts
Dec 12
Profile Icongiacomo, dan rules and Jay Thornton joined GarageLab (arduino, electronics, robotics, hacking)
Dec 11
GarageLab posted a blog post
Dec 10
GarageLab replied to Lou Liberatore's discussion LiquidCrystal_I2C library in the group Arduino
" Hi Lou Lberatone, I think you Hi Lou Lberatone, I think you probably are using the libraries…"
Dec 10
GarageLab joined Marcelo Rodrigues's group


Group for the Arduino communitySee More
Dec 10
GarageLab posted blog posts
Dec 9
Profile Iconbenjamin black and sunny lai joined GarageLab (arduino, electronics, robotics, hacking)
Dec 9
Profile IconJjdelala and Sathish GP joined GarageLab (arduino, electronics, robotics, hacking)
Dec 8

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service