当前位置:网站首页>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();
}
}
边栏推荐
猜你喜欢
随机推荐
【Day_11 0506】求最大连续bit数
TCP million concurrent server optimization parameters
完美指南|如何使用 ODBC 进行无代理 Oracle 数据库监控?
【R语言】对图片进行裁剪 图片批量裁剪
理财产品的月年化收益率怎么算?
关于LocalDateTime的全局返回时间带“T“的时间格式处理
深圳市商务局2022年度中央资金(跨境电子商务企业市场开拓扶持事项)申报指南
XAML WPF item groupBox control
tooltip 控件
LeaRun.net快速开发动态表单
金仓数据库KingbaseES安全指南--6.4. RADIUS身份验证
频域分析实践介绍
研发团队数字化转型实践
后台管理系统的权限思路
QT_QDialog dialog
Shell nl命令详解(显示行号、读取文件)
OnePlus 10RT appears on Geekbench, product launch also seems to be approaching
When custom annotations implement log printing, specific fields are blocked from printing
使用设备树时对应的驱动编程
吴恩达机器学习课后习题——kmeans