ME 333 Introduction to Mechatronics
Lab 3: Feedback Control of a DC Motor
This lab has three primary purposes: (1) to deepen your understanding
of how a DC motor works; (2) to give you experience using the function
generator, multimeter, oscilloscope, bench power supply, and
prototyping breadboard; and (3) to exercise your ability to design
op amp circuits, in this case for feedback control of a DC motor.
Make up your own answer sheet, with your team number and members' names.
Be neat! Points will be deducted if your work is not clear and neatly
presented. Make sure you answer every bold question on your
answer sheet.
1. Understanding Your Motor
We will be working with a Maxon motor with a 6:1 gearhead (output
shaft spins 6 times slower than the motor shaft) and an encoder.
You can find out more about this motor on the
mechatronics
wiki, including a data sheet. Do not drop the motor, as
you may damage the encoder!
Note: If you forget your motor has a 6:1 gearhead, you may not get correct
answers in this section!
- Try spinning the shaft of your motor by hand. Now connect the two motor
terminals by a wire (or alligator clips) and try again. Does it feel
any different? You should feel a resisting torque that is proportional
to the speed you spin the motor, i.e., a damping. Shorting a spinning motor's
terminals together causes a "fast motor stop," as opposed to a "free running
stop" that occurs when you simply disconnect the power.
Remember the motor's governing equations: (1) V = I R + L dI/dt + Ke w, where Ke is
the motor's electrical constant, w is the angular velocity, I is the current
through the motor, R is the motor resistance, and V is the voltage
across the motor terminals, and (2) T = Kt I, where T is the motor
torque and Kt is the torque constant. Given these,
derive the relationship between
the speed you spin the motor shaft and the torque you feel, in the form
of T = b w, where b is a damping constant dependent only on Kt, Ke, and R.
- Prove that Kt and Ke are really the same thing. Start by
remembering that the electrical power you put into your motor, I V,
is equal to the mechanical energy out plus the resistive heating of
the coils, I V = T w + I^2 R, then divide through by I. Make sure you
show your work.
- Connect your motor terminals to the oscilloscope. (To learn more about
the oscilloscope, see the
wiki page.)
Spin the motor by hand and observe the back-emf voltage
on the oscilloscope.
Record the peak voltage you create by spinning by hand
(don't use any other implements like pliers!).
How fast do you think you are spinning the motor? (The motor, not the
gearhead! Remember the gear ratio!) From this, roughly estimate
the electrical constant. No precision is necessary here.
- Record the resistance across the motor terminals using
measurements from your multimeter. Try it at different positions of
the gearhead shaft and notice that the resistance may change somewhat.
(Why do you think this is?) Use the minimum resistance you measure.
Now set your bench power supply to
supply +12V relative to ground.
(To learn more about
the bench supply, see the
wiki page.) Double-check the voltage using your
multimeter. Calculate the current you expect through the motor
when it is powered with +12V and the motor is stalled (that is, you
prevent the output shaft from rotating). Now use your multimeter to measure
and record the actual current through the motor when it is
powered by +12V and stalled. (Make sure you set the multimeter's connections
properly before attempting to measure current!) You can grab the output
shaft with your fingers to stall it. Does your
reading agree with your prediction?
-
Power the encoder with +5V and GND from the bench power supply.
Make sure to pay attention to the pinout for the encoder cable so
you don't damage the encoder (see
the actuator wiki page). The encoder has 100 lines, which means
each of its A and B channels goes through 100 full square wave cycles each revolution
of the motor (or 600 for each revolution of the output shaft;
the encoder is attached to the motor shaft, not the gearhead
output shaft). Connect
the oscilloscope to the A channel of the encoder output (with the ground
connection of the scope probe connected to the encoder ground) while you
power the motor with 12V. Record the speed of the motor
(inferred from the encoder pulses) and the speed of the output shaft
(based on the known 6:1 gear ratio).
- Now we will use a second motor as a tachometer (or generator).
Attach the output shafts of the two motors by a flexible coupler (a
piece of cable insulation is sufficient). Power one motor by 12V, and
use the oscilloscope to measure and record the voltage at the
other "tachometer" motor's terminals. Explain why it is the same or different.
Use the other oscilloscope channel to measure the encoder pulses of
channel A on the "tachometer" motor. Record the tachomotor's
speed based on the encoder pulses. Given the tachomotor's voltage
and speed, precisely calculate the electrical constant of the motor.
(Forget your previous rough estimate!)
Now we are ready to fill out the motor's data sheet. Fill in the
following information in tabular form on your answer sheet.
- Nominal voltage: 24V
- Terminal resistance (in ohms):
- Maximum (no load) speed (in both radians/sec and rpm):
- Stall torque (in N-m):
- Stall (starting) current (in amps):
- Maximum mechanical power output (in watts):
- Torque constant (in N-m/A):
- Electrical constant (in both volt-seconds and V/rpm):
- Speed constant (in rpm/V):
Do your results agree with the data sheet for the motor? (Ours is the
24V 937 model.)
Now draw the speed-torque curve on your answer sheet. All speeds
and torques under the curve are suitable for short-term operation, but
most manufacturers recommend that their motors only be used at high
speeds and low torques (the left end of the speed-torque curve)
for continuous operation. Explain why,
using the motor equations.
2. Manual Speed Control
- On your protoboard, build a push-pull op-amp plus transistors
amplifier, as discussed in class. Use a quad op-amp chip like the LM348
or LM324 for your op-amp and a TIP31 and a TIP32 as your NPN and PNP
transistors, respectively. Get the data sheets for these components
to make sure you hook up your circuit properly. Do not power your
circuit until you are finished building it. Don't forget to provide
connections to power your op-amp! Your manual speed input will be a
potentiometer provided by the TA, which creates a command signal
at the pot's wiper
between +/-12V.
Using the data sheets for your op-amp chip and transistors, and based on the
resistance of the motor,
prove whether or not the transistors can provide enough current
to drive the motor at all voltages, and whether or not the op-amp can
provide enough current to drive the transistors.
- We will first use a 1k resistor to simulate the motor. Connect
the resistor from the output of the push-pull amplifier to ground.
Now power your circuit with +/-12V from your bench power supply.
Demonstrate to the TA (using your oscilloscope) that the
voltage at the resistor (approximately)
tracks the potentiometer value as you
turn the knob. Record the maximum voltage swing (+/-12V?
+/-8V? other?) you can create at the resistor by turning the knob,
and justify why this range makes sense (or doesn't) using the op-amp data
sheet.
- Now replace the resistor with the motor. Verify that you can control
the speed of the motor by turning the potentiometer. Set the control voltage
at the potentiometer wiper to 5V and let the motor run for a little while. Feel the
backs of the transistors to notice that one is heating up and one is not
(but be careful not to get burned!). Which one is heating up?
Calculate how much power it is dissipating (wasting). We can use a heat sink
to help conduct heat away from the transistor if it is in danger of overheating.
3. Feedback Control
We could use the tachometer from the first part for velocity feedback,
but instead we will use a potentiometer for position feedback. A potentiometer
is a common, inexpensive way to get position feedback.
(Encoders are even more common.)
Connect the motor output shaft to the 1k potentiometer using a
flexible shaft coupler. Now when the motor turns, the pot shaft also
turns. Connect the two ends of the pot to +/-12V, so the wiper
returns a voltage between +/-12V depending on the rotation of the pot
shaft. The voltage at the wiper of the pot gives us feedback on the
position of the motor.
(Note: some potentiometers are made for the purpose of providing angle feedback. Our
knob potentiometer is not made for that purpose, but we will use it that way. If you are
ever buying a pot for feedback, do not buy one of these knobs!)
We are going to make a proportional (P) position controller with a system
block diagram shown below:
Vref is a voltage representing a reference (desired) position of the
motor, -Vsens is the sensing potentiometer voltage measuring the
actual position of the motor, and Vcontrol is proportional to Vref -
(-Vsens) = Vref + Vsens. The voltage Vcontrol
goes to the input of the current amp (which you already built) and
drives the motor to
reduce the error between the desired and actual motor positions
(assuming the polarity of the motor leads is correct; if not, just
switch them). We have already built the current amp portion of the
control system; now we just need to build the summer and multiplier
blocks, which output Vcontrol going to the + terminal of the op-amp
in the current amplifier.
We can construct the summer and multiplier with a single op-amp.
Build the circuit below using a 100k trimpot and another of the op-amps on the
same LM348 or LM324 chip. Let R be the resistance (between 0 and 100k) set by
the trimmer. You can change the resistance R by rotating the small knob on the
trimpot, and this will be useful for changing the gain of your feedback controller.
Derive Vcontrol in terms of R, Vref, and Vsens.
Unpower your protoboard. Set the trimpot to R=0 ohms. Set the
function generator signal to a 0.3 Hz square wave between +/-8V. Use
your oscilloscope to display Vref and -Vsens. (To display -Vsens
instead of +Vsens [the actual voltage at the sensing pot wiper], press
the Math Menu button on your oscilloscope and change the channel
displaying Vsens to display the inverted [negative] of the signal.)
Now power your protoboard and observe how the behavior of your
controller changes as you slowly increase the resistance R by turning
the trimpot. (If your motor turns until the potentiometer stops it
and then just stays there, you probably have positive feedback instead
of negative; just reverse the polarity of the leads to your motor.)
Once you are satisfied you are seeing stabilizing feedback control,
try square wave, sine wave, and triangular wave reference signals
between 0.3 and 3 Hz. Demonstrate to the TA.
Describe how increasing the trimpot resistance (the resistance R) changes the response
of the motor. Explain what the positive and negative effects of increasing R are.
Draw
one complete cycle of the reference and (negative) sensed signals for a square wave
reference.
You can also experiment with your oscilloscope's Math Menu by plotting
the sum of the two signals Vref and Vsens, which is the error signal.
Ideally the error would always be zero.
Note that a 10k resistor is only somewhat higher resistance than the
1k motor sensing pot. This means that the motor pot signal between
+/-12V is somewhat affected (loaded) by the summing circuit. In other
words, the input impedance of the "summing and multiplying" circuit is
not much higher than the output impedance of the "motor angle sensing"
circuit, so the value at the output of the sensing circuit is affected
by the subsequent circuit, and we have not achieved true modularization
in circuit design. (Modularity here is very similar to modularity in
programming.) Explain how you could use another op-amp on your
quad op-amp chip to fix this issue.
Turn in your answer sheet and make sure your bench is straightened up.