Intelligent Dairy Cow Health Monitoring with Signal Processing Based on Artificial Intelligence: An Integrated Approach in Precision Agriculture and Internet of Things (IoT) Systems"

Document Type : Original Article

Authors

1 Dept. of Biosystems Engineering, Faculty of Agriculture, University of Tabriz, Tabriz, Iran.

2 Biosystems Mechanical Engineering Group - Faculty of Agriculture - University of Tabriz - Tabriz - Iran"

3 Animal Nutrition Engineering Group - Faculty of Agriculture - University of Tabriz - Tabriz - Iran"

Abstract

This study introduces a novel and integrated Internet of Things (IoT) framework designed to enable intelligent and scalable health monitoring of dairy cattle, combining low-power piezoelectric sensing with deep learning methodologies. The proposed system addresses key limitations in the field of precision livestock farming (PLF) by focusing on the automated recognition of critical bovine behaviors—specifically, Feeding and Rumination. Central to this research is a comprehensive comparative analysis between two signal processing approaches: time-domain feature extraction versus Discrete Wavelet Transform (DWT), aimed at optimizing the classification accuracy and computational performance of the monitoring pipeline.

The implemented architecture is composed of four primary components: (1) piezoelectric sensors with a sampling rate of 24 Hz to capture jaw movements, (2) two parallel signal processing pipelines, (3) a wireless communication system based on LoRaWAN, and (4) a deep learning classifier built using convolutional neural networks (CNNs). The system was deployed and validated under real operating conditions at the dairy farm of the University of Tabriz.

From a hardware perspective, the solution utilizes piezoelectric sensors mounted on bovine halters to detect jaw activity associated with feeding and rumination behaviors. These sensors are interfaced with ESP32 microcontrollers that process the signal in real-time and transmit it via Bluetooth to a custom-designed mobile application. Additionally, raw sensor data is uploaded to Google Drive to facilitate cloud-based storage and collaborative analysis. The data preprocessing stage was performed in Google Colab using Python, consisting of three critical steps: digital Butterworth filtering to eliminate ambient noise, min-max normalization to standardize amplitude variations, and segmentation of the continuous data into fixed-length time windows of 20 to 30 samples (corresponding to 0.83–1.25 seconds per segment).

For feature extraction, two concurrent methodologies were applied. In the time-domain pathway, statistical metrics—including mean, standard deviation, minimum, and maximum values—were calculated. In parallel, the DWT approach utilized Daubechies wavelets to derive spectral-temporal coefficients from the signals, capturing transient patterns that may correspond to complex mastication phases. Given the class imbalance in the dataset—particularly a relative shortage of Feeding samples—the Synthetic Minority Over-sampling Technique (SMOTE) was used via the imbalanced-learn Python library to enhance classifier robustness and reduce bias.

The deep learning model employed for classification was a 1D Convolutional Neural Network (1D-CNN) constructed in TensorFlow/Keras. The network included two convolutional blocks. The first block utilized 64 filters with a kernel size of 3, followed by batch normalization, Swish activation, and max pooling. The second block employed 32 filters with identical operations. After convolution, the network architecture incorporated a flattening layer, a dense layer with 128 units, dropout regularization (dropout rate of 0.5), and a final softmax layer for multi-class output. The training configuration used Adam optimization with an initial learning rate of 0.001, categorical cross-entropy loss, a batch size of 256, and a total of 200 training epochs. To prevent overfitting, early stopping with a patience of 10 epochs and dynamic learning rate reduction strategies were applied. Model evaluation relied on accuracy scores, F1-scores, and confusion matrices, visualized using Matplotlib and Seaborn libraries.

Experimental results highlighted substantial differences in performance between the two signal processing approaches. The time-domain (non-DWT) method outperformed the DWT approach in several key areas. Specifically, the non-DWT model achieved a validation accuracy of 86.78%, compared to approximately 76% for the DWT model. In terms of computational efficiency, the non-DWT model trained in 21.68 minutes, whereas the DWT version required approximately 23 minutes. Additionally, the non-DWT model had a significantly leaner architecture, consisting of 0.17 million parameters, which is 39.3% fewer than the 0.28 million parameters in the DWT-based model.

Class-specific evaluation revealed nuanced insights. While the DWT method demonstrated a modest 1.1% improvement in F1-score for Feeding behavior detection (0.7627 vs. 0.7520), likely due to better capture of spectral features during chewing cycles, the time-domain model excelled in Rumination detection with an F1-score of 0.9903 compared to 0.9888 from DWT—an advantage attributed to the periodic nature of rumination, making spectral analysis less necessary.

Based on these findings, three key operational recommendations are proposed for real-world adoption in precision livestock farming. First, large-scale deployments should favor the non-DWT configuration due to its 8.3% faster training time, reduced computational complexity, and lower hardware requirements—beneficial for cost-sensitive and resource-limited environments. Second, selective use of DWT-based monitoring may be justified for high-risk subpopulations, such as peri-parturient cows vulnerable to metabolic conditions (e.g., ketosis or acidosis), where the slight improvement in Feeding behavior detection could have clinical value. Third, a hybrid system architecture—employing time-domain processing for Rumination and DWT for Feeding—could optimize both performance and resource allocation, ensuring critical diagnostic coverage.

The LoRaWAN-enabled communication infrastructure ensures that alerts and behavioral reports can be transmitted with latency under two minutes, even across large-scale farm environments, highlighting the system’s practical feasibility.

For future development, four promising research directions are identified. First, implementing edge computing by deploying optimized CNN models directly on ESP32 microcontrollers would eliminate reliance on cloud services, improving real-time responsiveness. Second, incorporating multi-sensor fusion—combining piezoelectric data with audio or accelerometer inputs—may further enhance classification accuracy, particularly for the underrepresented Feeding class. Third, adapting DWT-based feature extraction techniques to agricultural robotics (e.g., autonomous feeders) and remote sensing (e.g., pasture quality assessment) opens new application frontiers. Finally, reinforcement learning could be used to dynamically allocate sensing and processing resources based on individual animal risk profiles.

In conclusion, the proposed system demonstrates that time-domain feature extraction strikes an effective balance between diagnostic accuracy (86.78%), computational efficiency (0.17M parameters), and scalability for large-scale deployment in dairy farming. While DWT methods offer marginal gains in specific use-cases, their higher complexity limits practicality. The presented IoT architecture delivers a viable solution for smart livestock management and establishes a foundation for next-generation advancements in agricultural automation and sustainability.

Keywords

Main Subjects



Articles in Press, Accepted Manuscript
Available Online from 10 June 2026
  • Receive Date: 01 September 2025
  • Revise Date: 08 June 2026
  • Accept Date: 09 June 2026