当前位置:网站首页>B001 - Intelligent ecological fish tank based on STM32
B001 - Intelligent ecological fish tank based on STM32
2022-08-01 17:43:00 【little engineer】
摘要
This project combines software and hardware in one,使用STM32F103A series of single-chip microcomputers are used as the control system,Air temperature and humidity in environmental elements,光照强度,And an intelligent fish tank detection and control system designed for collecting and controlling water temperature,The system can accurately collect the current fish tank environmental information and display the environmental informationLCDscreen for real-time viewing,It enables users to know the current situation of the fish tank in real time,并且用户还可以通过GSMSMS real-time view and control the water pump circulation system of the fish tank as wellLED照明系统.The design cost of this project is low,However, it can collect fish tank environmental information in real time,To achieve intelligent control of the ecological environment of the fish tank according to environmental information,It doesn't take users much time,But it can do both breeding and viewing,Ideal for home ornamental fish farming,Realize the unity of practical and ornamental value.
效果
1:Selected fish tank
2:改造,make a line.Due to the focus on analog functions,Not too much attention to exterior design,So it looks a little messy.
效果


原理图

流程图

完成功能

- 光照强度检测
- Ambient temperature and humidity detection
- Fish tank water temperature detection
- GSM与手机通信
- LCD显示参数信息
- LEDDo fill lighting
- 3-in-1 water pump control
Data covers:
- 源程序
- 参考论文
- 原理图
- Multiple references
- Can be explained
代码片段
/******************************************************************************* * 文件名称:基于STM32smart ecological fish tank * 实验目的: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 Seconds are the premise for the serial screen module to work normally,If there is not enough waiting time, the module may not be able to receive commands normally and cause system errors.
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 Seconds are the premise for the serial screen module to work normally,If there is not enough waiting time, the module may not be able to receive commands normally and cause system errors.
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();
}
}
边栏推荐
猜你喜欢
随机推荐
缓存一致性MESI与内存屏障
金仓数据库 OCCI迁移指南(2. 概述)
自定义注解实现日志打印时屏蔽特定字段不打印
2022年SQL大厂高频实战面试题(详细解析)
成都理工大学&电子科技大学|用于强化学习的域自适应状态表示对齐
Bugku-Misc-贝斯手
机器学习快速入门
QLineEdit学习与使用
QPalette palette, frame color fill
不需要写代码,快速批量修改文件夹中图片的格式
QT_QDialog 对话框
QT常用全局宏定义
M1芯片电脑安装cerebro
金仓数据库 OCCI迁移指南(3. KingbaseES的OCCI特性支持)
Topology Parts Disassembly 3D Visualization Solution
成为优秀架构师必备技能:怎样才能画出让所有人赞不绝口的系统架构图?秘诀是什么?快来打开这篇文章看看吧!...
解决MySQL插入不了中文数据问题
SRM供应商管理系统如何助力口腔护理企业实现采购战略的转型升级
金仓数据库KingbaseES安全指南--6.4. RADIUS身份验证
hcip第九天









