Escolar Documentos
Profissional Documentos
Cultura Documentos
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
2.737 Lab 0
This lab provides an introduction to using the myRIO with Labview. We will evaluate your work
with a brief (510 minutes) checko on Thurs 9/11. No written lab report or other documentation
is required.
Specically, we ask you to:
1. Run the supplied Labview VI which emulates a rst-order continuous time lter, as driven
by an input on an A/D channel, and which outputs on a D/A channel. Examine the input
and output on the front panel displays in Labview and on the bench oscilloscopes in the lab.
Explore the eects of sampling visible in the signals on the oscilloscope. Try dierent sample
rates of the myRIO simulation loop. What interesting eects can you observe?
2. Now modify the supplied VI to simulate a second-order mass-spring-damper system in state
variable form as shown below.
Note that your simulation should use individual integrators which store the velocity and
position states. Program the front panel of the VI to allow you to adjust m, b, and k.
Simulate this second-order system for some interesting values of these parameters. What
eects can you see from the discrete-time implementation? Try varying the sample rate of
Checko on Thursday 9/11: We will post a signup sheet for checkos. You will need to demon
strate your working myRIO and associated signals on the oscilloscope for both models. Also plan
to show us any interesting eects you have observed.
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
2.737 Mechatronics
Pre-Lab 0: Controls Review
Assigned: 9/3/14
Due: 9/10/14 in class
Welcome to 2.737! The purpose of this pre-lab homework assignment is to get you thinking about
and reviewing controls. This material should be familiar to you from 2.14 or some other equivalent
controls course. If you get stuck, you can get help from your fellow students, but make sure that
what you turn in is your own work. You can also get help from the sta during oce hours which
are held in the lab, 1-004.
Problems
1. First-Order Response. For the system
H(s) =
10
0.05s + 1
1
s2
2
n
2s
n
+1
s + 1
s + 1
(a) Sketch the Bode plot and show that for > 1 this is a lead network and for 0 < < 1
this is a lag network.
(b) Find an expression for the system response to a unit step input. Sketch representative
responses for the cases > 1 (lead) and 0 < < 1 (lag).
4. Block Diagram. (This problem is taken from Roberge, J.K., Operational Ampliers: Theory
and Practice, Wiley, 1976.) Figure 2.20 shows a block diagram for a linear feedback system.
Write a complete, independent set of equations for the relationships implied by this diagram.
Solve your set of equations to determine the input-to-output gain of the system.
John Wiley & Sons. All rights reserved. This content is excluded from our Creative Commons license.
For more information, see http://ocw.mit.edu/help/faq-fair-use/..
5. Nonlinear Feedback. (This problem is taken from Roberge, J.K., Operational Ampliers:
Theory and Practice, Wiley, 1976.) Plot the closed-loop transfer characteristics for the non
linear system shown in Fig. 2.22.
John Wiley & Sons. All rights reserved. This content is excluded from our Creative Commons license.
For more information, see http://ocw.mit.edu/help/faq-fair-use/..
6. Servomechanism with Disturbance. For the servomechanism of Fig. 1.18 let the parame
ters be
JT
= 105 kg m2
B = 103 N m s/rad
Km = 0.1 N m/A
Kt = 2 V/rad
Note that the amplier with gain Ka is a current-drive which determines the motor current
Im directly. Thus in this model, the motor back emf does not aect the dynamics. The motor
torque is given by Tm = Km Im .
This system can be represented by the block diagram as shown in Figure 1.19. (Note: There
should not be gaps near the summing junction and output in Figure 1.19.)
(a) Choose gain Ka to yield a system with a step-response peak overshoot of 20% for an
input Vi and output . What is the resulting damping ratio and natural frequency,
n ?
(b) Calculate the disturbance transfer function
fected by varying Ka ?
(s)
Td (s) .
(c) Sketch a root locus for this system as Ka varies between 0 and . How is stability
aected with increasing Ka ?
(d) Verify your root locus in MATLAB.
(e) For the value of Ka found in part (a), determine an analytical expression for the loop
return ratio transfer function. Make a sketch of the Bode plot for this return ratio. What
are the loop crossover frequency and phase margin? Be sure to indicate these values on
the Bode plot.
(f ) Conduct a Nyquist analysis and make a sketch of the Nyquist plot for this loop. Is the
loop stable? Why or why not? Show how the crossover frequency and phase margin are
represented on this loop.
7. Op amp circuit The circuit shown below purports to be an analog computer simulation of a
mass/spring/damper system. In this circuit, all ampliers are ideal, with innite gain.
a) Draw a block diagram which represents the circuit, and which includes the variables Vi , i1 , i2 ,
i3 , i4 , V1 , V2 , V3 , and V4 . Expressions in the blocks should be in terms of the given system
parameters.
b) Show that the system can be described by the dierential equation
aV1 + bV 1 + cV1 = dVi
where a, b, c, and d are scalar constants. Give expressions for these constants in terms of the
system parameters. Hint: V2 V 1 , and V3 V 2 V1
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
2.737 Lab 1
This lab gives an introduction to using the myRIO with Labview to implement closed-loop control
of an RC lter. We also ask you to experimentally investigate the eects of loading on some RC
lters, in order to understand that the measurement system can aect the measurement. As well,
the lab report must include answers to some circuit problems. These problems are taken from the
le archive.pdf which is available on the course web page. Note that the archive also includes
solutions to many of the problems.
The solutions to the assigned problems must be included with your lab report. The lab report should
also clearly document your experimental work, predictions, results, and a comparison between these,
with explanations of observed phenomena and discrepancies. Be sure to show us your understanding
of the lab and design experiences. No formal lab report structure is required.
We will evaluate your work with a 30 minute checko on Thurs 9/18. Be sure to come to lab
early enough that you have your experiments running and ready to show us. You will need to
demonstrate the loading eects in the RC circuits as well as the closed-loop control implemented
on the myRIO.
Lastly, be sure to start this work early, as there is a signicant time commitment, and it is not
likely to be well-solved at the last minute!
Readings: Please look online and get copies of: 1) the myDAQ users guide, 2) the myRIO users
guide, and 3) the NI application note on analog signals, available by going to ni.com/info and
entering the Info Code analogwiring. The myDAQ users guide has a useful section on how to work
with the dierential inputs. The myRIO users guide has some details on the myRIO conguration,
which includes the myDAQ input dierential ampliers on the myDAQ connectors. Note that
the other analog inputs are single-ended, so these may require you to make your own dierential
amplier for measuring any critical signals. The NI application note has much more information
which is very useful for interfacing with sensors and other signal sources.
Specically, we ask you to:
Archive Problem 8.3 Complete the solution of this problem and submit with your lab report.
Archive Problem 8.5 Complete the solution of this problem and submit with your lab report.
Archive Problem 9.2 Complete the solution of this problem and submit with your lab report.
Archive Problem 9.10 Complete the solution of this problem and submit with your lab report.
The second-order circuit shown is to be considered as the plant to be controlled by the myRIO.
Specically, the input to the plant is the D/A output voltage vc , and the output of the plant
is the voltage vo . That is, the control loop conguration is:
a) Calculate the exact transfer function Vo (s)/Vc (s). Use MATLAB to compute the plant pole
locations, step response, and Bode plot for this plant.
b) Assume that the second RC stage does not load the rst. That is, since 1 M >> 100 k, we
can assume that the two RC transfer functions may be computed independently. Under this
assumption, calculate the approximate transfer function Vo(s)/Vc(s). Use MATLAB to compute
the plant pole locations, step response, and Bode plot for this plant. Compare these results
with the exact results from a) above.
c) Design a continuous-time PID (lead/lag) controller of the form
Gc (s) = Kp 1 +
1
Ti (s)
s + 1
.
s + 1
d) Implement this control loop inside the CD&Sim loop adapted from Lab 0. Record some in
teresting waveforms and compare with what would be predicted by theory. At a minimum,
compare the step responses in vc and vo with the responses predicted using MATLAB.
Checko on Thursday 9/18: We will post a signup sheet for checkos. You will need to demon
strate your working circuits and associated signals on the oscilloscope for the lab exercises. Also
plan to show us any interesting eects you have observed.
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Due:
There is no formal requirement to complete this addendum.
If you have time, check out the items listed herein, as you will learn important
You will likely have noticed that your controller in Lab 1 designed for 1000 rad/sec crossover had
a very strong oscillation in the control eort. This is due to the limited quantization levels of the
myRIO 12-bit converter. For the relatively high loop bandwidth, the quantization is not sucient
to support a linear control mode of operation. Also, the capacitors used in the lab have a large error
tolerance, and typically measure about 0.16 F rather than the nominal 0.1 F. We can create a
more accurate plant model on the basis of experimental measurements.
With the gain limitations, the loop crossover frequency needs to be reduced, or alternately, some
amount of gain needs to be taken in the analog domain.
Further, it is helpful to use a dynamic analyzer to measure the plant transfer function and loop
return ratio. We are providing a dynamic analyzer which runs in Labview to allow you to make
these measurements.
To understand these issues better:
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
2.737 Mechatronics
Laboratory Assignment 2: Analog Feedback Systems
Assigned: 9/17/14
Pre-lab due: Thursday 9/25/14 online by 5pm
Reports due: Thursday/Friday 10/210/3/14 in checkos
Overview
In this lab you will experiment with designing and stabilizing power op amp circuits. These devices
are used to drive loads requiring signicant power, such as motors, solenoids, deection coils,
speakers, etc. We will use two types of loads. The rst is just a power resistor driven directly
by the power op-amp. The second is an inductor driven in a closed-loop current-controlled mode.
This second design will be implemented by using a second low-level op-amp to serve as a current
controller by driving the power op-amp. You will need to model the system to design an appropriate
controller. Then you will test this connection in the lab to measure its performance. You will design
this low-level controller and build it on a section of the protoboard. This is a relatively challenging
lab experience, so be sure to start early!
Your prelab calculations are due in a prelab report to be submitted by 5pm on Thursday 9/25.
For the prelab, please complete all the requested modeling of the circuits, the prediction of the
requested step and frequency responses, 0$7/$% calculations, etc. You will need to make a copy to
give to us, and keep your original to support the lab portion of the assignment. You may submit
these online, or in the ling cabinet in the lab. It is not permitted to look at other students prelab
reports in the ling cabinet.
The lab report should clearly document your experimental work, predictions, results, and a com
parison between these, with explanations of observed phenomena and discrepancies. Be sure to
show us your understanding of the lab and design experiences. No formal lab report structure is
required. The lab report is due at the time of your checko. Please also include the prelab copy
with this report. These must be submitted in paper format at the checko.
You will also schedule a lab checko with the sta during 10/210/3. In this checko, you will
need to be able to discuss your design process, calculations, and experimental results. We are
particularly interested in how you have used the experimental results to understand the ways in
which the system matches predictions and the ways in which it departs from modeled behavior.
Come to lab well ahead of your checko time so that you can get set up and have your system
running at the start of checko.
Collaboration
You are welcome to collaborate freely with other students in the class, to discuss approaches and
solutions, and compare results. However, what you turn in for prelab and lab reports must represent
your individual understanding. We require that you fabricate your own circuits and controllers, and
do your own experimental lab work, as watching someone else is not very eective. The checkos
are one-on-one, and give you a chance to show us your own understanding of the material. If you
make use of insights from another student, good scholarship entails citing their contribution in your
report. It is always good form to acknowledge such assistance; it makes you a better scholar as well
as being fair.
Please read this section carefully before making any circuit connections, and before
applying any power to the circuit.
In this laboratory, we use a power op amp to drive loads requiring more current and voltage ranges
than is available from a low-level op-amp such as the 741 (which is limited to about 15 V and
10 mA maxiumum outputs). To this end you will work with an Apex PA-10 power operational
amplier mounted on a PC board which we have designed. This power amp board uses some of
the components available from Apex in their EK-21 evaluation kit. Data sheets for this amplier
and the circuit board are available on the course web page. Please read these data sheets in order
to familiarize yourself with the amplier characteristics.
The PA-10 ampliers have an absolute maximum of 50 volts. The lab bench supplies cannot
output voltages above 30 Volts, so the amplier is capable of running safely on the maximum
supply output. However, in order to limit the maximum amplier and load power dissipation, we
will run the supplies at 17 Volts.
The boards have two PA-10 ampliers, so that two loads can be driven independently. For this lab,
we will only use one channel. See the circuit board handout for more details.
Supply connections: In the following, we refer to the two 030 volt supplies available on the
Tektronix power supply. The unit also has a 5 volt supply which we do not use in this lab. The
supplies in the lab have been furnished with jumpers and connected for series operation. Please
keep the supply in this conguration throughout the laboratory. In this mode, the right-hand
voltage control sets the voltage output for both supplies. We operate the amplier with the power
supply set to 17 V. In this lab, do not operate at more than 17 V. As connected, the right-hand
supply provides +Vcc at its positive terminal, and the left-hand supply provides Vcc at its negative
terminal. Common is taken from the jumpered center connections (the negative terminal of the
right-hand supply and/or the positive terminal of the left-hand supply). Note: It is not always a
good idea to tie power supply common to earth ground at the supply chassis. In many cases, the
system earth connection should be located elsewhere. We will discuss this in more detail later in
the course.
2
Left-hand supply
Black
Right-hand supply
Bare
Wire
Common
Vcc
Red
+ Vcc
Assignments
1. Resistive load: Carefully connect the amplier to the supply as described above. Use a
10 , 25 W power resistor as the load in a non-inverting gain of two connection. The circuit
you build should appear as shown in Fig. 2. The 10k resistors shown are soldered-in on
the amplier board. We have also soldered in a pair of 1 M resistors to provide the input
current of the amplier under conditions where you have not connected its inputs. However
for present purposes, you can simply ignore these resistors. Connect the signal generator
through a BNC connector to the input of the power amplier. The power resistor is provided
for you on the amplier terminal strip.
PA-21
V1
10 k
10 , 25 W
Vs
10 k
Figure 2: Amplier with resistive load. The 10k resistors shown are soldered-in on the amplier
board. The ground connections are made on the terminal strip.
As a rst step, suppose that the PA-10 operates as an ideal innite gain op amp. Further,
suppose that the input in Fig. 2 is a 5V amplitude sine wave at 1000 rad/sec Vs = 5 sin 1000t.
Further assume that the PA-10 is operating from 17 V supplies. In this case, calculate
the voltage V1 (t) and the resulting current Is (t) through the 10 sense resistor Rs . Also
calculate the average power dissipated in the PA-10 and in Rs . How do these values compare
with the rated dissipation of the two devices? Note that your answers will not depend upon
frequency, given the ideal innite gain op amp assumption. Show your calculations.
Next, we want to explore the circuit operation with the model including the PA-10 internal
dynamics, and to predict and measure the closed-loop dynamic response of the amplier as
connected in Fig. 2. Use the data sheet for the PA-10 to determine an appropriate model for
the amplier which matches the data sheet in magnitude and phase as a function of frequency.
Show and explain how your determined this model. Use your model in a block diagram for
the connection to predict the loop crossover frequency, phase margin, and closed-loop stepand frequency-responses. Use 0$7/$% to simulate your system, and plot the expected step
response.
Now in the lab, measure the closed-loop step and frequency responses. Try to explain any
discrepancies between what you predict and what you measure in the lab. In this and sub
sequent sections, be sure that your measurements are small-signal in that the amplier is
responding linearly. In order to test whether you are in this regime, decrease the input signal
amplitude until the output scales linearly with the input. What departures from linearity
can you observe with both step and sine inputs? As one specic, can you observe the eects
of the amplier slew-rate limit? How does this compare with the data-sheet value?
2. Inductive load, voltage drive: Now we will use the amplier to drive an inductive load in
voltage mode as shown in Fig. 3. Each station has an inductor which has been constructed
from a small power transformer. Please keep each device at its original station. Do not move
4
these around between stations! For the greatest consistency, you may want to use the same
station for all your critical tests, but since the inductors are nominally identical, you are free
to use other stations and assume the inductors are matched. The purpose of this portion
PA-21
+
Inductor
V2
V1
10 k
10 , 25 W
Vs
10 k
2
3
+15 V
7 0.1 uf
LM741
+
4
PA-21
+
Inductor
V2
V1
0.1 uf
-15 V
Vs
L
10 k
R
15 , 25 W
or
10 , 25 W
10 k
be sure that the control amplier gain falls o at least as 1/ at high frequencies, i.e. for
frequencies well above crossover. Whenever you power up a new circuit, always use a scope
to check for the presence of such oscillations, and be sure to eliminate them before proceding
with the measurements in this lab. An oscillating amplier will yield aky results at best,
and may smoke itself and/or your load at worst.)
Choose your design values for the 0 A bias condition. Then, in the lab, verify the performance
at 0 A bias. Predict and measure the closed-loop step and frequency responses.
Then also use the model you developed earlier to predict the step and frequency responses at
0.5 A bias. Then measure these in the lab. How does saturation of the magnetics aect the
stability of your feedback loop?
In making the measurements above, it is important that the system is again behaving in a
small-signal fashion. Specically, make sure that the steps are small enough that neither
of the amplier outputs is hitting the supply rails. What happens when the ampliers are
allowed to saturate? Also, note that the 741 control amplier output is the control eort,
which his usually an important signal to monitor in all control loops.
For all of the above measurements, store interesting data from the scope output, and include in
your report.
Extra Credit: Absolutely not required, but if you have the time, assume that the closed-loop
current control system of Fig. 4 is driven with a 5V amplitude sine wave at 1000 rad/sec as
Vs = 5 sin 1000t. Further assume that the PA-10 is operating from 17 V supplies. In this case,
calculate the voltages V1 (t), V2 (t), and the resulting current Is (t) through the 10 sense resistor
Rs . Also calculate the average power dissipated in the PA-10 and in Rs . You should note that the
inductive load causes more dissipation in the power amplier than when driving a purely resistive
load. This issue should be addressed as part of determining compliance with the safe operating
area specications of the power amplier. See the data sheet for further discussion.
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
2.737 Mechatronics
Laboratory Assignment 3: Electronic Scale
Assigned: 10/14/14
Pre-lab due: Friday 10/17/14 online by 5pm
Reports due: Thursday/Friday 10/2310/24/14 in checkos
Overview
In this lab you will design and implement circuitry for interfacing with an electronic scale using
an instrumentation amplier and precision voltage reference. The scale is based upon a beam with
bonded foil strain gages in a full-bridge conguration. The instrumentation amplier is used to
amplify the millivolt range bridge output voltages up to the range of volts for interfacing with
the myRIO A/D convertor. You will also look at the measurement of signals in the presence of
common-mode voltage disturbances.
Your prelab calculations are due in a prelab report to be submitted by 5pm on Friday 10/17. For
the prelab, please complete all the requested modeling, preliminary measurements, circuit design
parameter choices, etc. You will need to make a copy to give to us, and keep your original to support
the lab portion of the assignment. You may submit these online, or in the ling cabinet in the lab.
It is not permitted to look at other students prelab reports in the ling cabinet.
The lab report should clearly document your experimental work, predictions, results, and a com
parison between these, with explanations of observed phenomena and discrepancies. Be sure to
show us your understanding of the lab and design experiences. No formal lab report structure is
required. The lab report is due at the time of your checko. Please also include the prelab copy
with this report. These must be submitted in paper format at the checko.
You will also schedule a lab checko with the sta during 11/2324. In this checko, you will
need to be able to discuss your design process, calculations, and experimental results. We are
particularly interested in how you have used the experimental results to understand the ways in
which the system matches predictions and the ways in which it departs from modeled behavior.
Come to lab well ahead of your checko time so that you can get set up and have your system
running at the start of checko.
The scale mechanism uses a full-bridge strain gage circuit attached to a beam which supports the
scale weighing platform. The circuit used for interfacing with the electronic scale is shown below
in Fig. 1. Note that in this circuit, we use the letter S to indicate the myRIO board common,
and the letter B to indicate the common for the strain gage bridge. This bridge common is driven
by the signal generator to create an articial common-mode disturbance, which is reected in the
common-mode of the bridge output voltages.
The scale is rated for about 3 kg maximum load. Do not apply any loads higher than 3 kg as they
may damage the scale mechanism.
The full-bridge circuit uses four active strain gages congured as shown below in Fig. 2. The change
in resistance is given by R = R G.F. E, where R is the nominal no-strain gage resistance, E is the
strain, and G.F. is the gage factor. For metal foil strain gages, the gage factor is typically in the
range of 25. Since our strain gage beam is taken from a commercial electronic scale, we are not
given the gage factor or the gage resistance. We also do not know the relationship between strain
and weight on the scale. We will experimentally determine the relationship between weight and
bridge output voltage. Note also that in this simple model we are ignoring the eect of temperature
on the gage resistance.
Note that the reference voltage is applied between terminals A and B, and the bridge output voltage
is taken between terminals C and D, as indicated in the gure.
Prelab
1. Bridge resistance: Assume zero strain, and thus R = 0. In this condition, calculate the
value of resistance measured: 1) between terminals A and C, 2) between terminals A and D?
In the lab, use a multimeter to measure the resistance between these terminals. What is the
nominal bridge resistance R?
2. Bridge output voltage: Write an expression for the bridge output voltage vb given a 10
volt reference input, and assuming that the gage factor G.F. is and unknown variable This
expression should also be in terms of the nominal bridge resistance R and strain E.
3. Measured circuit output: Now build just the reference voltage portion of the circuit, and
ground the disturbance input terminal, i.e. dont connect the signal generator. Attach the
scale cable to your circuit board and wire the reference circuit to the scale. Use the multimeter
to measure the bridge voltage as a function of weight on the scale for several weights varying
from zero to 2 kg. Write an expression for a linear model relationship between weight and
output voltage.
4. Dierential amplier design: Using your measurements above, choose Rg so as to give
9 V output from the LT1167 to the A/D convertor for 2 kg load on the scale. Show your
calculations.
Common Mode
Disturbance
Signal
Generator
+15 V
50k
+15 V
-15 V
50k
10k
25 turns
1k
47
LT 1021
Reference
Voltage
S
-15 V
741
.1uF
.1uF
B (bridge common)
red
.1 uF
green
LT 1167
-15 V
Offset Adjustment
Rg
white
.1uF
+15 V
+
10V
-
black
+15 V
.1uF
.1uF
R1
C1
Is bridge common, as
disturbed by signal
generator
Is board common
A/D
Lab exercises
1. Circuit construction: Build the circuit with the values selected in the prelab. Interface to
the myRIO using the provided VI. Adjust the oset potentiometer so that the LT1167 output
voltage is zero with no load. How close is your selected LT1167 gain value from the prelab,
i.e., how close is the LT1167 output to 9 V for 2 kg load? Adjust the scale factor in the VI
so that the measured weight is accurately displayed. With this calibration, check the output
versus weight for a number of dierent weights between 0 and 2 kg. What is the maximum
percent deviation from linearity of your scale system?
2. Scale dynamics: Display the LT1167 output on the scope, i.e., the voltage before low pass
ltering. Conduct experiments to determine the natural frequency of the scale/weight system
4
as a function of the weight on the scale platform. Note that you will need to be careful to
conduct the experiments so that the relevant mode is clearly seen, as there are many other
possible modes. We have found it helpful to use a soft hammer like a rubber eraser block
on the end of a pencil so that high frequencies are not inordinately excited. On the basis of
your experiments, determine: 1) the scale platform stiness [N/m], and 2) the scale platform
no-load mass [kg]. Include relevant measured responses and show your thinking.
3. Common-mode rejection using scope: Connect two 10x scope probes to the bridge
terminals C and D. Connect the signal generator to drive the common-mode disturbance
input. Use a 5 V square wave from the signal generator to drive the resistive voltage divider
which drives the bridge common. How large a disturbance does this induce on the bridge
common? How is this reected into the scope measured voltages on C and D? Congure the
scope to subtract the two probe voltages. Can you see the eect of weight on dierential
scope voltage? With what resolution?
4. Common-mode rejection using LT1167: Connect a 1x scope probe (i.e., BNC cable) to
the output of the LT1167. Now drive the common-mode bridge voltage using a 5 V square
wave from the signal generator as before. What is the response observed at the output of the
LT1167? How does this response compare with what you predicted in the prelab? Note that
you will need to use the actual common mode voltage at the output of the resistive divider
to compare with the rejection of the LT1167. How are the frequency-dependent dynamics
reected in this response?
5. Minimum resolution: What is the smallest weight dierence that you can measure? Show
us your approach and explain how you got the results.
6. Optional: Completely optional: Note that as congured we are only using the positive
voltage range of the myRIO A/D converter. This throws away half the A/D resolution, since
the negative range is unused. If you have time, recongure your circuit to use the full 10 V
range of the A/D converter. Explain your approach and show us relevant results.
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
2.737 Mechatronics
Laboratory Assignment 4: AC-Driven and Demodulated Electronic
Scale
Assigned: 10/28/14
Pre-lab due: No prelab
Reports due: Monday 11/3 in checkos; no lecture that day
Overview
In this lab you will implement an electronic scale using AC excitation and demodulation. That
is, you will use the myRIO to generate a sine wave which provides the reference voltage for the
strain gage bridge. With this sinusoidal drive, the bridge common-mode and dierential voltages
are also sinusoidal; the bridge imbalance which represents weight is then reected in the sinusoidal
dierential bridge output voltage. The conguration for this experiment is shown below in Fig. 1.
As shown in the gure, the myRIO is used to generate a sinusoidal drive at about 50 Hz and outputs
this sine wave through a D/A converter to drive the bridge reference voltage. A 741 op amp is
used as a buer to drive the bridge current. Note that no precision DC reference is required, since
the bridge is directly driven by the D/A, which provides the AC signal. Note that all the circuit
elements are referenced to a single common S; there is no common disturbance in this circuit as
there was in Lab 3.
As before, an LT1167 dierential amplier is used to amplify the sinusoidal bridge output. You
may optionally design an oset adjustment circuit to null this imbalance in the modulated domain.
The amplied bridge output is input to the myRIO A/D converter to yield a measurement in
the modulated domain. This measurement is then demodulated to yield estimates of the signal
, the signal phase , and the corresponding weight W
.
magnitude M
Note that no prelab is required. The lab report is due at the time of your checkos on Monday
11/3. This lab is not tightly specied as to how you solve the demodulation problem. Also, you will
need to write your own Labview code to implement the required functions. Be sure to document
your approach, including relevant calculations.
Lab exercises
1. System operating theory: Construct a model for the propagation of signals through the
system. Use any relevant results from Lab 3 to help with this analysis. Choose A such that
the bridge is driven with a 10 V sine wave. What gain do you select for the dierential
amplier? Why? This model should represent the bridge as a resistive imbalance which
1
the corresponding weight W . Create an analysis which explains the theory for how this
demodulation works, and how you develop the relevant estimates. Show how the weight
reects through the bridge imbalance into the estimates, and how you will make the weight
estimate accurate. Note that you may not assume that = 0, but must handle the general
case where = 0. You must also provide an adjustable weight oset to allow nulling of the
zero-load weight estimate (tare).
4. Experimental Implementation: Create a Labview VI to run on the myRIO and which
implements the AC system. We suggest that you run at a carrier frequency of 50 Hz, and
a sampling rate as high as allowed by the numerical capability of the myRIO. You are free
to try other frequencies to see the eect on the circuit operation. Your VI should include
graphical displays of interesting relevant waveforms including the three estimates, as well as
numerical displays of the three estimates. Run this system in the lab, and measure the scale
output for a number of dierent weights. What is the linearity of your measurement? Note
that linearity is dened in terms of the error as a percent of full-scale reading.
5. Challenge question: Can your system measure the scale dynamic resonant response as we
did in Lab 3? Why or why not? How could this be measured?
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Laboratory Assignment 5
Digital Velocity and Position control of a D.C. motor
2.737 Mechatronics
Dept. of Mechanical Engineering
Massachusetts Institute of Technology
Cambridge, MA-02139
1 Topics
Motor modeling
Proportional, PI velocity control
Implementation of Anti-Windup
Proportional position control
Lead-Lag compensation
Velocity minor loop / Position major loop
2 Equipment
PC 486 with ATMIO-16 card
Oscilloscope
Function generator
D.C. motor
Power amplier
Protoboard
3 Introduction
In this laboratory, digital control of a D.C. motor will be studied. Each station is equipped with a
D.C. motor (with an integral tachometer to measure angular velocity), a single turn potentiometer
to measure angular position and a power amplier to drive the motor. First, we will develop a model
for the motor. This model will then be used to perform velocity and position control experiments
on the motor. For the purpose of this lab, controller design will be done using continuous time
methods. Discrete time controllers will be obtained from these by using either backward difference
or ZOH equivalents.
Initial experiments will focus on velocity control. A proportional controller will be implemented
rst. Resulting steady state errors are observed and the effect of increasing gain on steady state
error is seen. This is followed by implementation of a PI controller to remove steady state errors in
response to a step input. Problems with integral windup are observed and an anti-windup scheme
is implemented. Next, step and frequency response specications are met by designing a controller
R
L
) e
KT
J
Ktach
Kpot
7:5
5:55mH
L 0:7ms
R
0:024Nm/A
1:5 10;5 Kgm2 (referred to motor shaft)
0:023V/rad/sec
0:53V/rad (of motor)
2
36
216
6
JR 200ms
) m
KT2
1
!m
)
Vm
KT (m s + 1)
(1)
An appropriate connection of the motor setup is shown in Figure 1. For the purposes of this lab,
the reference signal r will be generated by the function generator in some sections. Connect the
function generator to AD channel 0, the tachometer signal to AD channel 1 ,and the potentiometer
signal to AD channel 2. Also, compute the control output u and send it out on DA channel 0 to the
input of the power amplifer.
Please make sure the potentiometer is wired correctly to operate at 10 Volts. To do this, we
will use the 15 Volt power source from the protoboard, and use a pair of resistors to reduce the
voltage to 10 Volts. The typical value of the potentiometer resistance is about 4:7k, the pair of
additional resistors can be chosen as 1:2k . (Be very careful, dont connect the wiper to any other
voltage source or ground, the short circuit between the wiper and 10 Volts during wrap-around
will damage the potentiometer permanently.)
DA ch0
power amplifier
10k
10k
pinion
tachometer
AD ch1
CCW
1.2k
wiper
AD ch2
+15V
AD ch0
DC motor
-15V
flywheel
1.2k
CW
function
generator
potentiometer
built-in resistor
gear
5 Velocity control
We will use the motor model developed in the previous section for implementing velocity control
of the D.C. motor. The tachometer output is used to implement feedback. Remember to include the
amplier and tachometer gain when designing the controller. First, we will implement the simplest
controller, i.e., Proportional control. We will observe the effects of gain and sampling time on the
step response of the motor.
Next, we will implement PI control which removes the steady state errors (to a step input)
that were present with a proportional controller. The block diagram of the motor-controller setup
implementing a PI controller is given in Figure 2.
Ti s + 1
p
Ka
Kt
Ti s
1
ms + 1
y
K tach
5.1
Controller Design
D(s) Kp
D(s) Kp
Kp
1+
(2)
Ts
T s +i 1
i
Tis
(3)
The proportional gain Kp and the integral or reset time Ti are chosen to meet specications on
the response. For the purpose of this lab, we will design controllers based on step and frequency
response specications. Also, we will implement all controllers with a sampling interval of 1 ms
which is fast enough for implementation of digital controllers by emulating analog designs for the
D.C. motor under consideration.
5.2
Controller Implementation
The command signal for a PI controller using a backward difference scheme is given by
where
Kp
Ti
Ts
S2(k)
C
(4)
Proportional gain
Reset time
Sampling interval
S2 (k ; 1) + Ce(k)
KTpTs
i
Collecting terms,
u(k) Ae(k) + S2 (k ; 1)
(5)
where
A Kp + KTpTs :
i
The values A and C can be precomputed. A code fragment to implement the controller in an
interrupt service routine is then given by
ad = adin (1);
error = ref - ad;
command = A*error + sum;
daout (0, command);
sum += C*error;
The above code fragment implements the basic PI scheme without any anti-windup measures.
Note that you can also use the ZOH equivalent to implement the digital controller. To nd the ZOH
equivalent of the controller, use the c2dm (num, den, ts, zoh) command in MATLAB.
This will give you the polynomial to implement the difference equation for your controller.
Note that the presence of an integrator in your control law can lead to Integrator windup. This
can be noticed if you cause the error to accumulate in spite of saturation of the actuators. The
integrating action of the controller keeps accumulating the error and leads to large overshoots. You
can observe this by doing PI control of the motor and holding the ywheel with your hand. Be
careful not to get yourself hurt while doing this (i.e., Keep your ngers out of the gear mesh). When
you nally release the ywheel, you should be able to see a rather large overshoot. For the purpose
of observing windup, generate the step reference at the computer itself rather than using the signal
generator. Look at the program expt5_1.c for an example. Note that the size of the overshoot is
dependent on the time for which you hold the ywheel stationary ! You can implement anti-windup
measures very easily by turning off the integrator when the actuators saturate (in our case - when
the control output exceeds the 10 volts range). Please add anti-windup to your controller and
show us the difference with and without this term.
5
6 Position control
Position control is in some sense more difcult than velocity control, because you can cause the
system to go unstable rather easily due to the presence of the additional integrator in the transfer
function. To implement position control, feedback is from the potentiometer. The potentiometer
is a one-turn potentiometer with its output varying from ;10 to +10 volts. There is a wrap around
at either end of the range. What happens if you try to run through this wrap-around?
Remember to include the speed reducer gain in your model for the position control problem.
Note that the motor angle is ;6 times the potentiometer angle, which is what you measure. In your
model, please refer all elements to the motor shaft.
6.1
Controller Design
D(s) Kp
(6)
+ zb ; p < z
D(s) Klag ss +
p b b
(8)
a b
(9)
Compensator parameters are chosen to satisfy the system requirements. And the corresponding
discrete-time controller can obtained using the methods described earlier. Note that the pole pb is
sometimes placed at s 0 to perform as an integrator.
6.2
Controller Implementation
The controller is implemented in a similar way as for velocity control. Notice the effect of increasing
gain on the servo stiffness. Also, notice the effect of the integral term when you implement the
lead-lag compensator. Do you see chatter ?
7 State feedback
Having implemented both position and velocity feedback, we can now combine both to implement
state feedback. We consider the problem of controlling the position of the motor shaft with both
position and velocity feedback as shown in Figure 3. We saw that proportional control by itself led to
6
very poor performance due to the negligible amount of damping in the system. Lead compensation
was used to add damping to the system - adding derivative control has the same effect. In fact, PD
control can be seen as an extreme form of lead compensation. However, we observed chatter (on
some of the setups at least) when performing lead and lead-lag compensation.
+
-
K pos
Ka
-
K vel
s
Kt m + 1
K tach
K pot
8 Laboratory procedure
1. Some programs for use in this lab are in the directory c:\courses\2.737\lab5.
Change to this directory and run the program expt5_1.c. This implements proportional
velocity control of the D.C. motor. The program accepts a proportional gain input by the
user. Run the program for different value of proportional gain and observe the effects on
steady state error. Use a sampling interval of 1 ms. Suggested proportional gain values range
from 1 to 20.
2. Design a proportional controller for closed loop system time constant = 50 ms in
MATLAB (Be sure to include the power amplier gain in your model) and implement it.
Collect step response data and compare it with the predicted step response in MATLAB.
Use the program expt5_1.c to implement your controller. Note that the tachometer
voltage has a lot of
7
ripple on it which is not predicted by MATLAB. These are not oscillations due to your
controller, they are due to the tachometer itself !
3. Design a PI controller for
0:5
!n 30
Again, compare with MATLAB. Initially write your program and make your hardware connections such that the program generates a reference voltage on the same lines of expt5_1.c.
It might help to make a copy of the program expt5_1.c in your directory and modify it.
Hold the ywheel with your hand and notice the large overshoots when you release it. Implement anti-windup measures as suggested and run the program. Again, hold the ywheel
with your hand. Notice the greatly improved performance. Explain the difference.
4. Design a PI controller for
Mp < 30%
!n 50
Write your program and make your hardware connections such that the reference is generated
by the function generator rather than by the computer. Collect step response data and compare
with MATLAB predictions. Measure the rise time. Does this match your predictions ?
5. Run the program expt5_2.c. This implements proportional position control of the D.C.
motor. Use a step reference of 1 volt. Suggested values of gain range from 0.5 to 5 and
sample intervals range from 1 to 5 milliseconds. Note the effect of increasing gain on
the stiffness of the potentiometer shaft. Also, note the large overshoot that you get with
pure proportional control. Remember that the inclusion of another integral in your position
transfer function dropped your phase by 90 degrees and increasing gain leads to decreased
phase margin leading to increased overshoots ! Note when the servo becomes unstable. Be
sure not to confuse wrap-around of the potentiometer with stability of the servo.
6. We see that pure proportional control leads to poor control performance of the motor due
to the large overshoots. Hence, lead compensation is called for. First design a proportional
controller to obtain 45 degrees of phase margin. Notice that the proportional gain to implement such a controller comes out to be very low. Implementation of the controller reveals
that there is virtually no response from the motor. Why ? Consider nonlinearities such as
friction, stick-slip etc.
Now, consider using a lead compensator. Design a lead compensator to obtain a crossover
frequency of 30 rad/s and a phase margin of 45 degrees. Implement this controller and
record the step response. Compare the performance of this compensator with that of a pure
proportional controller.
7. We would like to drive the error to zero in the presence of steady torque disturbances. This
can be accomplished by using a lead-lag compensator. Design a lead-lag compensator (set
the lag pole at zero to obtain an integrator) to obtain a crossover frequency of 30 rad/s and
a phase margin of 45 degrees. Try rotating the potentiometer shaft away from the reference
point manually. Notice the restoring torque of the servo increase with time. This is caused by
the integrating action of the compensator. Record the step response. Can you see the rather
8
MIT OpenCourseWare
http://ocw.mit.edu
2.737 Mechatronics
Fall 2014
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.