How to Set Up a Stepper Motor in Under 10 Minutes

by ak33m98 in Circuits > Electronics

32668 Views, 127 Favorites, 0 Comments

How to Set Up a Stepper Motor in Under 10 Minutes

Easy Driver.png

Recently, I purchased several steppers and drivers for a 3D printer project and I was curious to see how quickly I could set a stepper up. For this I will not count time like waiting for the soldering iron to heat up. So for my first instructible I will start simple and show you how to quickly and very easily set up a bipolar stepper motor with Easy driver boards and an Arduino.

Gather Parts

Partlist:

  • EasyDriver 4.4 (Other versions will work similarly)
  • Arduino (I have tested both the Uno and Leonardo with this project)
  • Bipolar Stepper Motor (I used a NEMA 13 stepper in this project)
  • Several wires (Preferably of different colours)
  • Tape
  • Access to a computer or any other means of uploading code to the arduino 12V power supply
  • Soldering Iron and solder
  • Breadboard

Solder

img_20150214_2028021.jpg
img_20150216_2232001.jpg

Start the timer

Note: Always solder in a well ventilated area with a fume extractor, removed from potentially flammable items, and beware, because the iron and the solder can get very hot

Break away the pins into the required smaller quantities and place them in the holes on the EasyDriver, the “short end” is the bit going into the driver, leaving the plastic and the longer lead pointing out of the bottom of the drive.

Turn this whole thing upside down, so now you have the driver laying upside down and the long ends of the pins (and the plastic) pointing upwards, and ensure all the pins are straight. Push a breadboard down gently on this and now all the pins should be stuck in the breadboard and the EasyDriver should be on the bottom. turn this entire thing upside down again so now you have the pins sticking into the breadboard and the easy bit driver on top. This bit was all done to fasten the pins in place to make things easier while soldering. Proceed to solder the part of the pin sticking out the top of the EasyDriver to the driver itself, taking time to ensure to make sure all solder joints are made correctly.

Timer: 3 minutes

Setting Up Power Supply

img_20150216_1404261.jpg
img_20150216_2210261.jpg
img_20150216_2211431.jpg
img_20150216_2214451.jpg
Using your 12 Volt DC power Supply locate GND (Ground/Negative) and the +12V output. Connect wire to the necessary terminals. In my image the outside of the connector was GND and the inside was +12V so I wrapped a wire around the outside and placed a folded up wire on the inside and taped everything together with some of that magical duct-tape . Then these two wires were connected to jumper cables (Red for +12V, Black for GND). Do not plug these into anything yet.

Timer: 4.5 minutes

Wire Up Stepper

img_20150216_2229361.jpg
First strip the end of the wires leading from the stepper. Then connect the stripped ends to the ends of jumper cables, colour coding is very useful to not get confused with all of the wires, so try to use the same jumper cable colour as the original stepper motor connector colour to avoid confusion, for me, I had to connect a white jumper to the grey wire as there were no white jumpers available.

Timer: 6.5 minutes

Upload Code to Arduino

code.png
The basic code to just make the servo turn in one direction is as follows, and for this tutorial that is all I will cover , however with some simple modifications you can alter the speed and direction of this movement and can move on to more sophisticated projects from there

Code

void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
void loop() {delay(1);
digitalWrite(9, HIGH);
delay(1);
digitalWrite(9, LOW);
}

Timer: 7.5 minutes

Connect Everything on the Breadboard

img_20150217_0116121.jpg
img_20150216_2307451.jpg
img_20150216_2307301.jpg
Connect the stepper to the Driver pins marked MOTOR. With the first coil connected to A and the other connected to B. If you don’t know which wire corresponds to which coil don’t worry, just connect any arbitrary combination and see the note (Note 1) at the end of this tutorial. Connect the Arduino pin 8 to the DIR pin, and pin 9 to the STEP pin, and GND to GND Do not connect the 12V input or turn on the Arduino yet.

Timer: 8.5 mins

Thunderbirds Are Go

img_20150216_2308521.jpg
img_20150216_2309151.jpg
Check to make sure all wires are connected correctly then connect the arduino power supply, then the 12V supply to the EasyDriver Board, and you should have lift off . A red light on the board should light up and your stepper should begin to rotate

Timer: 9 mins

Notes

Note 1:

If as stated above you aren't aware of your servo wiring, just begin with any arbitrarily chosen combination of the 4 wires and let’s say that the order is now ABCD, test to see if that works, if not remove power from the EasyDriver board and reverse the last two wires to give you ABDC, power the driver and test to see if that works, if not remove power from the EasyDriver board and reverse the middle 2 giving you ADBC and power the driver to test to see if that works. If none of these combinations work it is likely that your driver is faulty or your connections are broken, or there was a bad solder joint. If the motor is spinning but in the opposite direction of where you intend then remove power from the driver and reverse the wiring, ABCD becomes DCBA and try again.

Also: Never unplug the stepper while the driver is connected to the power supply this could permanently damage the board

You can check out this tutorial and others like this on my blog