news 2026/6/15 12:19:44

【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/6/15 10:36:46

Admin.NET高效权限管理框架:实战开发完全指南

Admin.NET高效权限管理框架:实战开发完全指南 【免费下载链接】Admin.NET 🔥基于 .NET 6/8 (Furion/SqlSugar) 实现的通用权限开发框架,前端采用 Vue3/Element-plus,代码简洁、易扩展。整合最新技术,模块插件式开发&am…

作者头像 李华
网站建设 2026/6/15 10:41:57

如何在Windows 11上快速安装Visual C++ 6.0:完整兼容性终极指南

如何在Windows 11上快速安装Visual C 6.0:完整兼容性终极指南 【免费下载链接】VisualC6.0中文版安装包及Win11安装教程 本资源文件提供了Visual C 6.0(简称VC6.0)中文版的安装包下载及在Windows 11系统下的安装教程。VC6.0是一款经典的C开发…

作者头像 李华
网站建设 2026/6/13 1:10:40

PyTorch-CUDA-v2.6镜像是否支持A100/H100?官方适配列表公布

PyTorch-CUDA-v2.6 镜像对 A100/H100 的支持能力解析 在当前大规模模型训练成为主流的背景下,硬件与软件栈的协同优化直接决定了研发效率和算力利用率。NVIDIA 的 A100 和 H100 GPU 已成为高性能 AI 训练集群的核心组件,而 PyTorch 作为最主流的深度学习…

作者头像 李华
网站建设 2026/6/10 16:58:17

Autopsy数字取证工具:从零开始的快速入门指南

Autopsy数字取证工具:从零开始的快速入门指南 【免费下载链接】数字取证工具Autopsy的下载安装与学习指南 本资源文件旨在提供关于数字取证工具Autopsy的详细下载、安装及学习使用指南。Autopsy是一款开源的数字取证工具,广泛应用于计算机取证、数据恢复…

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

PocketPal AI移动端部署革命:解锁手机本地AI模型的无限潜能

在移动设备上直接运行先进的AI语言模型,这不再是遥不可及的梦想。PocketPal AI通过其创新的本地化部署方案,让每个人都能在掌中设备上体验强大的智能对话能力。 【免费下载链接】pocketpal-ai An app that brings language models directly to your phon…

作者头像 李华