Stepper

In this exercise we will drive a stepper motor with an Adafruit Industries Motor Shield. This shield will piggy-back an Arduino and will allow you to control 2 x 5V RC servos, up to 4 bi-directional DC motors or up to 2 stepper motors.


Each team has one motor shield kit in their box. This will need to be assembled. Check your parts list HERE.


Review or learn about soldering here:


Argue over, or flip a coin to see who is actually going to do it...


Now, put your motor shield together.

You will need to install the Arduino Stepper/Servo software library on your computer - put the AFMotor directory into the Arduino/hardware/library folder on your local drive. LINK.

Get some test code HERE.


Stepper motors operate differently from DC brush motors, which rotate when voltage is applied to their terminals. Stepper motors don’t turn continuously but move in a series of very precise steps. They are also different from the RC servo in that they can turn continuously in a full circle and they don’t give you any feedback about their absolute position. They’re useful any time you want to move a precise distance around a circle, or when you want to translate that distance to a precise linear distance. Stepper motors have several coils of wire inside, not just one. The center shaft has a series of magnets mounted on it, and the coils surrounding the shaft are alternately given current or not, creating magnetic fields which repulse or attract the magnets on the shaft, causing the motor to rotate. This design allows for very precise control of the motor: by proper pulsing, it can be turned in accurate steps of set degree increments. Stepper motors often provide more torque at lower speeds. They can be very useful for moving a precise distance or a specific number of rotations.

One of the first things you need to do is figure out how the stepper motor's wires are configured by measuring the resistance of each wire (as compared to all other wires) using a ohmmeter (one of the functions of a multimeter). To control a stepper motor, you need to energize the coils in the right sequence to make the motor move forward. To do this, you need to understand the how the wires are connected. You might have a datasheet or you might have to determine which wire goes to which coil by yourself. To do this, take an ohmmeter to the wires and measure the resistance from one wire to another. The outer wires for each coil will have a resistance that is double the resistance between the inner wire and either of the two outer wires. Two wires that are not connected have infinite resistance, which should read as an error on your meter.

In the example in the diagram above if the resistance between Wire A and Wire X is 5 ohms then the resistance between Wire A and Wire B will be 10 ohms. Two wires that are not connected (e.g. Wire A and Wire C) will have infinite resistance. Your meter should show this as an error.

You should make a 'truth table' as shown below and measure the amount of ohms across every combination of pairs of wires:


 Yellow  Green   Red  Blue  White   Black
 Yellow --          
 Green   --        
 Red     --      
 Blue       --    
 White         --  
 Black           --

From this you should be able to work out which are the outer wires for each coil and which are the center taps.



Like other motors, stepper motors may require more power than an Arduino can give it, so you may need a separate power supply for some. Ideally, you’ll know the voltage from the manufacturer, but if not, get a variable DC power supply and slowly raise the voltage until the motor is running smoothly. Typical voltages for a stepper motor might be 5 volts, 9 volts, 12 volts, or 24 volts.

The stepper motor your team has been provided with is rated for 4 Volts, 0.9A.

There are two basic types of stepper motors, unipolar stepper motors and bipolar stepper motors. A unipolar stepper motor has five or six wires and four coils (actually two coils divided by center connections on each coil). The center connections of the coils are tied together and used as the power connection. They are called unipolar stepper motors because power always comes in on this one pole. A bipolar stepper motor usually has four wires coming out of it. Unlike unipolar stepper motors, bipolar stepper motors have no common center connection. In practice, there’s not a lot of difference between unipolar stepper motors and bipolar stepper motors, for your purposes. They have two independent sets of coils instead. You can distinguish them from unipolar stepper motors by measuring the resistance between the wires. You should find two pairs of wires with equal resistance. If you’ve got the leads of your meter connected to two wires that are not connected (that. is, not attached to the same coil), you should see infinite resistance (or no continuity).

The stepper motor your team has been provided with is a unipolar stepper motor and has six wires.

Once you have figured out how the stepper motor's wires are configured, hook it up to your newly assembled motor shield and give it a whirl.


Comments