学生设计用纸共44页第1页毕业设计任务书一、设计题目:烟雾报警器设计二、设计目的设计一个由单片机控制的烟雾报警器,可以对房间的烟雾浓度进行检测,如果超过设定浓度,可以进行声、光报警。通过设计,掌握数据采集系统的工作原理、掌握计算机控制系统的设计原理、设计步骤,进一步提高综合运用知识的能力。三、设计内容和要求(1)选择传感器,设计接口电路,要求烟雾浓度的范围。(2)设计声光报警电路,要求达到设定浓度就进行报警。(3)烟雾报警器的信号采集模块设计;烟雾报警器的报警模块设计;烟雾报警器的软件设计。四、设计工作任务进度第一周:查阅资料、调研、确立设计方案;选择器件。第二周:系统总体方案和硬件的设计。第三周:系统软件的设计,并加以完善整个设计。第四周:修改整个设计,最后进行答辩。学生设计用纸共44页第2页摘要随着社会和经济的发展,防火工作越来越重要,但是目前国内的许多研发都侧重于大型场所的火灾报警。因此,我们就有必要研制一种结构简单、经济实用的家庭烟雾报警器以适应市场的需求。基于供家庭使用的烟雾报警器应该具备的基本要求和功能,文章设计了一种比较适合的烟雾报警器。本设计以传感器和单片机作为烟雾报警器设计的核心器件,配合其它器件即可实现声光报警、自动排烟换气和消防灭火等功能。设计中单片机选用AT89C51作为控制器件,传感器选用QM-N5型气体传感器实现对烟雾的检测。烟雾报警器主要由烟雾信号采集及前置放大电路、模数转换电路、单片机控制电路、显示电路、声光报警电路和安全保护电路构成,设计合理、简单易懂、价格低廉,使单片机在烟雾报警系统的控制中得到充分应用,具有一定的实用价值。论文主要针对烟雾报警系统中的各个组成部分及功能进行了详细的介绍和说明,并对其主控电路和外围设备电路之间的接口连接方式,以及系统软件设计进行了重点的分析和讲解。关键词:烟雾报警器;单片机;传感器学生设计用纸共44页第3页AbstractWiththedevelopmentofsocialandeconomic,thepreventionoffirearemoreandmoreimportant.However,inthepresent,mostofresearchanddevelopmentoffirealarmsystemsonlyfocusonlargesites.Therefore,itisnecessarytodesignasimple,economicalandpracticalfamilySmokeAlarmtomeetthemarketdemand.TakingboththebasicrequirementandthefunctionoffamilySmokeAlarmsshouldhaveintoaccount,thesisdesignsasuitablesmokealarmforhouseholdusing.Whichthesensorandthemicrocontrollerofthedesignisthemostimportantpartofalarmdevices,withotherdevicescanachievealarmingwithsoundandlight,automaticallyreducingsmokeandfightingfire,etc.INdesign,microcontrollerusedAT89C51andselectQM-N5GasSensortodetectsmoke.Smokealarmmainlybythesignalacquiredcircuit,A/Dconvertedcircuit,MCUcontrolledcircuit,displayedcircuitandalarmingwithsoundandlightcircuit,reasonabledesign,simplestructure,easytouse,inexpensive.Asaresult,themicrocontrollerinthecontrolofthesmokealarmsystemisfullyapplied.Therefore,thisdesignaboutsmokealarmhaspracticalvalue.Thesisgivedetailedintroductionforthefunctionandtheoryofthevariouscomponentpartsofthealarmsystem,focusontheinterfacetechnologybetweenitsmaincontrolledcircuitandperipheralcircuit,alsogiveexplanationofthesoftware.Keywords:SmokeAlarm;MCU;sensor学生设计用纸共44页第4页目录前言······················································3第1章报警器的概述······································41.1设计烟雾报警器的目的及意义··························41.2火灾报警器的现状及特点······························41.3火灾报警器的发张趋势·································5第2章系统的总方案设计···································62.1烟雾报警器的工作结构和原理··························62.2烟雾传感器的选型····································72.2.1烟雾传感器的介绍··································72.2.2MQ-5半导体气体烟雾传感器·························102.3单片机的选型·········································112.3.1AT89C51内部结构及功能····························122.3.2中断与定时系统···································142.3.3单片机外围电路的扩展·····························152.3.4时钟电路和复位电路·······························162.4A/D转换器的选型····································182.5显示器的选择·······································212.6放大器的选型·······································222.7烟雾报警器的主要功能设计···························22第3章系统的硬件设计·····································243.1系统电源电路········································243.2AT89C51的时钟电路和复位电路························243.3信号采集及前置放大电路······························253.4A/D转换电路········································263.5声音报警及消音键电路································273.6字符显示电路········································273.7状态指示电路········································283.8安全保护电路········································28学生设计用纸共44页第5页3.9报警故障自诊断电路···································293.10烟雾报警器硬件总电路································29第4章系统的软件设计·····································314.1系统主程序设计及流程图······························314.2主程序初始化流程图··································324.3报警子程序设计及流程图······························324.4按键输入设计子程序流程图····························34附录······················································35总结·······················································39参考文献···················································40学生设计用纸共44页第6页前言单片机及烟雾传感器是烟雾报警器系统的两大核心。单片机好比一个桥梁,联系着传感器和报警电路设备。近几年来,单片机已逐步深入应用到工农业生产各部门及人们生活的各个方面。各种类型的单片机也根据社会的需求而开发出来。单片机是器件级计算机系统,实际上它是一个微控制器或微处理器。由于它功能齐全,体积小,成本低,因此它可以应用到所有电子系统中。同样,它也可以广泛应用于报警技术领域,使各类报警装置的功能更加完善,可靠性大大提高,以满足社会发展的需要。而传感器作为信息技术系统的“感官”器件,如果没有“感官”感受信息,或者“感官”迟钝,都难以形成高精度、高速度的控制系统。美国曾把二十世纪八十年代称为传感技术时代,日本更是把传感技术列为十大技术之首。所以,根据报警器功能的需要,选择合适、精确、经济的烟雾传感器和单片机芯片是至关重要的。在本论文中的最主要的设计是选AT89C51单片机和QM-N5半导体气体烟雾传感器为核心器件。AT89C51单片机兼容标准MCS-51指令系统,功能强大,可供许多高性价比的场合应用,能够灵活应用于各种控制领域。QM-N5半导体气体烟雾传感器在较宽的浓度范围内对可燃气体有良好的灵敏度,寿命长,成本低,非常适用于家庭使用的气体泄漏报警器。由这两个核心器件设计而成的整个烟雾报警器系统可实现声光报警、报警状态字符显示、换气扇排烟和喷水灭火等烟雾报警器应有的功能,是一种结构简单、性能稳定、使用方便、价格低廉、智能化的烟雾报警器,具有一定的实用价值。目前,现代建筑都会有选择地安装不同功能的火灾自动报警系统。因为火灾自动报警系统是建筑物的神经系统,它能够感受、接收着发生火灾的早期信号并及时报警,发出警报同时告知用户和周边居民。它就像是一个个称职的更夫,给居住、忙碌或是休息在家庭中的人们以极大的安全感。在火灾的早期阶段,准确的探测到火情并迅速报警,对于及时组织有序快速疏散、积极有效地控制火灾的蔓延、快速灭火和减少火灾对居住人群的损失都具有重要的意义。学生设计用纸共44页第7页第1章报警器的概述1.1设计烟雾报警器的目的及意义随着社会和经济的发展,家庭火灾防不胜防,防火工作也就越来越重要。据美国消防学会统计,最近十多年中,安装自动消防设施的建筑中发生火灾,消防设施的有效率高达96.1%,确实起到了保证建筑物消防安全的作用。这是因为火灾自动报警系统能够及时将火灾迹象通知用户及有关管理人员,以便他们准备疏散或组织灭火,延长了建筑物可供疏散的时间并通过联动系统启动其他消防设施。所以,设计一种能够在火灾刚刚发生时或者有可燃气体堆积引