How do use use an Arduino with a Stepper Motor?
3 Answers
There are two kinds of stepper motors: unipolar and bipolar. Unipolar steppers have six wires coming off of them and bipolar ones have four wires. To control a unipolar stepper, you need to use a chip called a darlington array. To control a bipolar stepper you use an h-bridge.
I've never worked with unipolar steppers, but I can explain how to use bipolar ones. The first thing you need to do is find which wires are paired. Use a multimeter and one-by-once connect the meter to every possible pair of wires while measuring the resistance. On two of the pairings you'll find non-infinite amounts of resistance. These are the connected pairs. Attach each of these to the different halves of your h-bridge.
Once you've got your control circuit wired up (whether it be the h-bridge for the bipolar stepper or the darlington array for the unipolar), you use the Arduino Stepper Library to control it
I've got a write-up of a recent project I did with steppers Since I'm only allowed to post one link here, refer there for links to many of the things I mentioned here.
Tom Igoe has a great write-up about steppers on his site.
An alternative to crafting your own drivers and pushing out the correct order of controls to a stepper's pairs, is to use an off-the-shelf driver for your stepper. Most feature a simple two-pin control, one for direction and one you pulse to take a step, that greatly reduces the number of pins you use on your arduino, and the amount of logic involved. Not to mention, they also tend to support chopper (micro-stepping) driving, which reduces overall current consumption and allows you to run them at higher voltage, and gain smoother motions.
Some example of off-the-shelf drivers include:
Easydriver (a favorite among arduino folks) Probotix Unipolar Stepper Drivers, and Gecko drivers (Arguably the Rolls-Royce of stepper drivers)
(I have not included links as it does not allow me to include more than one link, but they can easily be found via google.)
An important point to note when you start driving steppers, which is often overlooked in the myriad tutorials out there: you must ramp into and out of full-speed stepping when making a multiple step move. I've seen many examples where they say to just send the same rate of steps to the motor at all times. Not only will this result in greater vibrations and noise when moving at full-speed, it can also result in a failure to execute move, and under- or over-shooting position. Apply proper linear (or otherwise) speed ramping to your movements. (Start and end with a larger delay between steps than the delay used in full-speed movement.)
!c
Here you have a tutorial made my me in Portuguese but google translate it to english pretty well.
The original language can be consulted to have the source without translation.
Best regards,