Live pig ear tag type wearable disease detection sensor and early warning system
By integrating multi-parameter sensing terminals and deep learning models, the wearable disease detection sensor and early warning system for pig ear tags solves the problems of lag and high equipment cost of traditional monitoring methods, and realizes real-time, continuous, and accurate monitoring and early warning of pig health status.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-10
- Publication Date
- 2026-04-14
AI Technical Summary
Traditional methods for monitoring swine diseases cannot achieve real-time, continuous, and multi-parameter fusion analysis, resulting in delayed epidemic prevention and control. Furthermore, existing equipment is costly and has limited communication coverage, failing to meet the needs of large-scale farms.
A wearable disease detection sensor and early warning system for pigs using ear tags was designed. It integrates a multi-parameter sensing terminal, a low-power wide-area data transmission gateway, and an embedded behavior judgment and disease detection and early warning model. Real-time data transmission and cloud analysis are achieved through LoRa and 4G communication, and health status is assessed by combining a deep learning model.
It enables real-time, continuous, and accurate monitoring of pig health status, allowing for early disease diagnosis, reduced equipment costs, expanded communication coverage, reduced manual inspection intensity, and improved efficiency in epidemic prevention and control.
Smart Images

Figure CN121845533A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of animal husbandry technology and relates to a wearable disease detection sensor and early warning system for pigs using ear tags. Background Technology
[0002] Pig farming is a pillar industry of my country's agricultural economy. With the continuous expansion of farming scale, disease prevention and control has become a key bottleneck restricting the industry's development. Highly contagious diseases such as African swine fever and porcine reproductive and respiratory syndrome (PRRS) cause significant economic losses annually. Traditional disease monitoring methods have obvious shortcomings: clinical observation relies on human experience, making early detection difficult; laboratory testing takes 24-72 hours, leading to diagnostic delays; and sampling coverage is less than 5%, making it impossible to monitor the entire herd. These shortcomings lead to a passive response in disease prevention and control, seriously threatening meat supply security. Physiological parameters and behavioral characteristics of pigs are key indicators for early disease warning. Abnormal body temperature is the primary marker of febrile diseases, decreased blood oxygen saturation is directly related to respiratory diseases, and changes in heart rate and abnormal movement behavior better reflect subclinical states. However, traditional methods cannot achieve real-time, continuous, and stress-free monitoring of these key indicators, and lack the ability to perform multi-parameter fusion analysis.
[0003] In recent years, the Internet of Things (IoT) and artificial intelligence (AI) technologies have provided new pathways for smart farming. Sensors, low-power communication (LoRa / 4G), and edge computing technologies have enabled wearable devices to achieve miniaturization, high precision, and long battery life. The combination of multimodal sensing and machine learning algorithms provides technical feasibility for mining disease characteristics from complex data. However, existing technological solutions still have significant shortcomings: imported equipment is expensive; domestically produced equipment mostly only supports body temperature monitoring, with limited functionality; communication coverage radius is limited (<15m), making it difficult to adapt to the environment of large-scale farms; and cloud processing modes have high latency, failing to meet the needs of real-time early warning.
[0004] Currently, the inability to provide early warnings for the disease leads to a high mortality rate from African swine fever; antibiotics are difficult to monitor accurately and optimize their use, resulting in high medication costs; and monitoring cannot be automated, requiring intensive manual inspections. Summary of the Invention
[0005] Purpose of the invention: The purpose of this invention is to provide a wearable ear tag-type disease detection sensor and early warning system for pigs that integrates a multi-parameter sensing terminal, a low-power wide-area data transmission gateway, an embedded behavior judgment and disease detection early warning model, and a cloud data management platform to achieve real-time, continuous, and accurate monitoring of multi-dimensional physiological indicators such as body temperature, blood oxygen, pulse, and movement behavior. This system constructs a sensor and early warning system for pigs that covers the perception layer, transmission layer, and application layer.
[0006] The technical solution of this invention is as follows: A wearable ear-tag disease detection sensor and early warning system for pigs, comprising: a wearable ear-tag sensor for wearing on a pig's ear to collect physiological parameters and behavioral data, and to perform local judgment and processing on the behavioral data to obtain detection data; a data transmission gateway wirelessly connected to the wearable ear-tag sensor for receiving and aggregating detection data from one or more wearable ear-tag sensors; and a cloud analysis platform connected to the data transmission gateway for storing and analyzing the received detection data, assessing the pig's health status based on a preset pig disease detection and early warning model, and generating early warning information.
[0007] Furthermore, the wearable sensor for pigs with ear tags includes an ear tag-shaped sensor housing, which includes a matching upper sensor housing and a lower sensor housing. A PCB sub-board, a PCB motherboard, and a battery are installed inside the upper and lower housings of the sensor. A temperature sensor and a light sensor port are mounted on the outer wall of the upper housing of the sensor. A matching rubber gasket is also installed on the outside of the sensor housing.
[0008] Furthermore, it also includes a multi-parameter sensing module, a main control module, a wireless communication module, and an antenna array; The multi-parameter sensing module includes a temperature sensor for collecting body temperature, a blood oxygen pulse sensor for collecting blood oxygen saturation and pulse rate, and a triaxial acceleration sensor for collecting triaxial acceleration data. The main control module is electrically connected to the multi-parameter sensing module and is used to control data acquisition, run embedded behavior judgment algorithms, and manage wireless communication. The wireless communication module is connected to the main control module and is used to communicate with the data transmission gateway using the LoRa protocol. The antenna array is connected to the wireless communication module and adopts a multi-antenna parallel layout to achieve directional signal enhancement; The temperature sensor and blood oxygen pulse sensor are placed on the PCB daughter board, while the triaxial accelerometer, main control module, wireless communication module, and antenna array are all placed on the PCB mother board.
[0009] Furthermore, the battery is connected to the PCB motherboard via a battery base. It also includes a wireless charging module, a receiver module and receiver module coil connected to it, and a transmitter module coil and transmitter module connected to it. The receiving module is placed on the PCB motherboard, and the receiving module coil connected to it is located below the battery; The transmitting module and transmitting module coil are placed separately outside the pig ear tag-type wearable sensor, and the battery is charged non-contactly through electromagnetic induction. Antenna array: The circuit layout uses a signal shielding copper layer, which can effectively reduce the impact of external electromagnetic interference on wireless signal transmission and improve data transmission stability.
[0010] Furthermore, the input to the embedded behavior judgment algorithm is data collected by a triaxial accelerometer, specifically including: Gravity component elimination and coordinate system standardization were performed on the raw triaxial acceleration data. The attention mechanism is applied to extract key behavioral-related features from calibrated data; The KNN algorithm is used to compare the extracted features with the pre-stored standard behavioral feature templates, output the current behavioral state label, and organize them to obtain a behavioral data sequence.
[0011] Furthermore, the detection modes of the pig ear tag wearable sensor include a basic detection mode and a high-fidelity detection mode; The basic detection mode is used for low-power routine monitoring, and periodically collects physiological parameters such as triaxial acceleration data, blood oxygen concentration, pulse rate and body temperature at a lower sampling frequency. The high-fidelity detection mode is used for high-precision monitoring under abnormal conditions. It adopts a higher sampling frequency and continuous acquisition method to collect and process multi-parameter data more intensively in real time.
[0012] Furthermore, the data transmission gateway includes a power supply circuit, a gateway housing, a boost module, a 4G module, and a LoRa wireless receiving module installed inside the gateway housing and interconnected with each other; and an antenna partially installed inside the gateway housing. The power supply circuit is connected to the boost module; The LoRa wireless receiving module is connected to the antenna and serves as the first communication unit, used to communicate with the pig ear tag wearable sensor using the LoRa protocol. The copper rod portion of the antenna is exposed on the outside of the gateway housing, while its base portion is fixed inside the gateway housing. The 4G module serves as a second communication unit, used to communicate with the cloud analysis platform via a 4G / 5G mobile network.
[0013] Furthermore, the health status assessed by the cloud-based analytics platform is based on an anomaly triggering mechanism, and its evaluation method is as follows: Based on the breed, age, and historical health data of the target pigs, the normal threshold range of their physiological parameters is dynamically determined. The received real-time physiological parameters are compared with the normal threshold range, and the duration and proportion of specific behaviors are calculated based on the behavioral data sequence to determine whether there is a continuous abnormal behavior pattern. When physiological parameters exceed the threshold range or there is a persistent abnormal behavior pattern, the swine disease detection and early warning model is triggered. It integrates real-time physiological parameters, behavioral data sequences, and environmental data to conduct a comprehensive diagnosis, calculate a health risk score, and infer potential disease types.
[0014] Furthermore, the swine disease detection and early warning model includes a data receiving and verification branch for processing input data, including timestamps, body temperature, pulse, blood oxygen saturation, and behavioral data; a feature engineering and time series construction branch for extracting and serializing the input data to obtain the time series data of the input deep learning inference branch; a deep learning inference branch for extracting time series features using a deep learning-based time series prediction model, and obtaining the disease probability feature vector and risk assessment index after processing; and an output correction branch for obtaining the health status based on the correction results. The deep learning inference branch includes: an input layer for converting input time-series data into embedding vectors; an LSTM layer for extracting long-term dependent features from the embedding vectors; a projection layer for projecting the output of the LSTM layer onto a multi-head attention layer; a multi-head attention layer for calculating attention weights, aggregating contextual information, and obtaining aggregated features; a fully connected layer for mapping the aggregated features to the output dimension to obtain the initial disease probability; and a medical rule correction module for fusing probability features and rule knowledge to appropriately correct the final probability and obtain the correction result.
[0015] Furthermore, a method for detecting and warning of swine diseases is applied to a system including a wearable ear tag sensor for swine, a data transmission gateway, and a cloud analysis platform. The operational steps include: Physiological parameters and raw behavioral data of pigs are collected by wearable ear tags, and behavioral status information is obtained by real-time behavioral judgment on the raw behavioral data at the sensor end. Data packets containing physiological parameters and behavioral status information are sent to the data transmission gateway, which then forwards them to the cloud analysis platform. On the cloud-based analysis platform, based on physiological parameters and behavioral status information, the health status of pigs is assessed using a pig disease detection and early warning model. If an abnormality is detected, an early warning message is generated and pushed to the user terminal. When an abnormal health status is detected, the cloud analysis platform sends an enhanced data acquisition command to the corresponding pig ear tag wearable sensor through the data transmission gateway, triggering the pig ear tag wearable sensor to enter the corresponding frequency data acquisition mode.
[0016] Beneficial Effects: Compared with existing technologies, this invention has the following significant advantages: This invention features long-term continuous monitoring, early diagnosis of swine diseases, long transmission distance, convenient operation, and minimal impact on swine; the sensor monitors key parameters related to swine health by fitting it to the swine's ear, uses LoRa wireless communication technology to send data to a data transmission gateway, and uses 4G communication technology to synchronize the data to a cloud platform. The cloud platform analyzes the key parameters of the swine's ear and uses behavioral judgment algorithms and disease detection and early warning algorithms to determine the swine's behavior and health status; when a swine is detected to be in a sub-healthy state, a danger alarm is sent to the mobile device, prompting the user to care for and treat the sub-healthy swine. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the overall structure of the present invention; Figure 2 This is a schematic diagram of the structure of the wearable ear tag sensor for pigs in this invention; Figure 3 This is a schematic diagram of the matching rubber gasket for the pig ear tag wearable sensor in this invention; Figure 4 This is a schematic diagram of the structure of the battery powering the wireless charging module of the present invention; Figure 5 This is a schematic diagram of the data transmission gateway in this invention; Figure 6 This is a schematic diagram of another in-ear sensor according to the present invention; Figure 7 This is a structural framework diagram of the abnormal triggering mechanism of the present invention; Figure 8 This is a comparison chart of temperature detection errors of the NTC sensor of the present invention; Figure 9 This is a graph showing the measured blood oxygen concentration data of pigs using the sensor of this invention; Figure 10 This is a graph showing the measured pulse data of pigs using the sensor of this invention; In the diagram: 1. Sensor upper shell, 2. Temperature probe, 3. Photosensitive port, 4. PCB daughter board, 5. PCB mother board, 6. Battery, 7. Sensor lower shell, 8. Power supply circuit, 9. Gateway shell, 10. Boost module, 11. 4G module, 12. LoRa wireless receiver module, 13. Antenna, 14. Receiver module, 15. Receiver module coil, 16. Transmitter module coil, 17. Transmitter module. Detailed Implementation
[0018] The specific technical solution of the present invention will be further described in detail below with reference to specific examples.
[0019] As shown in the figure, the wearable disease detection sensor and early warning system for pigs described in this invention can achieve high-precision measurement of pig ear temperature, blood oxygen, pulse, and posture. The system includes: a wearable ear tag sensor for pigs (sensor placement, key ear parameter acquisition); a data transmission gateway (repeater data synchronization) for wirelessly connecting to the wearable ear tag sensor and receiving and aggregating detection data from one or more wearable ear tag sensors; and a cloud analysis platform (cloud platform disease detection and early warning) for storing and analyzing the received detection data, assessing the pig's health status based on a preset pig disease detection and early warning model, and generating early warning information. The wearable ear tag sensor for pigs consists of three core components: a PCB circuit board, a protective shell, and a power supply battery. It incorporates a pig behavior judgment algorithm and has the function of continuously monitoring key physiological parameters of pigs (including but not limited to body temperature, blood oxygen saturation, and pulse rate). It also transmits the monitored physiological data to the data transmission gateway in real time via the LoRa wireless transmission protocol. The sensor adopts a low-power design and can meet the needs of continuous and rapid monitoring for more than 14 days on a single charge. It is suitable for long-term tracking of the health status of individual pigs in large-scale farming scenarios. The wearable sensor for pigs with ear tags specifically includes an ear tag-type sensor housing, which includes a matching upper sensor housing 1 and a lower sensor housing 7. A PCB sub-board 4, a PCB motherboard 5, and a battery 6 are installed inside the upper housing 1 and the lower housing 7 of the sensor. A temperature probe 2 and a light-sensing port 3 are mounted on the outer wall of the upper shell 1 of the sensor. A matching rubber gasket is also installed on the outside of the sensor housing. This rubber gasket is made of flexible medical-grade rubber material, which has good plasticity and elasticity and can be adaptively adjusted according to the size and thickness of the pig's ear. The gasket shape includes, but is not limited to, three types: disc-shaped (diameter 15-20mm, thickness 3-5mm), cylindrical (diameter 10-15mm, height 5-8mm), and cuboid-shaped (length 15-20mm, width 10-15mm, height 3-5mm). Users can choose the appropriate gasket according to the type of sensor housing and the size of the pig's ear. The core functions of the rubber gasket are twofold: first, to ensure a tight fit between the sensor and the pig's ear, preventing the sensor from becoming loose or shifting due to varying ear sizes, thereby preventing fluctuations or distortions in the monitoring data and ensuring the stability of data acquisition; second, because the flexible rubber material has good tactile feel and biocompatibility, when the sensor is worn on the pig's ear, it can reduce pressure and stimulation on the pig's ear skin, avoiding rejection behavior in the pig (such as ear shaking or scratching), and ensuring that the sensor can be worn stably for a long time.
[0020] This sensor integrates a temperature acquisition circuit based on SHT series chips (including SHT30, SHT31, SHT35, SHT85, etc.), and has high-precision temperature detection capability with a detection range of -40℃ to 125℃ and an accuracy error of ≤ ±0.3℃. This sensor uses the MAX30102 analog-to-digital converter chip as the core detection element (which can be replaced by MAX30101, MAXM86161, AFE4490, etc.), and is equipped with a 3.3V~1.8V voltage regulator module. It can accurately collect the blood oxygen saturation (detection range 70%~100%, accuracy ±2%) and pulse frequency (detection range 30~200 beats / minute, accuracy ±1 beat / minute) of pigs. This sensor uses a three-axis accelerometer chip (replaceable with models such as BMA400, LIS2DW12, and ADXL362) to collect real-time acceleration data during pig activity, providing fundamental data support for behavior assessment. The sensor employs a high-precision three-axis accelerometer chip with multiple range options, supporting ±2g, ±4g, ±8g, and ±16g measurement modes, which users can flexibly configure according to the pig's activity intensity and monitoring needs. The sensor resolution can reach 12 bits or higher (the specific resolution depends on the range configuration; a smaller range results in higher resolution, with a resolution of 0.5mg at the ±2g range). It can accurately detect minute vibrations or subtle movements in pigs (such as respiratory vibrations and slight limb movements), providing high-precision data support for behavior assessment. The sensor incorporates a pig behavior assessment algorithm, using a machine learning-based behavior assessment model to process and analyze three-axis acceleration data, predicting various behaviors and their duration. Simultaneously, it sets a behavior duration threshold based on behavior classification, comparing the predicted behavior duration with this threshold to determine if the behavior is abnormal. In addition, the sensor integrates a variety of practical functions, including free fall detection (to determine the risk of sensor detachment), 6D orientation detection (to determine the sensor's spatial attitude), and a FIFO buffer (to temporarily store data and reduce communication frequency with the main control module). These functions significantly reduce reliance on external processors and lower overall system power consumption. Regarding sampling frequency, the sensor supports multiple adjustable levels from 1.6Hz to 1200Hz. Users can set the sampling frequency according to the monitoring scenario (e.g., using a low frequency of 1.6Hz to 10Hz for daily monitoring and switching to a high frequency of 100Hz to 1200Hz for abnormal monitoring). It also features an abnormal trigger mode, which automatically adjusts the sampling frequency and sampling time based on changes in the collected acceleration data—automatically reducing the sampling frequency to save power when the pig's activity is stable, and automatically increasing the sampling frequency to obtain more detailed motion data when abnormal activity is detected (e.g., vigorous activity or prolonged immobility), ensuring timely and accurate monitoring. During the sensor installation phase, the temperature probe 2 is exposed above the upper housing 1 of the sensor and fits tightly with the matching rubber gasket without any gaps. The photosensitive port 3 is located above and below the upper part of the sensor housing 1, and it is at a suitable distance from the blood oxygen and pulse detection module of the PCB, so as to obtain accurate blood oxygen concentration and pulse rate. The upper housing 1 and the lower housing 7 of the sensor are connected by threads. At the same time, a matching rubber gasket is installed on the outside of the sensor housing to achieve waterproof and dustproof effect, which can meet the complex breeding environment of pig farms. In addition, two ear stud bases can be placed at both ends of the sensor housing. The ear studs are inserted through the pig's ear, and the matching rubber gaskets are used to fix the pig ear tag wearable sensor to the pig's ear. By fixing it at two points, the reliability of the pig ear tag wearable sensor is improved, the dropout rate of the pig ear tag wearable sensor can be greatly reduced, and the detection parameters are more stable and accurate.
[0021] It also includes a multi-parameter sensing module, a main control module, a wireless communication module, and an antenna array; The multi-parameter sensing module includes a temperature sensor for collecting body temperature, a blood oxygen pulse sensor for collecting blood oxygen saturation and pulse rate, and a triaxial acceleration sensor for collecting triaxial acceleration data. The main control module is electrically connected to the multi-parameter sensing module and is used to control data acquisition, run embedded behavior judgment algorithms, and manage wireless communication. The wireless communication module is connected to the main control module and is used to communicate with the data transmission gateway using the LoRa protocol. The antenna array is connected to the wireless communication module and adopts a multi-antenna parallel layout to achieve directional signal enhancement; This antenna array is a multi-antenna collaborative structure, constructed through parallel wiring of various antennas, including but not limited to flexible bendable antennas, spring antennas, ceramic antennas, patch antennas, and microstrip antennas. The core function of the antenna array is to achieve directional control of the spatial radiation field through array signal processing technology—enhancing the radiation field intensity in the communication direction between the pig ear tag wearable sensor and the data transmission gateway, while weakening the radiation field intensity in other unrelated directions, thereby significantly improving the directionality and penetration of the carrier signal. This effectively solves the signal attenuation problem caused by multiple obstacles in the pig pens, extending the wireless communication distance (up to 500–800 meters in open environments and 100–300 meters in complex pen environments), while simultaneously reducing signal interference and improving data transmission rate and stability. The temperature sensor and blood oxygen pulse sensor are placed on the PCB daughter board, while the triaxial accelerometer, main control module, wireless communication module and antenna array are placed on the PCB mother board. The main control module adopts a microcontroller unit (MCU) with a LoRa wireless receiver module, supporting multiple MCU models such as STM32WL (STM32WLE5CC, STM32WLE5JB, STM32WLE5J8, etc.), ASRR6601 (ASRR6601SOC, ASRR6601TR, ASRR6601LR, etc.), and LR1121IMLTRT (LR1110, LR1120, LR1121, etc.), and is responsible for coordinating the operation of various sensor modules, data acquisition and processing, and wireless transmission control. The main control module integrates a temperature sensor, a blood oxygen pulse detection circuit (only present on the PCB board inside the ear tag sensor housing), and a three-axis accelerometer. It adopts a low-power mode and controls the sampling frequency based on the relationship between data validity and acquisition time to achieve low-power and high-efficiency prediction. At the same time, the module uses an STM32WLE5JC (or STM32WLE5CC, STM32WLE5JB, STM32WLE5J8, etc.) as the core control chip and also undertakes the function of LoRa communication. The main control module also includes an automatic calibration module. The automatic calibration function is applied in scenarios including: sensor drift compensation (sensors such as temperature, blood oxygen, and heart rate may drift over time or with environmental changes; the automatic calibration module can correct sensor outputs in real time through a built-in reference source or periodic self-testing mechanism); environmental adaptability calibration (dynamically adjusting sensor acquisition parameters based on environmental factors such as temperature, humidity, and dust in the pigsty); motion artifact detection and suppression (automatically pausing or marking unreliable data segments based on accelerometer data to determine the pig's vigorous movement state, and automatically resuming high-precision acquisition mode after the movement ends); battery voltage monitoring and power consumption adaptation (a drop in battery voltage may affect sensor accuracy; the system can adjust the power supply strategy or issue a low-battery warning accordingly, automatically reducing the sampling frequency and extending battery life in low-battery mode); and remote calibration command support (supporting remote operation and maintenance and batch equipment management by issuing calibration commands via the cloud). The voltage conversion circuit uses the AP2127K-1.8TRG1 (AP2127K-3.3TRG1, MIC5205-1.8YM5-TR, TPS78218DDCR, etc. can be selected) as the linear buck module of the LDO. Its wide input range compensates for the instability of the output voltage due to battery operation time, while its low power consumption meets the requirements of long-term operation. The LDO is a linear regulator that uses transistor linear adjustment to step down the voltage. There is no switching action, so it does not generate high-frequency switching noise in nature, which greatly improves the accuracy of temperature, blood oxygen saturation, and heart rate measurements. The battery is connected to the PCB motherboard via a battery base. It also includes a wireless charging module, comprising a receiver module and receiver module coil, and a transmitter module coil and transmitter module connected together. The receiving module is placed on the PCB motherboard, and the receiving module coil connected to it is located below the battery; The transmitting module and transmitting module coil are placed separately outside the pig ear tag-type wearable sensor, and the battery is charged non-contactly through electromagnetic induction. The wireless charging module can be used as a special charging method. When the sensor is worn on the pig's ear and has no power, the module can charge the sensor while it is being worn, thereby improving the efficiency of the sensor. The wireless charging module uses the Core set series (Core33205, Core33515, Core33530) wireless power transceiver modules. These modules offer clear advantages in terms of technical parameters: firstly, the transmitting module operates within a voltage range of 5V to 12V, adapting to various common power supply scenarios; secondly, the receiving module boasts a high output current of 1000mAh, providing a stable and sufficient power supply to the battery, effectively ensuring the device's battery life stability and power reliability.
[0022] The battery uses a PZZY rechargeable lithium battery, characterized by an operating voltage of 3.7V, a large capacity of 1000mAh, which can support the sensor for long-term operation, and it can be recharged and reused. During the key parameter acquisition phase of pig ears, the wearable ear tag sensor establishes communication with the data transmission gateway; the digital temperature sensor collects temperature, blood oxygen, and pulse data several times, and after the data stabilizes (the first temperature, blood oxygen, and pulse acquisition takes about 3 minutes, and subsequent acquisitions take about 5 seconds to stabilize), a filtering algorithm is used to remove bad pixels to obtain accurate and stable temperature data; the triaxial accelerometer operates in a low-power mode when the pig is in a relatively calm state, such as when it is resting or sleeping, the posture sensor enters a sleep mode; when it detects violent movements, such as running, walking, or wriggling, the triaxial accelerometer exits the sleep mode and increases the sampling frequency until the pig returns to a calm state; The pig behavior judgment algorithm includes a signal preprocessing branch, a feature extraction branch, and a classification branch. The signal preprocessing branch uses a sliding window and filtering compensation mechanism to process the original triaxial acceleration sequence. The feature extraction branch uses statistical calculation methods to extract multidimensional feature vectors. The classification branch uses a KNN model to determine the attitude. It employs a data calibration, feature extraction, and classification process to determine the attitude of the triaxial acceleration data. First, a 64-point sliding window with a step size of 1 is used to process the original triaxial acceleration sequence {(x_t, y_t, z_t)| Slicing the data into segments {t=1,2,…,T} ensures timely capture of short-term pose abrupt changes. Signal preprocessing is performed on each window, including a 5-point moving average to filter out high-frequency jitter, estimating the gravity direction using the window mean vector and performing gravity compensation, and constructing a body coordinate system with the principal displacement direction as x_b and the gravity direction as z_b. 15-dimensional manual statistical features (5 dimensions per axis: mean, standard deviation, energy, peak value, kurtosis) are extracted from the aligned three-axis data, concatenated into a feature vector, and SMOTE oversampling is used to alleviate the imbalance problem among the four pose classes, amplifying the minority class samples to be consistent with the majority class. StandardScaler is used to process the features column-wise. Z-score standardization was used, and a KNN model (k=3, Euclidean distance metric, voting weights inversely proportional to distance) was selected to classify the standardized features. By comparing the similarity between real-time feature data and standard behavioral feature templates (including typical behaviors such as standing, lying down, walking, and feeding) stored in the database, the current behavioral state of pigs was determined, and a four-class label sequence {y_t∈{0,1,2,3}} corresponding to each point of the original sequence was generated, where 0 represents standing, 1 represents lying down, 2 represents walking, and 3 represents feeding. The behavior judgment accuracy of this algorithm can reach over 90%, which can provide a reliable basis for disease early warning.
[0023] This system employs a low-power adaptive sampling module to optimize sensor operation. The triaxial accelerometer operates in low-power mode when the pig is in a relatively calm state (e.g., resting or sleeping), while the attitude sensor enters sleep mode. When vigorous movement (e.g., running, walking, or wriggling) is detected, the attitude sensor exits sleep mode and increases the sampling frequency until the pig returns to a calm state. The algorithm's input is a time-sequential sequence of triaxial accelerations {(x_t, y_t, z_t)| For the dataset t=1,2,…,T}, a total of 3200 sampling points were used. First, a 64-point sliding window with a step size of 1 point was used to slice the original signal, ensuring timely capture of short-term attitude changes. Then, three preprocessing steps were performed on each window: 1> 5-point moving average to filter out high-frequency jitter; 2> estimation of gravity direction and gravity compensation using the window mean vector; 3> construction of a body coordinate system with the principal displacement direction x_b and the gravity direction z_b. Next, 15-dimensional manual statistical features (5 dimensions per axis: mean, standard deviation, energy, peak value, kurtosis) were extracted from the aligned three-axis data and concatenated into a feature vector. Then, to alleviate the natural imbalance among the four attitude classes, SMOTE oversampling was used to amplify the minority class samples to match the majority class, and then Standard was applied. dScaler performs Z-score standardization on features column by column and saves the parameters; the classic KNN model is used in the classification stage, with k=3, Euclidean distance metric, and voting weights inversely proportional to distance. The standardized features and labels are stored in KD-Tree to complete the training. During inference, the weighted voting results are returned for each new window; finally, the label of each window is assigned to its last sampling point, and the labels of the 63 points in the middle inherit the labels of the previous window. The program writes the results back to a new Excel file with a new "activity_label" column, and generates a stepped line chart with Y-axis scales of -1–4. -1 indicates that the first 63 points are not classified because the window is not complete. The classification results are input into the disease detection and early warning model to obtain the behavioral abnormality assessment, and finally, a behavioral statistics report is generated. After data acquisition is completed, the main control chip STM32 enters low-power mode. Every agreed time interval (typically 10 minutes), the main control chip exits low-power mode and sends the data to the data transmission gateway via the LoRa communication protocol.
[0024] The detection mode of the wearable ear tag sensor for pigs is based on an abnormal triggering mechanism. When the temperature, blood oxygen, or pulse exceeds the normally set threshold, or when the behavior and duration are abnormal, the cloud analysis platform will display the information and reset the threshold according to the specific behavior and duration.
[0025] In addition, the sensor can be either the pig ear tag-type wearable sensor described in this system or an in-ear sensor. Both types of shells are made of high-strength engineering plastics, possessing waterproof (IP67 protection rating), dustproof, and wear-resistant properties, and are equipped with rubber gaskets to adapt to pig ears of different sizes. The in-ear sensor also consists of an upper shell and a lower shell, which are connected by threads. The upper shell features an innovative design with a slender, flexible tube (3-5mm in diameter and 10-15mm in length) that matches the physiological structure of the pig ear canal, and an ear stud-style base. The flexible tube is made of medical-grade silicone. Made of a material with good biocompatibility and flexibility, it can avoid damage to the pig's ear canal. The exposed part at the front end of the tube is an NTC temperature sensor probe with a diameter of ≤2mm, which can penetrate deep into the pig's ear canal to collect temperature. Compared with the ear surface temperature collection method, it can effectively reduce the influence of ambient temperature on the monitoring results and improve the accuracy of temperature monitoring. The upper shell also has reserved space for component installation to place the antenna array, PCB circuit board, temperature sensor, three-axis attitude sensor, battery and blood oxygen pulse sensor. The component layout is consistent with the ear tag sensor shell to ensure the stability and consistency of the equipment.
[0026] During the repeater data (data transmission gateway) synchronization phase, the repeater is handled by the data transmission gateway, which includes a power supply circuit 8, a gateway housing 9, a boost module 10, a 4G module 11, a LoRa wireless receiving module 12, and an antenna 13. The power supply circuit 8 is connected to the boost module 10 to provide a stable power supply and boost the voltage to support the operation of each module; The LoRa wireless receiver module 12 is connected to the antenna 13 and serves as the first communication unit for communicating with the pig ear tag wearable sensor using the LoRa protocol. The copper rod portion of the antenna 13 is exposed on the outside of the gateway housing 9, while the base portion is fixed inside the gateway housing 9. The 4G module 11 serves as a second communication unit, used to communicate with the cloud analysis platform via a 4G / 5G mobile network. The data transmission gateway is used to process data from the LoRa wireless receiving module 12 and forward it to the cloud analysis platform via the 4G module 11, as well as forward instructions from the cloud analysis platform.
[0027] The LoRa wireless receiver module 12, including the STM32WL (which can be STM32WLE5CC, STM32WLE5JB, STM32WLE5J8, etc.), ASRR6601 (which can be ASRR6601SOC, ASRR6601TR, ASRR6601LR, etc.), and LR1121IMLTRT (which can be LR1110, LR1120, LR1121, etc.), has data reception, storage, preprocessing, and protocol conversion functions. The power supply circuit 8 converts the voltage to 3.3V via the boost module 10 to power the LoRa wireless receiver module 12 and other series of microcontrollers, and to 5V to power the 4G module 11. The power supply circuit 8 adopts a wide voltage input design and can be adapted to 12V-24V DC power supply to meet the power supply needs of different power supply scenarios in the breeding site. The gateway shell 9 is made of waterproof, dustproof and impact-resistant materials, which can adapt to the complex environment of the breeding pen. The protective shell can also be made of PC or ASA material to meet the application scenarios where the sensor needs high-temperature disinfection. The LoRa wireless receiver module 12 receives data from multiple sensors through the antenna 13, records the reception time and the number of the pig to which the data belongs, and stores the raw data locally. At the same time, the LoRa wireless receiver module 12 establishes communication with the 4G module 11. The MCU built into the LoRa wireless receiver module 12 processes the data and sends it to the cloud analysis platform through the 4G module 11.
[0028] During the disease detection and early warning phase of the cloud-based analytics platform, the platform receives key parameters of the pig's ear from the data transmission gateway and stores the data in the database. The cloud-based analysis platform consists of three parts: a swine disease detection and early warning model, a mobile human-computer interaction interface, and a database. The system workflow is as follows: First, key physiological parameters (body temperature, blood oxygen, pulse) and activity posture data of the pig's ear area are collected using wearable ear-tag sensors and transmitted to the cloud-based analysis platform via a data transmission gateway. Second, the cloud-based analysis platform uses its database module to store and manage historical monitoring data, health parameter threshold data, and disease case data. Subsequently, the disease detection and early warning model combines physiological parameters and behavioral status data to conduct real-time assessments of the pig's health status. Finally, when the system detects that a pig is in a sub-healthy state (physiological parameters exceeding normal threshold ranges or abnormal behavior), it sends an early warning notification to the user through the mobile human-computer interaction interface (including details of abnormal parameters, potential health risks, and preliminary treatment suggestions), enabling timely early warning and intervention for swine health risks. The swine disease detection and early warning model employs a low-power data acquisition, multi-dimensional data comparison, and accurate predictive analysis working mode to achieve efficient assessment of swine health status. It includes a data receiving and validation branch, a feature engineering and time series construction branch, a deep learning inference branch, and an output correction branch. The data receiving and validation branch processes input data, including timestamps, body temperature, heart rate, blood oxygen, and behavioral data. The feature engineering and time series construction branch performs feature extraction and serialization processing. The deep learning inference branch uses a deep learning-based time series prediction model (LSTM + multi-head attention mechanism + ...). The system extracts temporal features using a fully connected network, and after processing, obtains a disease probability feature vector and risk assessment indicators. A medical rule correction module is designed to fuse probabilistic features and rule knowledge. The input time-series data is first transformed into an embedding vector through the input layer, then input into an LSTM layer to extract long-term dependency features. The projection layer projects the LSTM output onto the query, key, and value space of a multi-head attention mechanism. The multi-head attention layer calculates attention weights and aggregates contextual information. The fully connected layer maps the aggregated features to the output dimension to obtain the initial conjunctivitis disease probability. Subsequently, medical rules are applied to appropriately correct the final probability, and the corrected result is input into the output layer to obtain the disease classification result, including the predicted corresponding time point and the conjunctivitis disease probability. The system generates a health assessment report by identifying risk levels, treatment recommendations, and warning indicators. During training, sample data is prepared, a dataset is constructed and divided, a loss function is designed, and learning rate scheduling, regularization, and early stop strategies are used to monitor the training process. Model validation and selection are performed based on the model selection strategy. When a disease or sub-health condition is detected, a danger alarm is sent to the data transmission gateway. The data transmission gateway instructs the sensor to exit low-power mode and collect temperature, blood oxygen, heart rate, and behavioral data multiple times at high frequency. After one set of collections (10 minutes), the data is sent to the cloud platform for re-evaluation. If the judgment is false, no alarm is issued; otherwise, an alarm is issued and the sensor is instructed to operate at full power, thus achieving accurate prediction of disease types.
Claims
1. A wearable disease detection sensor and early warning system for pigs using ear tags, characterized in that, The system includes a pig ear tag wearable sensor for wearing on the ears of pigs to collect physiological parameters and behavioral data of pigs and perform local judgment and processing on the behavioral data to obtain detection data; and a data transmission gateway for wirelessly connecting to the pig ear tag wearable sensor to receive and aggregate detection data from one or more pig ear tag wearable sensors. It is a cloud-based analysis platform that communicates with a data transmission gateway to store and analyze received detection data, assess the health status of pigs based on a preset pig disease detection and early warning model, and generate early warning information.
2. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 1, characterized in that, The wearable sensor for pigs with ear tags includes an ear tag-type sensor housing, which includes a matching upper sensor housing (1) and a lower sensor housing (7). Inside the upper housing (1) and lower housing (7) of the sensor, there are PCB sub-board (4), PCB motherboard (5) and battery (6). A temperature probe (2) and a light-sensing port (3) are installed on the outer wall of the upper shell (1) of the sensor. A matching rubber gasket is also installed on the outside of the sensor housing.
3. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 2, characterized in that, It also includes a multi-parameter sensing module, a main control module, a wireless communication module, and an antenna array; The multi-parameter sensing module includes a temperature sensor for collecting body temperature, a blood oxygen pulse sensor for collecting blood oxygen saturation and pulse rate, and a triaxial acceleration sensor for collecting triaxial acceleration data. The main control module is electrically connected to the multi-parameter sensing module and is used to control data acquisition, run embedded behavior judgment algorithms, and manage wireless communication. The wireless communication module is connected to the main control module and is used to communicate with the data transmission gateway using the LoRa protocol. The antenna array is connected to the wireless communication module and adopts a multi-antenna parallel layout to achieve directional signal enhancement; The temperature sensor and blood oxygen pulse sensor are placed on the PCB sub-board (4), while the triaxial accelerometer, main control module, wireless communication module and antenna array are placed on the PCB motherboard (5).
4. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 3, characterized in that, The battery (6) is connected to the PCB motherboard (5) via a battery base. It also includes a wireless charging module, comprising a receiver module (14) and a receiver module coil (15) connected together, and a transmitter module coil (16) and a transmitter module (17). The receiving module (14) is placed on the PCB motherboard (5), and the receiving module coil (15) connected to it is placed below the battery (6); The transmitting module (17) and transmitting module coil (16) are placed separately outside the pig ear tag type wearable sensor, and the battery (6) is charged non-contactly by electromagnetic induction.
5. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 3, characterized in that, The input to the embedded behavior judgment algorithm is data collected by a triaxial accelerometer, specifically including: Gravity component elimination and coordinate system standardization were performed on the raw triaxial acceleration data. The attention mechanism is applied to extract key behavioral-related features from calibrated data; The KNN algorithm is used to compare the extracted features with the pre-stored standard behavioral feature templates, output the current behavioral state label, and organize them to obtain a behavioral data sequence.
6. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 1, characterized in that, The wearable sensor for pig ear tags includes a basic detection mode and a high-fidelity detection mode. The basic detection mode is used for low-power routine monitoring, and periodically collects physiological parameters such as triaxial acceleration data, blood oxygen concentration, pulse rate and body temperature at a lower sampling frequency. The high-fidelity detection mode is used for high-precision monitoring under abnormal conditions. It adopts a higher sampling frequency and continuous acquisition method to collect and process multi-parameter data more intensively in real time.
7. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 1, characterized in that, The data transmission gateway includes a power supply circuit (8), a gateway housing (9), a boost module (10), a 4G module (11), and a LoRa wireless receiver module (12) installed inside the gateway housing (9) and connected to each other; and an antenna (13) partially installed inside the gateway housing (9). The power supply circuit (8) is connected to the boost module (10); The LoRa wireless receiver module (12) is connected to the antenna (13) and serves as the first communication unit for communicating with the pig ear tag wearable sensor using the LoRa protocol. The copper rod portion of the antenna (13) is exposed outside the gateway housing (9), while its base portion is fixed inside the gateway housing (9). The 4G module (11) serves as the second communication unit, used to communicate with the cloud analysis platform via the 4G / 5G mobile network.
8. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 6, characterized in that, The health status assessment performed by the cloud-based analytics platform is based on an anomaly triggering mechanism, and its specific evaluation method is as follows: Based on the breed, age, and historical health data of the target pigs, the normal threshold range of their physiological parameters is dynamically determined. The received real-time physiological parameters are compared with the normal threshold range, and the duration and proportion of specific behaviors are calculated based on the behavioral data sequence to determine whether there is a continuous abnormal behavior pattern. When physiological parameters exceed the threshold range or there is a persistent abnormal behavior pattern, the swine disease detection and early warning model is triggered. It integrates real-time physiological parameters, behavioral data sequences, and environmental data to conduct a comprehensive diagnosis, calculate a health risk score, and infer potential disease types.
9. The wearable disease detection sensor and early warning system for pigs using ear tags according to claim 8, characterized in that, The swine disease detection and early warning model includes a data receiving and verification branch for processing input data, including timestamps, body temperature, pulse, blood oxygen saturation, and behavioral data; a feature engineering and time series construction branch for extracting and serializing the input data to obtain the time series data of the input deep learning inference branch; a deep learning inference branch for extracting time series features using a deep learning-based time series prediction model, which, after processing, yields a disease probability feature vector and risk assessment indicators; and an output correction branch for obtaining the health status based on the correction results. The deep learning inference branch includes: an input layer for converting input time-series data into embedding vectors; an LSTM layer for extracting long-term dependent features from the embedding vectors; a projection layer for projecting the output of the LSTM layer onto a multi-head attention layer; a multi-head attention layer for calculating attention weights, aggregating contextual information, and obtaining aggregated features; a fully connected layer for mapping the aggregated features to the output dimension to obtain the initial disease probability; and a medical rule correction module for fusing probability features and rule knowledge to appropriately correct the final probability and obtain the correction result.
10. A method for detecting and warning of swine diseases, characterized in that, When applied to systems including wearable ear-tag sensors for pigs, data transmission gateways, and cloud analytics platforms, the operating steps include: Physiological parameters and raw behavioral data of pigs are collected by wearable ear tags, and behavioral status information is obtained by real-time behavioral judgment on the raw behavioral data at the sensor end. Data packets containing physiological parameters and behavioral status information are sent to the data transmission gateway, which then forwards them to the cloud analysis platform. On the cloud-based analysis platform, based on physiological parameters and behavioral status information, the health status of pigs is assessed using a pig disease detection and early warning model. If an abnormality is detected, an early warning message is generated and pushed to the user terminal. When an abnormal health status is detected, the cloud analysis platform sends an enhanced data acquisition command to the corresponding pig ear tag wearable sensor through the data transmission gateway, triggering the pig ear tag wearable sensor to enter the corresponding frequency data acquisition mode.