news 2026/4/20 1:52:15

【dz-1059】猪舍环境监测与控制系统设计

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
【dz-1059】猪舍环境监测与控制系统设计

摘 要

随着养猪产业的规模化发展,猪舍环境对生猪生长和健康的影响日益显著。良好的环境条件能够提高生猪的生长速度、降低发病率,从而提升养殖效益。因此,设计一套能够实时监测和自动控制猪舍环境的系统具有重要意义。

本设计基于STM32F103C8T6单片机,DHT11传感器用于监测猪舍环境温湿度,当温度超过设定阈值时,自动启动风机通风并发出声光报警。光照传感器用于检测环境光照强度,并根据设定值自动控制照明灯的开关。SGP30传感器用于监测CO2浓度,MQ-135传感器监测氨气浓度,当检测值超过设定阈值时,系统自动启动风机通风并报警。按键模块用于手动设置各传感器的阈值以及手动控制通风和照明灯。OLED显示屏实时显示当前环境参数,WiFi模块则将数据发送到手机端,用户可以通过手机远程查看数据、设置阈值并控制通风和照明灯。

经过实际测试,该系统能够稳定、准确地监测猪舍内的温湿度、光照、CO₂和氨气浓度等环境参数,并根据预设阈值自动执行通风和照明控制。在不同环境条件下,系统报警功能正常,WiFi模块数据传输稳定,手机端控制流畅。测试结果表明,该系统有效改善了猪舍环境,降低了人工管理成本,提高了生猪养殖的智能化水平,具有良好的应用前景。

关键词:猪舍;单片机;传感器;远程控制;环境监测

ABSTRACT

With the large-scale development of the pig farming industry, the impact of pigsty environment on the growth and health of pigs is becoming increasingly significant. Good environmental conditions can improve the growth rate of pigs, reduce the incidence rate, and thus improve the breeding efficiency. Therefore, designing a system that can monitor and automatically control the pigsty environment in real time is of great significance.

This design is based on the STM32F103C8T6 microcontroller, and the DHT11 sensor is used to monitor the temperature and humidity of the pigsty environment. When the temperature exceeds the set threshold, the fan will automatically start for ventilation and sound an audible and visual alarm. The light sensor is used to detect the ambient light intensity and automatically control the switch of the lighting according to the set value. The SGP30 sensor is used to monitor CO2 concentration, while the MQ-135 sensor monitors ammonia concentration. When the detection value exceeds the set threshold, the system automatically starts the fan ventilation and alarms. The button module is used to manually set the threshold of each sensor and manually control ventilation and lighting. The OLED display screen displays real-time environmental parameters, while the WiFi module sends data to the mobile phone. Users can remotely view the data, set thresholds, and control ventilation and lighting through their mobile phones.

After practical testing, the system can stably and accurately monitor environmental parameters such as temperature, humidity, lighting, CO ₂, and ammonia concentration in the pigsty, and automatically execute ventilation and lighting control according to preset thresholds. Under different environmental conditions, the system alarm function is normal, WiFi module data transmission is stable, and mobile control is smooth. The test results show that the system effectively improves the pigsty environment, reduces manual management costs, and enhances the intelligence level of pig farming, with good application prospects.

KEYWORDS:pigsty; singlechip; Sensors; Remote control; environmental monitoring

1 绪论

1.1 系统研究的背景及意义

1.2 国内外研究现状

1.2.1 国内研究现状

1.2.2 国外研究现状

1.3系统框架结构

2 系统总体设计

2.1系统功能分析

2.2主要模块方案选择

2.2.1 主控模块方案选择

2.2.2 温湿度传感器选择

2.2.3 光照传感器选择

2.2.4 无线通信模块方案选择

2.2 系统总体框架设计

3 系统硬件设计

3.1 主要模块电路设计

3.1.1 STM32F103C8T6单片机简介

3.1.2 单片机最小系统

3.2温湿度监测模块电路设计

3.3光照监测模块电路设计

3.4CO2监测模块电路设计

3.5氨气监测模块电路设计

3.6 按键监测模块电路设计

3.7显示模块电路设计

3.8声光报警模块电路设计

3.9继电器模块电路设计

3.10WiFi模块电路设计

4 系统软件设计

4.1主程序流程设计

4.2温湿度监测子流程设计

4.2CO2模块子流程设计

4.4按键子流程设计

4.5显示模块子流程设计

4.6WiFi模块子流程设计

5 实物制作及功能测试

5.1实物制作

5.2实物功能测试

5.2.1温湿度测控测控实物测试

5.2.2CO2测控实物测试

5.2.3光照测控实物测试

5.2.4氨气测控实物测试

5.2.5WiFi模块实物测试

6 总结

参考文献

致 谢

附录

附录Ⅰ:整体电路图

附录Ⅱ:部分代码

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/19 20:14:11

Apache ShenYu微服务网关快速部署与配置完整指南

Apache ShenYu微服务网关快速部署与配置完整指南 【免费下载链接】shenyu Apache ShenYu is a Java native API Gateway for service proxy, protocol conversion and API governance. 项目地址: https://gitcode.com/gh_mirrors/sh/shenyu Apache ShenYu作为一款高性能…

作者头像 李华
网站建设 2026/4/16 23:28:14

Alertmanager告警管理系统实战:从部署到高可用的完整解决方案

Alertmanager作为现代监控体系中的关键组件,专门负责告警的智能处理与分发。在实际生产环境中,告警管理往往面临信息过载、响应不及时等挑战,而Alertmanager正是解决这些问题的利器。 【免费下载链接】alertmanager prometheus/alertmanager:…

作者头像 李华
网站建设 2026/4/19 10:42:31

PRO Elements完全指南:免费打造专业WordPress网站的终极方案

PRO Elements完全指南:免费打造专业WordPress网站的终极方案 【免费下载链接】proelements This plugin enables GPL features of Elementor Pro: widgets, theme builder, dynamic colors and content, forms & popup builder, and more. 项目地址: https://…

作者头像 李华
网站建设 2026/4/20 1:09:48

多摄像头实时目标检测与跟踪系统完整指南

多摄像头实时目标检测与跟踪系统完整指南 【免费下载链接】Multi-Camera-Live-Object-Tracking Multi-Camera-Live-Object-Tracking: 该项目是一个多摄像头实时目标检测和跟踪系统,使用深度学习和计算机视觉技术,能够对视频中的物体进行检测、跟踪和计数…

作者头像 李华