System for monitoring breeding environment of breeding water turtles based on Internet of Things
By using an IoT system to perform multi-redundant calibration of the water turtle's activity trajectory and environmental parameters, the problem of insufficient assessment of captive animal habitats in existing environmental monitoring systems has been solved, achieving environmental adaptive optimization and improved data reliability.
Patent Information
- Application Number
- CN202511663686.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-13
AI Technical Summary
Existing environmental monitoring technologies struggle to assess whether an environment constitutes an attractive and complex suitable habitat for captive animals, and lack effective identification and calibration of sensor data drift, aging, or sudden malfunctions, leading to erroneous interventions and animal welfare issues.
An IoT-based monitoring system for the breeding environment of star-shaped aquatic turtles was adopted. Through a turtle activity trajectory tracking module, a spatial location entropy calculation module, and a multi-source environmental data acquisition module, combined with an environmental status fusion and adjustment module, the system can record the activity trajectory of aquatic turtles in the breeding tank, perform multi-channel redundant numerical calibration of environmental parameters, and adaptively adjust them.
This improved the reliability and fault tolerance of environmental monitoring data, enabled proactive optimization to meet the actual needs of animals, and enhanced the breeding level of turtles.
Smart Images

Figure CN121524923A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of environmental monitoring, and particularly relates to a star point water turtle breeding environment monitoring system based on Internet of Things. BACKGROUND
[0002] The technical field of environmental monitoring refers to a technology of using various sensors, data acquisition devices and communication networks to systematically and continuously monitor and analyze physical, chemical and biological parameters in a specific space or natural environment.
[0003] In the actual operation of the existing environmental monitoring technology, the monitoring mainly focuses on physical and chemical parameters such as temperature and humidity, and can only reflect whether the environment is within the preset safety threshold, but it is difficult to evaluate whether the environment constitutes a suitable habitat with attractiveness and complexity for the monitored object, especially captive animals. For example, a water breeding monitoring system may show that the water temperature and dissolved oxygen are within the standard range, but the internal layout may be too monotonous, leading to stereotyped behavior or stress reaction of the breeding object. These key animal welfare indicators are difficult to capture by traditional sensor networks, and managers are difficult to obtain direct feedback on whether the environmental layout is reasonable. At the same time, the existing technology generally relies on a single sensor reading as the basis for decision-making, and lacks an effective identification and calibration mechanism for sensor data drift, aging or sudden failure. Once the key position sensor fails and outputs incorrect data, the entire automatic control system may make incorrect interventions, such as unnecessary heating when the water temperature is normal, which not only wastes energy, but also may cause harm to the breeding object. Therefore, improvement is needed. SUMMARY
[0004] The purpose of the present application is to solve the shortcomings in the prior art, and to provide a star point water turtle breeding environment monitoring system based on Internet of Things.
[0005] In order to achieve the above-mentioned purpose, the present application adopts the following technical scheme: the star point water turtle breeding environment monitoring system based on Internet of Things comprises: A turtle activity trajectory tracking module is used to collect real-time images of the breeding box, to subtract the background by comparing the pixel differences between consecutive image frames, to identify the moving foreground target, to calculate the geometric center point of the moving foreground target pixel block, to map the center point to a two-dimensional coordinate, to record the real-time two-dimensional coordinates of each star point water turtle in the breeding box, and to generate a real-time two-dimensional coordinate set of the star point water turtle. A spatial position entropy calculation module is used to divide the star point water turtle activity area into MxN virtual grid cells according to the real-time two-dimensional coordinate set of the star point water turtle, to accumulate and statistically the frequency of the real-time two-dimensional coordinate set of the star point water turtle falling into each grid cell within a period, to obtain the occurrence probability by dividing the frequency of a single grid cell by the total frequency, and to obtain the environmental position entropy value by operating the occurrence probability of all grid cells.
[0006] Preferably, the system further includes: The multi-source environmental data acquisition module is used to deploy temperature sensors in the basking platform, hiding cave, and water location in the incubator, in the spawning area and basking platform area, and to deploy water temperature sensors at different depths in the water body. It synchronously collects the measurement readings of each sensor at a fixed frequency, and packages the multi-channel measurement readings read at each synchronous reading into a data frame to obtain redundant values of multi-channel environmental sensors. The environmental state fusion and adjustment module is used to predict the current state range based on the redundant values of the multi-channel environmental sensors, the optimal estimated value of the environmental state at the previous moment, and the water thermal inertia model. It updates the predicted state using the redundant values of the multi-channel environmental sensors at the current moment, identifies and removes readings that deviate from the predicted state range by a set threshold, obtains the optimal estimated value of the environmental state, and identifies areas with abnormal utilization rates in the activity heatmap when the environmental location entropy value is lower than the abundance threshold. It then matches these areas with a preset rule base and generates an adaptive adjustment scheme for the environmental layout.
[0007] Preferably, the turtle activity trajectory tracking module includes: The image foreground extraction submodule is used to compare the grayscale values of the current image frame with the pre-stored background model pixel by pixel based on the real-time image of the incubation box, mark the pixels that exceed the preset difference threshold, form a binarized image, and generate a foreground target pixel mask. The target centroid localization submodule is used to traverse all foreground pixels in the binary image according to the foreground target pixel mask, calculate the average value of the horizontal and vertical coordinates, use the average value as the geometric center point and map it to two-dimensional coordinates to obtain the instantaneous centroid coordinates. The trajectory coordinate serialization submodule is used to attach a collection timestamp to each coordinate based on the instantaneous centroid coordinates, and store the timestamped coordinates into a queue data structure in chronological order to generate a real-time two-dimensional coordinate set of the star turtle.
[0008] Preferably, the spatial location entropy calculation module includes: The activity space gridding submodule is used to divide the activity area of the star-spotted turtle into M×N virtual grid units according to the real-time two-dimensional coordinate set of the star-spotted turtle, traverse each coordinate point in the coordinate set and determine the grid unit to which it belongs, increment the frequency counter of the corresponding grid unit, and obtain the grid unit dwell frequency statistics. The grid probability distribution generation submodule is used to calculate the sum of frequencies of all grid cells based on the frequency statistics of the grid cells, and then divide the count value of each grid cell by the sum of frequencies to obtain the probability of occurrence of each grid cell and establish a spatial location probability distribution map. The location entropy quantization calculation submodule is used to traverse each grid cell in the spatial location probability distribution map, extract the occurrence probability value, and calculate the environmental location entropy value based on the occurrence probability value.
[0009] Preferably, the multi-source environmental data acquisition module includes: The multi-point sensor data reading submodule is used to deploy temperature sensors in the basking platform, hiding cave, and water location in the incubator, in the spawning area and basking platform area respectively, and to deploy water temperature sensors at different depths in the water. The main controller sends data reading commands to all sensors at the same time to obtain instantaneous multi-channel sensor readings. The sensor data synchronization submodule is used to add a unified timestamp to all readings in a batch after the main controller receives all sensor readings, based on the instantaneous multi-channel sensor readings, and to align the readings of different sensors according to the timestamps to generate a synchronized sensor data frame.
[0010] Preferably, the multi-source environmental data acquisition module further includes: The redundant data packaging submodule is used to store the unified timestamp and multi-channel measurement reading data structure as independent data units according to the synchronous sensing data frame, forming a time series data stream, and obtaining multi-channel environmental sensing redundant values.
[0011] Preferably, the environmental state fusion adjustment module includes: The environmental state prediction submodule is used to calculate the theoretical value of the current state by substituting the optimal estimated value of the environmental state at the previous moment into the preset water body thermal inertia equation based on the redundant values of the multi-channel environmental sensors, and superimposing the noise covariance to establish the environmental state prediction interval at the current moment. The state estimation and calibration submodule is used to compare each reading with the prediction interval based on the current environmental state prediction interval and the redundant values of the multi-channel environmental sensors, perform a weighted average on the readings that fall within the interval, and mark and remove readings outside the interval to obtain the environmental state calibration estimate.
[0012] Preferably, the environmental state fusion adjustment module further includes: The enrichment scheme generation submodule is used to calibrate the estimated value based on the environmental state. When the environmental location entropy value is lower than the enrichment threshold, it searches for areas with probability values lower than the set lower limit in the spatial location probability distribution map, extracts the area coordinates, matches the coordinate-related adjustment instructions in the preset rule base, and generates an environmental layout adaptive adjustment scheme.
[0013] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, by continuously comparing pixel differences between image frames and calculating the geometric center point of moving targets, the continuous recording of the activity trajectory of individual spotted turtles in the breeding tank is achieved. The activity area is gridded, and the probability of occurrence is calculated by statistically analyzing the frequency of coordinates falling into each cell, providing an objective data basis for environmental optimization. At the same time, multiple sets of temperature sensors are deployed in key locations such as the egg-laying area and basking platform to obtain redundant values from multiple environmental sensors. Based on the state range predicted by the water body thermal inertia model, the multiple readings are updated and calibrated, effectively identifying and eliminating biased data, improving the reliability of environmental monitoring data and the fault tolerance of the system. Finally, the quantified environmental location entropy value is compared with a preset abundance threshold. When it is lower than the threshold, abnormal utilization areas in the activity heat map can be automatically identified, and a specific adaptive adjustment scheme for the environmental layout can be generated by matching the rule base. This transforms environmental management from a passive response to an active optimization based on the actual needs of the animals, improving the level of breeding turtles. Attached Figure Description
[0014] Figure 1 This is a system flowchart of the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0016] Please see Figure 1 The present invention provides a technical solution: an Internet of Things-based monitoring system for the breeding environment of spotted turtles includes: The turtle activity trajectory tracking module is used to acquire real-time images of the breeding box, compare the pixel differences between consecutive image frames to perform background subtraction, identify moving foreground targets, calculate the geometric center point of the pixel block of the moving foreground target, map the center point to two-dimensional coordinates, record the real-time two-dimensional coordinates of each spotted turtle in the breeding box, and generate a set of real-time two-dimensional coordinates of spotted turtles. The spatial location entropy calculation module is used to divide the activity area of the star-spotted turtle into M×N virtual grid units based on the real-time two-dimensional coordinate set of the star-spotted turtle. It accumulates the frequency of the real-time two-dimensional coordinate set of the star-spotted turtle falling into each grid unit within the statistical period, divides the frequency of a single grid unit by the total frequency to obtain the occurrence probability, and calculates the occurrence probability of all grid units to obtain the environmental location entropy value. The multi-source environmental data acquisition module is used to deploy temperature sensors in the basking platform, hiding cave, and water location in the incubator, in the spawning area and basking platform area, and to deploy water temperature sensors at different depths in the water body. It synchronously collects the measurement readings of each sensor at a fixed frequency, and packages the multi-channel measurement readings read at each synchronous reading into a data frame to obtain redundant values of multi-channel environmental sensors. The environmental state fusion and adjustment module is used to predict the current state range based on redundant values from multiple environmental sensors, the optimal estimate of the environmental state at the previous moment, and the water thermal inertia model. It updates the predicted state using the redundant values from multiple environmental sensors at the current moment, identifies and removes readings that deviate from the predicted state range by a set threshold, obtains the optimal estimate of the environmental state, and identifies areas with abnormal utilization rates in the activity heatmap when the environmental location entropy value is lower than the abundance threshold. It then matches these areas with a preset rule base to generate an adaptive adjustment scheme for the environmental layout.
[0017] The turtle activity tracking module includes: The image foreground extraction submodule is used to compare the grayscale values of the current image frame with the pre-stored background model pixel by pixel based on the real-time image of the incubation box, mark the pixels that exceed the preset difference threshold, form a binarized image, and generate a foreground target pixel mask. The target centroid localization submodule is used to traverse all foreground pixels in the binarized image based on the foreground target pixel mask, calculate the average horizontal and vertical coordinates, use the average value as the geometric center point and map it to two-dimensional coordinates to obtain the instantaneous centroid coordinates. The trajectory coordinate serialization submodule is used to attach a collection timestamp to each coordinate based on the instantaneous centroid coordinates, and store the timestamped coordinates into a queue data structure in chronological order to generate a real-time two-dimensional coordinate set of the star turtle.
[0018] Specifically, based on real-time images from the incubation terrarium, a stable background model is first established. This is achieved by continuously capturing 3000 frames at a frequency of 5 frames per second for the first 10 minutes when there is little or no activity from the spotted turtles in the terrarium. These 3000 frames are then converted to grayscale, and the average of all 3000 grayscale values at each pixel is calculated to generate an average grayscale background image representing the static environment. Simultaneously, the standard deviation of the grayscale value for each pixel is calculated, forming a standard deviation matrix. Next, for each subsequent real-time frame, it is also converted to grayscale, and then pixel-by-pixel, the grayscale value of the current frame is subtracted from the average grayscale value of the corresponding pixel in the background model to obtain a difference image. A dynamic difference threshold is then set. This threshold is calculated as follows: for each pixel, the threshold equals the value of that pixel in the standard deviation matrix multiplied by a preset coefficient plus a base offset. For example, the threshold equals 2.5 times the standard deviation plus a base value of 5. For each pixel (100, ...), the threshold is calculated as follows: ... Taking 150 as an example, if its standard deviation is 4, then its threshold is 2.5 multiplied by 4 plus 5, resulting in 15. The absolute value of the difference of each pixel in the difference image is compared with the dynamic difference threshold of the corresponding pixel. If the absolute value of the difference is greater than the threshold, the pixel is marked as a foreground point in the newly generated binarized image and assigned a value of 255 (white). Otherwise, it is marked as a background point and assigned a value of 0 (black). After completing the initial foreground segmentation, morphological processing is performed on the generated binarized image. Specifically, a 3x3 structuring element is first used to perform an erosion operation to eliminate isolated noise points caused by water surface reflection or small impurities. Then, the same 3x3 structuring element is used to perform two dilation operations to fill the holes inside the main body of the spotted turtle that may be caused by the color being similar to the background, and to connect the broken foreground areas, making the outline of the spotted turtle more complete and smooth. The final processed binarized image is the generated foreground target pixel mask.
[0019] Based on the foreground target pixel mask, initialize a foreground pixel coordinate list and two accumulators: one for summing the horizontal coordinates and the other for summing the vertical coordinates. Simultaneously, set a foreground pixel counter and clear it. Then, starting from the top-left pixel (0, 0) of the binarized image, traverse every pixel in the image using a double loop structure, checking the pixel value of each pixel. If the current pixel value is 255 (i.e., a white foreground point), record the horizontal and vertical coordinates (x, y) of that point. Accumulate the horizontal coordinate x into the horizontal coordinate summator and the vertical coordinate y into the vertical coordinate summator. Simultaneously, increment the foreground pixel counter. After traversing the entire image, check the foreground pixel counter value. If the counter value is greater than a minimum number of valid pixels (e.g., 50 pixels) to avoid misidentifying small noise as a target, then perform centroid calculation. The formula for calculating the centroid's horizontal coordinate is... The formula for calculating the centroid's ordinate is: ,in, and These represent the calculated horizontal and vertical pixel coordinates of the geometric center point. and Let N represent the x and y coordinates of the i-th foreground pixel, and N represent the total number of foreground pixels, which is the final value of the foreground pixel counter. After obtaining the geometric center point in the pixel coordinate system, coordinate mapping is performed to convert it into physical two-dimensional coordinates within the incubator. This mapping relationship is obtained through a pre-calibration process. The calibration method involves placing a calibration board of known size, such as a 10 cm by 10 cm grid board, at the bottom of the emptied incubator, taking a calibration image, and calculating the number of pixels per centimeter in the image. For example, if 10 cm occupies 200 pixels in the image, the pixel-to-physical-size conversion ratio is 0.05 cm per pixel. The calculated centroid pixel coordinates are then... Multiply by this transformation ratio to obtain the instantaneous centroid coordinates.
[0020] Based on the instantaneous centroid coordinates, after each successful calculation of a new centroid coordinate, the operating system's clock function is immediately invoked to obtain the current system time and format it as a UNIX timestamp with millisecond precision, such as 1677628800.123. This timestamp records the acquisition time of the image frame corresponding to that coordinate. Subsequently, this timestamp is compared with the corresponding two-dimensional physical coordinates. The data is combined into a structured record, which is a tuple: (timestamp, x-coordinate, y-coordinate). This newly generated data record is then added as an element to a pre-initialized queue data structure with a fixed length. This queue follows a first-in, first-out (FIFO) principle, and its length is set to 7200. This setting is based on the consideration of acquiring 2 frames per second and needing to store the trajectory data of the most recent hour (2 frames / second * 3600 seconds / hour = 7200 frames). When a new coordinate data record is enqueued, if the current queue length is less than 7200, the new record is directly added to the tail of the queue. If the queue is full, i.e., the length has reached 7200, the oldest data record at the head of the queue is removed first, and then the new data record is added to the tail. This operation ensures that the queue always stores the latest hour's Star Turtle activity trajectory points, and all coordinate points are strictly arranged in chronological order. The entire set of data records in the queue constitutes the real-time two-dimensional coordinate set of the Star Turtle.
[0021] The spatial location entropy calculation module includes: The activity space gridding submodule is used to divide the activity area of the star-spotted turtle into M×N virtual grid units based on the real-time two-dimensional coordinate set of the star-spotted turtle. It traverses each coordinate point in the coordinate set and determines the grid unit to which it belongs. The frequency counter of the corresponding grid unit is incremented by one to obtain the resident frequency statistics of the grid unit. The grid probability distribution generation submodule is used to calculate the sum of frequencies of all grid cells based on the frequency statistics of grid cell residence, and then divide the count value of each grid cell by the sum of frequencies to obtain the probability of occurrence of each grid cell and establish a spatial location probability distribution map. The location entropy quantization calculation submodule is used to traverse each grid cell in the spatial location probability distribution map, extract the occurrence probability value, and calculate the environmental location entropy value based on the occurrence probability value.
[0022] Specifically, based on the real-time two-dimensional coordinate set of the spotted turtle, the physical dimensions of its activity area are first defined. For example, the effective activity range of the terrarium is determined to be a rectangular area 120 cm long and 60 cm wide. Then, based on the desired spatial analysis granularity, the size of the virtual grid unit is determined. For example, each grid unit is set to a 5 cm x 5 cm square. This calculates that the activity area will be divided into an M x N grid, where M equals 120 divided by 5 (24 rows) and N equals 60 divided by 5 (12 columns), forming a 24x12 virtual grid. Next, a two-dimensional integer array of the same size as this virtual grid is created, called the resident frequency matrix, and all elements are initialized to 0. Each element of this matrix corresponds to a frequency counter for a grid unit. Then, data from the most recent statistical period is extracted from the real-time two-dimensional coordinate set of the spotted turtle, such as all coordinate points from the past 24 hours. This process iterates through each coordinate point in the set. For each coordinate point, its corresponding grid cell index is determined by calculation. The calculation method is as follows: the row index i is equal to the result of the coordinate y value divided by the grid cell height of 5 cm and rounded down, and the column index j is equal to the result of the coordinate x value divided by the grid cell width of 5 cm and rounded down. For example, the grid index corresponding to a coordinate point (53.2, 21.8) is (j, i) = (floor(53.2 / 5), floor(21.8 / 5)) = (10, 4). After determining the grid index, the counter value of the corresponding position in the dwell frequency matrix is incremented by one, that is, the value of the dwell frequency matrix [4]
[10] is increased by 1. After traversing all coordinate points within the specified statistical period, the final dwell frequency matrix is the grid cell dwell frequency statistics.
[0023] Based on the grid cell dwell frequency statistics, first initialize a floating-point variable named "Frequency Sum" and set its value to 0. Then, iterate through the entire grid cell dwell frequency statistics matrix using a double loop, accumulating the count value of each grid cell in the matrix into the "Frequency Sum" variable. The expression for this calculation process is as follows: Where S represents the sum of frequencies, This represents the dwell frequency recorded in the grid cell at row i and column j, where M and N are the number of rows and columns of the grid, respectively. For example, if the sum of all frequency counts in a 24x12 grid is 172800, then the frequency sum S is 172800. After calculating the frequency sum, a two-dimensional floating-point array of the same size as the dwell frequency statistics matrix is created and named the spatial location probability distribution map. Then, each cell of the dwell frequency statistics matrix is traversed again. For each cell, its count value is... Divide by the previously calculated total frequency S to obtain the probability of occurrence of that grid cell. The calculation formula is: And store this probability value in the corresponding spatial location probability distribution map. For example, if the frequency count of grid cell (4, 10) is 864 and the total frequency is 172800, then the probability of this cell appearing is 864 divided by 172800, which equals 0.005. This process ensures that the sum of the probabilities of all grid cells is equal to 1. After traversing and calculating the probability of all grid cells, the final generated two-dimensional floating-point array is the spatial location probability distribution map.
[0024] Based on the spatial location probability distribution map, initialize a floating-point variable named environmental location entropy and set it to 0. Then, iterate through each grid cell in the spatial location probability distribution map. For each cell... Extract its corresponding probability value. Before performing the calculation, each probability value is checked. If the probability of a grid cell appearing is... A value of 0 indicates that the Spotted Water Turtle never entered the area during the statistical period, because... It is not mathematically defined, but it is conventionally used in information entropy calculation. The result is 0, so the calculation for this unit is skipped directly, and it does not contribute to the environmental location entropy value. If the probability occurs... If the value is greater than 0, then the contribution of that unit to the total entropy is calculated according to the definition of Shannon entropy, and added to the environmental location entropy variable. The complete formula for calculating environmental location entropy is as follows: Where H represents the final environmental location entropy value, It is a grid cell The probability of occurrence, where M and N are the number of rows and columns of the grid. It is a logarithm with base 2. This logarithmic operation reflects the amount of information. The negative sign ensures that the entropy value is positive. For example, for a grid cell with a probability of 0.005, its contribution to the entropy is -(0.005 * log2(0.005)), which is approximately equal to 0.0382. After summing up the contribution values calculated by all non-zero probability grid cells and traversing all grid cells, the final value in the accumulator is the environmental location entropy value.
[0025] The multi-source environmental data acquisition module includes: The multi-point sensor data reading submodule is used to deploy temperature sensors in the basking platform, hiding cave, and water location in the incubator, in the spawning area and basking platform area respectively, and to deploy water temperature sensors at different depths in the water. The main controller sends data reading commands to all sensors at the same time to obtain instantaneous multi-channel sensor readings. The sensor data synchronization submodule is used to add a unified timestamp to all readings in a batch after the main controller receives all sensor readings from the instantaneous multi-channel sensor readings, and align the readings of different sensors according to the timestamps to generate a synchronized sensor data frame. The redundant data packaging submodule is used to store data structures including a unified timestamp and multiple measurement readings as independent data units based on the synchronous sensing data frame, forming a time-series data stream to obtain redundant values from multiple environmental sensors.
[0026] Specifically, the deployment of DS18B20 digital temperature sensors in the basking platform, hiding burrows, and water within the rearing tank is as follows: Two DS18B20 digital temperature sensors, named Basking Platform Temperature 1 and Basking Platform Temperature 2, are placed at the center and edge of the 60cm x 30cm basking platform area, respectively. A similar sensor, named Burrow Temperature, is placed in the center of the hiding burrow. In the spawning area, which is an area covered with 20cm of sand, one sensor is placed on the sand surface and at a depth of 10cm, named Spawning Area Surface Temperature and Spawning Area Depth Temperature. In the water section, one waterproof DS18B20 sensor is deployed at three depths below the water surface: 5cm, 15cm, and 25cm, named Shallow Water Temperature, Medium Water Temperature, and Water Temperature. The system has a total of 8 temperature sensors. The main controller is configured with a timer, and the sampling frequency is set to once every 30 seconds. At each sampling point, the main controller sends a "start temperature conversion" command to all 8 sensors in parallel or rapidly polling within a total cycle of no more than 50 milliseconds through its I / O pins. After waiting for a fixed conversion time of 750 milliseconds, it sends a "read register" command to each sensor in sequence. Each sensor returns its 12-bit accurate temperature reading through a single bus protocol. For example, the basking platform temperature 1 returns 28.75℃, and the water temperature depth returns 24.125℃. This set of 8 raw temperature readings collected within the same command cycle is the instantaneous multi-channel sensor reading.
[0027] Based on instantaneous multi-channel sensor readings, the main controller internally sets up a receive buffer and a counter, initially set to 0. Each time a reading is successfully received from a sensor, the counter increments by one. When the counter value reaches a preset total of 8 sensors, or when the countdown from the start of the read command exceeds a set timeout threshold (e.g., 1000 milliseconds), a data acquisition batch is considered complete. At this point, the main controller immediately calls its internal Real-Time Clock (RTC) module to obtain a UNIX timestamp, such as 1678886400.123. This timestamp is designated as the unified timestamp for all 8 readings in the batch. Subsequently, a data structure is created containing two main fields: a timestamp field and a reading set field. The obtained unified timestamp is stored in the timestamp field. Then, the 8 sensor readings acquired in the batch, along with their respective unique identifiers (e.g., "sun deck temperature 1", "water temperature depth"), are stored as a key-value pair set in the reading set field, forming a complete data packet, for example, {timestamp: 1678886400.123,} The data structure `readings:{"Sunbathing platform temperature 1":28.75, "Sunbathing platform temperature 2": 28.69, ..., "Water temperature depth": 24.125}}`, which contains a unified timestamp and all aligned readings, is used to generate the synchronized sensor data frame.
[0028] Based on the synchronized sensor data frames, a first-in, first-out (FIFO) memory queue is established. The queue's capacity is set to 2880, calculated based on the requirement of storing 24 hours of data generated every 30 seconds (2 frames / minute * 60 minutes / hour * 24 hours = ). (2880 frames). Whenever a new synchronous sensor data frame is generated, it is pushed to the end of the queue as a whole data unit. If the length of the queue exceeds 2880, the oldest data frame is automatically removed from the head of the queue, thus maintaining the environmental data records of the most recent 24 hours in the queue. Each element in the queue, i.e., a synchronous sensor data frame, contains a unified timestamp and the measurement readings of all 8 sensors at that moment. Since multiple sensors are deployed in specific functional areas (such as balconies and water bodies), each data frame naturally contains multiple measurements of the same environmental parameter (such as balcony temperature or water temperature). These sets of values from different physical locations but measuring the same macroscopic environmental state constitute redundant information. The entire queue data arranged in chronological order forms a time-series data stream containing redundant measurement information. This data stream is used to acquire redundant values from multiple environmental sensors.
[0029] The environmental status fusion and adjustment module includes: The environmental state prediction submodule is used to calculate the theoretical value of the current state by substituting the optimal estimate of the environmental state at the previous moment into the preset water body thermal inertia equation based on the redundant values of multiple environmental sensors, and then superimposing the noise covariance to establish the environmental state prediction interval at the current moment. The state estimation and calibration submodule is used to compare each reading with the prediction interval based on the current environmental state prediction interval and the redundant values of multiple environmental sensors, perform a weighted average on the readings that fall within the interval, and mark and remove readings outside the interval to obtain the environmental state calibration estimate. The enrichment scheme generation submodule is used to calibrate the estimated value based on the environmental state. When the environmental location entropy value is lower than the enrichment threshold, it searches for areas with probability values lower than the set lower limit in the spatial location probability distribution map, extracts the area coordinates, matches the coordinate-related adjustment instructions in the preset rule base, and generates an environmental layout adaptive adjustment scheme.
[0030] Specifically, based on the redundant values of multiple environmental sensors, a simplified water thermal inertia equation is first defined. This equation, based on Newton's law of cooling, is used to predict water temperature changes, and its expression is as follows: ,in, It is the theoretical value of the predicted water temperature at the current time k. It is the water temperature value in the optimal estimate of the environmental state at the previous moment. It was the ambient air temperature at the time (approximately based on readings from cave temperature sensors). It represents the power state of the heater at the previous moment (0 or 1), and the coefficient is... and This is obtained by performing linear regression analysis on historical data; for example, by analyzing data from the past week. This indicates the rate of heat exchange between the water body and the environment. This represents the heater's efficiency in raising the water temperature per unit time, calculated based on the theoretical value at the current moment. Next, a process noise covariance is introduced to quantify the uncertainty of the model itself. This noise covariance is set based on the variance of historical prediction errors. For example, by calculating the variance of the difference between the predicted values and the actual best estimates over the past 100 times, a value of 0.01 is obtained. This value represents the average uncertainty of the model's predictions. Finally, based on this theoretical value and uncertainty, a prediction interval for the current environmental state is established. The interval is calculated by adding or subtracting twice the standard deviation from the theoretical value. or This interval is the interval for predicting the environmental state at the current moment.
[0031] Based on the current environmental state prediction interval and the redundant values from multiple environmental sensors, three readings related to water temperature at the current moment are extracted from the redundant values: shallow water, medium water, and deep water. For example, if the environmental state prediction interval obtained in the previous step is [24.8℃, 25.2℃], and the three currently collected water temperature readings are 25.05℃, 25.10℃, and 25.90℃, comparing these three readings one by one with the prediction interval, 25.05℃ and 25.10℃ both fall within the interval [24.8℃, 25.2℃]. Readings within the range of 25.2℃ were marked as valid, while 25.90℃ exceeded the upper limit of the range and was marked as an abnormal reading, thus being discarded in this calculation. Next, a weighted average was calculated for all valid readings falling within the range. The weighting coefficients were set based on the sensor's physical location and its representativeness of the overall water temperature. These weighting coefficients were pre-set; for example, based on experience, the middle water temperature is considered the most representative, followed by the shallow water, while the deep water is more significantly affected by the bottom material. Therefore, the weight for shallow water was set to 0.3, the weight for middle water to 0.5, and the weight for deep water to 0.2. Since deep water temperature readings were discarded in this calculation, only shallow and deep water temperatures were weighted, and their weights were normalized. The new weights are: shallow water weight 0.3 / (0.3 + 0.5) = 0.375, middle water temperature weight 0.5 / (0.3 + 0.5) = 0.625. The weighted average was calculated as: 25.05 * 0.375 + 25.10 * 0.625 = 9.39375 + 15.6875 = 25.08125℃. This calculated result of 25.08125℃ is the estimated value for environmental condition calibration.
[0032] Based on the environmental state calibration estimate, the system first determines whether the environmental location entropy value is lower than a preset abundance threshold. This abundance threshold is set by recording the daily environmental location entropy values of spotted turtles considered healthy and active within a week during the initial system operation phase, calculating their mean and standard deviation. For example, if the mean is 4.2 and the standard deviation is 0.3, the abundance threshold is set as the mean minus one standard deviation, i.e., 4.2 - 0.3 = 3.9. When the environmental location entropy value calculated in the most recent 24 hours is lower than 3.9, subsequent operations are triggered. Next, the system searches the spatial location probability distribution map for all regions with probability values lower than a preset lower limit. This lower limit is set to 10% of the ideal uniform distribution probability. If the activity area is divided into 288 grids, the uniform distribution probability is 1 / 288, approximately 0.00347, and the lower limit threshold is 0.00347 * 0.1. =0.000347. All grids with a probability lower than this value are identified as areas of abnormal utilization. Then, the coordinates of these low-utilization grid cells are extracted and matched against a preset rule base. This rule base is established based on the knowledge of turtle behavior experts and contains a series of "IF-THEN" rules. For example, rule 1: IF abnormal area coordinates are concentrated in the basking platform area AND the environmental state calibration estimate of the basking platform area is consistently higher than 34℃, THEN generate the instruction "reduce the basking platform heating lamp power by 5%". Rule 2: IF abnormal area coordinates are concentrated in a corner of an open water area AND the environmental state calibration estimate of the water temperature is within a suitable range (24℃-26℃), THEN generate the instruction "place a duckweed-like shelter at coordinates (x,y)". Based on the first matched rule, the system generates a structured JSON instruction, such as {"command": "set_enrichment", "type": "floating_shelter", "location": [105,50]}. This instruction generates an adaptive adjustment scheme for the environmental layout.
Claims
1. An Internet of Things-based monitoring system for the breeding environment of spotted turtles, characterized in that, The system includes: The turtle activity trajectory tracking module is used to acquire real-time images of the breeding box, compare the pixel differences between consecutive image frames to perform background subtraction, identify moving foreground targets, calculate the geometric center point of the pixel block of the moving foreground target, map the center point to two-dimensional coordinates, record the real-time two-dimensional coordinates of each spotted turtle in the breeding box, and generate a set of real-time two-dimensional coordinates of spotted turtles. The spatial location entropy calculation module is used to divide the activity area of the star-spotted turtle into M×N virtual grid units based on the real-time two-dimensional coordinate set of the star-spotted turtle. It accumulates the frequency of the real-time two-dimensional coordinate set of the star-spotted turtle falling into each grid unit within the statistical period, obtains the occurrence probability by dividing the frequency of a single grid unit by the total frequency, and calculates the occurrence probability of all grid units to obtain the environmental location entropy value.
2. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 1, characterized in that, The system also includes: The multi-source environmental data acquisition module is used to deploy temperature sensors in the basking platform, hiding cave, and water location in the incubator, in the spawning area and basking platform area, and to deploy water temperature sensors at different depths in the water body. It synchronously collects the measurement readings of each sensor at a fixed frequency, and packages the multi-channel measurement readings read at each synchronous reading into a data frame to obtain redundant values of multi-channel environmental sensors. The environmental state fusion and adjustment module is used to predict the current state range based on the redundant values of the multi-channel environmental sensors, the optimal estimated value of the environmental state at the previous moment, and the water thermal inertia model. It updates the predicted state using the redundant values of the multi-channel environmental sensors at the current moment, identifies and removes readings that deviate from the predicted state range by a set threshold, obtains the optimal estimated value of the environmental state, and identifies areas with abnormal utilization rates in the activity heatmap when the environmental location entropy value is lower than the abundance threshold. It then matches these areas with a preset rule base and generates an adaptive adjustment scheme for the environmental layout.
3. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 1, characterized in that, The turtle activity tracking module includes: The image foreground extraction submodule is used to compare the grayscale values of the current image frame with the pre-stored background model pixel by pixel based on the real-time image of the incubation box, mark the pixels that exceed the preset difference threshold, form a binarized image, and generate a foreground target pixel mask. The target centroid localization submodule is used to traverse all foreground pixels in the binary image according to the foreground target pixel mask, calculate the average value of the horizontal and vertical coordinates, use the average value as the geometric center point and map it to two-dimensional coordinates to obtain the instantaneous centroid coordinates. The trajectory coordinate serialization submodule is used to attach a collection timestamp to each coordinate based on the instantaneous centroid coordinates, and store the timestamped coordinates into a queue data structure in chronological order to generate a real-time two-dimensional coordinate set of the star turtle.
4. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 1, characterized in that, The spatial location entropy calculation module includes: The activity space gridding submodule is used to divide the activity area of the star-spotted turtle into M×N virtual grid units according to the real-time two-dimensional coordinate set of the star-spotted turtle, traverse each coordinate point in the coordinate set and determine the grid unit to which it belongs, increment the frequency counter of the corresponding grid unit, and obtain the grid unit dwell frequency statistics. The grid probability distribution generation submodule is used to calculate the sum of frequencies of all grid cells based on the frequency statistics of the grid cells, and then divide the count value of each grid cell by the sum of frequencies to obtain the probability of occurrence of each grid cell and establish a spatial location probability distribution map. The location entropy quantization calculation submodule is used to traverse each grid cell in the spatial location probability distribution map, extract the occurrence probability value, and calculate the environmental location entropy value based on the occurrence probability value.
5. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 2, characterized in that, The multi-source environmental data acquisition module includes: The multi-point sensor data reading submodule is used to deploy temperature sensors in the basking platform, hiding cave, and water location in the incubator, in the spawning area and basking platform area respectively, and to deploy water temperature sensors at different depths in the water. The main controller sends data reading commands to all sensors at the same time to obtain instantaneous multi-channel sensor readings. The sensor data synchronization submodule is used to add a unified timestamp to all readings in a batch after the main controller receives all sensor readings, based on the instantaneous multi-channel sensor readings, and to align the readings of different sensors according to the timestamps to generate a synchronized sensor data frame.
6. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 5, characterized in that, The multi-source environmental data acquisition module also includes: The redundant data packaging submodule is used to store the unified timestamp and multi-channel measurement reading data structure as independent data units according to the synchronous sensing data frame, forming a time series data stream, and obtaining multi-channel environmental sensing redundant values.
7. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 2, characterized in that, The environmental state fusion adjustment module includes: The environmental state prediction submodule is used to calculate the theoretical value of the current state by substituting the optimal estimated value of the environmental state at the previous moment into the preset water body thermal inertia equation based on the redundant values of the multi-channel environmental sensors, and superimposing the noise covariance to establish the environmental state prediction interval at the current moment. The state estimation and calibration submodule is used to compare each reading with the prediction interval based on the current environmental state prediction interval and the redundant values of the multi-channel environmental sensors, perform a weighted average on the readings that fall within the interval, and mark and remove readings outside the interval to obtain the environmental state calibration estimate.
8. The IoT-based monitoring system for breeding environment of spotted turtles according to claim 7, characterized in that, The environmental state fusion adjustment module also includes: The enrichment scheme generation submodule is used to calibrate the estimated value based on the environmental state. When the environmental location entropy value is lower than the enrichment threshold, it searches for areas with probability values lower than the set lower limit in the spatial location probability distribution map, extracts the area coordinates, matches the coordinate-related adjustment instructions in the preset rule base, and generates an environmental layout adaptive adjustment scheme.