Introduction: How to Set Up a Stepper Motor in Under 10 Minutes

About: I'm just your average teenager, wanting to change the world bit by bit. I do projects whenever I feel they need to be be done on whatever I feel they need to be done on, and hopefully learn something in the pr…

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.

Step 1: 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

Step 2: Solder

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

Step 3: Setting Up Power Supply

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

Step 4: Wire Up Stepper

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

Step 5: Upload Code to Arduino

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

Step 6: Connect Everything on the Breadboard

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

Step 7: Thunderbirds Are Go

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

Step 8: 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