LAB 8 CLOSED-LOOP TEMPERATURE 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#8
lab08_closed_loop_control.pdf

example_lab_report_writeup.pdf

Don't use plagiarized sources. Get Your Custom Essay on
LAB 8 CLOSED-LOOP TEMPERATURE CONTROL
Just from $13/Page
Order Essay

lab_report_guide_1_.pdf

Unformatted Attachment Preview

Mechatronics
Spring 2018
LAB 8 CLOSED-LOOP TEMPERATURE CONTROL
OBJECTIVE
•
•
•
Get familiar with power resistors and temperature sensors.
Learn how to perform closed-loop temperature control with different methods.
Learn how to collect and plot engineering data.
INTRODUCTION
I.
Closed Loop Control
In this lab, you will learn the basics of closed-loop control. Closed-loop control systems are
generally represented schematically by the diagram in Figure 1.
r +
e
Controller
u
Plant
z
Sensors
y
Fig.1. Control System Block Diagram
The input r is the reference signal, often called the “Setpoint” and it represents what we want the
system output to be. The temperature on the oven control or thermostat, the speed setting on the
cruise control of your car, or the brightness setting on the screen of your phone are a few
examples. The state z is the actual temperature or speed or brightness produced by the system. It
is sensed by the sensors, as shown in Figure 1. The sensor measurement y includes two
components: the true state plus the measurement error (or noise). The actual value y is subtracted
from the desired value r to develop an error signal, e. If the error signal is positive, the output is
less than the desired value and the controller sends a signal u to the furnace to turn it on or to the
engine fuel injectors to send more fuel to the engine, etc. If e is negative, the output is higher
than desired, and the controller tells the system to cool down, slow down, or dim the screen.
The control engineers must write an algorithm to decide what the signal u should be as a function
of the error e and time: u = u(e, t). This lab will explore two different strategies for computing u.
PROCEDURE
I.
Binary Temperature Control
The simplest and most common form of temperature control is binary control – the actuator is
either on or off. Most heating systems, pneumatic systems, and many other processes work this
way. The controller output is either 1 or 0 to turn the actuator on or off. In this lab, you will
build a small heating system that will work this way.
A. Setpoint Input
Use the potentiometer as a setpoint adjustment mechanism. Use 5V and ground from the
Arduino as you have done before and connect the wiper of the potentiometer to one of the analog
input pins. Remember that you cannot use analog inputs 0 or 1.
Page 1 of 7
Mechatronics
Spring 2018
The desired temperature should vary between 80F and 150F. These temperatures will correspond
to the voltage range 0.0 to 5.0V. Scale the potentiometer voltage by writing a segment of code
that does the following:
Start a loop;
Read the voltage on the wiper of the potentiometer;
Find an equation to convert the voltage to a temperature that:
Set 0V = 80F (Note: we must set the desired temperature higher than ambient);
Set 5V = 150F (Note: the heater and sensor can handle a higher temperature, but
our skin cannot…);
Use linear interpolation in between;
Display the setpoint temperature on the screen;
Pause 1 second then go back and run the loop again.
B. Sensor Feedback and Scaling
Connect the LM34 temperature sensor assembly in your toolbox to Ardunio as shown in Figure
2. You do not need to wire the resistor – it is already done for you on the circuit board. Just
connect the three wires from the sensor as follows:
Red wire = 5 V
Orange wire = Signal
Black wire = Ground
The output of the LM34 temperature sensor is given by:
Vout = 0.01 × T
(T is in oF)
Write a code segment that does the following:
Read the voltage on the temperature sensor;
Convert the voltage to a temperature;
Display temperature, pause one second;
Repeat.
Fig. 2. Temperature Sensor Wiring. The
1 kO Resistor is Already on the Board.
Get 5V and Ground from the Arduino.
Test your code by alternately touching or blowing on the sensor to heat or cool it and watch the
temperature change.
C. The Plant
In control systems language, the “Plant” is the system we are trying to control. It usually consists
of a passive part like the oven or the chassis of a car, and an actuator such as a heating element or
a motor or a hydraulic cylinder, etc. In our case, the actuator will be a power resistor that we use
as a heating element. In your toolbox will be a power resistor – a rectangular prism that is gold
in color with two wires. Connect the resistor to one of the motor output channels on the Arduino
Motor Shield as shown in Figure 3. We will use the motor shield to regulate the electric power
that we want to convert to heat.
Note that the power supply to the motor control should be about 7-10V instead of 5V to get the
resistor hotter. You still want to use 5V and ground for the temperature sensor and potentiometer
because the analog inputs only go up to 5V. You can get the 5V for those two items from the
Arduino use the red/blue “bus” strips on a breadboard to distribute power from the Arduino to
the temperature sensor and potentiometer.
Page 2 of 7
Mechatronics
Spring 2018
Construction Tip: the LM34 sensor must be
in close contact with the heater. You want
to make sure that the power resistor is
touching the plastic LM34. A small piece
of masking tape can be handy here (e.g.,
Figure 4). Also make sure that you will not
short the sensor by having one of the
exposed pins (or the bottom of the circuit
board) touching a metal object, such as the
case of the power resistor.
Add an LED and current limiting resistor in
parallel with the heater, so you can tell
easily when the heater is on or off. Choose
the current limiting resistor R by
measuring the voltage across the heater
when it is on. Then compute the proper
value of current limiting resistor R to keep
the LED current below 40 mA. Remember
that the LED must be properly oriented or
it will not conduct current.
Fig. 3. Overall Schematic of the Temperature
Measurement and Control System
Write a code segment to compare the
temperature measured by LM34 with the
setpoint temperature. If the measured
temperature is less than the setpoint, apply full
voltage
to
the
heater,
i.e.
AnalogOut(a,3,5).
If
the
actual
temperature is greater than the setpoint, turn
Fig. 4. Attaching the Temperature Sensor to the
off the current to the heater. Display the
Power Resistor
setpoint and actual temperatures on the screen;
pause 1 second, then go back to the beginning of the loop.
D. Test the System
To test your system, run the program and turn the potentiometer so the setpoint temperature is a
few degrees higher than the actual temperature. Your program should turn on power to the
heater and it will start to warm up. The LED should glow telling you that the heater is “on”.
Once the setpoint temperature is reached or exceeded, the LED should turn off, indicating that
the controller has turned off power to the heater. The temperature may continue to rise for a
short while after this happens, because the heater has some thermal mass. But eventually, the
temperature should start to go back down. When it passes the setpoint, the heater should turn
back on again and drive the temperature back up. It will do this repeatedly or until you break out
of the program with Ctrl + C. Don’t forget that if you break the program while the heater is
on, it will stay on until you manually reset it to off or turn off the power supply.
E. Graph Your Data
It will be helpful if you can see the data as it is being generated. To do this, embed a ‘plot’
command in the repeating loop of your program. You will need to use the hold command to
Page 3 of 7
Mechatronics
Spring 2018
keep MATLAB from making a new plot for each data point. Here is a sample program showing
how to plot two different traces on the same axes. Note that you must give the plot function a
symbol (e.g., a ‘+’ or ‘*’) to use for each data point because it will not plot lines between the
data points when used this way, but it does give you a much better way to “see” what is
happening while your controller is operating.
% In line plotting program example
hold on
% keeps the plot from being erased
for i = 1:10
% Generate random data to plot
j = i*i;
k = 70;
plot(i,j,’k+’,i,k,’r*’)
% i is the x-axis variable
end
legend(‘Signal A’,’Signal B’)
hold on
% Stop holding the plot
Now, modify you code so it can plot the setpoint and temperature measurements as time goes.
Run your program a few times, allowing it to run long enough so that the temperature stabilizes
in a band about the setpoint. You should see a ‘sawtooth’ pattern oscillating about the setpoint if
your system is working properly.
Demonstrate your system to a T/A.
F. Logging Your Data
You will often want to save data that are being generated by a control program. In this lab, you
will be required to submit plots of the response of your control system using data that you have
“logged”. You can save the data collected at each sample time by making a matrix that you can
later use with MATLAB or Excel to plot the data. Each time you go through the loop, you want
to log several variables: the time, Tsetpoint, Tactual, and Output_Command. Outside the loop,
initialize a counter – let’s call it i. Note that i must start with 1, not with 0. We will create an n ×
4 matrix called DATA. Do the following:
Set i = 1 before you enter the loop;
Add a tic statement just before you enter the loop to start the stop
watch;
Just before the pause( ) statement, add the following lines of code:
DATA(i,1) = toc;
DATA(i,2) = Tsetpoint;
DATA(i,3) = Tactual;
DATA(i,4) = Output_Command;
i = i+1;
Now when you stop the program, there will be a matrix called DATA in the workspace. If you
go to the Command Window and type DATA, it will print it out. You can use the command
plot(data(:,1),data(:,3)) to plot the measured temperature, Tactual, with respect to
time. Use the appropriate index to plot the setpoint or the voltage command to the heater.
Review the use of the plot command by typing doc plot in the MATLAB command window.
Page 4 of 7
Mechatronics
Spring 2018
Note that each time you run the control program, it will write over the DATA matrix, so you
must save the data under a different name before running the program again. It is also a good
idea to clear the DATA matrix in case the next run is not as long as the last one. Do this:
>>New_Name = DATA;
>>clear DATA;
Alternately, you can use the save filename command to save your DATA matrix in a file
and use the load filename command to load the file later. Try a few tests to make sure this
feature works.
II. Proportional Control
It is possible to avoid the on/off cycles of the heater altogether by supplying only the amount of
current needed to maintain the temperature of the space against the convective heat loss to the
environment. In this case, you want the voltage to the resistor to be proportional to the error
between the setpoint temperature and the actual temperature. Define the error as: error =
Tsetpoint – Tactual; a proportional controller then works by setting Vheater = Pgain × error. Pgain is the
proportional gain, and you should make it a variable in MATLAB so it is easy to change in just
one place in the program. Start with Pgain = 0.5 and see how the system responds. Since you
cannot send a negative voltage to the resistor, you will need to use an if statement to detect
negative values of Vheater and set them to zero in order to avoid an error message from Arduino.
Note that you will have to scale the command to the AnalogOut that controls your heater current
(pin 3 if motor control channel A is used). The maximum command you can give AnalogOut is
“5”. So you create a proportional band that makes the output linear between an error of 0 and
some maximum value of error, which scales to “5”. Figure 5 shows what the scaling function
should look like: 0 for all negative values of error, and 5 for all values above the proportional
band, and linear within the proportional band. Setting the gain Pgain = 0.5 is the same as setting
the proportional band to 10. You can adjust the sensitivity of the control by adjusting the width
of the proportional band, which is the same as adjusting Pgain up or down. Figure 5 shows the
scaling function for different values of the proportional band.
Output Command Scaling Functions
Output Command
6
5
4
3
P-Band = 5
P-Band = 10
P-Band = 15
P-Band = 20
2
1
0
-15
-10
-5
0
5
10
15
20
Temperature Error, Degrees F
Fig.5. Output Command vs Error with Different Values of Proportional Band
Page 5 of 7
Mechatronics
Spring 2018
The pseudocode for this experiment will look something like this:
% This code will not run – it is an outline for you to follow in
writing your own code
Pgain = 0.5;
i = 1;
Turn off brakes on motor output;
Start Loop
Read setpoint potentiometer and convert voltage to temperature
Tsetpoint;
Read LM34 voltage and convert to temperature Tactual;
Error = Tsetpoint – Tactual;
Vheater = Pgain × Error;
if Vheater >= 5? Vheater = 4.99;
if Vheater < 0 ? Vheater = 0; % Analog output must be < 5.0 % Analog output must be >= 0.0
AnalogOut(a,3,Vheater);
Plot the data on screen as explained above;
Log the data as explained above in the DATA matrix;
Pause for one second;
i = i+1;
End loop
Set the Tsetpoint to a fairly high value like 120 ºF or 130 ºF so the heater will cool off more quickly
when the current is turned off. Be careful and don’t get burned. With Pgain = 0.5, how does the
system behave? Does the temperature overshoot the setpoint? Does it reach the setpoint? How
fast does the temperature rise or fall if you suddenly change the setpoint?
Try increasing Pgain to 1 and see how the system behaves now. Experiment with different values
of Pgain to find a value that gives you minimal overshoot but reasonable rise time.
Find a value of Pgain that makes your system work well and plot the results of a “step test” – with
the system at a stable temperature, increase or decrease the setpoint by about 10 ºF and let the
system come to a new equilibrium. Log the data and plot it in a graph that you will submit as
part of your report for this lab. Note the value you use for Pgain and make a nice, clean data set
and plot. It should be something similar to Figure 6. Be sure to let the system run for long
enough time that the output comes to within a stable band of values before terminating the test.
Page 6 of 7
Mechatronics
Spring 2018
Fig.6. Example Plot for Temperature Control Result
Demonstrate your program to a TA before cleaning up your lab station.
DELIVERABLE
Submit a lab report to eCampus for your closed-loop temperature control experiments. With each
controller, include a plot of the setpoint temperature, the measured temperature and the control
command × 25. Multiplying the control command by 25 makes it more easily visible on a set of
axes where the rest of the values will be in the 80-150 range.
Attach your MATLAB code as Appendix in the report. The code must be properly formatted and
commented.
Page 7 of 7
MAE 211 Mechatronics Spring 2018
Laboratory 3: Digital Multi-Meter
Larry Banta (LB) and Yu Gu (YG)
Tuesday Lab Section, Station 19
February 07, 2018
1. Introduction
The objective of this lab is to learn how to use the Digital Multi-Meter (DMM). The lab also
provides instruction in writing up lab reports and presenting data.
Although other
exercises were performed in the lab, only the results of resistor testing will be presented
here in this sample report. In your report, all experiments need to be discussed.
2. Materials List
The lab station was supplied with a DMM and five (5) resistors, each with a nominal value
of 1kO. The lab station had two lab partners, LB and YG. The only equipment used for
this lab was a Cen-Tech Digital Multi-meter, model P37772.
3. Procedure
The five resistors were laid out on the table in order so they could be distinguished from
each other by position. They were labeled “A”, “B”, “C”, “D”, and “E” for data recording
purposes. With the DMM on the 2kO scale, LB measured each of the resistors three
times and recorded the data. Measurements were made by placing the resistor on the
lab table and touching each end of the resistor with the meter probes, as shown in Figure
1.
Figure 1: Resistance measurement method 1
1
A second set of measurements was then made by another person (YG), using a different
method. He squeezed the resistor leads between his fingers and the meter probes, as
shown in Figure 2. Three measurements were taken for each resistor.
Figure 2: Resistance measurement technique #2. Finger pressure was used on both resistor leads
Following those measurements, a different DMM was obtained by trading with another
lab group. The purpose was to determine the influence of the meter on the readings. The
same procedure was used with the second meter. Data from the experiments are
presented in the next section of this report.
4. Results
Data are presented below for each of the measurements taken. Table 1 presents data
taken with Meter #1, and includes the data for both measurement methods. Table 2
presents the data taken using Meter #2. Table 3 is a summary of the data, and is
constructed by taking the mean value for each set of three measurements on each
resistor.
2
Table 1: Meter 1 Measurements
Resistor
Meter 1 LB (Ohms)
Meter 1 YG (Ohms)
mean
sigma
A
985
985
985
983
983
982
984
1.33
B
993
992
993
991
991
991
992
0.98
C
982
982
982
980
980
980
981
1.10
D
984
984
983
983
982
982
983
0.89
E
985
984
985
983
984
983
984
0.89
mean
986
985
986
984
984
984
sigma
4.21
3.85
4.34
4.12
4.18
4.28
mean
sigma
Table 2: Meter 2 Measurements
Resistor
Meter 2 LB (Ohms)
Meter 2 YG (Ohms)
A
983
983
983
979
979
980
981
2.04
B
991
992
991
987
987
988
989
2.25
C
980
981
980
977
977
978
979
1.72
D
983
982
983
979
979
979
981
2.04
E
984
984
985
980
980
980
982
2.40
mean
984
984
984
980
980
981
sigma
4.09
4.39
4.10
3.85
3.85
4.00
Table 3: Data Summary from Tables 1 and 2
A
Meter 1
LB
Average
985
Meter 1
YG
Average
983
Meter 2
LB
Average
983
Meter 2
YG
Average
979
B
993
991
991
987
C
982
980
980
977
D
984
982
983
979
E
985
983
984
980
mean
986
984
984
981
sigma
Overall
Average
Overall
sigma
4.12
4.18
4.17
3.89
Resistor
984
4.20
3
5. Conclusions
Although all five resistors were nominally 1,000 Ohms, the mean value of our
measurements was 984 Ohms, as shown in Table 3. While this is within the ±5%
tolerance of the resistor, it is interesting that all five of our resistors were less than the
nominal value by a substantial amount. Four of the five resistors were within one standard
deviation of the mean value. For a given meter, measurement method and resistor, there
was very little variation in the measured values among the three measurements made in
each trial. This indicates that there was not significant random electrical noise present in
the readings. We wish to investigate the error mechanisms and the relative importance
of several types of error on the measurements.
We can model a single measurement as follows:
Rm = Rt + ßm + ßp + e(t)
(1)
Where Rm is the measured value, Rt is the true value, ßm is bias due to the meter
(constant), ßp is bias due to the measurement technique (assumed more or less constant,
or at least containing a constant component) and e(t) is a random error that changes with
each measurement and/or with time. In the absence of specific knowledge about e, we
will assume that the random error is normally distributed with zero mean.
We would like to estimate the bias terms, so that we can “correct” the measured data and
develop an estimate of the actual resistance for each resistor. For the meter bias, we see
that there is a difference in the readings between meter 1 and meter 2 of about 1.27 Ohms
for LB and about 3.27 Ohms f …
Purchase answer to see full
attachment

GradeAcers
Calculate your paper price
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.

Professional and Experienced Academic Writers

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.

24/7 Customer Support

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?

Follow these simple steps to get your paper done

Place your order

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

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

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.

Essays

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.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

Order your essay today and save 15% with the discount code DISCOUNT15