当前位置:网站首页>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();
}
}
边栏推荐
猜你喜欢
随机推荐
关于MySql中explain结果filtered的理解
素域和扩域
开发工具:第五章:使用idea生成实体类
opencv语法Mat类型总结
我在启牛开户安全吗?谁能告诉我开不靠谱?
GRUB2的零日漏洞补丁现已推出
金仓数据库 OCCI迁移指南(3. KingbaseES的OCCI特性支持)
Bugku-Misc-贝斯手
2022年SQL大厂高频实战面试题(详细解析)
下载 | 谷歌科学家Kevin P. Murphy发布新书《概率机器学习:高级主题》
块级元素、行内元素、行内块元素
B011 - 51-based multifunctional fingerprint smart lock
缓存一致性MESI与内存屏障
使用设备树时对应的驱动编程
OpenCV安装、QT、VS配置项目设置
插入排序 优化插入排序
【100个网络运维工作者必须知道的小知识!】
XAML WPF item groupBox control
Xingtu has been short of disruptive products?Will this M38T from the Qingdao factory be a breakthrough?
QT basic functions, signals, slots