当前位置:文档之家› 火灾报警系统设计

火灾报警系统设计

计算机科学与技术学院《ZigBee综合实践》课程设计报告设计题目:基于zigbee的火灾报警系统设计人员:程念学号:*********指导教师:***2015年4月目录摘要 (I)ABSTRACT (II)1设计目标 (1)2设计内容 (1)3设计方案 (2)4实验所需器件 (3)5实验各模块电路设计 (3)5.1 核心板模块 (3)5.2 传感器模块 (4)6实验设计 (6)6.1目的 (6)6.2 系统原理图 (6)6.3完成实物图 (9)7调试与结果 (10)7.1核心代码 (10)7.2上位机测试 (12)8设计总结:(成员作用与体会) (13)9附件 (14)10成绩报告 (24)基于zigbee的火灾报警系统摘要随着经济的发展,高层建筑、地下建筑以及大型综合性建筑日益增多火灾隐患也随之增加,火灾发生的数量及其造成的损失都呈逐年上升趋势,因此,火灾报警系统成为保障人生命财产安全的重要因素。

而目前我国的火灾报警系统主要是总线型报警系统,由于外界环境因素的影响不可避免的会存在一定的误报率和漏报率,而且安装和维修成本很高。

伴随着ZigBee技术的出现和发展,它使无线型火灾报警系统成为了可能,基于网络化的火灾报警系统具有成本低、安装方便、稳定性高的特点。

ZigBee具有短时延和数据传输可靠的独特优势,它更适合于火灾报警系统中。

本设计以CC2530为核心控制芯片,采用Z-Stack协议栈作为协议平台组成一个小型的ZigBee网络,系统由一个协调器设备和一个终端设备组成一个小型网络。

终端设备作为传感器节点采集温度、烟雾数据,将终端设备放在室内的不同地方,将采集到的数据无线传输到协调器节点,通过串口将各个传感器节点的信息传输到上位机,上位机用VB编写,完成数据的显示和储存,基本上实现了家庭火灾报警系统所应有的功能。

【关键词】ZigBee 火灾报警CC2530Z-Stack协议栈《zigbee综合实践》课程设计:基于zigbee的火灾报警系统ABSTRACTWith the development of economy, high-rise buildings, underground structures and increasingly large comprehensive buildings, the fire hazard also will increase, the number of fires and the damage caused by rising trend year by year, as a result, fire alarm system become the important factor of people life and property security.And fire alarm system in our country at present is mainly form alarm system, because of the influence of the external environment factors, there are inevitably some non-response rates and the rate of false positives, and installation and maintenance cost is very high. Accompanied by the emergence and development of ZigBee technology, it makes no linear fire alarm system, fire alarm system based on network has characteristics of low cost, easy installation, high stability. ZigBee has the unique advantages of short time delay and data transmission is reliable, it is more suitable for fire alarm system.CC2530 this design as the core control chip, using Z - Stack protocol Stack as deal platform, forming a small ZigBee network and system consists of a coordinator and a terminal equipment of a small network. Terminal equipment as the data collection temperature, smoke sensor node, terminal equipment in different parts of the interior, the collected data wireless transmission to the coordinator node, through a serial port to transmit information of each sensor node to PC, PC written in LabVIEW software, complete the data display and storage, basically realized the function of fire alarm system of the family should have. 【Keywords】ZigBee , Fire alarm ,CC2530 Z - Stack protocol Stack;《嵌入式综合实践》课程设计:基于STM32和WiFi的遥控小车1设计目标本次设计要求能通过zigbee终端节点上火焰传感器采集火警信息,并将采集数据实时发送给协调器,检测是否有火灾发生,并且通过VB上位机显示出来;同时要求学生对CC2530芯片编程和zigbee协议栈有相当程度的理解以及熟练的应用,熟悉ZigBee 串口以及中断的使用,会基本的C语言熟练掌握IAR FOR 8051软件的使用与程序下载。

2设计内容(1)利用zigbee核心板,用AD设计好电路板,搭建好硬件环境,调试好火焰传感器;(2)将火焰传感器作为节点采用广播方式加入到zigbee协调器网络中;(3)编写并调试程序,并分别下载到协调器和终端节点,并将协调器串口链接到电脑,实现VB上位机显示火警状态,设计完成。

2.1系统组成框图3设计方案(1)CC2530芯片做接收信息设备和控制设备。

(2)ZigBee终端设备和协调器组网成功通信。

(3)终端设备监测传感器状态,并实时传给协调器。

(4)协调器获取传感器状态,并做出处理,同时VB上位机展示。

4实验所需器件(1)核心板,此处采用CC2530核心板(2)火焰传感器模块,及各种常用元器件(3)ZigBee核心板和JLINK下载模块及其相关的驱动(4)杜邦线若干,电池若干(最好是可以充电的)5实验各模块电路设计5.1 核心板模块(1)芯片的选择:CC2530(2)芯片的介绍:*高性能、低功耗的8051 微控制器内核;*适应2.4GHz IEEE 802.15.4的RF 收发器;*电源电压范围宽(2.0~3.6V);*看门狗、电池监视器和温度传感器;*具有8 路输入8~14 位ADC;*2 个支持多种串行通信协议的USART, 1 个红外发生电路;*1 个通用的16 位和2 个8 位定时器;图 5.1.3(4)实物图:图5.1.45.2 传感器模块(1)所用传感器:火焰传感器(2) 特点:1、可以检测火焰或者波长在760纳米~1100纳米范围内的光源,打火机测试火焰距离为80cm,对火焰越大,测试距离越远2、探测角度60度左右,对火焰光谱特别灵敏3 、灵敏度可调(图中蓝色数字电位器调节)4、比较器输出,信号干净,波形好,驱动能力强,超过15mA5、配可调精密电位器调节灵敏度6、工作电压3.3V-5V7、输出形式:数字开关量输出(0和1)8、设有固定螺栓孔,方便安装9、小板PCB尺寸:3.2cm x 1.4cm10、使用宽电压LM393比较器(3传感器使用说明:1 .火焰传感器对火焰最敏感,对普通光也是有反应的,一般用做火焰报警等用途。

2. 小板输出接口可以与单片机IO口直接相连,有火灾输出低电平正常输出高电平3.传感器与火焰要保持一定距离,以免高温损坏传感器,对打火机测试火焰距离为80cm,对火焰越大,测试距离越远图5.2.3(4)实物图:图 5.2.46实验设计6.1目的熟悉基于zigbee的控制系统的使用,为今后进一步学习物联网无线传感网打下基础。

6.2 系统原理图图6.2.1终端节点原理图图6.2.2 终端节点PCB图6.2.3协调器原理图6.2.4协调器PCB图6.3完成实物图图6.3.1 正视图图6.3.2底面图7调试与结果7.1核心代码7.1.1 初始化部分,串口初始化,登记串口任务号,传感器接口初始化7.1.2 火灾判断部分7.1.3 发送部分7.1.4 接收并串口打印部分7.2上位机测试(1)班级总控界面如下,在程念组里面就可以实时观察火焰传感器状态。

图7.28设计总结:通过这次实践课程,通过亲自动手,从最初确定课题,到画设计PCB,到印刷电路板,到焊接元器件,到测试电路,到调试程序,经过了反复的修改和实践,终于完成课题,一路走来,确实很不易。

画PCB,制板,编程,调试等各方面能力都得到了提升.9附件应用层源码:#include "OSAL.h"#include "ZGlobals.h"#include "AF.h"#include "aps_groups.h"#include "ZDApp.h"#include "SampleApp.h"#include "SampleAppHw.h"#include "OnBoard.h"/* HAL */#include "hal_lcd.h"#include "hal_led.h"#include "hal_key.h"#include "MT_UART.h" //此处用于串口//定义IO#define LED1 P0_0 //LED提醒#define fire P0_6 //传感器检测口/********************************************************************* * MACROS*//********************************************************************* * CONSTANTS*//********************************************************************* * TYPEDEFS*//********************************************************************* * GLOBAL V ARIABLES*/// This list should be filled with Application specific Cluster IDs.const cId_t SampleApp_ClusterList[SAMPLEAPP_MAX_CLUSTERS] ={SAMPLEAPP_PERIODIC_CLUSTERID,SAMPLEAPP_FLASH_CLUSTERID};const SimpleDescriptionFormat_t SampleApp_SimpleDesc ={SAMPLEAPP_ENDPOINT, // int Endpoint;SAMPLEAPP_PROFID, // uint16 AppProfId[2]; SAMPLEAPP_DEVICEID, // uint16 AppDeviceId[2]; SAMPLEAPP_DEVICE_VERSION, // int AppDevVer:4; SAMPLEAPP_FLAGS, // int AppFlags:4; SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters; (cId_t *)SampleApp_ClusterList, // uint8 *pAppInClusterList; SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters; (cId_t *)SampleApp_ClusterList // uint8 *pAppInClusterList;};// This is the Endpoint/Interface description. It is defined here, but// filled-in in SampleApp_Init(). Another way to go would be to fill// in the structure here and make it a "const" (in code space). The// way it's defined in this sample app it is define in RAM.endPointDesc_t SampleApp_epDesc;/********************************************************************* * EXTERNAL V ARIABLES*//********************************************************************* * EXTERNAL FUNCTIONS*//********************************************************************* * LOCAL V ARIABLES*/uint8 SampleApp_TaskID; // Task ID for internal task/event processing// This variable will be received when// SampleApp_Init() is called.devStates_t SampleApp_NwkState;uint8 SampleApp_TransID; // This is the unique message ID (counter)afAddrType_t SampleApp_Periodic_DstAddr;//广播afAddrType_t SampleApp_Flash_DstAddr; //组播afAddrType_t Point_To_Point_DstAddr;//网蜂点对点通信定义aps_Group_t SampleApp_Group;uint8 SampleAppPeriodicCounter = 0;uint8 SampleAppFlashCounter = 0;/********************************************************************* * LOCAL FUNCTIONS*/void SampleApp_HandleKeys( uint8 shift, uint8 keys );void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pckt );void SampleApp_SendPeriodicMessage( void );void SampleApp_SendFlashMessage( uint16 flashTime );void SampleApp_SendPeriodicMessage1( void ); //正常周期性广播函数声明void SampleApp_SendPeriodicMessage2( void ); //有火灾!//void SampleApp_SendPeriodicMessage3( void );//void SampleApp_SendPeriodicMessage4( void );/********************************************************************* * NETWORK LAYER CALLBACKS*//********************************************************************* * PUBLIC FUNCTIONS*//********************************************************************* * @fn SampleApp_Init** @brief Initialization function for the Generic App Task.* This is called during initialization and should contain* any application specific initialization (ie. hardware* initialization/setup, table initialization, power up* notificaiton ... ).** @param task_id - the ID assigned by OSAL. This ID should be* used to send messages and set timers.** @return none*/void SampleApp_Init( uint8 task_id ){SampleApp_TaskID = task_id;// task_id is Pointer to location of the Application task ID. SampleApp_NwkState = DEV_INIT;SampleApp_TransID = 0; // This is the unique message ID (counter)MT_UartInit();//串口初始化MT_UartRegisterTaskID(task_id);//登记任务号/******火灾探测传感器电路初始化******/P0SEL &= ~0X40; //设置P0.6为普通IO口P0DIR &= ~0X40; // 在P0.6口,设置为输入模式P0INP &= ~0x40; //打开P0.6上拉电阻// Device hardware initialization can be added here or in main() (Zmain.c).// If the hardware is application specific - add it here.// If the hardware is other parts of the device add it in main().#if defined ( BUILD_ALL_DEVICES )// The "Demo" target is setup to have BUILD_ALL_DEVICES and HOLD_AUTO_START // We are looking at a jumper (defined in SampleAppHw.c) to be jumpered// together - if they are - we will start up a coordinator. Otherwise,// the device will start as a router.if ( readCoordinatorJumper() )zgDeviceLogicalType = ZG_DEVICETYPE_COORDINATOR;elsezgDeviceLogicalType = ZG_DEVICETYPE_ROUTER;#endif // BUILD_ALL_DEVICES#if defined ( HOLD_AUTO_START )// HOLD_AUTO_START is a compile option that will surpress ZDApp// from starting the device and wait for the application to// start the device.ZDOInitDevice(0);#endif// Setup for the periodic message's destination address// Broadcast to everyone 广播参数配置SampleApp_Periodic_DstAddr.addrMode = (afAddrMode_t)AddrBroadcast; SampleApp_Periodic_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;SampleApp_Periodic_DstAddr.addr.shortAddr = 0xFFFF;/*0xFFFF——数据包将被传送到网络上的所有设备,包括睡眠中的设备。

相关主题