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.
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)
Basic Internet of Things Development Board
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.
WiFi_printf("AT+CWJAP="%s","%s"
",SSID,PASS); //发送连接路由器
WiFi_printf("AT+CIPSTART="TCP","%s",%d
",ServerIP,ServerPort);//发送连接服务器指令
Here, the MQTT driver handles some data formats
Here is the router information macro definition
(I have a light sensor here, and I will improve the sensor later)
Report sensor data
Use the serial port for debugging to easily check the device status.
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)
Data delivery
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.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet