基于单片机的温度控制外文文献及中文翻译

时间:2020-04-08 13:20:45 浏览量:

  Temperature Control Using a Microcontroller: An Interdisciplinary Undergraduate Engineering Design Project James S. McDonald Department of Engineering Science Trinity University San Antonio, TX 78212 Abstract:This paper describes an interdisciplinary design project which was done under the author’s supervision by a group of four senior students in the Department of Engineering Science at Trinity University. The objective of the project was to develop a temperature control system for an air-filled chamber. The system was to allow entry of a desired chamber temperature in a prescribed range and to exhibit overshoot and steady-state temperature error of less than 1 degree Kelvin in the actual chamber temperature step response. The details of the design developed by this group of students, based on a Motorola MC68HC05 family microcontroller, are described. The pedagogical value of the problem is also discussed through a description of some of the key steps in the design process. It is shown that the solution requires broad knowledge drawn from several engineering disciplines including electrical, mechanical, and control systems engineering. 1 Introduction The design project which is the subject of this paper originated from a real-world application. A prototype of a microscope slide dryer had been developed around an OmegaTM model CN-390 temperature controller, and the objective was to develop a custom temperature control system to replace the Omega system. The motivation was that a custom controller targeted specifically for the application should be able to achieve the same functionality at a much lower cost, as the Omega system is unnecessarily versatile and equipped to handle a wide variety of applications. The mechanical layout of the slide dryer prototype is shown in Figure 1. The main element of the dryer is a large, insulated, air-filled chamber in which microscope slides, each with a tissue sample encased in paraffin, can be set on caddies. In order that the paraffin maintain the proper consistency, the temperature in the slide chamber must be maintained at a desired (constant) temperature. A second chamber (the electronics enclosure) houses a resistive heater and the temperature controller, and a fan mounted on the end of the dryer blows air across the heater, carrying heat into the slide chamber. This design project was carried out during academic year 1996–97 by four students under the author’s supervision as a Senior Design project in the Department of Engineering Science at Trinity University. The purpose of this paper is

  to describe the problem and the students’ solution in some detail, and to discuss some of the pedagogical opportunities offered by an interdisciplinary design project of this type. The students’ own report was presented at the 1997 National Conference on Undergraduate Research [1]. Section 2 gives a more detailed statement of the problem, including performance specifications, and Section 3 describes the students’ design. Section 4 makes up the bulk of the paper, and discusses in some detail several aspects of the design process which offer unique pedagogical opportunities. Finally, Section 5 offers some conclusions. 2 Problem Statement The basic idea of the project is to replace the relevant parts of the functionality of an Omega CN-390 temperature controller using a custom-designed system. The application dictates that temperature settings are usually kept constant for long periods of time, but it’s nonetheless important that step changes be tracked in a “reasonable” manner. Thus the main requirements boil down to ·allowing a chamber temperature set-point to be entered, ·displaying both set-point and actual temperatures, and ·tracking step changes in set-point temperature with acceptable rise time, steady-state error, and overshoot.

  Although not explicitly a part of the specifications in Table 1, it was clear that the customer desired digital displays of set-point and actual temperatures, and that set-point temperature entry should be digital as well (as opposed to, say, through a potentiometer setting). 3 System Design The requirements for digital temperature displays and setpoint entry alone are enough to dictate that a microcontrollerbased design is likely the most appropriate. Figure 2 shows a block diagram of the students’ design.

 The microcontroller, a MotorolaMC68HC705B16 (6805 for short), is the heart of the system. It accepts inputs from a simple four-key keypad which allow specification of the set-point temperature, and it displays both set-point and measured chamber temperatures using two-digit seven-segment LED displays controlled by a display driver. All these inputs and outputs are accommodated by parallel ports on the 6805. Chamber temperature is sensed using a pre-calibrated thermistor and input via one of the 6805’s analog-to-digital inputs. Finally, a pulse-width modulation (PWM) output on the 6805 is used to drive a relay which switches line power to the resistive heater off and on. Figure 3 shows a more detailed schematic of the electronics and their interfacing to the 6805. The keypad, a Storm 3K041103, has four keys which are interfaced to pins PA0{ PA3 of Port A, configured as inputs. One key functions as a mode switch. Two modes are supported: set mode and run mode. In set mode two of the other keys are used to specify the set-point temperature: one increments it and one decrements. The fourth key is unused at present. The LED displays are driven by a Harris Semiconductor ICM7212 display driver interfaced to pins PB0{PB6 of Port B, configured as outputs. The temperature-sensing thermistor drives, through a voltage divider, pin AN0 (one of eight analog inputs). Finally, pin PLMA (one of two PWM outputs) drives the heater relay.

  Software on the 6805 implements the temperature control algorithm, maintains the temperature displays, and alters the set-point in response to keypad inputs. Because it is not complete at this writing, software will not be discussed in detail in this paper. The control algorithm in particular has not been determined, but it is likely to be a simple proportional controller and certainly not more complex than a PID. Some control design issues will be discussed in Section 4, however. 4 The Design Process Although essentially the project is just to build a thermostat, it presents many nice pedagogical opportunities. The knowledge and experience base of a senior engineering undergraduate are just enough to bring him or her to the brink of a solution to various aspects of the problem. Yet, in each case, realworld considerations complicate the situation significantly. Fortunately these complications are not insurmountable, and the result is a very beneficial design experience. The remainder of this section looks at a few aspects of the problem which present the type of learning opportunity just described. Section 4.1 discusses some of the features of a simplified mathematical model of the thermal properties of the system and how it can be easily validated experimentally. Section 4.2 describes how realistic control algorithm designs can be arrived at using introductory concepts in control design. Section 4.3 points out some important deficiencies of such a simplified modeling/control design process and how they can be overcome through simulation. Finally, Section 4.4 gives an overview of some of the microcontroller-related design issues which arise and learning opportunities offered. 4.1 MathematicalModel Lumped-element thermal systems are described in almost any introductory linear control systems text, and just this sort of model is applicable to the slide dryer problem. Figure 4 shows a second-order lumped-element thermal model of the slide dryer. The state variables are the temperatures Ta of the air in the box and Tb of the box itself. The inputs to the system are the power output q(t) of the heater and the ambient temperature T¥. ma and mb are the masses of the air and the box, respectively, and Ca and Cb their specific heats. μ1 and μ2 are heat transfer coefficients from the air to the box and from the box to the external world, respectively.

  It’s not hard to show that the (linearized) state equationscorresponding to Figure 4 are

 Taking Laplace transforms of (1) and (2) and solving for Ta(s), which is the output of interest, gives the following open-loop model of the thermal system:

 where K is a constant and D(s) is a second-order polynomial.K, tz, and the coefficients of D(s) are functions of the variousparameters appearing in (1) and (2).Of course the various parameters in (1) and (2) are completely unknown, but it’s not hard to show that, regardless of their values, D(s) has two real zeros. Therefore the main transfer function of interest (which is the one from Q(s), since we’ll assume constant ambient temperature) can be written

 Moreover, it’s not too hard to show that 1=tp1 <1=tz <1=tp2, i.e., that the zero lies between the two poles. Both of these are excellent exercises for the student, and the result is the openloop pole-zero diagram of Figure 5.

  Obtaining a complete thermal model, then, is reduced to identifying the constant K and the three unknown time constants in (3). Four unknown parameters is quite a few, but simple experiments show that 1=tp1 _ 1=tz;1=tp2 so that tz;tp2 _ 0 are good approximations. Thus the open-loop system is essentially first-order and can therefore be written

  (where the subscript p1 has been dropped). Simple open-loop step response experiments show that,for a wide range of initial temperatures and heat inputs, K _0:14 _=W and t _ 295 s.1 4.2 Control System Design Using the first-order model of (4) for the open-loop transfer function Gaq(s) and assuming for the moment that linear control of the heater power output q(t) is possible, the block diagram of Figure 6 represents the closed-loop system. Td(s) is the desired, or set-point, temperature,C(s) is the compensator transfer function, and Q(s) is the heater output in watts.

  Given this simple situation, introductory linear control design tools such as the root locus method can be used to arrive at a C(s) which meets the step response requirements on rise time, steady-state error, and overshoot specified in Table 1. The upshot, of course, is that a proportional controller with sufficient gain can meet all specifications. Overshoot is impossible, and increasing gains decreases both steady-state error and rise time. Unfortunately, sufficient gain to meet the specifications may require larger heat outputs than the heater is capable of producing. This was indeed the case for this system, and the result is that the rise time specification cannot be met. It is quite revealing to the student how useful such an oversimplified model, carefully arrived at, can be in determining overall performance limitations. 4.3 Simulation Model Gross performance and its limitations can be determined using the simplified model of Figure 6, but there are a number of other aspects of the closed-loop system whose effects on performance are not so simply modeled. Chief among these are ·quantization error in analog-to-digital conversion of the measured temperature and · the use of PWM to control the heater. Both of these are nonlinear and time-varying effects, and the only practical way to study them is through simulation (or experiment, of course). Figure 7 shows a SimulinkTM block diagram of the closed-loop system which incorporates these effects. A/D converter quantization and saturation are modeled using standard Simulink quantizer and saturation blocks. Modeling PWM is more complicated and requires a custom S-function to represent it.

  This simulation model has proven particularly useful in gauging the effects of varying the basic PWM parameters and hence selecting them appropriately. (I.e., the longer the period, the larger the temperature error PWM introduces. On the other hand, a long period is desirable to avoid excessive relay “chatter,” among other things.) PWM is often difficult for students to grasp, and the simulation model allows an exploration of its operation and effects which is quite revealing. 4.4 The Microcontroller Simple closed-loop control, keypad reading, and display control are some of the classic applications of microcontrollers, and this project incorporates all three. It is therefore an excellent all-around exercise in microcontroller applications. In addition, because the project is to produce an actual packaged prototype, it won’t do to use a simple evaluation board with the I/O pins jumpered to the target system. Instead, it’s necessary to develop a complete embedded application. This entails the choice of an appropriate part from the broad range offered in a typical microcontroller family and learning to use a fairly sophisticated development environment. Finally, a custom printed-circuit board for the microcontroller and peripherals must be designed and fabricated. Microcontroller Selection. In view of existing local expertise, the Motorola line of microcontrollers was chosen for this project. Still, this does not narrow the choice down much. A fairly disciplined study of system requirements is necessary to specify which microcontroller, out of scores of variants, is required for the job. This is difficult for students, as they generally lack the experience and intuition needed as well as the perseverance to wade through manufacturers’ selection guides. Part of the problem is in choosing methods for interfacing the various peripherals (e.g., what kind of display driver should be used?). A study of relevant Motorola application notes [2, 3, 4] proved very helpful in understandingwhat basic approaches are available, and what microcontroller/peripheral combinations should be considered. The MC68HC705B16 was finally chosen on the basis of its availableA/D inputs and PWMoutputs as well as 24 digital I/O lines. In retrospect this is probably overkill, as only one A/D channel, one PWM channel, and 11 I/O pins are actually required (see Figure 3). The decision was made to err on the safe side because a complete development system specific to the chosen part was necessary, and the project budget did not permit a second such system to be purchased should the first prove inadequate. Microcontroller Application Development. Breadboarding of the peripheral hardware, development of microcontroller software, and final debugging and testing of a custom printed-circuit board for the microcontroller and peripherals all require a development environment of some kind. The choice of a development environment, like that of the microcontroller itself, can be bewildering and requires some faculty expertise. Motorola makes three grades of development environment ranging from simple evaluation boards (at around $100) to full-blown real-time in-circuit emulators (at more like $7500). The middle option was chosen for this project: the MMEVS, which consists of _ a platform board (which supports all 6805-family parts), _ an emulator module (specific to B-series parts), and _ a cable and target head adapter (package-specific). Overall, the system costs about $900 and provides, with some limitations, in-circuit emulation capability. It also comes with the simple but sufficient software development environment RAPID [5]. Students find learning to use this type of system challenging, but the experience they gain in real-world microcontroller application development greatly exceeds the typical first-course experience using simple evaluation boards. Printed-Circuit Board. The layout of a simple (though definitely not trivial) printed-circuit board is another practical learning opportunity presented by this project. The final board layout, with package outlines, is shown (at 50% of actual size) in Figure 8. The relative simplicity of the circuit makes manual placement and routing practical—in fact, it likely gives better results than automatic in an application like this—and the student is therefore exposed to fundamental issues of printed-circuit layout and basic design rules. The layout software used was the very nice package pcb,2 and the board was fabricated in-house with the aid of our staff electronics technician.

 中文翻译:

 单片机温度控制: 一个跨学科的本科生工程设计项目 JamesS.McDonald 工程科学系三一大学德克萨斯州 圣安东尼奥市78212 摘要:本文所描述的是作者领导由四个三一大学高年级学生组成的团队进行的一个跨学科工程项目的设计。该项目的目标是设计一个气室内温度控制系统。该系统的要求是:当实际气室的温度阶跃响应时,规定范围内的温度进入气室后,稳定时的温度误差和超调量必须少于一个绝对温度。本组学生开发设计是基于摩托罗拉MC68HC05系列单片机。该问题的教学价值也通过某些步骤的关键描述在本文说明。研究结果表明,解决该方案需要具有广泛的工程学科知识,包括相关电子、机械和控制系统工程的知识。 1 引言 该设计项目来自一个实际应用问题,一个关于显微镜载玻片干燥剂温控器——欧米茄CN-390温度控制器,而这个设计的目标是研发一个自定义的通用温度控制系统取代欧米茄系统、一个以更低的成本实现相同功能的自定义控制器,就像欧米茄系统一样,并不需要能够全方位的处理各种问题。 该载玻片干燥机的机械布局如图1所示。干燥机的主体是一个足够大的绝缘充气室,里面依次存放着薄纸包着的石蜡。为了使石蜡保持适当稳定性,载玻片气室的温度必须维持稳定。第二个气筒(电子围绕元件)设有一个电阻加热器、一个温度控制器以及一个安装在干燥机上的风扇,是为了把风吹过加热器,把热量带到载玻片气室。

 图1-1 载玻片干燥机的机械布局

  自1996-97学年来,本文作者带领四位三一大学工程科学系的高年级学生开展此项目的研究。本文的目的说明了提出一些问题并详细阐述学生的一些解决方案,而且讨论了这种类型的跨学科设计项目在教学方面应用的问题。这份学生报告曾经在1997年全国本科毕业生研讨会上提出过并讨论过。第2节给出该设计的更多详细情况,包括性能规格。第3节具体 学生的设计。第4节是论文的主体,讨论该设计在教学应用方面的实施问题。最后,第5节全文总结。 2 问题阐述 该项目基本的思想是设计一个自定义温度控制系统来取代相关的欧米茄CN-390温度控制器。温度时通常保持在一个稳定的常数,但重要的是阶跃变化可以被“合理”的跟踪。因此主要要求如下: ·可以对空气室的温度进行设定, ·同时显示设定值和实际温度, ·以及在设定温度值情况下,可接受范围内的跟踪阶跃变化,稳态误差,超调量。 设定温度接口

 设定温度显示

 室内温度显示

 范围 精度 准确度 60-99 1°C ±1°C 室内温度阶梯响应

 范围(稳定状态) 精度(稳定状态) 最大超调 设定时间(到±1°) 60-99 ±1°C

 1°C 120s 表1

 精确的规格说明

 尽管表1部分说明并不明确,但是它清楚的反映了人们对数字显示器在设定值和实际温度的要求和温度应该通过数值输入来设定(而不是,通过电位器设置)。 3.系统设计 根据微控设计,数字温度显示和单点输入的要求可能是最合适的。图2为学生的设计框图。

 图2-2 温度控制器硬件结构图

 摩托罗拉MC68HC705B16(简称6805),是系统的核心。它通过一个简单的4键小键盘对温度进行设定,同时使用两个显示驱动控制7段LED数码管来显示定值和气室温度的测量值。所有这些,输入和输出信号与6805的并行口相连。气室的温度值使用预校准热敏电阻测量,并通过6805的数模转换输入。最后,6085的脉冲宽度调制(PWM)输出用来驱动一个继电器,以控制线性电阻加热器的闭合和断开。 图3更详细的显示了6805的接口和电子器件。使用暴风3K041103型号四键键盘,通过PA0-PA3端口进行数据输入。其中一个重要的功能是进行模式切换。两种模式:固定模式和运行模式。在固定模式下,其他两个键用于设定温度,一个增加,一个减少,第四个按键暂无作用。LED显示屏由哈里斯半导体ICM7212进行驱动,通过PB0-PB6端口与芯片相连,作为输出。热敏电阻由电压分频器驱动,通过AN0针脚(八个模拟输入端口中的一个)相连。最后,PLMA针脚(两个PWM输出端口中的一个)驱动加热继电器。

 图2-3

 单片机原理图

 图3单片机原理图是关于用软件实现温度控制算法、保持温度显示以及改变键盘输入响应,这将不会在本文详细讨论,因为这并不是本文的重点,也没有编译完成。软件部分还没有确定控制算法,但很可能是一个简单的比例控制,比PID算法简单。一些控制设计的问题将在第四节讨论。 4 设计过程 虽然该项目的本质是建立一个恒温器,但它有许多很好的契机可以供教学借鉴。高级工程本科教育的知识只是能够让学生们具有解决问题的能力。然而,很多情况下,实际情况却和理论有些不同。不过,这些不是问题,参与这个项目的设计,将获得很多设计方面的宝贵经验。本节的其余部分着眼于其他的几个方面:4.1节讨论系统的一些特征,简化系统热性能的数学模型,以及一些简单理论的证明。4.2节介绍确定实际控制算法。4.3节指出控制设计程序的一些不足,并通过模拟环境,指出怎样克服问题。4.4节给出单片机的一些设计相关概述,以及出现问题和值得借鉴之处。 4.1数学模型 集总元件热系统符合线性控制,适用于载玻片干燥机的问题。图4显示了二阶集总元件热量模型的载玻片干燥机。状态变量是温度,Ta是箱内空气的温度,Tb是箱子本身的温度。该系统输入功率等于q(t)的热量和环境温度T的和。ma,mb分别对应空气和箱子的质量。 Ca和Cb则分别是其对应热量。m1和m2分别是空气与箱子间以及箱子与外界间的传热系数。

 图4-1 集总元件热模型

 由图4可以推出(线性)状态方程

 拉普拉斯变换(1)和(2)等式,并整理Ta(s)。有趣的是,可以推出一个开环的热系统方程。

 其中K是一个常数,D(s)是一个二阶的多项式。K,tz,以及系数D(s)和在(1)和(2)等式中出现的系数功能相近。当然,在(1)和(2)等式中各种参数在未知的情况下,不难证明D(s)与其他参数的值无关,具有两个零点。因此传递函数可以写成(我们假设环境温度为常数)

 此外,可以推出1/tp1<1/tz<1/tp2,即,零点在两极之间。开环零极点如图5所示。

 图4-2 Gaq(s)的零极点

 为了获取完整的热模型,从(3)式中除去常数K和3个未知的时间常数。四个未知参数并不少,但由简单的实验表明,1/tp1<<1/tz,1/tp2统基本上是一阶函数,且tz,tp2近似为0。因此,开环系可以写成:

 (下标p1已经被去掉了) 过初始温度和热量值大范围内的设置,简单的开环阶跃响应实验结果表明,K≈0.14o/W,τ≈295S。 4.2

 控制系统设计 使用(4)式的一阶开环传递函数Gaq(s),并且假定加热器的输出函数q(t)为线性,图6是系统框图代表闭环系统。Td(s)是设定温度的函数,C(s)是传递函数,Q(s)是热量输出,单位是瓦特。 图6简化的闭环系统框图鉴于这种简单情况,前面所指的线性控制设置,例如,根轨迹法设计法可以使C(s)中符合要求的阶跃响应对应的上升时间、稳态误差和超调量符合表格1所示。当然,一个有足够增益的比例控制器就可以满足各种要求。超调量改变是不可能既增加增益又减少稳态误差和上升时间的。不幸的是,如果要获得足够增益,需要生产超过实际生产能力的大容量加热器。这是本系统的实际问题,将会致使上升时间不符合要求。这要求学生们如何利用这个经过仔细计算的简化模型,在整体性能上达到最佳控制。 4.3 模型仿真 该设计的大部分性能和限制功能,应该可以使用图6简化模型来完成。但有一个数据对闭环系统其他方面的影响并非能够如此简单的仿真。其中最主要的是: ·量化误差的模拟和数模转换, ·测量温度和使用PWM控制加热器。 这两种都是非线性的、时变的。所以唯一切实可行的方法就是通过仿真(或实验)加以研究。 图7Simulink仿真闭环系统框图显示了Simulink情况下的闭环系统框图,其中包括A/D转换和使用标准Simulink量化饱和块建立的饱和量化模型。建立PWM调制模型比较复杂,需要一个自定义的S函数来表示。

 图4-3

 仿真闭环系统框图

 这种仿真模型已经被证明在衡量不同的PWM基本参数对设计的影响以及适当参数的选择中特别有用。(即时间越长,PWM调制会产生更多温度误差。另一方面,时间越长,继电器抖动机率越小。)PWM调制方法往往很难让学生掌握,并且仿真模型允许研究测试运行和明显的影响。 4.4单片机 简单的闭环控制、键盘输入和显示控制是经典单片机应用技术,这个设计项目包含上述三个方面。因此这是一个优秀的全面的单片机应用练习。 此外,由于该项目是来源于现实,它不会是一个简单的输入输出设计就能完成的。相反,这个项目需要制定一个完整的嵌入式应用。这需要从大量的单片机型号中选取适当的芯片并学着使用一个相当复杂的开发环境。最后,必须设计和选取印刷电路板和单片机,以及外接元件。 4.4.1单片机选择 从现有的实际经验来看,经常选用摩托罗拉公司的单片机。不过,芯片的选择不应该局限于此。研究表明,系统要求符合工作需求的单片机。这对学生很困难,因为他们缺乏良好的经验与判断能力,只能通过制造商的产品选择指南决定单片机的选择。部分问题是各种外围设备(例如,应该使用哪种显示驱动程序?)连接方法的选择。摩托罗拉的相关应用研究[2,3,4]中的证明是非常有用的,基本阐述了可实用性的连接方法以及单片机和外围连接的组合方式。在最终要求的基础上,选择MC68HC705B16,其现有A/D输入和PWM输出以及24个数字I/O线。这样选择是有必要的,因为此项目需要一个A/D通道、一个PWM通道和11个I/O引脚(见图3)。该决定为了安全方面,因为选择一个完整的开发系统是有必要的,该项目预算中没有足够的资金再次购买元件。 4.4.2单片机应用开发 外围设备的电路硬件、软件的开发、最终调试、单片机的自定的印刷电路板和外设都需要某种形式的发展环境。 如同单片机本身,一个开发环境的选择是令人困惑并需要一些教师的专业知识。摩托罗拉三级发展环境,包括从简单的评估板(在约100美元)到全面的实时在线仿真器(在大约7500元)。中间选项被选为本项目的MMEVS,其中包括:

 ·平台板(支持所有6805-family部分), · 模拟器模块(具体到B系列部分),和 · 电缆头和目标适配器(简明包装)。 总体而言,该系统的成本为900美元,并且在一定局限下,提供了在线仿真能力。它还配备了简单但足够的软件开发环境RAPID[5]。 学生发现学习使用这类系统的挑战。但他们在现实世界的微控制器应用获得的经验大大超过了第一使用典型的简单评估板的经验。 4.4.3印刷电路板 一个简单的(虽然布局绝对不平凡)印刷电路板是这个工程提供的另一个现实学习的机会。图8显示最后的板布局与包轮廓(50%实际大小)。相对简单的电路使手工安置和路由实践方面更实际,它有可能提供更好的结果比一个这样的应用程的自动性。学生因此接触到基本印刷电路布局问题和基本的设计规则。本排版软件使用的是非常漂亮的包装印刷电路板,板制作是在内部电子技术员的帮助下完成的。

 图4-4

 单片机印刷版布局

推荐访问:外文 单片机 文献

《基于单片机的温度控制外文文献及中文翻译.doc》
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:

文档为doc格式

一键复制全文 下载 投诉