Wiring a Step/Dir Type Stepper Motor Driver Board to an Arduino 18

Subscribe to my Feed!

This page will show you how to wire a  step/dir type stepper motor driver board to an Arduino. The driver board used in this particular example is available from Avayan Electronics and has thus far proven to be quite superb.

Here is the link http://www.avayanelectronics.com/Products/AE-STPR8811/ae-stpr8811.html

Although commercial driver boards vary in their design, the general method of wiring and controlling them typically remains more or less the same. The one thing to watch out for though is to make sure you buy a stepper motor that is compatible with your driver board.

If you buy a BiPolar stepper motor driver, then you can use basically any stepper motor just by wiring it correctly.

If you buy a UniPolar stepper motor driver, however, stepper motors with four wires (BiPolar) will not work, but all the other stepper motor types will.

If I have a choice, I generally just go with the BiPolar drivers because there are only four wires to keep in order.

Driver Board Stepper Motor Test Code

You can download example stepper motor control code by clicking the link. Stepper Motor Test.zip The code itself is rather simplified, but will be a good, quick test to make sure you have your board wired correctly.

You will notice that I have the code set up to test two stepper motors sense I am using them to control a pan and tilt solar tracker / heliostat. This entire tutorial is slightly biased toward this tracker, but hopefully not so much so that you won’t still find it useful if the tracker is not how you came to this site.

The code is programmed to turn Motor 1 one full revolution forwards and backwards. Next, (if it is set up) motor 2 will do the same thing.


NOTE: A word of wisdom from someone who has learned it the hard way, if you were thinking of using the Stepper.h library to control your stepper motor(s), don’t bother because it’s not for the step / dir type driver board like we’re using here. You might have luck using the AccelStepper library though.

Wiring the Driver Board to the Arduino

For my particular driver board (and possibly yours too), many extra “features” are built into it. These features can be controlled through the various pins if desired, or simply left unused if not needed.

The first thing we’ll address is the VCC and GND pins. Here, the VCC pin on the driver board is wired to the 5v pin on the Arduino and the GND pin just goes to, well, GND on the Arduino.

Next, we’ll take a look at the Step and Dir pins. The Step pin tells the stepper motor when it is time to move one step, and the Dir pin tells it which direction to take that step. It is possible to wire these two pins to most any of the Arduino’s pins, but I typically just use pins 2 and 3 for the first driver board and pins 4 and 5 for the second.

This last pin to address is the Enable (ENBLn) pin. Not all driver boards have this one. It’s purpose, however, is to basically just turn the stepper motor on and off. This can be quite useful if you are trying to save power. In my case, this pin must be written LOW to turn the board on and HIGH to turn it off. It sounds backwards, but that is indeed how it is set up. I have my Enable pin wired to pin 6 on the Arduino.

Pin Recap (Driver Board On Left, Arduino On Right)

VCC  –>  5v
Motor 1 STEP –> Pin 2
Motor 1 DIR –> Pin 3
Motor 2 STEP –> Pin 4
Motor 2 DIR –> Pin 5
Enable –> Pin 6

Note: When using multiple driver boards, it is possible for them to share Arduino pins. For example, 5v, GND, and Pin 6 can all be wired in parallel with multiple boards.

Controlling Step Size

It is oftentimes the case that you can control the step size of the stepper motor by changing settings on the driver board. You should check your driver board’s documentation to see how step size is controlled, but the one I’m using does so through jumpers (shown in the picture below).

A couple of reasons for controlling the stepper motor’s step size is for both increased precision and smoother (quieter) operation. Generally, the best step size for your particular stepper motor(s) can be determined through experimentation.

The various step sizes for my driver board can be seen in the picture below. One of the most important things to realize when changing the step size is that doing so also changes the number of steps required to move your stepper motor(s) a set distance.

For example, if I have a stepper motor which has 200 steps / rev written on the back of it, one would expect it to take 200 steps for the stepper to make one complete revolution. This would be correct if I were to use “full” stepping, but, if my driver board was set on “half” stepping it would actually require 400 steps to make one complete revolution.

If it was on “quad” stepping it would take 800 and if it was on “eight” stepping it would take 1600. You may have noticed that the full, half quad, and eight options are essentially just multipliers. Full stepping essentially just multiplies by 1 which means that it basically does nothing to the number of steps / rev printed on your stepper motor. Half stepping multiplies by 2, quad by 4, and eight multiplies by 8.

Wiring Driver Board to Stepper Motor

Wiring a stepper motor can either be really easy or really confusing. If you buy a stepper motor that has a decent data sheet you can access, and also if your driver board has good documentation, then figuring out how to do it shouldn’t be too overwhelming.

My general recommendation in this department is to just Google it because there is already a ton of information on this subject. Suffice it to say that there are just too many variations to really fit in this tutorial.

I will give you this one warning however, don’t start wiring the stepper motors to the driver board until you have turned off power. The driver board can be damaged if you do so.


Power Supply

For any stepper motor of a decent size, the Arduino itself will not be enough to power it. This is easily remedied by adding DC power supply to the mix. Driver boards can typically accept a range of voltage inputs, so check the documentation for yours to find out what it is. The power supply I’m using was originally for an old HP printer. It has a 18V output and is capable of up to 2.23A.

VREF Adjust

VREF, if your driver board has the option, essentially allows you to control how much power goes into your stepper motor. Too much power, and your stepper motor will overheat. Too little power, and the thing might not have enough torque to get the job done.

The documentation that comes with your driver board will likely contain formulas which will allow you to calculate the exact optimum VREF setting you should use. I generally go for the less scientific (lazy) approach and just start low and keep increasing until I reach a happy medium of adequate torque without too much heat.

I generally let the motors run for at least half an hour before determining that they aren’t overheating. I also check the driver board chip itself with a temperature probe to make sure that it also isn’t overheating.

A good temperature range for both the stepper motor and the driver chip can be determined by looking it up in their data sheets.

The actual VREF is typically set with a variable resistor. There should also be a place to test the VREF with a multimeter. Black probe goes to ground and red probe goes to the VREF contact point. As the variable resistor is adjusted, the measured voltage should also change. The higher the voltage, the greater the power to the stepper motor.

NOTE: Your driver board, like mine, might need to be hooked up to the Arduino first so that the enable pin can be controlled to turn the board on.

The End

Finally, we have reached the end of everything (relevant at least) that I can think of adding to this page.

If I missed something, leave a comment below.



Subscribe to my Feed!

18 thoughts on “Wiring a Step/Dir Type Stepper Motor Driver Board to an Arduino

  • Len Oliver

    I found a couple of inexpensive, used, astrosyn steppers on ebay that I want to use for a similar project. Now that I have received them, i c that they are 8 wire steppers. Of course, they didn’t come with data sheets and astosyn tells me that they can’t help because the motors were special order for a customer. I am little confused about how I would wire these up to the AE-MDL-STPR88 stepper driver boards. Any thoughts? I am trying to find other 8 wire steppers in hopes of downloading a wiring diagram, but no luck yet.

    • Gabriel Miller Post author

      Hi Len,

      Try doing a search for something like “How to wire an 8-wire stepper motor as Bi-Polar”. There is tons of information out there on this subject. You should be able to get it to work, but the color coding on stepper motors isn’t always clear.

      Basically, 8-wire stepper motors consist of 4 separate coils. Once you identify which pairs of wires are coils (you can do this just by shorting the ends together and seeing if the motor gets harder to turn), you should be able to follow any generic diagram to figure out how to wire the coils together to create a Bi-Polar stepper motor.
      For example the “Conceptual Module of BiPolar Stepper Motor” at this link.

  • JOHN

    What is the input voltage range for the AE-MDL-STPR8811 board you used? Thanks again my project is almost ready for testing :)

    • Gabriel Miller Post author

      The documentation for the DRV8811 chip, which is what this driver board uses, says that it accepts an “8-V to 38-V Operating Supply Voltage Range”. http://www.ti.com/product/drv8811

      On the board itself though, it says that “VM MAX: with Sch Diodes = 28V No Diodes = 38V”, so using a voltage between 8V and 28V might be safest if you aren’t sure which varient of the board you have.
      Good luck with your project!

  • Eric Lieberman

    Did you wire the PK266 in BiPolor Series or Parallel ?

    ( Black, Green, Red , Blue )


    ( Black, Yellow, Red, White )

    Also in the pictures of the AE-MDL-STPR8811 it looks like you have more wires connected then 5v, ground, step, dir and enable. Am I going blind or am I missing something ?

    Thanks in advance.

    • Gabriel Miller Post author

      Hey Eric,

      I wired the PK266 as bipolar series, although, you can use whatever you think is best.

      I just looked at my wiring, and I think I see what you are referring to. I do have an extra wire soldered to the sleep pin, but it isn’t hooked up to anything. It’s just leftover from when I was doing some experiments with the driver board.

      Hope that helps and sorry it took me so long to reply,
      Crazy week :)


    • Gabriel Miller Post author

      Oh, sorry I don’t have them. I bought them used off of EBay, and they didn’t come with a datasheet. I have looked everywhere for them online, but couldn’t find anything. You might try contacting someone over at astrosyn.com and see if someone has it hidden away in storage.

  • luigi grimaldi


  • Lynn Demers "ljd10"

    Sun Tracking/Heliostat program v_094
    is that an actual program or something like a pic program?
    I am trying to understand the heleostat control program.
    I don’t believe there is a direct link to the complete program or I am missing something. Now I know ther is a driver board to run the steppers through bipolar control. The arduino board your talking about has to be the front end (between the driver and the paralell port pin wiring.) or some type of pic program that holds the program. However if thers is a stand alone program or *.exe file I can’t find the link to it.
    thank you
    Lynn Demers

    • Gabriel Miller Post author

      Hi Lynn,

      There is no direct link to the heliostat control program, but there is one to a page where it is located. You can also find it under “Heliostat Projects” on the navigation menu. Sense this driver board set up is adaptable to many situations, I opted not to link the sun tracking / heliostat program because many of the people who find this page probably aren’t here for it.

      The Arduino is a standalone microcontroller, like the pic boards are, and there is a link, “Stepper Motor Test.zip”, toward the top of the page which has code for the Arduino to allow it to control the stepper motors. The Arduino controls the driver boards/stepper motors directly, so no parallel port is necessary.

      Hope that help!

Comments are closed.