# LAB 7 STEPPER MOTOR CONTROL

write for me an introduction,material list,procedure. I’ve attached a sample that you can follow,a lab report report,and the lab itself. do report for lap#7
lab07_stepper_motor_control.pdf

example_lab_report_writeup__1_.pdf

Don't use plagiarized sources. Get Your Custom Essay on
LAB 7 STEPPER MOTOR CONTROL
Just from \$13/Page

lab_report_guide_1_.pdf

Unformatted Attachment Preview

Mechatronics
Spring 2018
LAB 7 STEPPER MOTOR CONTROL
OBJECTIVE



Learn what stepper motors are and how they work.
Learn to interface stepper motors to the Arduino motor shield.
Program in MATLAB to control the stepper motion.
INTRODUCTION
I.
Stepper Motors
Stepper motors are a special kind of motor designed to move in discrete steps. This can perhaps
best be understood by looking at how they are designed. While there are many variations, you
will get the general idea by studying a simple type of stepper called the permanent magnet
stepper. Consider the diagram below. The stepper rotor is the moving part attached to the shaft.
It is a permanent magnet with North (N) and South (S) poles. The stepper stator surrounds the
rotor and is the stationary part of the motor. It consists of several coils of wire wound around
iron laminations, which make up electromagnets that can be turned on and off. Recall that
opposite magnetic poles (i.e. N-S) attract each other while like poles (N-N and S-S) repel. The
magnetic polarity of the stator magnets can be controlled, by controlling the current direction
through the coils.
coil A
coil A
coil B
S
N
coil D
coil D
coil B
S
N
coil C
coil C
Figure 1A: rotor aligned with coil A Figure 1B: rotor aligned with coil B
Fig.1. a. Rotor Aligned with Coil A (left), b. Rotor Aligned with Coil B (Right)
Let us assume that our stepper is set up so that when we turn a coil on it generates a magnetic
N pole closest to the rotor. Then, if we turn on coil A and leave all of the others off, it is clear
that the rotor will try to line itself up with its S pole aligned with coil A, as shown in Figure 1a.
If we leave coil A on, the rotor will come to rest in alignment with coil A and will not move
farther. In fact, it will vigorously resist any attempt to manually move it from this position. The
amount of external torque the motor can resist is called its holding torque.
Page 1 of 4
Mechatronics
Spring 2018
If we then turn off coil A and turn on coil B, the rotor will turn
¼ rotation to the right and align with coil B, as shown in Figure
1b. Continuing to rotate the magnetic field around the circle
will cause the rotor to align next with coil C then coil D, etc.
Each of these locations is a stable position. That is, as long as
one of the coils is energized, the rotor will attempt to lock itself
in alignment with that coil.
The motors you will use are wound as shown in Figure 2. The
motors have two coils (i.e. two phases), each with a center tap,
allowing you a great deal of flexibility in how the motors are
controlled.
Fig. 2. Stepper Motor Windings
with Center Tap
PROCEDURE
I.
Windings
Your first task is to figure out how the stepper motor used in
the lab (Figure 3) is wired. Use your ohmmeter (digital multimeter) to find which colored wires are connected to each coil in
the stepper motor. You will find that the wires are connected in
groups of three, as you can see from the diagram in Figure 2.
First separate the wires into their groups of three and write
down the colors for Group A-B-C and Group D-E-F. You
should be able to find which wire corresponds to terminal A
and which one is terminal D in Figure 2 by comparing the
resistances between the different wires. The resistance between
Fig. 3. Stepper Motor in the Lab
wire C and wire B will be twice as much as the resistance
between C and A or A and B. The same method works for group D-E-F. Write down the wire
colors for terminals A and D.
Find wires A and D and connect them both to the ground. From coil A-B-C, connect one of the
wires to +5V. The motor will move to an equilibrium position and stop. Label that wire B, and
the other wire from that group C. Now with wire B still connected to +5V, choose one of the
wires from the other group and connect it also to +5V. Note which direction the motor turns
when you do this. For the sake of convention, if the motor turns CCW when you connect the
second wire, call it wire E and if the motor turns CW, call it wire F. Label the remaining wire
accordingly. The stepping sequence will be B, E, C, F for CCW rotation, and B, F, C, E for CW
rotation.
Connect wires B, C, E, F to the A+, A-, B+, B- terminals on the Arduino Motor Shield, do not
connect wires A and D to anything, and power the shield with a +5V power supply. Since we are
using the Arduino Motor Shield for motor control, the shields pins, divided by channels are
shown again in the table in the next page:
Page 2 of 4
Mechatronics
Spring 2018
Function
Direction
Voltage
Brake
Current Sensing
Pins Per Ch. A
D12
D3
D9
A0
Pins Per Ch. B
D13
D11
D8
A1
For example, if we want to switch the terminal A- to high, we need first send a digital output
command to pin D12 to select the proper direction, and then send another digital output
command to D3 to turn it on. This is not a very straightforward process and you might need to
try a few times to get it right. The good news is that there is an LED connected to each of the A+,
A-, B+, B- terminals on the Arduino Motor Shield, so you can try different commands and see if
you can turn on the associated LED in a proper sequence.
To turn the motor CCW four steps would require the following sequence (pseudocode). Note that
this sequence uses only one coil at a time.
1. Set A+ terminal high, all others low; Hint: this step will take three lines of code.
2. pause(0.5)
3. Set A+ terminal low
4. Set B+ terminal high, all others low
5. pause(0.5)
6. Set B+ terminal low
7. Set A- terminal high, all others low
8. pause (0.5)
9. Set A- terminal low
10. Set B- terminal high, all others low
11. pause (0.5)
12. Set B- terminal low
The sequence shown above could be repeated until enough steps had been taken. Each switch of
the coils requires a short pause between steps to allow the rotor to move before issuing a new
step command. Play with the length of pause to see how short you can make it.
II. Forward and Reverse Motion
Determine the number of steps per revolution of your motor, then write a program that will drive
the motor one revolution clockwise and one revolution counterclockwise. Use the full-stepping,
one coil at a time mode. Put a piece of tape on the motor shaft as a flag to help you see how
far the shaft has gone. Start by making a flow chart of your programming logic for making the
program work.
Hint: Do not forget to turn off the coils at the appropriate times. Also, do not forget that it will
take some time for the stepper to move from one point to another, and that it will move much
slower than the computer can run through the program. You must insert some time delay in the
appropriate places or the motor will not be able to keep up. If the motion is erratic or it appears
Page 3 of 4
Mechatronics
Spring 2018
that steps are being skipped, you either have the coils out of sequence or you need to insert more
time delay.
Demonstrate your program to a TA before going on to the next step.
III. Input from Keyboard
For motion control, we want to be able to tell the motor when to stop and which direction to go
from a program or perhaps from the keyboard. Lets use the keyboard as our input interface.
MATLAB can accept input from the keyboard via the command input(prompt). From
the Matlab command window, type help input for more information on this command.
Modify your first program to prompt the user for a number n between -40 and 40, and use this

Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

## Calculate the price of your order

Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

## Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.