设计简介:
项目名:环境监测(实物)
项目编号:mcuclub-dz-244
单片机类型:STM32F103C8T6
具体功能:
1、通过MQ-2检测烟雾值,当烟雾浓度大于设置最大值,进行声光报警
2、通过MQ-135检测有害气体浓度值,当有害气体浓大于设置最大值,进行声光报警,并启动风扇通风
3、通过光敏电阻检测光照值,光照值小于设置最小值,进行关窗帘,否则开窗帘(步进电机模拟)
4、通过雨量检测模块检测雨量值,当雨量值大于设置最大值,进行关窗,否则开窗(步进电机模拟)
5、通过按键可设置各阈值
6、通过OLED显示屏显示测量值
7、通过WIFI模块将测量数据发送到手机端,并可以设置阈值、开关通风、窗帘、窗户、切换模式
总字数:15772
摘 要
随着科学技术的不断发展,智能家居走进人们的日常生活。然而,由于智能家居技术不成熟、不兼容等问题,从而导致同一空间内同一种传感器重复使用,造成功能冗余、增加能耗同时也提高了成本,因此,急需一种包含多种传感器且兼容性较强的室内环境监测系统。
针对于上述状况,本文通过WiFi无线通信技术、传感器技术与单片机技术设计了一套针对于室内环境实时监测的解决方案。该方案设计的系统主要分为主机系统和从机系统两大部分。主机系统包含一个主机设备,负责接收从机系统上传的数据,提供显示和控制界面,主机设备的主控芯片采用STM32单片机,包括显示电路、WiFi 通信电路等部分。从机系统包括多个结构相同的从机设备,负责环境检测、环境数据实时上传等功能。
通过多次测试,本设计的系统能够长期稳定运行,并提供稳定可靠的数据,其操作界面简单明了,传感器种类丰富,网络兼容性强,开发成本低,可单独作为环境监测系统使用,也可与其他智能家居配套使用,具有较强的实用价值。
关键词:STM32单片机;环境监测;传感器;WiFi
Abstract
With the continuous development of science and technology, smart home has entered People’s Daily life. However, due to the immaturity and incompatibility of smart home technology, the same sensor is reused in the same space, resulting in functional redundancy, increased energy consumption and increased costs, therefore, there is an urgent need for a variety of sensors and strong compatibility of indoor environmental monitoring system.
Aiming at the above situation, this paper designs a set of solutions for indoor environment real-time monitoring through WiFi wireless communication technology, sensor technology and single-chip microcomputer technology. The system designed in this scheme is mainly divided into two parts: the host system and the slave system. The host system contains a host device, which is responsible for receiving the data uploaded by the slave system and providing the display and control interface. The main control chip of the host device uses STM32 single chip microcomputer, including the display circuit and WiFi communication circuit. The slave system consists of multiple slave devices with the same structure, which is responsible for environmental detection, real-time environmental data upload and other functions.
Through many tests, the designed system can run stably for a long time, and provide stable and reliable data. Its operation interface is simple and clear, the sensor types are rich, the network compatibility is strong, the development cost is low, can be used as an environmental monitoring system alone, can also be used with other smart homes, and has strong practical value.
Key words: STM32 MCU; Environmental monitoring; Sensor; WiFi
目 录
1.绪论 4
1.1 研究背景及其研究意义 4
1.2 国内外研究现状 4
1.2.1 国内研究现状 4
1.2.2 国外研究现状 5
1.3 研究目标和组织结构 5
2.系统方案设计 7
2.1 整体方案设计 7
2.2 主要器件选型选择 8
2.2.1 主控芯片方案选择 8
2.2.2 显示模块方案选择 9
2.2.3 MQ-2气体检测模块方案选择 9
3.硬件电路设计 11
3.1 主控模块电路 11
3.2 MQ-135混合气体检测模块电路 12
3.3 MQ-2烟雾检测模块电路设计 14
3.4 光照强度检测模块电路 15
3.5 雨滴监测模块 17
3.6 步进电机模块电路 18
3.7 继电器模块电路 21
3.8 显示模块电路 21
3.9 按键电路 22
3.10 声光报警报警提醒电路模块 22
3.11 WIFI无线传输模块电路 23
4.系统程序设计 25
4.1 编程软件介绍 25
4.2 系统主流程设计 25
4.3独立按键 26
4.4步进电机子流程 27
4.5 WiFi模块子流程设计 28
4.6 OLED显示流程设计 29
5.实物调试 31
5.1 实物总体设计 31
5.2有害气体浓度浓度模块实物测试 31
5.3光照强度模块实物测试 32
5.4雨量模块实物测试 33
5.5烟雾浓度模块实物测试 33
5.6WiFi模块实物测试 34
总结 35
参考文献 36
致谢 37
附录 38
附录A:原理图 38
附录B:PCB 39
附录C:程序 40