Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
69 views

Lab 2

This document describes Lab 2 of a control systems course on implementing a proportional temperature controller for a thermoelectric heating system. Students will design a proportional controller, simulate it in Simulink, and test it on the physical system. They will control the temperature of a metal block by varying the voltage to a Peltier heater using PWM signals. The lab involves calibrating the temperature sensor, identifying the system model, designing and simulating the controller, implementing it on the Arduino, and reporting results.

Uploaded by

Vu Le
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Lab 2

This document describes Lab 2 of a control systems course on implementing a proportional temperature controller for a thermoelectric heating system. Students will design a proportional controller, simulate it in Simulink, and test it on the physical system. They will control the temperature of a metal block by varying the voltage to a Peltier heater using PWM signals. The lab involves calibrating the temperature sensor, identifying the system model, designing and simulating the controller, implementing it on the Arduino, and reporting results.

Uploaded by

Vu Le
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

TEE 451 - Control Systems

Winter 2021

Instructor: Michael McCourt Assignment: Lab 2 Temperature Control


Assignment: Thursday February 11

1 Introduction to Temperature Control Lab


In this lab, you will implement a proportional controller for the thermoelectric heating system introduced
in Lab 1. To control the temperature of the metal block, you will vary the voltage applied to the
thermoelectric Peltier heater. To set the voltage across the heater, you will use two Arduino PWM
signals and the L293D motor driver. You can think about changing the PWM duty cycles as setting an
average voltage level over time. This assumption can be made as long as the PWM frequency is high
compared to the system being tested. This is the case for our temperature control system as the PWM
frequency is 490 Hz and the time constant of the system is over a minute. As a note, in your code you
will have to implement a conversion from a desired voltage across the heater to the PWM duty cycles.
With this motor driver configuration, we can set the voltage across the heater to be positive or negative.
When the heating PWM pin voltage is higher on average than the cooling PWM pin, the voltage across
the heater is positive and the metal block will heat up over time. When the cooling PWM pin voltage is
higher on average than the heating PWM pin, the voltage across the heater is negative and the the metal
block will cool over time. With the 5V supply, the maximum voltage that can be applied to the heater is
about 5V. This is true for heating or cooling which can be thought of as control input saturation of +5V
and -5V. As a note, there is lost energy in this system. If you run the system cooling long enough, waste
heat will be generated and the entire system will start to heat up.
The main result from Lab 1 was the first order transfer function with gain KG and time constant τG .
KG
G(s) =
τG s + 1
If it has been several days since you last used the thermoelectric heating system, it is recommended to
recalibrate the temperature sensor. If you do not, your results could be off by several degrees. You can
follow the same calibration procedure that you did in Lab 1. If you do not have access to a thermometer
for calibrating your temperature sensor, your temperature values may be off. The setpoints discussed in
this lab assignment may not be achievable for your setup. You should check with the instructor to get
alternative desired setpoints based on your own temperature sensor.

2 Control Design
To control this system, you will design a proportional controller using the feedback loop in Figure 1 where
K(s) = KP .

1. Find the closed loop transfer function of the system with KP as a variable.

2. Choose a proportional gain to set the closed loop time constant to be less than 10 seconds.

page 1 of 3
Control Systems Winter 2021

𝐾(𝑠) 𝐺(𝑠)

Figure 1: Proportional controller feedback for the thermoelectric heating system.

3 Control Simulation
1. Create the feedback loop in Simulink with the proportional gain KP you found in the previous
section. Add a summing block after the plant to add in a room temperature offset (about 70◦ F).
This adjusted output should be connected to a scope to visualize the output. It should also be
connected to the summing block to complete the feedback loop.

2. Simulate this closed loop system with a step input with initial value 70◦ F a final value of 100◦ F.
Adjust the final simulation time to allow for the output value to settle.

3. One issue with this simulation is that the real system has saturation limits on the actuator because
we can apply a maximum of 5V and a minimum of -5V to the heater. Add a saturation block to
your simulation between the controller and the plant. Change the limits to be -5 and 5.

4. Simulate with the 90◦ step input and adjust your maximum simulation time to allow time for the
output to settle. Take a screenshot of a scope with the reference input and output signals on one
figure. You can do this by using a MUX block to combine two signals into one.

5. Replace the step input with a square wave input that alternates between 80◦ and 90◦ . You can
do this by using a pulse generator, a constant input, and a summing block to add them together.
Adjust the timing of the pulse generator so that the output has time to settle before the input value
switches.

6. At this point, take measurements of your rise time, settling time, and steady state error. Feel free
to modify your proportional gain value to improve performance. Make sure to document why you
made the change and explain in your report. Once you are done adjusting, take a screenshot of the
reference input and output signals on one figure.

4 Temperature Control Test


In the simulation, we assumed that when the controller calculates a voltage, this value is applied directly
to the heater. For this control setup, you will have to convert between this voltage and two PWM signal
duty cycles. For example, when the voltage calculated by the controller is 1.8V, the PWM duty cycle for
the heating pin should be set to 36% (1.8/5 = 0.36) and the cooling pin should be set to zero. Likewise,
if the calculated voltage is -1.8V, you must set the heating pin to 0 duty cycle and the cooling pin to
36% duty cycle. You must perform this calculation each time through the for loop. You can use if/else
conditionals to decide whether to heat or cool based on whether the control voltage is positive or negative.
You can read about how to set the PWM value in MATLAB at the links below.
https://www.mathworks.com/help/supportpkg/arduinoio/ref/configurepin.html
https://www.mathworks.com/help/supportpkg/arduinoio/ref/writepwmdutycycle.html

page 2 of 3
Control Systems Winter 2021

1. Modify your MATLAB code from Lab 1 to add the controller. First, include a line to calculate the
error between your reference input and system output.

2. The error must be multiplied by your proportional gain Kp to calculate the control input (voltage
level to send to the heater).

3. Add code to configure the PWM pins and to convert from a control voltage to the two PWM duty
cycles.

4. To avoid errors in your code, you should add “if” statements to check if your PWM signals are
greater than 1. If greater than 1, the value should be set to 1 for maximum heating or cooling.

5. Test your control loop by setting the desired temperature to 90◦ and running for at least 8 minutes.
Make sure to store your timing data and sensor measurement data in vectors. Save the data in a
.mat file so you have access to it later.

6. Convert the voltage measurement data to temperature using your linear sensor calibration. Plot
this data and include in your report.

7. Test your controller by implementing the square wave you tested in Simulink. Control the resistor
temperature to 80◦ and 90◦ at least twice for each temperature setpoint. You will have to adjust
your timing so that the system has enough time to settle at each setpoint before switching to the
next value. Save the data in a .mat file so you have access to it later.

8. Convert this voltage measurement data to temperature values and plot. Also plot the setpoint using
a different line type so that you can visually show the actual temperature and the desired setpoint.
Include this plot in your report.

5 Lab Report
This lab is the second part of a two part lab. For this lab, you will individually write and turn in a
formal lab report. You should document your progress for Lab 1 and Lab 2. Your lab report should
be organized into sections such as Introduction, Temperature Sensor Calibration, System Identification,
Control Design, Control Simulation, Control Results, and Conclusions. Make sure to use formal writing
and label all figures and tables.

page 3 of 3

You might also like