基于单片机的温度控制系统(英语)_第1页
基于单片机的温度控制系统(英语)_第2页
基于单片机的温度控制系统(英语)_第3页
基于单片机的温度控制系统(英语)_第4页
基于单片机的温度控制系统(英语)_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

TemperatureControlUsingaMicrocontroller:

AnInterdisciplinaryUndergraduateEngineeringDesignProject

JamesS.McDonald

DepartmentofEngineeringScience

TrinityUniversity

SanAntonio,TX78212

Abstract

Thispaperdescribesaninterdisciplinarydesignprojectwhichwasdoneundertheauthor’ssupervisionbyagroupoffourseniorstudentsintheDepartmentofEngineeringScienceatTrinityUniversity.Theobjectiveoftheprojectwastodevelopatemperaturecontrolsystemforanair-filledchamber.Thesystemwastoallowentryofadesiredchambertemperatureinaprescribedrangeandtoexhibitovershootandsteady-statetemperatureerroroflessthan1degreeKelvinintheactualchambertemperaturestepresponse.Thedetailsofthedesigndevelopedbythisgroupofstudents,basedonaMotorolaMC68HC05familymicrocontroller,aredescribed.Thepedagogicalvalueoftheproblemisalsodiscussedthroughadescriptionofsomeofthekeystepsinthedesignprocess.Itisshownthatthesolutionrequiresbroadknowledgedrawnfromseveralengineeringdisciplinesincludingelectrical,mechanical,andcontrolsystemsengineering.

Introduction

Thedesignprojectwhichisthesubjectofthispaperoriginatedfromareal-worldapplication.AprototypeofamicroscopeslidedryerhadbeendevelopedaroundanOmegaTMmodelCN-390temperaturecontroller,andtheobjectivewastodevelopacustomtemperaturecontrolsystemtoreplacetheOmegasystem.Themotivationwasthatacustomcontrollertargetedspecificallyfortheapplicationshouldbeabletoachievethesamefunctionalityatamuchlowercost,astheOmegasystemisunnecessarilyversatileandequippedtohandleawidevarietyofapplications.

ThemechanicallayoutoftheslidedryerprototypeisshowninFigure1.Themainelementofthedryerisalarge,insulated,air-filledchamberinwhichmicroscopeslides,eachwithatissuesampleencasedinparaffin,canbesetoncaddies.Inorderthattheparaffinmaintaintheproperconsistency,thetemperatureintheslidechambermustbemaintainedatadesired(constant)temperature.Asecondchamber(theelectronicsenclosure)housesaresistiveheaterandthetemperaturecontroller,andafanmountedontheendofthedryerblowsairacrosstheheater,carryingheatintotheslidechamber.Thisdesignprojectwascarriedoutduringacademicyear1996-97byfourstudentsundertheauthor’ssupervisionasaSeniorDesignprojectinthe

DepartmentofEngineeringScienceatTrinityUniversity.Thepurposeofthispaperis

10.25"TopView

Electronicsenclosure( Tempe工苜tuiuizontfuLlut

FigureLSlided/yerwechantcallayoui

todescribetheproblemandthestudents’solutioninsomedetail,andtodiscusssome

ofthepedagogicalopportunitiesofferedbyaninterdisciplinarydesignprojectofthistype.Thestudents’ownreportwaspresentedatthe1997NationalConferenceonUndergraduateResearch[1].Section2givesamoredetailedstatementoftheproblem,includingperformancespecifications,andSection3describesthestudents’design.Section4makesupthebulkofthepaper,anddiscussesinsomedetailseveralaspectsofthedesignprocesswhichofferuniquepedagogicalopportunities.Finally,Section5offerssomeconclusions.

ProblemStatement

ThebasicideaoftheprojectistoreplacetherelevantpartsofthefunctionalityofanOmegaCN-390temperaturecontrollerusingacustom-designedsystem.Theapplicationdictatesthattemperaturesettingsareusuallykeptconstantforlongperiodsoftime,butit’snonethelessimportantthatstepchangesbetrackedina“reasonable”manner.Thusthemainrequirementsboildownto

allowingachambertemperatureset-pointtobeentered,

displayingbothset-pointandactualtemperatures,and

•trackingstepchangesinset-pointtemperaturewithacceptablerisetime,steady-stateerror,andovershoot.

Table1.TemperatureconWollerspecifications

Set-pointtemperatureentiy

Range

Precision

60-99°C

1nC

Set-pointtemperaturedisplay

RangePrecision

60-99°C

1℃

ChambeiLtemperaturedisplay

RangePrecisionAccuracy

60-99°C

1℃±1℃

Chambertemperaturestepresponse

Range(steadystate)Accuracy(steadystate)MaximuinovershootSettlingtime(to±LC)

60-99°C士1℃

1℃

120s

AlthoughnotexplicitlyapartofthespecificationsinTable1,itwasclearthatthecustomerdesireddigitaldisplaysofset-pointandactualtemperatures,andthatset-pointtemperatureentryshouldbedigitalaswell(asopposedto,say,throughapotentiometersetting).

SystemDesign

Therequirementsfordigitaltemperaturedisplaysandsetpointentryaloneareenoughtodictatethatamicrocontrollerbaseddesignislikelythemostappropriate.Figure2showsablockdiagramofthestudents’design.

Themicrocontroller,aMotorolaMC68HC705B16(6805forshort),istheheartofthesystem.Itacceptsinputsfromasimplefour-keykeypadwhichallowspecificationoftheset-pointtemperature,anditdisplaysbothset-pointandmeasuredchamber

temperaturesusingtwo-digitseven-segmentLEDdisplayscontrolledbyadisplaydriver.Alltheseinputsandoutputsareaccommodatedbyparallelportsonthe6805.Chambertemperatureissensedusingapre-calibratedthermistorandinputviaoneofthe6805’sanalog-to-digitalinputs.Finally,apulse-widthmodulation(PWM)outputonthe6805isusedtodrivearelaywhichswitcheslinepowertotheresistiveheateroffandon.

Figure3showsamoredetailedschematicoftheelectronicsandtheirinterfacingtothe6805.Thekeypad,aStorm3K041103,hasfourkeyswhichareinterfacedtopinsPA0{PA3ofPortA,configuredasinputs.Onekeyfunctionsasamodeswitch.Twomodesaresupported:setmodeandrunmode.Insetmodetwooftheotherkeysareusedtospecifytheset-pointtemperature:oneincrementsitandonedecrements.Thefourthkeyisunusedatpresent.TheLEDdisplaysaredrivenbyaHarrisSemiconductorICM7212displaydriverinterfacedtopinsPB0{PB6ofPortB,configuredasoutputs.Thetemperature-sensingthermistordrives,throughavoltagedivider,pinAN0(oneofeightanaloginputs).Finally,pinPLMA(oneoftwoPWMoutputs)drivestheheaterrelay.

Figure3.Schematicof basrd

Softwareonthe6805implementsthetemperaturecontrolalgorithm,maintains

WV

Heater

12TABcDAE

thetemperaturedisplays,andalterstheset-pointinresponsetokeypadinputs.

Becauseitisnotcompleteatthiswriting,softwarewillnotbediscussedindetailinthispaper.Thecontrolalgorithminparticularhasnotbeendetermined,butitislikelytobeasimpleproportionalcontrollerandcertainlynotmorecomplexthanaPID.SomecontroldesignissueswillbediscussedinSection4,however.

TheDesignProcess

Althoughessentiallytheprojectisjusttobuildathermostat,itpresentsmanynicepedagogicalopportunities.Theknowledgeandexperiencebaseofaseniorengineeringundergraduatearejustenoughtobringhimorhertothebrinkofasolutiontovariousaspectsoftheproblem.Yet,ineachcase,realworldconsiderationscomplicatethesituationsignificantly.

Fortunatelythesecomplicationsarenotinsurmountable,andtheresultisaverybeneficialdesignexperience.Theremainderofthissectionlooksatafewaspectsoftheproblemwhichpresentthetypeoflearningopportunityjustdescribed.Section4.1discussessomeofthefeaturesofasimplifiedmathematicalmodelofthethermalpropertiesofthesystemandhowitcanbeeasilyvalidatedexperimentally.Section4.2describeshowrealisticcontrolalgorithmdesignscanbearrivedatusingintroductoryconceptsincontroldesign.Section4.3pointsoutsomeimportantdeficienciesofsuchasimplifiedmodeling/controldesignprocessandhowtheycanbeovercomethroughsimulation.Finally,Section4.4givesanoverviewofsomeofthemicrocontroller-relateddesignissueswhichariseandlearningopportunitiesoffered.

MathematicalModel

Lumped-elementthermalsystemsaredescribedinalmostanyintroductorylinearcontrolsystemstext,andjustthissortofmodelisapplicabletotheslidedryerproblem.Figure4showsasecond-orderlumped-elementthermalmodeloftheslidedryer.ThestatevariablesarethetemperaturesTaoftheairintheboxandTboftheboxitself.Theinputstothesystemarethepoweroutputq(t)oftheheaterandtheambienttemperatureT¥.maandmbarethemassesoftheairandthebox,respectively,andCaandCbtheirspecificheats.四1and四2areheattransfercoefficientsfromtheairtotheboxandfromtheboxtotheexternalworld,respectively.

Figure4.Lmiped-elemeiilthermalmodel

It’snothardtoshowthatthe(linearized)stateequationscorrespondingtoFigure

4are

(〃-㈤

-m~乙j

TakingLaplacetransformsof(1)and(2)andsolvingforTa(s),whichistheoutputofinterest,givesthefollowingopen-loopmodelofthethermalsystem:

whereKisaconstantandD(s)isasecond-orderpolynomial.K,tz,andthecoefficientsofD(s)arefunctionsofthevariousparametersappearingin(1)and(2).Ofcoursethevariousparametersin(1)and(2)arecompletelyunknown,butit’snothardtoshowthat,regardlessoftheirvalues,D(s)hastworealzeros.Thereforethemaintransferfunctionofinterest(whichistheonefromQ(s),sincewe’llassumeconstantambienttemperature)canbewritten

Moreover,it’snottoohardtoshowthat1=tp1<1=tz<1=tp2,i.e.,thatthezeroliesbetweenthetwopoles.Bothoftheseareexcellentexercisesforthestudent,andtheresultistheopenlooppole-zerodiagramofFigure5.

FigurexPole-zerodiagramofGaq(s)

Obtainingacompletethermalmodel,then,isreducedtoidentifyingtheconstantKandthethreeunknowntimeconstantsin(3).Fourunknownparametersisquiteafew,butsimpleexperimentsshowthat1=tp1_1=tz;1=tp2sothattz;tp2_0aregoodapproximations.Thustheopen-loopsystemisessentiallyfirst-orderandcanthereforebewritten

G/s)=含 ⑷

(wherethesubscriptp1hasbeendropped).

Simpleopen-loopstepresponseexperimentsshowthat,forawiderangeofinitialtemperaturesandheatinputs,K_0:14_=Wandt_295s.1

ControlSystemDesign

Usingthefirst-ordermodelof(4)fortheopen-looptransferfunctionGaq(s)andassumingforthemomentthatlinearcontroloftheheaterpoweroutputq(t)ispossible,theblockdiagramofFigure6representstheclosed-loopsystem.Td(s)isthedesired,orset-point,temperature,C(s)isthecompensatortransferfunction,andQ(s)isthe

heateroutputinwatts.

Figure6.Simplifiedblockdiagrctntoftheclosed-loopsystem

Giventhissimplesituation,introductorylinearcontroldesigntoolssuchastherootlocusmethodcanbeusedtoarriveataC(s)whichmeetsthestepresponserequirementsonrisetime,steady-stateerror,andovershootspecifiedinTable1.Theupshot,ofcourse,isthataproportionalcontrollerwithsufficientgaincanmeetallspecifications.Overshootisimpossible,andincreasinggainsdecreasesbothsteady-stateerrorandrisetime.

Unfortunately,sufficientgaintomeetthespecificationsmayrequirelargerheatoutputsthantheheateriscapableofproducing.Thiswasindeedthecaseforthissystem,andtheresultisthattherisetimespecificationcannotbemet.Itisquiterevealingtothestudenthowusefulsuchanoversimplifiedmodel,carefullyarrivedat,canbeindeterminingoverallperformancelimitations.

SimulationModel

GrossperformanceanditslimitationscanbedeterminedusingthesimplifiedmodelofFigure6,butthereareanumberofotheraspectsoftheclosed-loopsystemwhoseeffectsonperformancearenotsosimplymodeled.Chiefamongtheseare

quantizationerrorinanalog-to-digitalconversionofthemeasuredtemperatureand

theuseofPWMtocontroltheheater.

Bothofthesearenonlinearandtime-varyingeffects,andtheonlypracticalwaytostudythemisthroughsimulation(orexperiment,ofcourse).

Figure7showsaSimulinkTMblockdiagramoftheclosed-loopsystemwhichincorporatestheseeffects.A/DconverterquantizationandsaturationaremodeledusingstandardSimulinkquantizerandsaturationblocks.ModelingPWMismorecomplicatedandrequiresacustomS-functiontorepresentit.

Figure7,SiumUnkblockdiagramofclosed-loopsystem

ThissimulationmodelhasprovenparticularlyusefulingaugingtheeffectsofvaryingthebasicPWMparametersandhenceselectingthemappropriately.(I.e.,thelongertheperiod,thelargerthetemperatureerrorPWMintroduces.Ontheotherhand,alongperiodisdesirabletoavoidexcessiverelay“chatter,”amongotherthings.)PWMisoftendifficultforstudentstograsp,andthesimulationmodelallowsanexplorationofitsoperationandeffectswhichisquiterevealing.

TheMicrocontroller

Simpleclosed-loopcontrol,keypadreading,anddisplaycontrolaresomeoftheclassicapplicationsofmicrocontrollers,andthisprojectincorporatesallthree.Itisthereforeanexcellentall-aroundexerciseinmicrocontrollerapplications.Inaddition,becausetheprojectistoproduceanactualpackagedprototype,itwon’tdotouseasimpleevaluationboardwiththeI/Opinsjumperedtothetargetsystem.Instead,it’snecessarytodevelopacompleteembeddedapplication.Thisentailsthechoiceofanappropriatepartfromthebroadrangeofferedinatypicalmicrocontrollerfamilyandlearningtouseafairlysophisticateddevelopmentenvironment.Finally,acustomprinted-circuitboardforthemicrocontrollerandperipheralsmustbedesignedandfabricated.

MicrocontrollerSelection.Inviewofexistinglocalexpertise,theMotorolalineofmicrocontrollerswaschosenforthisproject.Still,thisdoesnotnarrowthechoicedownmuch.Afairlydisciplinedstudyofsystemrequirementsisnecessarytospecifywhichmicrocontroller,outofscoresofvariants,isrequiredforthejob.Thisisdifficultforstudents,astheygenerallylacktheexperienceandintuitionneededaswellastheperseverancetowadethroughmanufacturers’selectionguides.

Partoftheproblemisinchoosingmethodsforinterfacingthevariousperipherals(e.g.,whatkindofdisplaydrivershouldbeused?).AstudyofrelevantMotorolaapplicationnotes[2,3,4]provedveryhelpfulinunderstandingwhatbasicapproachesareavailable,andwhatmicrocontroller/peripheralcombinationsshouldbeconsidered.

TheMC68HC705B16wasfinallychosenonthebasisofitsavailableA/DinputsandPWMoutputsaswellas24digitalI/Olines.Inretrospectthisisprobablyoverkill,asonlyoneA/Dchannel,onePWMchannel,and11I/Opinsareactuallyrequired(seeFigure3).Thedecisionwasmadetoerronthesafesidebecauseacompletedevelopmentsystemspecifictothechosenpartwasnecessary,andtheprojectbudgetdidnotpermitasecondsuchsystemtobepurchasedshouldthefirstproveinadequate.

MicrocontrollerApplicationDevelopment.Breadboardingoftheperipheral

hardware,developmentofmicrocontrollersoftware,andfinaldebuggingandtestingofacustomprinted-circuitboardforthemicrocontrollerandperipheralsallrequireadevelopmentenvironmentofsomekind.Thechoiceofadevelopmentenvironment,likethatofthemicrocontrolleritself,canbebewilderingandrequiressomefacultyexpertise.Motorolamakesthreegradesofdevelopmentenvironmentrangingfromsimpleevaluationboards(ataround$100)tofull-blownreal-timein-circuitemulators(atmorelike$7500).Themiddleoptionwaschosenforthisproject:theMMEVS,whichconsistsof_aplatformboard(whichsupportsall6805-familyparts),_anemulatormodule(specifictoB-seriesparts),and_acableandtargetheadadapter(package-specific).Overall,thesystemcostsabout$900andprovides,withsomelimitations,in-circuitemulationcapability.ItalsocomeswiththesimplebutsufficientsoftwaredevelopmentenvironmentRAPID[5].

Studentsfindlearningtousethistypeofsystemchallenging,buttheexperiencetheygaininreal-worldmicrocontrollerapplicationdevelopmentgreatlyexceedsthetypicalfirst-courseexperienceusingsimpleevaluationboards.

Printed-CircuitBoard.Thelayoutofasimple(thoughdefinitelynottrivial)printed-circuitboardisanotherpracticallearningopportunitypresentedbythisproject.Thefinalboardlayout,withpackageoutlines,isshown(at50%ofactualsize)inFigure8.Therelativesimplicityofthecircuitmakesmanualplacementandroutingpractical—infact,itlikelygivesbetterresultsthanautomaticinanapplicationlikethis—andthestudentisthereforeexposedtofundamentalissuesofprinted-circuitlayoutandbasicdesignrules.Thelayoutsoftwareusedwastheverynicepackagepcb,2andtheboardwasfabricatedin-housewiththeaidofourstaffelectronicstechnician.

Figure&Printed-circidtlayoutformicrocontrollerboard

5Conclusion

Theaimofthispaperhasbeentodescribeaninterdisciplinary,undergraduateengineeringdesignproject:amicrocontroller-basedtemperaturecontrolsystemwithdigitalset-pointentryandset-point/actualtemperaturedisplay.Aparticulardesignofsuchasystemhasbeendescribed,andanumberofdesignissueswhicharise—fromavarietyofengineeringdisciplines—havebeendiscussed.Resolutionofthese

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论