Ecological fish tank control system integrating ESP32S3CAM visual identification and intelligent nourishing
By integrating the ESP32S3CAM visual recognition module and image analysis algorithm, the problems of insufficient water quality assessment and lack of biological status monitoring in intelligent aquarium systems have been solved, realizing intelligent environmental control and biological maintenance across the entire chain.
Patent Information
- Application Number
- CN202511759569.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-17
AI Technical Summary
Existing smart aquarium systems lack the ability to monitor water turbidity, cannot identify abnormal fish behavior, and have inaccurate lighting management, resulting in insufficient early warning of water quality deterioration and fish health problems.
The system integrates the ESP32S3CAM vision recognition module and combines it with image analysis algorithms to achieve water turbidity detection, fish behavior recognition, and light intensity calculation, thereby driving the automatic control module to perform coordinated adjustments.
It enables multi-dimensional perception of water clarity, fish activity, and lighting conditions, improving the accuracy and timeliness of environmental control. It can automatically identify abnormal fish behavior and issue timely warnings, thus reducing management risks.
Smart Images

Figure CN121541544A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent aquarium technology, and in particular to an ecological aquarium control system integrating ESP32S3CAM visual recognition and intelligent feeding. Background Technology
[0002] Existing smart aquarium systems mostly use a microcontroller as the core, connecting physical sensors such as temperature and water level, and using simple switching control of actuators such as relays and servos to achieve basic functions such as constant water temperature, water level maintenance, and timed feeding. Such systems usually provide remote status monitoring and manual operation interfaces through a web server, forming a preliminary automated management framework.
[0003] The aforementioned solutions lack sufficient water quality assessment capabilities, making it difficult to effectively monitor water turbidity. They often rely on user judgment and cannot automatically trigger filtration and cleaning. Furthermore, the systems lack the ability to sense the state of the aquarium organisms, failing to recognize abnormal fish behavior (such as violent agitation or prolonged inactivity), thus missing early warning opportunities for water quality deterioration or fish health problems. In addition, existing solutions largely rely on simple timers or photoresistors for lighting management, unable to perform precise closed-loop adjustments based on the actual lighting conditions in the aquarium, and thus failing to simulate a natural light environment that matches the organisms' habits.
[0004] Therefore, in response to the problems mentioned above, this invention proposes an ecological aquarium control system that integrates ESP32S3CAM visual recognition and intelligent feeding. Summary of the Invention
[0005] To overcome the problems of lack of visual perception and blank biological status monitoring in existing intelligent aquarium systems, this invention proposes an ecological aquarium control system that integrates ESP32S3CAM visual recognition and intelligent feeding. By introducing a camera module and integrating advanced image analysis algorithms, it realizes visual perception of water turbidity, fish behavior and light intensity, and drives the automatic control module to coordinate and make decisions, thereby realizing intelligent management of the entire chain from environmental regulation to biological maintenance.
[0006] The technical solution of this invention is: an ecological fish tank control system integrating ESP32S3CAM visual recognition and intelligent nutrition, comprising: The ESP32S3CAM microcontroller is responsible for data aggregation, instruction distribution, and overall scheduling. The environmental monitoring module, connected to the ESP32S3CAM microcontroller, is used to collect environmental parameters of the aquarium in real time. This module includes a temperature sensor, preferably a DS18B20 sensor, using the OneWire bus protocol, configured with 12-bit resolution, a measurement range of -55℃ to 125℃, an accuracy of ±0.5℃, and an outlier detection mechanism that automatically reinitializes when the reading is <-50℃ or >100℃; an ultrasonic water level sensor, operating on the echo ranging principle, derives the distance by calculating the time difference between sound wave emission and echo reception, with a preferred sampling frequency of once every 5 seconds, and uses multiple sampling and averaging to reduce measurement noise; and a camera module, preferably an OV2640 image sensor, outputting JPEG compressed images. The system dynamically adjusts the resolution based on whether PSRAM is provided: UXGA (1600x1200) with PSRAM, and SVGA (800x600) without PSRAM, with a preferred sampling frame rate of 15fps. The automatic control module, connected to the ESP32S3CAM microcontroller, drives the actuators to maintain a stable aquarium environment based on data collected by the environmental monitoring module and preset rules. The automatic control module includes a relay group for controlling the start and stop of the water pump and heater. Its hardware design employs a safety logic of high-level shutdown and low-level activation; all relays are initialized to the off state by default when the system starts. A servo motor drives the feeding mechanism to perform feeding actions, achieving quantitative feeding through precise angle control between the 0° initial standby position and the 20° feeding position, with a preferred single feeding amount of 0.5 grams. The LED light strip preferably uses a WS2812B full-color light strip, supporting various dynamic lighting effects such as sunrise / sunset gradients, rainbow flow, and breathing lights to simulate natural day / night changes. The user interaction module communicates with the ESP32S3CAM microcontroller and provides a remote web visualization interface built on the HTML5+CSS3+JavaScript technology stack, supporting cross-terminal responsive access. The system uses image data acquired by a camera module to execute a visual recognition algorithm based on image analysis. The visual recognition algorithm includes: The turbidity detection algorithm evaluates the clarity of water by calculating the edge gradient difference of pixels in the image and converts it into a turbidity percentage. The algorithm adopts an interlaced sampling strategy, with a preferred sampling step size of 4, which reduces the computational load by about 94% and limits the output to the range of 0% (completely clear) to 100% (completely turbid). The fish abnormal behavior recognition algorithm quantifies the fish movement intensity by comparing the pixel differences of consecutive image frames using the frame difference method, and determines the abnormal behavior based on the proportion of moving pixels. It preferably adopts a downsampling strategy that performs difference detection once every 10 pixels, and sets a threshold where the absolute value of pixel difference is greater than 30 to filter out environmental interference. The illumination intensity calculation algorithm quantifies the ambient illumination intensity by calculating the average brightness value of all pixels in the image. The algorithm has a complexity of O(n) and achieves millisecond-level response.
[0007] Preferably, the turbidity detection algorithm includes: A1 performs interlaced sampling of the acquired image to reduce computational load; A2, iterate through the sampled pixels, calculate the absolute value of the gradient difference between each pixel in the horizontal and vertical directions and sum them up to obtain the total image sharpness value; A3 standardizes the total sharpness value, eliminating the influence of image size and normalizing it to the range of 0-100; A4 converts the normalized sharpness value into a percentage of turbidity.
[0008] Preferably, the fish abnormal behavior recognition algorithm specifically includes: B1 compares the pixel differences between two consecutive frames of images after downsampling and sets a difference threshold to filter out environmental interference. B2, count the number of pixels that exceed the difference threshold as the number of moving pixels; B3: When the number of moving pixels exceeds a preset ratio of the total number of pixels in the image, it is determined to be abnormal fish behavior.
[0009] Preferably, the water level control strategy executed by the automatic control module is a graded threshold control: when the ultrasonic water level sensor detects that the water level is lower than the target water level by a first preset threshold, the water replenishment pump is started, and the first preset threshold is preferably 2 cm below the target water level; when the water level rises back to the target water level, water replenishment is stopped; the system also has a water replenishment safety mechanism, which automatically cuts off the power supply to the water replenishment pump and determines that the water replenishment is abnormal when the water replenishment duration exceeds 5 minutes and still fails to reach the target water level.
[0010] Preferably, the temperature control strategy executed by the automatic control module is a switch control with a hysteresis range: when the temperature sensor detects that the water temperature is lower than the target temperature minus the hysteresis value, the heating rod is started; when the water temperature is higher than the target temperature plus the hysteresis value, the heating rod is turned off; the target temperature is preferably set to a default value of 24℃, and users can customize it within the range of 18℃ to 30℃; the hysteresis value is preferably ±1℃ to avoid frequent start-stop of the heating equipment.
[0011] Preferably, the system also includes a water quality maintenance triggering mechanism: when the turbidity percentage output by the turbidity detection algorithm exceeds a preset threshold, the main water pump is automatically started to perform water circulation filtration until the turbidity drops below the preset threshold.
[0012] Preferably, the control logic of the feeding mechanism includes an anti-conflict mechanism: during the execution of a feeding action, the system automatically shuts down the main water pump and locks new feeding requests until the current feeding action is completed.
[0013] Preferably, the web interface provided by the user interaction module adopts a modular layout, including an environmental status monitoring area, a device status indication area, a manual control area, and a parameter setting area. It also periodically obtains the latest status data asynchronously from the ESP32S3CAM microcontroller through a polling mechanism to update the interface display.
[0014] Preferably, when the sensor readings exceed a reasonable physical range, the system automatically executes a sensor re-initialization process; when a critical sensor continues to malfunction, it uses safe default values to maintain basic system operation and triggers user alarms.
[0015] Preferably, the system also includes a network fault tolerance mechanism: when the network connection is abnormal, a reconnection process is automatically executed, and the key status data accumulated during the interruption is synchronized to the user interaction module after the connection is restored.
[0016] The beneficial effects of this invention are: 1. This invention introduces a camera module and integrates visual recognition algorithms such as turbidity detection, abnormal fish behavior recognition, and light intensity calculation, thereby achieving multi-dimensional perception of water clarity, fish activity status, and lighting environment. This solves the problem of visual perception deficiency caused by the reliance on physical sensors in traditional smart aquarium systems, and expands the system's monitoring capabilities from a single environmental parameter to a comprehensive state including biological behavior.
[0017] 2. This invention achieves closed-loop intelligent control based on actual perception by linking the output of the visual recognition algorithm with the automatic control module. For example, the system can automatically start and stop the filter pump to maintain water quality based on the turbidity percentage obtained from image analysis, or dynamically adjust the LED light strip to supplement light based on the average brightness of the image. This not only improves the accuracy and timeliness of aquarium environment control, but also reduces the management risks caused by sensor limitations or user subjective judgment errors.
[0018] 3. This invention uses the frame difference method to quantify and analyze the movement intensity of fish, which can automatically identify abnormal behavior patterns such as abnormal activity or prolonged stillness in fish and immediately alert the user. This enables early detection and warning of the health status of fish, fills the gap in the existing system for monitoring the status of biological organisms, and allows users to intervene in a timely manner to avoid losses. Attached Figure Description
[0019] Figure 1 The diagram shown is a schematic representation of the system framework of this invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Please see Figure 1 This invention provides an embodiment of an ecological fish tank control system integrating ESP32S3CAM visual recognition and intelligent feeding: In this embodiment, the control unit uses an ESP32-S3 series microcontroller with Wi-Fi and Bluetooth capabilities as the main control chip, specifically the ESP32S3CAM microcontroller. This chip is responsible for running the main control logic, processing sensor data, executing control algorithms, and hosting the web server.
[0022] In this embodiment, the environmental monitoring module is described in detail: The temperature sensor selected is the DS18B20 digital temperature sensor, which connects to the ESP32S3CAM using the OneWire protocol. During the software initialization phase, it is configured with 12-bit resolution to achieve a measurement range of -55℃ to 125℃ and an accuracy of ±0.5℃. At the same time, an outlier detection mechanism is set in the software. When the temperature value read is less than -50℃ or greater than 100℃, the sensor is reinitialized.
[0023] The ultrasonic water level sensor uses an ultrasonic ranging module with an operating frequency of 40kHz. Its TRIG and ECHO pins are connected to two GPIO pins of the ESP32S3CAM, respectively. The ranging principle is based on the time-of-flight of sound waves. Measurement is triggered by sending a 10-microsecond high-level pulse to the TRIG pin, then the duration of the high-level pulse on the ECHO pin is detected, and finally the water level is calculated using the formula: Distance (cm) = Duration (μs) × 0.034 / 2. The system performs a measurement every 5 seconds and, by default, takes three samples and uses the average value as the final result.
[0024] The camera module uses an OV2640 image sensor module, connecting to the ESP32S3CAM via a DVP or SPI interface. In terms of hardware layout, special attention must be paid to isolating its clock (XCLK) and data pins (PCLK) from other peripherals (such as LED strips) to avoid electromagnetic interference. Images are output in JPEG format. Upon startup, the system checks for PSRAM; if present, it sets the image resolution to UXGA (1600x1200) to acquire high-definition images for detailed analysis; otherwise, it automatically downgrades to SVGA (800x600) to ensure basic functionality. The sampling frame rate is set to 15fps, and DMA transfer is used to reduce CPU load.
[0025] In this embodiment, the automatic control module is described in detail: The relay group is used to control equipment such as the main water pump, makeup water pump, and heating rod. The control logic of the relay module is designed to be "active low," meaning that the relay is energized (equipment is on) when the ESP32S3CAM outputs LOW, and the relay is de-energized (equipment is off) when it outputs HIGH. During system initialization, all GPIO pins controlling the relays are set to output mode and written with HIGH to ensure that the equipment is in a safe off state during startup.
[0026] A servo motor is used to drive the mechanical door of the automatic feeder. A 180-degree servo motor is selected and controlled via the PWM pin of the ESP32S3CAM. The feeding action is designed to rotate from the 0° (closed) position to the 20° (open) position, hold this position for 2000 milliseconds (2 seconds) to ensure that about 0.5 grams of feed has completely fallen, and then return to the 0° position.
[0027] The LED light strip uses WS2812B addressable full-color LEDs and is driven by the FastLED library, supporting full-color display and dynamic effects. The system has preset multiple lighting modes, including a "sunrise and sunset gradient" that simulates the natural light cycle, a dynamic "rainbow flow" effect, and a soft "breathing light" effect.
[0028] In this embodiment, an HTTP server is built on the ESP32S3CAM. The front-end interface is developed using HTML5, CSS3, and JavaScript, and adopts a modular layout, divided into an environment status monitoring area, a device status indication area, a manual control area, and a parameter setting area. The front-end uses AJAX technology to send a GET request to the ESP32's / status interface every 3 seconds to obtain the system status returned in JSON format, and dynamically updates the webpage content to achieve remote monitoring.
[0029] In this embodiment, the turbidity detection algorithm is described in detail: This algorithm converts the visual information captured by the camera into a quantified turbidity percentage (0%-100%), providing a direct and objective basis for decision-making for the automatic filtering system, replacing the traditional method that relies on subjective judgment by the user.
[0030] Algorithm steps explained: (1) The OV2640 camera captures a frame of a fish tank image. In order to reduce the amount of computation, the algorithm does not process all pixels, but instead uses a step size of 4 for interlaced sampling, that is, one pixel is taken for processing every 4 rows and every 4 columns, so that the amount of computation is reduced to about 1 / 16 of the full sampling.
[0031] (2) For each sampled pixel (coordinates (x, y)), calculate the absolute value of the gray level difference between it and the pixel to the right (x+1, y) (horizontal gradient dx), and the absolute value of the gray level difference between it and the pixel below (x, y+1) (vertical gradient dy). Accumulate (dx + dy) into a variable named clarity.
[0032] (3) After traversing all sampled pixels, perform standardization: clarity = (clarity / ((width * height) / 16)) / 2.55. This step aims to eliminate the influence of image resolution differences and normalize the clarity value to the range of 0-100. Finally, turbidity = 100 - min(100.0f, max(0.0f,clarity)), outputting a percentage value from 0 (completely clear) to 100 (completely turbid).
[0033] When the turbidity value output by the algorithm exceeds the preset threshold (e.g., 25%), the system automatically starts the main water pump to circulate and filter the water until the turbidity drops below the threshold.
[0034] This embodiment describes the algorithm for identifying abnormal fish behavior, specifically: This algorithm analyzes the motion differences between consecutive frames to automatically identify and alert to abnormal states such as violent agitation or prolonged stillness in fish, filling a gap in biological state monitoring.
[0035] Algorithm steps explained: (1) The system retains the previous frame image (prev_fb) and the current frame image (fb) in memory. When traversing the pixels of the current frame, a downsampling strategy with a step size of 10 is adopted. For each sampled pixel position i, the absolute value of the difference between its gray value and the gray value of the corresponding position in the previous frame is calculated as abs(fb->buf[i] - prev_fb->buf[i]).
[0036] (2) Set a difference threshold (preferably 30). Only when the absolute value of the pixel difference is greater than this threshold will the pixel be counted in the number of "motion pixels". This step can effectively filter out minor interference caused by slow changes in lighting or water ripples.
[0037] (3) After the statistics are completed, calculate the proportion of moving pixels to total pixels. When motionPixels > (fb->len / 100) (i.e., the proportion of moving pixels exceeds 1%), the system determines that the fish behavior is abnormal (abnormal = true).
[0038] (4) A double buffering mechanism is adopted. After the current frame is processed, the memory occupied by prev_fb is released immediately, and the current frame fb is set as the prev_fb for the next round of comparison, so as to keep the memory usage stable within two frames.
[0039] Once an anomaly is detected, the system will display a visual alert in a prominent location on the web user interface (such as displaying "Fish are unusually active"), and may also trigger an LED light strip to emit flashing light of a specific color to attract the user's attention.
[0040] In this embodiment, the algorithm for calculating light intensity is described, specifically: This algorithm calculates the average brightness of the entire frame image to provide feedback signals for the automatic adjustment of LED light strips based on the actual lighting conditions inside the aquarium, making it less susceptible to external environmental interference than traditional photoresistors.
[0041] Algorithm steps: Iterate through each pixel in the image buffer fb->buf (index i from 0 to fb->len-1), and accumulate its brightness value (for grayscale images, this value is the pixel value; for color images, the RGB average value can be simply taken) into a variable sum. After the iteration is complete, the light intensity lightLevel = (float)sum / fb->len.
[0042] The calculated lightLevel can be used as a feedback signal to input the LED control logic. For example, the user can set a target light intensity, and the system can automatically adjust the brightness of the LED strip through PID or simple switch control so that the measured light intensity approaches the target value.
[0043] This embodiment describes the automatic control strategy and safety mechanism, specifically: Temperature control employs a hysteresis-based switching system. The target temperature is set to 24℃ by default, with a hysteresis value of ±1℃. The heating element is activated when the measured temperature is below 23℃ and deactivated when it is above 25℃. This hysteresis effectively prevents frequent relay activation near the water temperature critical point.
[0044] The water level control adopts a graded threshold control. The target water level is 20cm. When the water level is below 18cm, the water replenishment pump is started. When the water level rises back to 20cm, it stops. The system is equipped with a safety timer. If a single water replenishment lasts for more than 5 minutes, the water pump will be forcibly stopped and an error will be reported to prevent continuous water replenishment or dry burning of the equipment due to malfunction.
[0045] Feeding optimization and mutual exclusion logic: (1) The system supports timed feeding (default interval 72 hours) and manual feeding. Before any feeding request is executed, a feedingInProgress flag and the time interval between the last feeding will be checked to prevent repeated feeding.
[0046] (2) When performing the feeding action, the system will first shut down the main water pump (controlled by a relay), then drive the servo motor to complete the feeding, and then resume the operation of the water pump after the servo motor is reset. This mutual exclusion logic prevents the feed from being scattered by the water flow and ensures feeding efficiency.
[0047] Network and fault recovery: (1) The system will automatically connect to Wi-Fi when it starts up. If the connection fails, it will retry every 30 seconds, up to 10 times.
[0048] (2) When abnormal sensor data is detected (such as temperature out of range) or hardware communication fails, the system will attempt to reinitialize the hardware. If the failure continues, the system will use the default safety values (such as setting the light intensity to 128 and the turbidity to 50 when the camera fails) and trigger an alarm to ensure the most basic safe operation of the system.
[0049] This invention provides a comparative example: This comparative example verifies the invention by setting up a control experiment, with a total of three groups of experimental subjects, specifically: Example 1 is the present invention.
[0050] Comparative Example 1 is a traditional physical sensor system with temperature and water level sensors, which can achieve basic temperature control, water level alarm and timed feeding, but does not have a camera or any visual recognition function.
[0051] Comparative Example 2, based on Example 1, removed the fish abnormal behavior recognition algorithm and the light intensity calculation algorithm, and only retained turbidity detection for automatic filtration.
[0052] This experiment used a 60cm aquarium equipped with a filter box, heater base, and a modified automatic feeder. All three groups of experimental subjects had the same configuration. The initial water temperature was set at 24℃ and the water level at 20cm. The experiment lasted for 14 days, simulating daily feeding (automatic feeding once every 3 days) and one human-induced water quality disturbance event (adding a small amount of fish food on the 7th day to simulate overfeeding).
[0053] This experiment used a water quality tester to measure the NTU (turbidity unit) value of the water body at fixed times every day, and recorded the number of times and timing of the automatic filtration pump of the system to start and stop.
[0054] detection indicators Example 1 Comparative Example 1 Comparative Example 2 Water quality stability (NTU value) 4.5 6.8 5.1 Recovery time after water quality disturbance 2.5 hours Human intervention is required. 3.0 hours As shown in the table above, Example 1, utilizing a turbidity detection algorithm, automatically activated the filtration system on day 7 when water quality began to deteriorate (NTU increased) but before reaching a level visible to the naked eye, resulting in rapid water quality recovery and the lowest average NTU value. Comparative Example 1, unable to quantify turbidity, only required manual filtration after the user visually detected the problem, leading to the longest recovery time and the need for intervention. Comparative Example 2, while capable of automatic filtration, recovered more slowly than Example 1, indicating that a complete intelligent control chain (such as automatic pump shutdown during feeding) impacts efficiency.
[0055] On the 7th day of the experiment, when human interference occurred, fish behavior was recorded by a third-party high-definition video recording system. Aquatic experts then conducted a blind review to determine the timing and extent of abnormal behavior, and compared the results with alarm records from various systems.
[0056] detection indicators Example 1 Comparative Example 1 Comparative Example 2 Abnormal behavior identification success rate 95% (Timely Alerts) 0% (Unrecognized) 0% (Algorithm missing) As shown in the table above, the fish abnormal behavior recognition algorithm in Example 1 successfully detected the abnormal activity of the fish school within approximately 15 minutes after overfeeding on day 7 and issued an alarm. Comparative Examples 1 and 2, however, did not provide any relevant warnings.
[0057] This experiment records the water temperature fluctuation range and water level maintenance in real time throughout the entire experiment, and records the total power consumption of each system during the experimental period through a smart socket.
[0058] detection indicators Example 1 Comparative Example 1 Comparative Example 2 Temperature control fluctuation range ±0.6℃ ±1.2℃ ±0.6℃ Water level maintenance compliance rate 99.8% 98.5% 99.7% Total system energy consumption (kWh / 14 days) 1.85 1.92 1.83 As shown in the table above, Example 1 exhibits very stable temperature and water level control. Regarding energy consumption, due to the vision module and on-demand startup strategy of Example 1 and Comparative Example 2, the energy consumption is slightly lower than that of Comparative Example 1, which continuously operates some peripherals. The energy consumption of Example 1 is comparable to that of Comparative Example 2, indicating that adding fish behavior recognition and illumination calculation does not result in a significant energy burden.
[0059] detection indicators Example 1 Comparative Example 1 Comparative Example 2 Frequency of user manual intervention 2 times 9 times 5 times As shown in the table above, the frequency of user intervention in Example 1 is much lower than that in the other two. Comparative Example 1 requires frequent manual operation due to the lack of functionality, while Comparative Example 2 requires more attention due to the lack of some intelligent alarms.
[0060] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. An ecological aquarium control system integrating ESP32S3CAM visual recognition and intelligent feeding, characterized in that: Including: The ESP32S3CAM microcontroller is responsible for data aggregation, instruction distribution, and overall scheduling. The environmental monitoring module, connected to the ESP32S3CAM microcontroller, is used to collect environmental parameters of the aquarium in real time. The environmental monitoring module includes a temperature sensor for collecting aquarium water temperature; an ultrasonic water level sensor for measuring aquarium water level; and a camera module for capturing image data of the aquarium environment. The automatic control module, connected to the ESP32S3CAM microcontroller, is used to drive the actuators to maintain a stable aquarium environment based on data collected by the environmental monitoring module and preset rules. The automatic control module includes a relay group for controlling the start and stop of the water pump and heater; a servo motor for driving the feeding mechanism to perform feeding actions; and an LED light strip for providing illumination and simulating lighting effects. The user interaction module communicates with the ESP32S3CAM microcontroller, providing a remote visual interface that allows users to monitor environmental data, view device status, and manually intervene in control. The system uses image data acquired by a camera module to execute a visual recognition algorithm based on image analysis. The visual recognition algorithm includes: The turbidity detection algorithm assesses water clarity by calculating the edge gradient difference of pixels in an image and converts it into a turbidity percentage. The fish abnormal behavior recognition algorithm quantifies the fish movement intensity by comparing the pixel differences of consecutive image frames using the frame difference method, and determines abnormal behavior based on the proportion of moving pixels. The illumination intensity calculation algorithm quantifies the ambient illumination intensity by calculating the average brightness value of all pixels in the image.
2. The integrated ESP32S3CAM visual recognition and intelligent nutrient replenishment ecological aquarium control system according to claim 1, characterized in that, The turbidity detection algorithm includes: A1 performs interlaced sampling of the acquired image to reduce computational load; A2, iterate through the sampled pixels, calculate the absolute value of the gradient difference between each pixel in the horizontal and vertical directions and sum them up to obtain the total image sharpness value; A3 standardizes the total sharpness value, eliminating the influence of image size and normalizing it to the range of 0-100; A4 converts the normalized sharpness value into a percentage of turbidity.
3. The ecological fish tank control system integrating ESP32S3CAM visual recognition and intelligent nutrient replenishment according to claim 1, characterized in that, The fish abnormal behavior identification algorithm specifically includes: B1 compares the pixel differences between two consecutive frames of images after downsampling and sets a difference threshold to filter out environmental interference. B2, count the number of pixels that exceed the difference threshold as the number of moving pixels; B3: When the number of moving pixels exceeds a preset ratio of the total number of pixels in the image, it is determined to be abnormal fish behavior.
4. The integrated ESP32S3CAM visual recognition and intelligent nutrient replenishment ecological aquarium control system according to claim 1, characterized in that, The automatic control module executes a graded threshold control strategy for water level control: when the ultrasonic water level sensor detects that the water level is lower than the first preset threshold of the target water level, the water replenishment pump is started; when the water level rises back to the target water level, the water replenishment stops.
5. The integrated ESP32S3CAM visual recognition and intelligent nutrient replenishment ecological aquarium control system according to claim 1, characterized in that, The automatic control module executes a temperature control strategy of on / off control with hysteresis: when the temperature sensor detects that the water temperature is lower than the target temperature minus the hysteresis value, the heating rod is activated; when the water temperature is higher than the target temperature plus the hysteresis value, the heating rod is deactivated.
6. The ecological fish tank control system integrating ESP32S3CAM visual recognition and intelligent nutrient replenishment according to claim 1, characterized in that, The system also includes a water quality maintenance trigger mechanism: when the turbidity percentage output by the turbidity detection algorithm exceeds a preset threshold, the main water pump is automatically started to perform water circulation filtration until the turbidity drops below the preset threshold.
7. The integrated ESP32S3CAM visual recognition and intelligent nutrient replenishment ecological aquarium control system according to claim 1, characterized in that, The control logic of the feeding mechanism includes an anti-conflict mechanism: during the execution of a feeding action, the system automatically shuts down the main water pump and locks new feeding requests until the current feeding action is completed.
8. The ecological aquarium control system integrating ESP32S3CAM visual recognition and intelligent nutrient replenishment as described in claim 1, characterized in that: The web interface provided by the user interaction module adopts a modular layout, including an environmental status monitoring area, a device status indication area, a manual control area, and a parameter setting area. It also updates the interface display by periodically obtaining the latest status data asynchronously from the ESP32S3CAM microcontroller through a polling mechanism.
9. The integrated ESP32S3CAM visual recognition and intelligent nutrient replenishment ecological aquarium control system according to claim 1, characterized in that: When the sensor readings exceed a reasonable physical range, the system automatically executes a sensor re-initialization process. When a critical sensor continues to malfunction, it uses safe default values to maintain basic system operation and triggers user alarms.
10. The integrated ESP32S3CAM visual recognition and intelligent nutrient replenishment ecological aquarium control system according to claim 1, characterized in that, The system also includes a network fault tolerance mechanism: when the network connection is abnormal, the reconnection process is automatically executed, and the key status data accumulated during the interruption is synchronized to the user interaction module after the connection is restored.
Citation Information
Cited By
Radiator performance detection device and detection method
CN122016175A