• No results found

Microcontroller-based experiments for a control systems course in electrical engineering technology

N/A
N/A
Protected

Academic year: 2021

Share "Microcontroller-based experiments for a control systems course in electrical engineering technology"

Copied!
11
0
0

Loading.... (view fulltext now)

Full text

(1)

International Journal of Electrical Engineering Education, Volume 51, Number 1 (January 2014), © Manchester University Press

Microcontroller-based experiments for a

control systems course in electrical

engineering technology

Albert Lozano-Nieto

Penn State University, Wilkes-Barre Campus, Lehman, PA, USA E-mail: [email protected]

Abstract A microcontroller-based system is used to illustrate experimental concepts in a Control Systems course in an Electrical Engineering Technology program. Students are able to experiment with different control strategies ranging from an open-loop to PID control. Students are asked to reason and discuss the benefi ts and drawbacks associated with each strategy. The microcontroller system has been chosen to minimize the learning curve for the students in such a way that they are mostly concerned with acquiring and representing the appropriate signals from the system as well as experimenting with changing the parameters of the system in each case.

Keywords closed loop; control systems; derivative gain; integral gain; microcontroller; open-loop;

proportional gain

Engineering technology students benefi t from intense and meaningful experimental activities that give them the necessary technical skills and perspective to complement the concepts developed in lectures. Experimental learning is especially important in courses which, because of their strong theoretical and mathematical content, cause students to focus on equations rather than on acquiring a broad vision of the subject matter. The author’s experience of teaching on a Baccalaureate degree in an Electri- cal Engineering Technology program is that Control Systems is one such type of course. We need to place a strong emphasis on experimental learning as a tool to give the students a breadth of perspective regarding the varied and very different applications of control systems as well as the necessary content depth for them to master its critical concepts.

Simulation packages are routinely used by some academic programs as a method to incorporate experimental learning in this type of course by simulating the behavior of complex systems. However, although useful, simulation activities by themselves are not enough to give students a solid understanding of the complexities and vari- ables that must be considered when dealing with dynamic systems. They may also contribute to make students lose some perspective on reality.

There is also evidence that shows how students have serious diffi culties in tran- scending the understanding of a system’s functioning toward more formal defi nitions of the control process.1 For these reasons is important to develop educational activi- ties that will help students master these diffi cult concepts, in particular hands-on experiments.2 Previous work in developing meaningful laboratory experiences in control systems course describe the use of spreadsheets to simulate Proportional- Integrative-Derivative (PID) control,3 magnetic levitation systems,4 and the use of

(2)

microcontrollers for specifi c areas of control systems5 or even developing a micro- controller-based circuit as the main control system.6

The goal of this paper is to contribute to the body of experimental learning in this type of course by sharing the author’s experiences in developing a series of micro- controller-based experiments to expose students to the basics of PID control. These are the fi rst experiments using microcontrollers that we have used in our Control Systems course. Past experiences were focused on both simulations and the use of analog feedback loops. Because of timing reasons, the current syllabus for the course does not cover PID control, so these experiments also serve to give the students a basic understanding of these control methods. When students take the Controls System course they have already taken an introductory course on microprocessors and microcontrollers and are somewhat familiar with their functionality. Further- more, because a large number of students choose to incorporate a microcontroller in their capstone (fi nal year) design project, this course helps them to gain a deeper knowledge of these systems.

One fi nal reason to incorporate a microcontroller for these experiments is that a large number of graduates from our program use microcontrollers in their profes- sional careers, thus contributing to their overall success.

The microcontroller-based experimental platform

The experimental platform used in these experiments is based on the Basic Stamp system manufactured by Parallax Inc. These boards are based on a PIC microcon- troller manufactured by Microchip to which Parallax has added external memory, input/output control and devices as well as a programming language very similar to BASIC. We have chosen the Basic Stamp modules as they provide a simple and integrated platform to change the parameters of the PID system as well as record that data acquired. This module has a total of 16 input/output ports that are more than suffi cient for these purposes.

The Basic Stamp modules interpret coding without being fi rst compiled. This means a large amount of CPU time is being used in reading instructions. In an industrial setting it would be necessary to migrate the application to a single micro- controller system with compiled code in order to reduce the execution times as well as the costs associated with the hardware of the system. However, the Basic Stamp modules present the advantage of using a very simple programming language and a very easy input/output interface. This fact allows students to learn how to operate them very quickly, moving the focus away from the intricacies of the microcontroller to the subject matter of control systems. In this course, students are given the code as well as an explanation of how it works. Their interaction with the software is focused on changing the values of the diverse parameters of the PID system and acquiring and recording its output. This allows students to evaluate the effects of their changes on the system output.

The goal of the experiments described in this paper is to maintain a specifi c envi- ronment at a constant temperature, compensating for several disturbances introduced

(3)

in the system. In these experiments, the environment is a fi lm canister that has been chosen because its small size results in faster temperature changes.

One of these elements is a resistor used to increase the temperature inside the canister due to the power dissipated and the second one is a temperature sensor. The heater consists of a 47 Ω resistor using a bipolar transistor to switch it on or off.

The base of the transistor is connected to one of the microcontroller I/O pins for control. The temperature sensor is the LM34 from National Semiconductor that has a sensitivity of 10.0 mV/F.7 The output of the temperature sensor is connected to an ADC 0831 Analog-to-Digital converter.8 Pins 1 and 3 of the ADC0831 A/D con- verter are controlled by the Basic Stamp module providing the device with the adequate clock and chip select signals. The output of the converter is also connected to the Basic Stamp module.

Students are presented with the schematic shown in Fig. 3 and the specifi cations of the ADC. First, they are asked to set the values of the two potentiometers for the control system to be able to regulate temperatures between 70 °F and 120 °F. The ADC0831 is a differential converter, converting the voltage difference between pins 2 and 3. Therefore, because the lower desired temperature range is 70 °F that cor- responds to 700 mV, a voltage of 700 mV in pin 3 produces a converter output of zero. This pin is used to adjust the lower temperature to be converted. Pin 5 is used to adjust the conversion span. In order to reach a highest temperature equal to 120

°F that corresponds to a temperature span of 50 °F, the voltage at pin 5 must be equal to 500 mV. Disturbances are created by using a small fan placed directly across the canister that can switched on or off manually or through a control signal from the microcontroller.

Experimental work

The experimental work for the students is divided into two parts. In the fi rst part, the control system is confi gured as an open-loop system. This part also serves for the students to become familiar with the microcontroller and its environment as well as to establish a baseline on the system that will be controlled by characterizing the system. The second part is focused on studying the different strategies for closed- loop control and learning the benefi ts and drawbacks for each strategy.

Open-loop and system characterization

This fi rst set of experiences is focused on characterizing the open-loop response of the system when the control system is operating in open-loop. These experiences are also aimed towards familiarizing the students with the microcontroller, its soft- ware and the data acquisition and plotting interface. Figure 1 shows a typical tem- perature plot obtained for these initial experiments. In addition to the temperature behavior, the display also shows the status of the heater either on or off. In addition to the graphical information, the display shows the current temperature value (Last Analog Data on the right side of the display), and the Maximum and Minimum temperature values. The time information is presented in arbitrary units that, once the students have accounted for the delays specifi cally introduced by the software,

(4)

can be easily converted to seconds. Students are also given the possibility to save the data to a fi le by checking the box located in the left hand side of the graph.

After successfully completing this part, students are asked to answer several ques- tions regarding the system. The following are examples of the type of work and questions presented to the students:

• Using the graph of temperature, calculate the time constant of this system (Wait until the temperature has stabilized and consider the loop delays).

• After the temperature has reached a stable value, turn the heater off and calculate the time constant of the system as it cools off.

• Compare the two time constants. Comment on your fi ndings.

• Remove the lid of the fi lm canister. Repeat the previous measurements.

• Comment on the differences between the system with and without the lid. Comment on the heat losses in both cases.

The previous experiences have been carried out with the heater being constantly ON. It is also possible instruct to the microcontroller to regulate the amount of current injected into the heating resistor by using a Pulse-Width Modulator (PWM) approach. In the next experiment, students are asked to modify the appropriate

Fig. 1 Display presented to students showing temperature versus time as well as the status of the heater.

(5)

parameter in the microcontroller code to change the duty cycle of the PWM signal from 0% to 100% at 10% intervals. They are also asked to construct a table with the stabilized temperature of the canister with the lid on for each one of the duty cycles being tested. Given that the course is part of an Electrical Engineering Tech- nology program we also ask students to measure the duty cycle directly on the appropriate pin of the microcontroller and compare it to the desired duty cycle.

The last part of this fi rst set of experiences is focused on evaluating the response of the open- loop system to external disturbances. In this case, students are asked to set the duty cycle to achieve a specifi c temperature value. After the system has stabilized, they place the fan two inches away from the canister turning it on. The fan acts like a disturbance by removing heat from the system from which it cannot compensate as shown in Fig. 2. This gives students the opportunity to experience the limitations of open-loop systems.

Strategies for closed-loop control

During the previous experiments, students have experienced the inability of an open- loop control system to compensate for disturbances. Compensation for disturbances requires a closed-loop system that takes into account information about the state of Fig. 2 Students can evaluate the effect of disturbances (electric fan) on the temperature of

the system and extract parametric information.

(6)

the output when generating the command signal. In the following experiments stu- dents are exposed to three different strategies for closed-loop control in increasing complexity. These are:

– Simple ON-OFF control – ON-OFF control with hysteresis

– PID (Proportional-Integral-Derivative) control

Simple ON-OFF control is a straightforward control method. It is based on turning the heater ON or OFF depending on whether the measured variable is above or below a value that is normally called setpoint. First, students are asked to choose a setpoint within the temperature range for the system and program it into the software used for this control approach. In the absence of disturbances they record a graph similar to the one shown in Fig. 3. The temperature plot shows an initial temperature increase due to the heater being on until the system reaches its setpoint. Afterwards, the heater enters a period of rapid fl uctuations between On and Off that is also refl ected in fast temperature changes.

During these measurements, students are asked to answer several questions regarding this control approach. These are:

Explain the behavior of the system with this control approach. Do you see fast changes? What may cause them even in the absence of external perturbations?

Fig. 3 Simple ON – OFF control showing fast cycling in heating element.

(7)

What are the maximum and minimum temperatures for the system after it has reached its setpoint? (Analyze the data fi le collected by the plotting software).

Can you relate the behavior of this control approach to using a simple Op-Amp based comparator?

Explain the advantages and drawbacks of this type of control. When would you use this type of control?

The next step involves the creation of external disturbances by once again placing the fan at a distance of two inches away from the canister and turning it manually.

After repeating the procedure from the previous exercise, students have to respond to the following questions:

Is the system able to reach the desired setpoint while there is a disturbance?

Measure again the maximum and minimum temperatures with the disturbance affecting the system. Compare it to the case without disturbances.

Describe your observations, in particular the ability of this control approach to compensate for disturbances.

After evaluating the performance of the Simple ON-OFF control strategy, students are introduced to the ON-OFF with hysteresis control approach. They choose two setpoints, one above the original setpoint and one below it. The software for this control mode allows the students to change the two setpoints in order to experiment with different values. After experiencing the response of the system with and without external disturbances, students can answer the following questions:

In the absence of disturbances, compare the behavior of the system with and without hysteresis.

Comment on the effect of increasing the distance between the two setpoints. What are the benefi ts and drawbacks of increasing this distance?

Once the system has stabilized, introduce a disturbance using the fan. Keep it for some time and then remove it. Compare the behavior of the system affected by the disturbance with how it was affected without the hysteresis.

What can you tell about an ON-OFF control with hysteresis? When would you use it?

The fi nal control strategy studied in these laboratory experiments is PID control. It is necessary to mention once again that the goal of these activities is not an in-depth study of PID control but rather to give a practical and basic introduction to this control approach. The microcontroller software used for these activities allows stu- dents to change the values of the proportional gain (Kp), integral gain (Ki) and dif- ferential gain (Kd).

First, students are asked to set up the control system keeping the three gains at zero (Kp= Ki= Kd= 0) and observe its response. They should recognize that this is the same as operating in open-loop. The second step involves studying the behavior of the system using only proportional control. Students experiment with several values for Kp while keeping both the integral and derivative gains to zero (Ki= Kd

= 0). Figure 7 shows a temperature plot obtained in these circumstances that is used

(8)

for the students to realize that a proportional-only control strategy needs an error signal in order to achieve the correct temperature. However, the presence of the error signal means a departure from the setpoint, thus giving origin to the oscillations around the setpoint shown in Fig. 4.

The fi nal experiences for proportional-only control involve studying the effects of both long-term and short-term external disturbances. Students need to answer the following questions for this control strategy:

Comment on the temperature graph that you have obtained. Is your system able to reach and maintain its setpoint temperature?

What is the (average) temperature at which your system settles? Explain the oscil- lations that you see in your graph around the setpoint.

Does the system respond differently for short-term and long-term disturbances?

Comment on your fi ndings.

The experiments continue with a short introduction to integral control, especially focused on how this type of control is used to compensate the shortcomings from proportional-only control. For different values of proportional gain (Kp) and integral gain (Ki) while keeping the derivative gain at zero (Kd= 0), students evaluate the response of the system with and without disturbances. In addition to being able to change the values of proportional and integral gains it is possible for the students to experiment with different values for the integration period. They can also experi- ment with the response of the system after the disturbance has been removed by

97

Target: 96 F

96 95 94 93 92 91 90

89

1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 127 133 139 145 151 157 163 169

Fig. 4 Effects of proportional control on the hearing system. Vertical axis is temperature in degrees C; horizontal axis shows time event.

(9)

turning the fan off as shown in Fig. 5. After these experiences students are asked the following questions:

Comment on the temperature plot obtained with this control strategy, especially the differences with previous strategies.

How long does it take for the temperature of your system to reach a value close to the setpoint?

Explain the effect of the integration interval (Ti) on the settling time. What happens if we increase and/or decrease the integration interval?

Relate the temperature overshoot after removing the disturbance with the values of Ki, Kp and Ti.

Do the same for the settling time after removing the disturbance.

The fi nal set of experiences introduces the derivative gain to the previously used proportional and integral gains in order to create the full PID control system. Fol- lowing the approach to studying the response of the system from previous experi- ences, students are now asked to create their own set of experiments to characterize the behavior of the PID control system. They are also asked to develop the appropri- ate methods to characterize the response of the PID control system to long-term and short-term disturbances. Students must also extract meaningful conclusions about this control method as well as its benefi ts and potential drawbacks.

92

90

88

86

84

82

80

78

Temp - remove fan. SP = 86F

Gp = Gi = 0.1

Remove Fan after temp. stable (point 109)

1 12 23 34 45 56 67 78 89 100 111 122 133 144 155 166 177 188 199 210 221 232 243 254 265 276 287 298 309 320 331 342 353

Fig. 5 Effects of proportional-integrative control. Students can evaluate the response of the heating system to a disturbance. In this case, the fan used to remove excess

heat was turned off at data point 109.

(10)

Conclusion

This paper has described a set of laboratory experiences designed to expose students enrolled in a control systems course to different control strategies. We developed these activities for students to interact with a physical system rather than a mathe- matical model. This is achieved, in part, through using a simple microcontroller as the central element in the control system. These activities are also designed so they can be expanded in order to include further data and signal processing, datalogging or similar approaches.

We have run these experimental activities for two semesters. The feedback from students has been very positive, indicating that not only do they like this type of approach but they feel that their understanding of the big picture in control systems has improved. They also value the fact that these experiments include concepts from previous courses such as microcontroller, analog electronics, data processing, etc.

We can state that student response has, in general, been satisfactory. We have measured this by indirect methods such as student surveys as well by direct methods focusing on the specifi c learning outcomes of this course. In particular, the course contains a specifi c learning outcome on students being able to conduct experiments and evaluate their results as applied to control systems. This outcome, in turn, sup- ports the outcome for the academic program that is focused on supporting experi- mental learning. While this paper is not primarily concerned with assessment methods for the course or the program, it is important to note that the introduction of these laboratory experiments has increased student performance in their ability to conduct experiments and interpret their results. We believe that students feel more comfortable with using systems in which they already have experience such as microcontrollers rather than analog feedback loops.

The activities described here are a basic approach to the use of microcontrollers in the control systems laboratory in electrical engineering technology programs. The author hopes that other faculty members teaching similar courses will follow on them and will share their experiences in different forums to build a body of knowl- edge and best practice for these courses.

References

1 I. Levin and D. Mioduser, ‘A multiple-constructs framework for teaching control concepts’, IEEE Trans. Educ., 39(4) (1996), 488–496.

2 A. Leva, ‘A hands-on experimental laboratory for undergraduate courses in automatic control’, IEEE Trans. Educ., 46(2) (2003), 263–272.

3 K. K. Tan and H. Goh, ‘Development of a mobile spreadsheet-based PID control simulation system’, IEEE Trans. Educ., 49(2) (2006), 199–207.

4 A. Lozano-Nieto, ‘Magnetic levitation experiments for a control systems course in an electrical engineering technology program’, The Technology Interface Journal, 10(1) (2009).

5 M. T. Hagan, ‘A microcomputer-controlled experiment: root locus design’, IEEE Trans. Educ., 27(2) (1984), 79–85.

6 A. Kulatunga and R. Muir, ‘Embedded controller development for closed-loop process control learn- ing’, The Technology Interface Journal, 9(2) (2009).

(11)

7 National Semiconductor LM34 Precision Fahrenheit Temperature Sensor. Available at http://www.

national.com/mpf/LM/LM34.html#Overview, last accessed April 2013.

8 National Semiconductor AD0831 8-Bit Serial I/O A/D Converter with Multiplexer Option. Available at http://www.national.com/mpf/DC/ADC0831.html#Overview, last accessed April 2013.

References

Related documents

[Review Domain 1, Element 1E in the Self-Assessment Rubric.] List all agencies, stakeholders, community members, subcontractors and staff that are providing activities or services

Also, the Swedish national board of housing, building and planning (Boverket) will require an assessment of life cycle greenhouse gas emissions in the permit process

This viaduct carries the track over the local JR Tohoku line and consists of four piers. The damaged pier, at the end closest to the Furukawa station, had not yet been

When compared to other Certification Authorities (CA) on the market, DigiCert provides the best value and flexibility with its Secured Socket Layer (SSL), code signing,

Elevens behov knyttet til læringsforhold, og sosial deltakelse med andre elever bør være de to overordnete faktorene avgjør om eleven skal få opplæring på en alternativ arena

During 4 years of study students of the Faculty of International Economic Relations can get two higher professional education degrees – a degree of Financial University and a

Many countries have enacted environmental regulations that require a comprehensive multiple criteria analysis as a part of water resources planning and management. While the flood

LEARN AND DOWNLOAD TO OBTAIN SUPPORT MANUFACTURER ZEN ESTILO SERVICE MANUAL PROVIDE IT WITH ANY SIGNIFICANT INSIGHTS OR TIPS.. Manual De Estilo Apa