fish001

[Training Camp - Advanced Class] Intelligent fish tank monitoring based on Alibaba Cloud

 
Overview

Project introduction: The intelligent fish tank control system uses sensors to collect data and integrates multiple control functions, including water change, oxygen supply, feeding, lighting, display and other systems. Connected to the Internet through the WiFi module, the mobile APP can remotely monitor the temperature, lighting, feeding, and water changes of the fish tank, and the display screen will display the status of the fish tank in real time.

1. System architecture

image.png

2. Hardware composition

Main control module: STM32F103RB

Sensors: PH value sensor, BH1750 light intensity sensor, DS18B20 temperature sensor, water level detection

Control device: water pump, stepper motor, aerator, heating rod, buttons, display screen

Since the power supply part was designed incorrectly during the first version of the design, causing a short circuit and causing smoke, the IoT development board designed in the basic class was used to complete this design.

First edition (power supply design errors) 1.jpg2.png

Basic Internet of Things Development Board 2.jpg

3. Function introduction

1. Temperature detection and water temperature control Temperature detection is detected by the DS18B20 temperature sensor. The output of DS18B20 is a digital signal, so it can be directly connected to the STM32F103 and the temperature data can be read through a single bus protocol. The temperature control is to control the opening of the heating rod according to the detected temperature value.

2. PH detection and water purification control PH detection is detected by a PH sensor. PH value detection is through A/D conversion to collect PH value and control the water pump to start the water purification system.

3. Light intensity detection and oxygenation control (oxygen concentration detection can be used). Light intensity detection is detected by the BH1750 light intensity sensor module and driven through I2C communication. When the light is too high, the dissolved oxygen in the water will be consumed faster, and the light intensity will increase. Increase, the activity of microorganisms in the water will also intensify. Frequent activity of microorganisms will lead to deterioration of water quality. Based on this, control the operation of the aerator and water purification system.

4. Water level monitoring and control Water level monitoring and control is achieved by detecting water level changes and adding water and changing water.

5. Remote feeding: Timing feeding can be realized through the timing function of the APP, and the stepper motor can also be actively controlled to realize the automatic feeding function.

Precautions:

1. Create a project and add devices in the Life IoT Platform in Alibaba Cloud IoT Platform

(1) Create project


1.png


(2) Function definition


2.png


(3) Human-computer interaction interface


3.png


(4) Select module


3 (2).png


(5) Add a device (the Alibaba Cloud triplet generated by adding the device needs to be recorded. During program development, the triplet needs to be used to connect to the Alibaba Cloud MQTT server)


7.png


(6) Cloud intelligence APP


9.png

2. Program development


(1) ESP8266 module AT command distribution network


Encapsulate the AT command provided by the module through the serial port, and use the serial port output to send the information AT command to the module so that the module can access the router.

            WiFi_printf("AT+CWJAP="%s","%s"
",SSID,PASS); //发送连接路由器
            WiFi_printf("AT+CIPSTART="TCP","%s",%d
",ServerIP,ServerPort);//发送连接服务器指令

(2) MQTT protocol transplantation


Alibaba Cloud IoT platform is an MQTT server. We need to connect ESP8266 to the IoT platform through the MQTT protocol.

Here, the MQTT driver handles some data formats             image.png

(3) Configure WIFI information and Alibaba Cloud triplet information


Here is the triple information macro definition

image.png

Here is the router information macro definition             image.png

(4) Sensor driver development


You need to develop the sensor driver you need to upload sensor data to the cloud.

(I have a light sensor here, and I will improve the sensor later)

(5) Data is uploaded to data distribution control (publish and subscribe)

Report sensor data             image.png

Here is the cloud data delivery processing

image.png

Debugging equipment

Use the serial port for debugging to easily check the device status. image.png There is a ping process here that sends a ping command every 30 seconds to prevent the device from being kicked offline.

Note: Data reporting and distribution are in Jason format

Sensor data reporting (set to report every 30 seconds here) image.png

Data delivery image.png


Project summary

This project was originally planned to design an integrated control board, but due to a design error in the power supply, the board burned out and could only be developed using an IoT development board designed as a basic board. The board will be redesigned later to be equipped with a lithium battery and add a motor. , the aeration equipment is integrated into the fish tank at home. In this project, I gained an understanding of using AT commands to operate modules and the MQTT protocol. I also realized my own shortcomings. It can be said that I am a mess in editing technical documents. I will also need to practice document editing in the future. I would also like to thank Lichuang EDA for organizing this training camp, which gave us this opportunity to practice.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-07-03 18:19:51

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号