【毕业设计】_基于STM32单片机的火灾检测报警(原理图+源码)

一.系统概述

本设计的火灾检测报警系统通过温度传感器和烟雾传感器来进行监测。温度传感器用于检测环境温度,烟雾传感器则用于监测烟雾浓度。系统将实时数据显示在屏幕上,并在检测到烟雾浓度或温度超过预设阈值时触发报警并启动灭火装置。

在这里插入图片描述

二.仿真概述

  1. 仿真启动后,显示屏将展示当前的温度和烟雾浓度数据,并实时显示设定的阈值。

在这里插入图片描述

  1. 调整烟雾传感器的滑动变阻器,当烟雾浓度超出设定阈值时,系统会自动触发报警并启动灭火装置。

在这里插入图片描述

  1. 调节DS18B20传感器的红色按钮,当温度超过设定阈值时,系统同样会发出报警并启动灭火功能。

在这里插入图片描述

  1. 通过按键可以设定温度和烟雾浓度的阈值。按下设置按钮进行阈值调整,设置完成后需要按下确认按钮保存设置。

在这里插入图片描述

三.程序设计

#include <stm32f10x.h>
#include <Lcd1602.h>
#include <Led.h>
#include <Ds18b20.h>
#include <Beep.h>
#include <Relay.h>
#include <key.h>
#include "PCF8591.h" 

int main(void)
{	
	u8 t,s,k,m=0,Tmax = 50,Smax=50;
	
	Key_Init();
	Lcd1602_Init();
	Led1_Init();//PC0
	Beep_Init();//PA13
	Ds18b20_Init();//PA12
	PCF8591_Init();
	
	
	Lcd1602_Write_String(0x80,2,(u8*)"T:");
	Lcd1602_Write_String(0x86,2,(u8*)"!:");
	Lcd1602_Write_String(0xc0,2,(u8*)"S:");
	Lcd1602_Write_String(0xc6,2,(u8*)"!:");
	Lcd1602_Write_String(0xc4,2,(u8*)"%");
	
	while(1)
	{	
		k =Key_detect();
		Lcd1602_Write_Num8(0x8c,m);
		t =Ds18b20_Temp() ;
		s =PCF8591_ADC_Input(0x90,1);
		Lcd1602_Write_Num8(0x82,t);
		Lcd1602_Write_Num8(0x88,Tmax);
		Lcd1602_Write_Num8(0xc2,s);
		Lcd1602_Write_Num8(0xc8,Smax);
		
		if(Key2==0)
		{
			m++;
			if(m==3)	m=0;
		}
		if(Key3==0)
		{
			m=0;
		}
		//
		if(m==1)
		{
			Lcd1602_Write_String(0xcA,1,(u8*)" ");
			Lcd1602_Write_String(0x8A,1,(u8*)"<");
			
			if(Key0==0)	Tmax++;
			else if(Key1==0)	Tmax--;
		}
		else if(m==2)
		{
			Lcd1602_Write_String(0x8A,1,(u8*)" ");
			Lcd1602_Write_String(0xcA,1,(u8*)"<");
			if(Key0==0)	Smax++;
			else if(Key1==0)	Smax--;
		} 
		else if(m==0)
		{
			Lcd1602_Write_String(0x8A,1,(u8*)" ");
			Lcd1602_Write_String(0xcA,1,(u8*)" ");
			if(t>Tmax||s>Smax)	
			{
				Beep_1;Led1_1;
			}
			else if(t<Tmax&&s<Smax)		
			{
				Beep_0;Led1_0;
			}
		}
		

	}	
}


24-32f-28

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值