DIY Arduino Stepper Motor Driver Board

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.

Update:I no longer use this driver board with my sun tracking / heliostat system. Commercial driver boards have become so cheap that it is hardly even worth bothering to build it. Additionally, this driver circuit is no longer supported by the Arduino Sun Tracking / Heliostat Program. It simply uses up too many pins which are required for other features of the program.

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.

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)

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.

[bad]

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.

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.

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.

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.

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.

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.