news 2026/6/9 23:57:26

【dz-700】基于STM32智能水族箱的设计

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
【dz-700】基于STM32智能水族箱的设计

摘要

在水族饲养日益普及的当下,水族箱环境的精准调控对保障水生生物的健康生长至关重要。传统的水族箱管理依赖人工操作,存在监测不及时、调控精度低、劳动强度大等问题,难以满足现代化、精细化饲养的需求。​

基于 STM32F103C9T6 单片机的智能水族箱系统,整合了超声波水位传感器、防水式 DS18B20 温度传感器、PH 检测模块、浊度传感器、光敏电阻、人体热释电 D20S3 传感器、RTC 时钟模块、按键、OLED 显示屏、WIFI 模块及执行设备(加水装置、防水加热棒、换水水泵、补光设备、步进电机投喂装置、充氧设备等),实现了水族箱环境的自动化监测与智能调控。系统核心功能包括:通过超声波传感器检测水位,当水位低于设置最小值时启动加水装置;借助防水式 DS18B20 检测水温,水温低于设置最小值时触发防水加热棒工作;通过 PH 检测模块监测 PH 值,当 PH 值超出设定范围时,启动水泵进行换水;利用浊度传感器检测水体浑浊度,大于设置最大值时,控制水泵换水;通过光敏电阻检测光照值,低于设置最小值时自动补光;通过人体热释电 D20S3 传感器监测水族箱周围是否有人,检测到人时控制补光灯亮起;借助内部 RTC 获取时间,支持通过按键设置 3 个定时投喂时间点,时间到时开启步进电机,10 秒后自动关闭;支持通过按键设置充氧间隔时间及各参数阈值;通过 OLED 显示屏实时显示各项监测数据;利用 WIFI 模块将数据发送至手机端,实现手机端调节各阈值及控制加水、排水、加热、投喂、补光和模式切换。​

该系统的实现,有效提升了水族箱环境调控的自动化与智能化水平,减少了人工干预,确保了水生环境参数的稳定与适宜,为水生生物的健康生长提供了高效、可靠的解决方案,同时为同类智能水族设备的研发提供了参考,具有较高的实际应用价值。

关键词:STM32F103C9T6;智能水族箱;环境监测;自动调控;传感器;WIFI 通信

ABSTRACT

With the increasing popularity of aquatic breeding, precise regulation of aquarium environments is crucial for ensuring the healthy growth of aquatic organisms. Traditional aquarium management relies on manual operations, which have problems such as untimely monitoring, low regulation accuracy, and high labor intensity, making it difficult to meet the needs of modern and refined breeding.​

The intelligent aquarium system based on the STM32F103C9T6 microcontroller integrates ultrasonic water level sensors, waterproof DS18B20 temperature sensors, PH detection modules, turbidity sensors, photoresistors, human pyroelectric D20S3 sensors, RTC clock modules, buttons, OLED displays, WIFI modules, and executive devices (water adding devices, waterproof heating rods, water change pumps, supplementary lighting equipment, stepper motor feeding devices, oxygenation equipment, etc.), realizing automatic monitoring and intelligent regulation of the aquarium environment. The core functions of the system include: detecting water level through an ultrasonic sensor, starting the water adding device when the water level is lower than the set minimum value; using a waterproof DS18B20 to detect water temperature, triggering the waterproof heating rod to work when the water temperature is lower than the set minimum value; monitoring PH value through a PH detection module, starting the water pump for water change when the PH value exceeds the set range (using two relays); detecting water turbidity through a turbidity sensor, controlling the water pump to change water when the turbidity is greater than the set maximum value (using two relays); detecting light intensity through a photoresistor, automatically supplementing light when the light intensity is lower than the set minimum value; monitoring whether there is a person around the aquarium through a human pyroelectric D20S3 sensor, and controlling the supplementary light to turn on when a person is detected; obtaining time through the internal RTC, and supporting setting 3 定时 feeding time points through buttons, when the feeding time comes, the stepper motor is turned on, and automatically turned off after 10 seconds; supporting setting the interval for oxygenation through buttons; allowing setting of various thresholds through buttons; displaying measured values through an OLED display; sending measured data to the mobile phone through a WIFI module, enabling the mobile phone to adjust various thresholds and control water adding, draining, heating, feeding, supplementary lighting, and mode switching.​

The implementation of this system effectively improves the automation and intelligence level of aquarium environment regulation, reduces manual intervention, ensures the stability and suitability of aquatic environment parameters, provides an efficient and reliable solution for the healthy growth of aquatic organisms, and also offers a reference for the research and development of similar intelligent aquatic equipment, with high practical application value.

Keywords:STM32F103C9T6; Intelligent aquarium; Environmental monitoring; Automatic regulation; Sensor; WIFI communication​

目录

第 1 章 绪论

1.1 研究的目的及意义

1.2 国内外发展情况

1.3 本文主要研究内容

第 2 章 设计思路与方案论证

2.1 主要元器件选择

2.1.1 主控芯片选择

2.1.2 超声波水位传感器选择

2.1.3 水温传感器选择

2.1.4 PH 检测模块选择

2.1.5 浊度传感器选择

2.1.6 光照检测模块选择

2.1.7 人体热释电传感器选择

2.1.8 继电器模块选择

2.1.9 步进电机及驱动模块选择

2.1.10 RTC 时钟模块选择

2.1.11 按键模块选择

2.1.12 显示模块选择

2.1.13 WIFI 模块选择

2.2整体设计方案

第 3 章 硬件设计

3.1 主控电路模块

3.2 超声波水位传感器电路

3.3 水温传感器电路

3.4 PH 检测模块电路

3.5 浊度传感器电路

3.6 光照检测模块电路

3.7 人体热释电传感器电路

3.8 步进电机驱动电路

3.9 显示模块电路

3.10 WIFI 模块电路

3.11 按键模块电路

3.12 继电器驱动电路

第4章 系统程序设计

4.1 编程软件介绍

4.2 系统主流程设计

4.3 独立按键

4. 4 A/D模数转换子流程

4.5 直流电机-MX1508驱动模块子流程

4.6 温度检测模块子流程

4.7 时钟模块子流程

4.8 步进电机子流程

4.9 超声波检测模块子流程

4.10 OLED显示流程设计

4.11 WiFi模块子流程设计

第 5 章 实物测试

5.1 整体实物测试

5.2 超声波水位传感器功能测试

5.3 水温传感器功能测试

5.4 PH 检测模块功能测试

5.5 浊度传感器功能测试

5.6 光照与人体感应联动功能测试

5.7 步进电机投喂功能测试

5.8 充氧设备功能测试

5.9 WIFI 模块功能测试

5.10 按键设置与显示功能测试

第 6 章 总结与展望

6.1 总结

6.2 展望

致谢

参考文献

附录

附录一:原理图

附录二:PCB

附录三:主程序

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

云服务器:渗透日常的数字赋能者,连接个人与产业的无形桥梁​

当你在手机上备份旅行照片、用在线文档同步工作进度、通过直播软件观看远隔千里的演唱会时,云服务器正以一种 “隐形却不可或缺” 的姿态,渗透到生活与工作的每一个角落。它不再是科技行业的专属术语,而是像水电一样普惠的数字基础设施&#…

作者头像 李华
网站建设 2026/6/5 14:30:01

云平台云应用运维实施技术方案

建设目标 为企业、应用开发者、维护者提供一站式服务提供本地化实施及技术支持服务能力提供全面的解决方案咨询及实施能力 云计算应用集成解决方案咨询及集成实施能力云计算系统集成解决方案咨询及集成实施能力云计算数据集成解决方案咨询及集成实施能力云主机平台、私有云、混…

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

什么是RS485转LoRa一对多通讯?一篇看懂物联网设备无线组网逻辑

微型LoRa数传模块凭借小体积、低功耗、远距离、抗干扰的核心优势,主要适配低速率、小数据量、电池供电、布线困难的物联网场景,以下是其细分且具体的应用方向: 一、 智慧工业场景 1.设备状态监测:嵌入电机、泵体、机床等设备的…

作者头像 李华
网站建设 2026/6/6 7:24:37

Motia事件驱动的内核:深入适配器(Adapter)层看消息队列的流转

在构建复杂的 AI Agent 系统时,如何保证任务的异步处理、系统的高可用以及各组件之间的解耦?Motia 给出的答案是一个精妙的事件驱动内核。本文作为 Motia 源码深度解析系列的第四篇,将把目光聚焦于 packages/adapters,探索 Motia …

作者头像 李华
网站建设 2026/6/5 19:37:24

一份消除VM蔓延的全面指南

VM 蔓延(又称虚拟化蔓延),指环境中虚拟机(VM)数量失控增长的现象。它常导致资源浪费、成本攀升与管理难题,因此,规避 VM 蔓延刻不容缓。下文将为您分步解析 VM 蔓延的识别、管理与预防方法。一、…

作者头像 李华