DIY Arduino Stepper Motor Driver Board

Subscribe to my Feed!

This page will show you how to put together a simple stepper motor driver board that can be controlled with an Arduino. I built mine to use with my heliostat projects, but it could be used for other things too.

You will need to build two of these if you are also building a heliostat or sun tracking machine, one for the altitude rotation and another for the azimuth rotation.

This stepper motor driver board uses four of the Arduino’s pins. Through some electronics trickery, it is technically possible to reduce the number down to two pins (Check out this link if your interested in doing this); however, I don’t think it’s possible to completely turn off the power to the stepper motors using this method. Since I need to be able to shut the power off, I stick with the method that uses four pins.

Parts List

Here is the parts list for the driver board. I put a link to Allied Electronics for each item with the product description in case you want to find it on another site.

This is exactly what I used, but it is, of course, possible to substitute slightly different parts for everything.

It only costs around 6 dollars for each driver board, so it isn’t a bad idea to get enough parts to build an extra one or two in case you mess something up.

For each driver board you build, you will need four of each of the items listed below.

Resistors http://www.alliedelec.com/search/productdetail.aspx?SKU=2964741
Resistor; Carbon Film; Res 1 Kilohms; Pwr-Rtg 0.25 W; Tol 5%; Axial; Cer-Core

Diodes http://www.alliedelec.com/search/productdetail.aspx?SKU=2660003
DIODE; 1 A (MAX.) @ 25C IF; 1.1 V (MAX.) @ 25C; 5 UADC (MAX.) @ 25C IR

Transistors http://www.alliedelec.com/search/productdetail.aspx?SKU=2482050
TRANSISTOR, POWER; NPN; 100VCE; 100VCB; 5VEB; 8A ICC; 1A IB; 80 W @ <= 25 C

Heat Sinks http://www.alliedelec.com/search/productdetail.aspx?SKU=6195071
Heat Sink; 1.750 in.; 0.500 in.; TO-220 packages

This protoboard is large enough to be cut up into three smaller pieces, each big enough for one driver board, so you really only need one.

Protoboard http://www.alliedelec.com/search/productdetail.aspx?SKU=2370112

Motor Power Supply

The power supply I’m using is one that came off of some unknown, obsolete household gadget, so I don’t have a link for it. Use what you think is best for your stepper motors.

Schematic

Here is the “schematic” for the circuit.  I tried to make it easy to follow by drawing it to look more or less the same as it does in real life. It’s a pretty simple circuit since it is basically just the same thing done four times for each of the stepper motors coils. (Click the picture for a larger image)

Driver Board Circuit

Where it says “Arduino Pin” in the circuit, I use pins 2,3,4,5 for the first stepper motor (altitude) and pins 6,7,8,9 for the second stepper motor (azimuth).

Both the first and second driver board use the same motor power supply, so the positive and negative wires for each individual driver board go to the same spot.

The box labeled “Relays” is explained in more detail on  the Using Relays to Control Multiple Solar Machines page. For now though, just skip it and connect the wire straight into the stepper motor’s power supply. You can come back to it later after you’re sure you have the driver board working.

I didn’t show them in this schematic (it is in the relay schematic though), but the stepper motors require a diode on each of the wires that go to the transistors if you are controlling multiple stepper motors with the relays.

If you are only going to build one sun tracking or heliostat machine, you can completely forget about the “Relays” box and diodes.

Transistor

Here is a picture showing which leads are which for the transistor in the above schematic. The smaller sized transistors use a different ordering for the base, collector, and emitter. Something to keep in mind if you were to try and modify the schematic for smaller stepper motors.

Transistor Pins

Pictures of the Build

Here is a picture of one of my driver boards when it was about 3/4 finished. You can see how the positive and negative wires are laid out in this one. When spacing the transistors, don’t forget to leave room for the heat sinks.

img19

Here is another picture of the driver board almost finished. The resistors have been added along with eight wires. The four grey wires go to the Arduino pins while the blue and red wires power the stepper motor.

img20

This picture shows the driver board after the heat sinks were added. They are held on with nuts and bolts that I had from an old Erector set. It’s a good idea to use the heat sinks in order to help keep the transistors from getting too hot. The transistors on my board stay below 100 degrees Fahrenheit with the heat sinks attached. I also used some heat sink compound, but it might not have been absolutely necessary.

Transistor Heat Sinks

This picture shows both driver boards after they were completed and wired to the Arduino. You can see how the protoboard has been cut down to size here.

Arduino Driver Board

Stepper Motor Wiring

Wiring the stepper motors to the driver board can sometimes be a little tricky. Mine are the eight wire type, and it took me awhile to figure out how to put them in the right order. There was a lot of trial and error involved before I got it to work correctly.

I had another five wire stepper motor that I tried too, and that was a piece of cake to figure out, so it all depends on what you have I guess.

I don’t know what your stepper motor has, and it could be entirely different, but my 8 wire stepper has 2 reds, 2 blacks, 2 grays, and two yellows.

The blacks and reds are all tied together and go to the positive wire on the stepper motor’s power supply while the other wires plug into the driver board in this order: gray, yellow, gray, yellow.

Arduino Stepper Motor Test Sketch

You can test out your driver boards and stepper motors with this Arduino sketch. It should rotate the first stepper motor one full revolution in each direction and then do the same with the second stepper motor. Once this has been done successfully, you are ready to move on to something else.

Subscribe to my Feed!

5 Responses to DIY Arduino Stepper Motor Driver Board

  1. Geoffrey Baler says:

    Boy this is an interesting project and thread. I’m doing research on building my own small scale suntrackers, each with their own stepper motors. Looks like I can buy stepper motors pretty cheap, its the driver boards etc that can get expensive.
    Q: The arduino has a time clock library. Couldn’t you build a system without using a real time clock? It would require setting in the original sketch but would run until reset without difficulty.
    Q: Why did you drop the VB system? It looks like the Arduino based system is cheaper, but much harder for your average person like me to figure out compared to plugging in a board and running some software on a computer.
    Q: Because I’m thinking of building a large number of SMALL heliostats (24 maybe) can’t I simply run the motors in parallel gangs, several on each circuit? That way fewer boards etc. A 3 amp 4 axis board should be able to run 4 groups of 3 1A motors wired in parallel, correct?
    Thanks so much for all the info, my head is spinning!

    • Gabriel Miller says:

      Yes, the time clock library should work I think. The Arduino isn’t especially accurate as a time keeping device and can lose up to 2 seconds per day, but, depending on what you want to do, it might be good enough.

      I moved the program over to the Arduino for several different reasons:
      It uses much less electricity than a computer.
      Running parallel port cable out to my heliostat would be expensive.
      The computer’s parallel port doesn’t always work as it should. Once day it works, you install a program or update, and the next day it doesn’t.
      The Ardiuno has lots of example code which makes my life much easier.
      The laptop I had with a parallel port died, so I can’t really do much with the VB program anyway.

      I don’t know enough about electronics to be confidant enough to give advice on wiring the motors. What exactly do you want to do with your heliostats? Depending on what it is, you might be able to get away with just two stepper motors.

      Also, the way I have mine wired allows me to control several sets of stepper motors with just one driver board. Would that work for you?

      Hope that helps!
      Gabriel

  2. Paul Firnschild says:

    Great write up! Maybe you can give me a clue. I need to build a stand alone stepper controller that I can use to:
    control 1 stepper using a rheostat and 2 push buttons – forward and reverse.
    Now the tough part. A also need to be able to specify the number of steps I want the motor to advance (or retreat) when a signal which is triggered by another device crossing an optical sensor. Can I do this with no programming? OK. If it must be programmed, have you seen anything like this that I can use as a starting point?

    • Gabriel Miller says:

      It probably can be done with no programming, but I wouldn’t know where to start in that case. My guess is that it would be the considerably easier to do it with programming though, but I’m biased. Electronics nerds may tell you otherwise :) .

      I think your best bet would be to get an Arduino and start working through the tutorials on the Arduino site. If I understand correctly, what you want to do would be fairly easy using an Arduino.

      If an Arduino ends up being overkill for your project, you can always look into the ATTiny. I’ve never used one myself, but the ATTiny chips only cost a few dollars and are considerably more compact too. There is even a tutorial at the below link which shows how you can upload Arduino programs to the ATTiny. This way you can always start with an Arduino and move everything over to the ATTiny later.
      http://toasterbotics.blogspot.com/2011/08/programming-attiny85-arduino-style.html

      Hope that helps,
      Gabriel

  3. B T says:

    You probably want to use a servo motor since you want to use a rheostat. Have a look at the MC33030 servo chip. It does everything and all you add is your motor, a feedback rheostat and your set rheostat. With proper gearing it will move almost anything with the added benefit the electric motor will auto correct if it gets bumped. Something the stepper motor will not do. Hope this helps.

    Good website.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">