news 2026/6/10 13:12:14

【dz-927】基于stm32的温湿度检测设计

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
【dz-927】基于stm32的温湿度检测设计

基于stm32的温湿度检测设计

摘要

在农业种植、家庭园艺等场景中,环境温湿度、土壤湿度及光照等参数的稳定对植物生长至关重要。传统的人工监测与调控方式不仅耗时费力,还难以实现精准控制,易导致植物因环境不适出现生长问题。因此,研发一种能自动监测环境参数并实现智能调控的设备具有重要现实意义。

本设计提出一种基于 STM32F103C8T6 单片机的温湿度检测系统。系统主要功能包括:通过DHT11 温湿度传感器检测当前环境的温湿度;借助YL-69 土壤湿度传感器监测土壤湿度,当湿度小于最小值时,继电器控制水泵自动浇水,直至湿度大于最大值后停止;通过YW01 液位检测模块监测水池液位,液位小于最小值时,继电器控制水泵加水;利用5516 光照检测模块采集环境光照,光照大于最大值时,通过 ULN2003A 驱动四相五线步进电机控制遮阳棚打开;通过按键可设置各参数阈值,手动控制浇水、抽水及遮阳棚开关;所有测量数据通过OLED 显示屏实时展示;系统采用电池供电,确保便携使用。

该系统的作用在于,为植物生长提供了自动化的环境监测与调控方案。通过实时监测与智能响应,精准维持适宜的生长环境,减少人工干预,提高植物养护效率与成功率,为农业种植和家庭园艺提供有力支持。

关键词:STM32;温湿度检测;自动调控;土壤湿度;光照监测

Design of Temperature and Humidity Detection Based on STM32

Abstract

In agricultural planting, home gardening, and other scenarios, the stability of environmental temperature, humidity, soil moisture, and light parameters is crucial for plant growth. The traditional manual monitoring and regulation methods are not only time-consuming and laborious, but also difficult to achieve precise control, which can easily lead to growth problems of plants due to environmental discomfort. Therefore, developing a device that can automatically monitor environmental parameters and achieve intelligent regulation is of great practical significance.

This design proposes a temperature and humidity detection system based on STM32F103C8T6 microcontroller. The main functions of the system include: detecting the temperature and humidity of the current environment through the DHT11 temperature and humidity sensor; Using YL-69 soil moisture sensor to monitor soil moisture, when the humidity is below the minimum value, the relay controls the water pump to automatically water until the humidity exceeds the maximum value and then stops; Monitor the liquid level of the water tank through the YW01 liquid level detection module. When the liquid level is below the minimum value, the relay controls the water pump to add water; Use the 5516 light detection module to collect ambient light. When the light exceeds the maximum value, use ULN2003A to drive a four phase five wire stepper motor to control the opening of the sunshade; By pressing buttons, various parameter thresholds can be set, and watering, pumping, and sunshade switches can be manually controlled; All measurement data is displayed in real-time on an OLED screen; The system is powered by batteries to ensure portability.

The function of this system is to provide automated environmental monitoring and regulation solutions for plant growth. By real-time monitoring and intelligent response, we can accurately maintain a suitable growth environment, reduce manual intervention, improve plant maintenance efficiency and success rate, and provide strong support for agricultural planting and home gardening.

Keywords:STM32; Temperature and humidity detection; Automatic regulation; Soil moisture; Light monitoring

目 录

1 绪论

1.1 研究背景及意义

1.2 国内外研究现状

1.3 主要内容

2 系统总体方案设计

2.1系统总体设计

2.2 主要模块方案选择

3系统硬件设计

3.1 总体硬件框架

3.2 主控模块电路设计

3.3 温湿度检测模块电路设计

3.4 土壤湿度检测模块电路设计

3.5 液位检测模块电路设计

3.6 光照检测模块电路设计

3.7 电机驱动与遮阳棚控制模块电路设计

3.8 继电器与水泵控制模块电路设计

3.9 显示模块电路设计

3.10 按键模块电路设计

3.11 电源模块电路设计

4 系统程序设计

4.1 编程软件介绍

4.2 系统主流程设计

4.3 OLED显示子流程设计

4.4 温湿度检测模块子流程设计

4.5 土壤环境检测模块子流程设计

4.6 独立按键子流程设计

4.7 ADC模数转换子流程设计

5实物制作与功能测试

5.1 实物制作

5.2 温湿度检测功能测试

5.3 土壤湿度检测与自动浇水功能测试

5.4 液位检测与自动补水功能测试

5.5 光照检测与遮阳棚控制功能测试

5.6 阈值设置与参数显示功能测试

6 总结

参考文献

致谢

附录A 原理图

附录B PCB

附录C 主程序

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

小程序VUE

goNext() {// 方法1: 直接使用微信小程序APIwx.switchTab({url: /pages/mine/index})// 如果 mine/index 是 tabbar 页面,必须用 switchTab// 如果不是 tabbar 页面,可以用 navigateTo }

作者头像 李华
网站建设 2026/6/8 20:13:33

【dz-932】基于单片机的车内环境监测系统设计

基于单片机的车内环境监测系统设计 摘要 随着汽车保有量的不断增加,车内环境安全问题日益受到人们的重视。车内温度异常、有害气体浓度超标等情况,不仅会影响驾乘人员的舒适度,更可能对身体健康乃至生命安全造成严重威胁。因此,研…

作者头像 李华
网站建设 2026/6/8 13:54:50

GitHub星标过万的Qwen3-VL-8B项目实战合集

Qwen3-VL-8B:轻量多模态落地的破局者 在AI模型参数竞赛愈演愈烈的今天,一个反向而行的技术路径正悄然崛起——不是追求千亿级“巨无霸”,而是打磨80亿参数级别的“精悍战士”。通义千问团队推出的 Qwen3-VL-8B 正是这一理念的典型代表。它没有…

作者头像 李华
网站建设 2026/6/9 11:15:02

Linux MAC层实现机制深度剖析

Linux MAC层实现机制深度剖析 1. MAC层在网络协议栈中的战略定位 1.1 网络世界的 “交通管理局” 想象一下, 如果网络世界是一个庞大的城市交通系统, 那么MAC(Media Access Control)层就是这座城市的交通管理局. 它位于OSI模型的第二层(数据链…

作者头像 李华
网站建设 2026/6/10 9:29:49

清华源配置Miniconda后仍慢?检查这5个网络设置

清华源配置Miniconda后仍慢?检查这5个网络设置 在人工智能项目开发中,一个常见的场景是:你已经按照教程将 Miniconda 配置为使用清华大学镜像源,信心满满地运行 conda install pytorch,结果命令行却卡在“Solving env…

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

基于SpringBoot2+Vue2的行业知识答题考试系统

行业知识答题考试系统 演示视频 https://www.bilibili.com/video/BV1J8m1BjEuE/ 角色 管理员、考生 技术 SpringBoot2, Vue2, MySQL 核心功能 本系统是一个行业知识答题考试系统,旨在提供一个完整的在线考试解决方案。核心价值在于实现题库的集中管理、试卷…

作者头像 李华