LAB 5 DC MOTORS AND STEPPER MOTORS
Document Sample


ME 333 Introduction to Mechatronics Lab 5
LAB 5
DC MOTORS AND STEPPER MOTORS
Objectives To understand the basic operation of DC and stepper motors and their
control from the Handy Board.
Preparation A&H Chapter 10, the Handy Board Technical Reference, the web pages
on the Handy Board and IC, DC motors, and stepper motors, and the class
handout on DC motors.
Tools A PC running IC, the Handy Board, multimeter, oscilloscope, power
supply, and prototyping breadboard.
*** IMPORTANT! ***
In this lab, you may notice your Handy Board exhibiting strange behavior, e.g., resetting
itself. This is due to the electrically noisy motors and the large current they draw. Here
are some things to try to alleviate these problems.
Make sure you have a charged battery, as the wall transformer may not provide
enough current.
If the motor resistance is low, so that it tries to draw too much current, you can
put a low resistance power resistor in series with the motor. This is an ugly
solution, since you waste power through the resistor, but may be necessary if the
motor resistance is low.
Try putting a 0.1 µF ceramic capacitor across the coil (an orange disk capacitor).
This will smooth out voltage spikes.
You might need appropriately placed flyback diodes.
1 Introduction
In Lab 3 we learned to program the Handy Board. The Handy Board is the brain of our
mechatronic systems. In Lab 4 we learned to interface sensors to the Handy Board. In
this lab we learn how to control motors with the Handy Board. Along with mechanical
design, these are the basic building blocks of mechatronics: perception, computation, and
actuation.
We will look at two types of motors: a permanent magnet brushed DC gearhead motor
and a stepper motor. Advantages of DC motors include: simple to drive, cheap, and
relatively high power-to-weight ratio. A disadvantage is that we need a sensor, such as
an encoder or tachometer, to keep track of the position or velocity of the motor. With a
stepper motor, on the other hand, we can simply send a series of pulses to the motor, and
it will rotate an angle proportional to the number of pulses. In theory, if we know how
many pulses have been sent, we know where the motor is, and we know the velocity of
the motor is proportional to the pulse frequency. In practice, however, stepper motors do
1
ME 333 Introduction to Mechatronics Lab 5
not generate much torque, and as a result, slipping can occur, where the motor turns when
no pulses are given or the motor fails to turn in response to the pulses. Also, the control
electronics are somewhat more complicated. Stepper motors are a good choice for
precise, low torque motions, since they eliminate the need for feedback control.
The motors provided to you should work well with the Handy Board. The Handy Board
drives motors using two L293D motor driver chips. Each L293D has four 1/2 H-bridges,
which may be used to drive four DC motors unidirectionally or two DC motors
bidirectionally. Also, one L293D can be used to drive one stepper motor. When
choosing motors for your project, be aware of the 600 mA current limitation of the
L293D! Some motors, especially cheap ones, draw too much current and could damage
the Handy Board (or at least cause it to reset). If you want to drive motors that require
more current, some possibilities are to replace the L293D’s with L293’s, which provide 1
A of current; piggyback two L293D’s on top of each other, effectively putting them in
parallel; or create a push-pull circuit with power transistors, as shown in your handout.
Be aware that high current motors will drain your Handy Board batteries quickly.
There is no answer sheet for this lab. Make your own, and make it neat! Be sure to give
answers for all action items in bold.
2 Permanent Magnet DC Brush Motor (+ Gearhead)
The gearmotor you were given has a gear ratio G = 120. The output shaft turns once for
every G revolutions of the motor shaft. This divides the motor speed by G and multiplies
the torque by G. This is useful for us, since for most mechatronic and robotic
applications we rarely need thousands of RPM, but we do need torque for moving heavy
loads. Keep this gear ratio in mind; don’t be fooled into thinking that DC motors move
so slowly!
Tasks
a. Let’s first determine if this motor is safe to use with our Handy Board. Briefly run
the motor with a 5V supply, then disconnect and record the resistance across the
motor terminals measured with the multimeter. From this, calculate the stall current
if the motor is driven by a 5V supply. Now connect the motor up to your 5V power
supply (your benchtop supply, not your Handy Board) and use your multimeter to
measure the current running through the motor, both when it is unloaded (except by
the gears) and when the motor is stalled out. Stall the motor by grabbing the shaft
with your fingers. It will not be easy to stop the rotation; if you need to, try the
needlenose pliers to get a grip on the output shaft. Does the stall current you measure
agree with the stall current you calculated? Explain. Give the efficiency of the
motor when it is stalled.
In general, if the motor has a terminal resistance of 10 ohms or more, it should be safe
to use with the Handy Board. Describe the operating conditions whereby a motor
with a smaller resistance could be safely used by the Handy Board.
2
ME 333 Introduction to Mechatronics Lab 5
b. Now you will control the motor with your Handy Board. First, experiment with the
IC motor command, and use your oscilloscope to look at the voltage pulses generated
by the L293D. (Don’t hook up the motor yet.) Be sure to connect the ground leads
of the oscilloscope probes to the ground of the HB, not to the motor outputs. The
motor command takes an argument in the range –100 to 100. Record the relationship
you observe between this argument and the duty cycle of the pulse train. Find an
argument that gives about a 25% duty cycle, record the argument, and sketch two
cycles of the pulse train. This sketch should include the time scale and the voltage
scale. In particular, what is the frequency of the pulse train?
Now hook up the motor. You may need flyback diodes or a 0.1µF ceramic capacitor
across the motor terminals to smooth out spikes when changing motor speeds. Also,
you may need a charged battery to run motors; the wall transformer that comes with
your HB may not provide enough current for the DC motor or for the stepper motors
later. Write a routine that controls the bidirectional speed of the motor according to
the knob. Demonstrate the routine to the TA.
c. Make an encoder for this motor. Cut out a round piece of cardboard or similar
material, 1.5” or 2” in diameter, punch a small hole in the center for the shaft, and cut
a slit, as shown below. A better encoder wheel would have more slits, but one slit is
fine for this lab. Press this encoder disk on the shaft, and using the encoder program
and circuit you built last week, measure the maximum velocity of the motor under
Handy Board control. (We are asking for the velocity of the motor, not the output of
the gearing! Remember the gear ratio G. Be aware that the maximum velocity of the
motor by itself would be higher without the gear train loading the motor; the motor is
not really spinning freely.) Using your multimeter, measure the current flowing
through the motor at this maximum speed. Remembering the resistance you
measured in part a, calculate the back-emf Vemf. Now calculate the motor’s
electrical constant ke. Explain why it would probably be better to put the encoder
wheel on the motor shaft, not the output shaft of the gearhead. Demonstrate your
encoder counting to the TA.
3 The Stepper Motor
Read the web page on controlling stepper motors with the Handy Board. This
supplements the lecture notes. Your stepper motor is a bipolar drive. There are two
coils, one connected to red and brown wires, and one connected to white and green wires.
Check these connections by measuring resistance with your multimeter. If the motor
does not move, switch the connections (there are only a few possibilities).
3
ME 333 Introduction to Mechatronics Lab 5
Tasks
a. Write a program that allows the user to rotate the stepper a desired angle at a desired
speed. First the program asks for the amount of rotation, and the user responds by
turning the knob. The program displays the knob value (or the corresponding
rotation) while the user does this. When the user presses the START button, the goal
rotation is set. Next the program asks for a speed, and the user chooses the speed
with the knob and presses START again. After a short delay (2 seconds or so), the
stepper performs the motion. Then the program goes back to the beginning, and stays
in the loop indefinitely. You will have to make a few choices here. How do the knob
values map to angles of the motor? How do the knob values map to speeds? We
should be able to rotate the motor in either direction. Demonstrate to the TA.
Summary
• Motor characteristics and specifications
• Pulse width modulation
• Controlling actuators from the Handy Board
4
Related docs
Get documents about "