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

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

GarageLab posted a blog post
13 hours ago
Profile IconDuncan Bell and Robert Murray joined GarageLab (arduino, electronics, robotics, hacking)
14 hours ago
Profile IconRichard Vincent and KrisWiner joined GarageLab (arduino, electronics, robotics, hacking)
GarageLab posted blog posts
Profile IconJ.J.J. Kuipers and Phan Minh Kha joined GarageLab (arduino, electronics, robotics, hacking)
GarageLab posted a blog post

Electric lawn mower converted to RC control

Not too many people like pushing a lawn mower around the yard, but unfortunately, it is a necessary…See More
Jun 29
Profile Iconchiran sachintha and Blun Blun joined GarageLab (arduino, electronics, robotics, hacking)
Jun 29
GarageLab posted a blog post

Codename Colossus: The HMC Boudicca

[Michael Sng], founder of [Machination Studio], wanted to create a toy line unlike anything the…See More
Jun 26
Fernando Rodrigues Pontes is now a member of GarageLab (arduino, electronics, robotics, hacking)
Jun 26
GarageLab posted blog posts
Jun 23
Profile IconSayed Akbar Rajaei Ramsheh, william sarte and Ahmed OUKERROUM joined GarageLab (arduino, electronics, robotics, hacking)
Jun 23
GarageLab posted a blog post

Dashboard in you simulator!

 Fans of driving simulator games not only play with steering wheels, gear shifters and pedals. Some…See More
Jun 22
Jesus M Andino commented on GarageLab's blog post Diabetes Has a New Enemy: Robo-Pancreas
"How will be the sugar regulated when there is a higher demand of it due to stress situations? "
Jun 19
GarageLab posted blog posts
Jun 19
GarageLab posted blog posts
Jun 17
AnalysIR posted a blog post

Porting AnalysIR firmware to Particle’s Photon platform

We have just finished porting our (single source) firmware from a range of other ‘Arduino’ type…See More
Jun 17
Profile Iconabin joseph, ATony and cocowei joined GarageLab (arduino, electronics, robotics, hacking)
Jun 17
Michael updated their profile
Jun 15
lovakiranvarma replied to Kringen's discussion MSP430 Launch Pad
"hi! Kringen even though Energia is promissing! But in my opinion it won't much helpful…"
Jun 14
GarageLab posted a blog post
Jun 12

© 2015   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service