Leveraging Embedded Accelerometers and Machine Learning for Real-Time Sheep Behavior Classification in Precision Farming
The development of efficient and real-time animal behavior monitoring systems is crucial to support precision livestock farming. This study proposes a behavior classification system for sheep using a triaxial accelerometer and embedded machine learning models, implemented on a low-power Internet of Things (IoT) device. Accelerometer signals were filtered using a Kalman Filter and segmented with a 2-second moving average window with 50% overlap. From each window, statistical features including mean, standard deviation, minimum, maximum, and signal energy were extracted for each axis (X, Y, Z), resulting in a 15-feature vector per segment. Four classification algorithms such as Random Forest (RF), K-Nearest Neighbors (KNN), Support Vector Machine (SVM), and XGBoost were evaluated for recognizing three sheep behaviors: standing, laying, and sleeping. Experimental results on a dataset of 6,000 labeled samples showed that Random Forest outperformed other models with an accuracy of 92.1% and an F1-score of 0.9272. The trained model was then converted and deployed on an ESP32 Mini C3 microcontroller, allowing real-time behavior classification directly on the device. Classified data was transmitted via Wi-Fi and visualized on a web dashboard with latency under 2 seconds. The system demonstrates that lightweight machine learning models can be effectively integrated into embedded platforms for autonomous animal behavior monitoring. This approach reduces the reliance on manual observation and enables scalable implementation in practical farm environments. Future enhancements include incorporating additional sensor modalities expanding behavior classes and adopting adaptive learning techniques to improve robustness in diverse and dynamic livestock settings.
Authors
- Giva Andriana Mutiara (ORCID: https://orcid.org/0000-0003-4387-6128)
- Moch Fahru Rizal (ORCID: https://orcid.org/0000-0003-2431-2909)
- Al Fahri Suhaimi
Institutions
- Telkom University (ID)
Publication Details
- Journal
- IEEE Access
- Published
- 2025-01-01
- DOI
- https://doi.org/10.1109/access.2025.3612098
- Citations
- 1
- Primary Topic
- Animal Behavior and Welfare Studies
- Type
- article
- Field-Weighted Citation Impact
- 2.35