news 2026/1/16 12:48:55

【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/1/11 16:36:32

csp信奥赛C++标准模板库STL(3):list的使用详解

csp信奥赛C标准模板库STL(3):list的使用详解 1. list基本概念 list是C标准模板库(STL)中的双向链表容器。与vector和deque不同,list不支持随机访问,但可以在任意位置快速插入和删除元素。 特点: 双向链表…

作者头像 李华
网站建设 2026/1/12 17:05:30

csp信奥赛C++标准模板库STL(2):deque的使用详解

csp信奥赛C标准模板库STL(2):deque的使用详解 一、deque基本概念 1.1 什么是deque deque(double-ended queue,双端队列)是一种可以在两端进行高效插入和删除操作的序列容器结合了vector和list的优点&…

作者头像 李华
网站建设 2026/1/10 22:05:57

LobeChat部署在Docker中遇到的问题及解决办法总结

LobeChat 部署在 Docker 中的实战问题与深度解析 在构建 AI 聊天系统时,前端体验往往决定了用户是否愿意持续使用。即便底层模型再强大,一个卡顿、掉线或配置丢失的界面也会让用户迅速流失。LobeChat 作为近年来备受关注的开源聊天框架,凭借其…

作者头像 李华
网站建设 2026/1/15 23:45:52

AutoGPT在城市交通流量预测中的建模实验

AutoGPT在城市交通流量预测中的建模实验 在智慧城市的发展浪潮中,交通拥堵已成为制约城市运行效率的核心痛点。传统的交通流量预测系统往往依赖固定的建模流程:数据工程师手动采集数据、算法团队编写脚本清洗特征、模型训练后输出结果——整个过程耗时数…

作者头像 李华
网站建设 2026/1/13 19:38:38

AutoGPT镜像部署最佳实践:提升效率的关键一步

AutoGPT镜像部署最佳实践:提升效率的关键一步 在生成式AI迅猛发展的今天,我们正见证一个关键转折——大模型不再只是“回答问题的工具”,而是逐渐演变为能主动思考、规划并执行复杂任务的智能体。传统聊天机器人依赖用户逐条输入指令&#x…

作者头像 李华