当前位置:网站首页>B001 - 基于STM32的智能生态鱼缸
B001 - 基于STM32的智能生态鱼缸
2022-08-01 17:33:00 【小小工程员】
摘要
本项目结合软件和硬件于一体,使用STM32F103系列单片机作为控制系统,对环境要素中的空气温湿度,光照强度,以及水温度进行采集与控制而设计的一款智能鱼缸检测控制系统,该系统能够精准采集当前鱼缸环境信息并将环境信息显示到LCD屏幕上以供实时查看,使用户能够实时了解到当前鱼缸的情况,并且用户还可以通过GSM短信实时查看和控制鱼缸的水泵循环系统以及LED照明系统。本项目设计成本较低,但是能够实时采集鱼缸环境信息,做到根据环境信息智能控制鱼缸生态环境,不需要花费用户太多时间,却能够做到养殖与观景两不误,非常适合家用观赏鱼养殖,实现实用与观赏价值的统一。
效果
1:所选鱼缸
2:改造,做线路。由于注重于模拟功能,没有过多注重外观设计,故显得略微杂乱。
效果


原理图

流程图

完成功能

- 光照强度检测
- 环境温湿度检测
- 鱼缸水温检测
- GSM与手机通信
- LCD显示参数信息
- LED做补光照明
- 三合一水泵控制
资料涵盖:
- 源程序
- 参考论文
- 原理图
- 多项参考资料
- 可加讲解
代码片段
/******************************************************************************* * 文件名称:基于STM32的智能生态鱼缸 * 实验目的:1. * 2. * 程序说明:完整程序Q:2772272579;@: [email protected] * 日期版本: *******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** * @说明 主函数 * @参数 None * @返回值 None */
int main(void)
{
u8 i=0;
int ret=0;
Relay_Init();
LED_Init();
LED_Control(ON);
Delay_ms(1000);
LED_Control(OFF);
Proc_Init();
USART2_Init();
Delay_ms(1000);//上电等待 1 秒是串口屏模块正常工作的前提,如果没有足够的等待时间模块有可能无法正常的接收指令而导致系统出错。
printf("CLR(LCD_ColorStructure.LCD_BackColor);DIR(3);SBC(LCD_ColorStructure.LCD_SBCColor);\r\n");
USART2_CheckBusy();
printf("DCV32(124,8,'初始化界面 ',%d);\r\n",LCD_ColorStructure.LCD_TextColor);
USART2_CheckBusy();
printf("DCV32(12,40,'制作人:*** ',%d);\r\n",LCD_ColorStructure.LCD_TextColor);
USART2_CheckBusy();
printf("DCV32(12,72,'正在检测DHT11接口:',%d);\r\n",LCD_ColorStructure.LCD_TextColor);
USART2_CheckBusy();
if(DHT11_Init() == 1)
{
printf("DCV32(300,72,'失败',%d);\r\n",1);
USART2_CheckBusy();
}
else
{
printf("DCV32(300,72,'成功',%d);\r\n",2);
USART2_CheckBusy();
}
USART3_Init();
Delay_ms(1000);//上电等待 1 秒是串口屏模块正常工作的前提,如果没有足够的等待时间模块有可能无法正常的接收指令而导致系统出错。
printf("DCV32(12,200,'GSM配置:',%d);\r\n",LCD_ColorStructure.LCD_TextColor);
USART2_CheckBusy();
for(i = 0;i < STABLE_TIMES;i++)//等待GSM网络稳定
{
delay_20ms(100);
ret = check_status(); //初始化配置
if(ret==1)
{
break;
}
}
if(ret == 1)
{
printf("DCV32(140,200,'通信成功 ',%d);\r\n",2);
USART2_CheckBusy();
Delay_ms(200);
ret = config_format();//配置
if(ret == 1)
{
printf("DCV32(140,200,'配置成功 ',%d);\r\n",2);
USART2_CheckBusy();
LCD_DefShow.state_gsm=0;
Delay_ms(500);
}
else
{
printf("DCV32(140,200,'配置失败 ',%d);\r\n",1);
USART2_CheckBusy();
LCD_DefShow.state_gsm=1;
Delay_ms(500);
}
}
else
{
printf("DCV32(140,200,'通信失败 ',%d);\r\n",1);
USART2_CheckBusy();
LCD_DefShow.state_gsm=1;
Delay_ms(500);
}
CLR_Buf();//清空串口数组,准备接收 GSM信息
printf("CLR(LCD_ColorStructure.LCD_BackColor);DIR(3);SBC(LCD_ColorStructure.LCD_SBCColor);\r\n");
USART2_CheckBusy();
ADC1_Init();
TIM4_Init();
ds18b20_init_x();
ds18b20_startchange();
while(1){
if(TIM4_FlagStatus.Flag_200MS == SET){
TIM4_FlagStatus.Flag_200MS = RESET;
if(LCD_DefShow.state_MD == 0)
LED_Control(REVERSE);
else
LED_Control(OFF);
Proc_200Ms();
}
if(find_string_flag == 1)
{
Delay_ms(1000);//延时一点,让串口把数据接收完成
if(Find((u8 *)"+CMTI"))//说明接收到了短信
{
ret = read_message();
if(ret == 1)
{
SIM800_CmdHandle();
}
CLR_Buf();
}
CLR_Buf();
}
LCD_Display();
}
}
边栏推荐
猜你喜欢

Xingtu has been short of disruptive products?Will this M38T from the Qingdao factory be a breakthrough?

C#中关于DevExpress的常用操作和帮助类项目工程内容说明

后台管理系统的权限思路

数字化采购管理系统开发:精细化采购业务流程管理,赋能企业实现“阳光采购”

RecSys'22|CARCA: Cross-Attention-Aware Context and Attribute Recommendations

2022年MySQL最新面试题

TCP million concurrent server optimization parameters

Flask框架实战

The site is not found after the website is filed. You have not bound this domain name or IP to the corresponding site! The configuration file does not take effect!

SQL的索引详细介绍
随机推荐
[供应链·案例篇]石油和天然气行业的数字化转型用例
The anxiety of the post-90s was cured by the vegetable market
SRM供应商管理系统如何助力口腔护理企业实现采购战略的转型升级
【R语言】批量重命名文件
MySQL 慢查询
TCP百万并发服务器优化调参
想做期货,农产品期货怎么炒?波动大么
GTK修改pixmap像素,提取pixmap像素RGB值
[ACNOI2022]物品
Winform的消息提示框帮助类
GridControl helper class for DevExpress
Unity ui点击事件只响应最上层ui的方式
matlab 基于奇偶校验的LSB隐藏水印 三种改进
03 gp cluster construction
UI helper class for Winform - some components will use DevExpress components
JumpServer堡垒机部署
Path helper class for C#
不需要写代码,快速批量修改文件夹中图片的格式
访问域名直接访问wordpress
完全背包问题求组合数和排列数