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.

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.

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!