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

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


Comment by Robbie McCreath on April 13, 2015 at 4:11am

Hi there, ive been woking on this tutorial and it is exactly what i need, with use of the serial monitor. However i am using a big easy driver instead, but the code wont work.... Do i need to change any of the code for this, or the board set up ? I have imitated the setup exactly as above but it wouldnt work, however i'm not sure about the enable to second ground? Is this needed, i have tried with and without but no luck. 


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

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

Profile IconWilliam Johnson and Todd Enger joined GarageLab (arduino, electronics, robotics, hacking)
Carlos Kwiek posted a blog post


Turning on and off a lamp on the internet and smartphone using ESP8266 with MQTT languageThank you…See More
Avtar Singh is now a member of GarageLab (arduino, electronics, robotics, hacking)
Profile IconPete Z, Anatolio Filho and ashok joined GarageLab (arduino, electronics, robotics, hacking)
Oct 18
Profile IconEmrah Ponjevic and Sergio Salazar joined GarageLab (arduino, electronics, robotics, hacking)
Oct 17
autoelectric is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 14
Gary Plaza is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 13
James Anderson is now a member of GarageLab (arduino, electronics, robotics, hacking)
Oct 10
Adan Salinas commented on Marcelo Rodrigues's blog post SwagBot
"Great use of technology right there."
Oct 5
Ojasvi Gupta left a comment for Olivy Gis
"Something is fishy here....what do you wish to talk about...if you could be a tad more specific?"
Oct 5
Profile IconDave Petersen, Olivy Gis, gian crespo and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Oct 5
Olivy Gis updated their profile
Oct 5
Alaa Alrashdan commented on GarageLab's blog post Tutorial: How to use the Monster Moto Shield
"Hi I have a firgelli actuator that i run using arduino+monster moto shield. I can run it with a…"
Oct 4
Richard Reubenstone posted a blog post

Some great maker projects you can join

If you are interested in joining some teams consisting of makers working together from all over the…See More
Oct 4
Dmitry Slepov posted a blog post

Tibbo Project System-based Office Aircon Controller Application

The app allows you to manage traditional air conditioners that are controlled through infrared…See More
Oct 4
Marcelo Rodrigues left a comment for Jose Gustavo Abreu Murta
"Spammer member suspended. Thanks!"
Oct 2
Profile IconCharles Howey, Neil Besner and Jim Ory joined GarageLab (arduino, electronics, robotics, hacking)
Oct 2
Roosevelt Sebial left a comment for Roosevelt Sebial
"I have left a message to your given e-mail address Mr. Frank. Thanks!"
Sep 29
Eric Delgado updated their profile
Sep 29
Jose Gustavo Abreu Murta left a comment for Jose Gustavo Abreu Murta
"SPAM !!!!"
Sep 29

© 2016   Created by Marcelo Rodrigues.   Powered by

Badges  |  Report an Issue  |  Terms of Service