In this article I am going to present the basics about using a stepper motor with an Arduino Uno and an Adafruit clone stepper shield.
There are many kind of stepper motors around. From small ones that can be found in digital cameras to bigger ones that can move huge CNC machines back and forth. They usually come with 4, 6 or 8 wires, but they can have even more wires, and special techniques to rotate.
Practically these motors are equipped with multiple winding. When DC voltage is applied to one winding the motor turns a given “step” and when an other winding is under current then turns an other step. These motors are impossible to rotate without a special controller board. These types of motors are very useful because it can be turn a given degree and there is no need for feedback if it is sized carefully to the application in speed and torque.
They are widely used in robotics and other devices like printers, scanners, DVD drives so you sure own a few of them laying around the house. In 3D printing communities are widely used because they have high torque at low speeds at startup and it can work almost in every environment.
After this short theory, let`s get started with the actual experiment. The following things are needed:
1 x Arduino Uno or Leonardo (or almost any other Arduino or Arduino clone board, just check the wiring)
1 x Adafruit V 1 motor controller shield (it`s an old one, back from around 2009)
1 x 6 wire stepper motor – I used an old Romanian model made by Metalurgica. I don`t know the exact model because nothing is written on it. I tested it from 5 and 12 volts, but I`m sure it can take more up to 20-30 V.
1 x some kind of radiator with a bit of thermal paste in order not to burn the L293D IC
For uploading the example code and testing I used Arduino 1.0.6 IDE because the newer versions threw error messages with the old Adafruit library (which can be downloaded from -> Adafruit Motor library Github page <-).
After downloading the library extract it into a folder and place it where you have installed you Arduino 1.0.6 IDE (here you can find the download page -> Arduino IDE 1.0.6 <- ) inside the “libraries” folder. If the IDE is already running then you have to restart it to work correctly with the new library you have copied.
After gathering the needed hardware you have to find out the polarity and the steps per revolution of your motor. In many cases you can find this inside the official documentation. In my case I had to play with it, to see how it works best, but that is not the professional method. In order to find out correctly where to connect the wires you will need also a multimeter to measure the resistance of the wires and make a table like this.
|WHITE||–||20 Ω||20 Ω||∞||∞||∞|
|WHITE/GREEN||20 Ω||–||25 Ω||∞||∞||∞|
|GREEN||20 Ω||25 Ω||–||∞||∞||∞|
|WHITE/RED||∞||∞||∞||–||23 Ω||19 Ω|
|RED||∞||∞||∞||25 Ω||–||19 Ω|
|BLACK||∞||∞||∞||26 Ω||20 Ω||–|
After looking through the table we can make fast conclusions about how are wires connected inside the motor. As can be seen from the table the white, white and green, green are separated from the other three. After that we can see that from each group the highest resistance the white/green and green pairs have and from the other group the white/red and red cable. So these pairs are at the end of the coils, the black and white are connected exactly to the middle of the coils.
I personally recommend creating a schematics like this to make sure how to connect the wires correctly to the shield.
After successfully finishing the steps described before, we have to connect the wires of the motor to the controller shield, like on the picture which is based on the schematic (image nr. 2).
It is time to fire up the Arduino IDE (1.x) after placing the downloaded libraries for the stepper controller shield. Open the Stepper test in the examples and upload your code. If everything goes well the code will be uploaded and after the board is restarted your motor will start to turn.
Keep in mind that your USB port can supply only 0,5 amps (500 milli amps) and for bigger steppers that is not enough. There is a two pin connector on the stepper controller board where you can connect an external power supply. Using bigger currents your chips may need additional heat sinks to protect them from overheating.
You can find example codes and schematics on the official website: