当前位置:网站首页>51 single chip microcomputer indoor environment monitoring system, mq-2 smoke sensor and DHT11 temperature and humidity sensor, schematic diagram, C programming and simulation
51 single chip microcomputer indoor environment monitoring system, mq-2 smoke sensor and DHT11 temperature and humidity sensor, schematic diagram, C programming and simulation
2022-06-30 03:27:00 【Jiangyuzhi】
The design requirements
1. With 51 Single chip microcomputer is the control core , Temperature and humidity sensors and smoke sensors are used to collect and process indoor environmental data ;
2.LCD1602 LCD real-time display of temperature and humidity 、 Smoke concentration and other data ;
3. The user can set the upper and lower limit of temperature and humidity alarm threshold and smoke alarm threshold by pressing the key ;
4. When the indoor temperature and humidity are not within the set range 、 When the smoke concentration exceeds the limit , Buzzer and LED The lamp provides audible and visual alarm ;
System Overview
This paper designs a software based on MQ-2 and DHT11 Indoor temperature and humidity of the sensor - Smoke alarm system , It can realize the control of indoor temperature and humidity 、 Combustible gas / Real time monitoring and display of smoke concentration , It also provides early warning value setting and audible and visual alarm functions .
The system hardware mainly consists of AT89C52 Minimum system of single chip microcomputer 、MQ-2 Smoke sensor module 、DHT11 Temperature and humidity sensor module 、LCD1602 Display module 、 It is composed of key module and audible and visual alarm module , The system framework is as follows .
among ,AT89C52 Single chip microcomputer is the control core of the whole system , Used to receive 、 Process the information collected by the sensor , And send the processed information to LCD Real time display .
When indoor temperature and humidity 、 When the concentration of combustible gas or smoke exceeds the threshold set by the user , relevant LED The indicator light is on , The buzzer makes a sound .
Simulation circuit diagram
Schematic diagram
Simulation analysis
Open indoor temperature, humidity and smoke detection .pdsprj Simulation file for , Double click the MCU , Click the small yellow folder icon in the pop-up dialog window , load Monitor.hex file ( be located C In the program folder ), Run the simulation , The effect is as follows .
It can be seen from the picture that ,LCD The first 1 Row display Monitor System( The monitoring system ), The first 2 The row shows that the current indoor temperature is 27℃, The humidity is 55%RH, The smoke concentration is 14%.LCD The displayed result is consistent with the value on the sensor , Indicates that the data sampling is correct .
adopt DHT11 On the sensor 3 A small red arrow simulates the change of indoor temperature and humidity . The first two small red arrows are used to increase or decrease the value , The last small arrow is used to switch between temperature and humidity .
because Proteus Simulation no MQ-2 Smoke sensor element , and MQ-2 The principle of the sensor is to convert the smoke concentration directly into the change of resistance , So here we use sliding rheostat to replace it .
Slide the rheostat by clicking RV2 Up and down red arrows , Simulate the change of indoor smoke concentration .
for example , We adjust the indoor temperature to 31℃, The humidity is 48%RH, The smoke concentration is 7%, give the result as follows .
The user can adjust the key 、 Increase and decrease keys to set the upper and lower limit of temperature and humidity alarm threshold and smoke alarm threshold .
Click the adjustment key , The system enters the upper and lower limits of temperature and humidity 、 Smoke alarm threshold setting interface , As shown in the figure below . among T Represents the temperature ,H Represents humidity ,S Represents smoke concentration .
The default temperature range of the system is :20-35℃, The humidity range is :40-85%RH, The smoke alarm threshold is :15%.
After entering the setting interface , The lower temperature limit cursor flashes , At this time, you can add / Decrease the key to adjust the value , After adjustment , Continue to click the adjustment key , The cursor of the upper temperature value flashes , At this time, the upper limit value can be adjusted .
By analogy , After all parameters are set , Click the adjustment button again , You can exit the setting interface , Return to the system display interface .
for example , We set the temperature range to 28-36℃, The humidity range is 40-65%RH, The smoke alarm threshold is 5%.
When the system detects that the indoor temperature and humidity are not within the set upper and lower limits or the smoke concentration is greater than the alarm threshold , The buzzer beeps , Corresponding LED The light is on . When the indoor environment returns to normal , Alarm disarmed .
Return to the display interface , The system monitors that the current indoor smoke concentration is 7%, Greater than set 5%, At this time, the smoke alarm lamp is on , The buzzer makes a sound , Remind users to pay attention to .
in summary , The simulation results meet the design requirements .
part C Code
while(KeySet_P) // “ Set the key ” Not pressed , It is always in the setting of smoke limit
{
if(KeyDown_P==0) // Judge “ Minus button “ Is it pressed
{
if(AlarmSK>0) // Only when the smoke limit is greater than 0 when , Can reduce 1
AlarmSK--;
LcdGotoXY(0,14); // Refresh to display the changed smoke limit
LcdPrintNum(AlarmSK);
LcdGotoXY(0,15); // Reposition the flashing cursor position
DelayMs(350);
while(!KeyDown_P);
}
if(KeyUp_P==0) // Judge “ Add button “ Is it pressed
{
if(AlarmSK<99) // Only when the smoke limit is less than 99 when , To add 1
AlarmSK++;
LcdGotoXY(0,14); // Refresh to display the changed smoke limit
LcdPrintNum(AlarmSK);
LcdGotoXY(0,15); // Reposition the flashing cursor position
DelayMs(350); // Time delay
while(!KeyUp_P);
}
}
LcdWriteCmd(0x0C); // Cancel cursor blink
LcdShowInit(); // The liquid crystal display is the... Of the detection interface
DelayMs(10); // Remove the jitter caused by key pressing
while(!KeySet_P); // Wait for the key to release
DelayMs(10); // Remove the jitter caused by key release
Information content
(1) be based on MQ-2 and DHT11 Indoor temperature and humidity smoke alarm system design paper ;
(2)Proteus8.6 Simulation ;
(3)C Program ;
(4)AD Schematic diagram ;
(5)Visio flow chart ;
(6) Reference material ;
(7) List of components ;
Data figure
Say the important thing again !!!
Because the design of indoor environment monitoring system is my original design , Get a full set of information ,
Please search to see my 【 Male 】( many *)“ Number ”: Jiaoyuan Xiaozhi
边栏推荐
- Use of foreach in QT
- Global and Chinese market for sensor screwdrivers 2022-2028: Research Report on technology, participants, trends, market size and share
- 约瑟夫环 数学解法
- golang bilibili直播彈幕姬
- If you can tell whether the external stock index futures trading platform I am trading is formal and safe?
- Laravel9 installation locale
- QT中foreach的使用
- Auto.js学习笔记16:按项目保存到手机上,不用每次都保存单个js文件,方便调试和打包
- Chapter 2 control structure and function (programming problem)
- 炒现货黄金的交易平台如何保障资金安全?
猜你喜欢
C # [advanced part] C # multithreading
[QT] QMap使用详解
Auto. JS learning notes 16: save to the mobile phone by project, instead of saving a single JS file every time, which is convenient for debugging and packaging
1152_ Makefile learning_ Pattern matching rules
Simple custom MVC optimization
HOOK Native API
Stc89c52/90c516rd/89c516rd ADC0832 ADC driver code
共124篇!墨天轮“高可用架构”干货文档分享(含Oracle、MySQL、PG)
The next change direction of database - cloud native database
Stc89c52/90c516rd/89c516rd DHT11 temperature and humidity sensor drive code
随机推荐
Utilisation de foreach en Qt
【十分钟】manim安装 2022
Stc89c52/90c516rd/89c516rd ADC0832 ADC driver code
1151_ Makefile learning_ Static matching pattern rules in makefile
Number of students from junior college to Senior College (III)
Some common functions and precautions
华为面试题: 高矮个子排队
4-4 beauty ranking (10 points)
编译一个无导入表的DLL
[wechat applet] how did the conditional rendering list render work?
C#【高级篇】 C# 泛型(Generic)【需进一步补充:泛型接口、泛型事件的实例】
【常见问题】浏览器环境、node环境的模块化问题
The broadcast module code runs normally in autojs4.1.1, but an error is reported in pro7.0 (not resolved)
Use of foreach in QT
Neo4j---性能优化
laravel9本地安裝
Huawei interview question: divide candy
Number of students from junior college to Senior College (4)
专升本语文资源整理
正则全匹配:密码由8位以上数字,大小写字母,特殊字符组成