iRunMon: A real-time ruminant monitor⋆ Pedro Gonçalves1, ∗,†, William Xavier 2,† and Gustavo Corrente2,† 1 Instituto de Telecomunicações and Escola Superior de Tecnologia e Gestão de Águeda, Universidade de Aveiro, Campus Universitário de Santiago P-3810-193, Aveiro, Portugal 2 iFarmTec and Wiseware, Zona Industrial da Mota, Rua 12, Lote 51, Fração E, 3830-527 Gafanha da Encarnação, Portugal Abstract Present paper presents a real-time animal monitoring solution envisaged for ruminants. The complete solution includes a wearable collar enabled with inertial sensors and a thermometer, a sensor gathering gateway that generates alarms and interfaces with a cloud hosted application that implements system analytics, and video recording tools that allow the supervision of telemetry data. System operation supports a triple mode: it operates in a learning mode where it gathers sensor data, an enriched version integrated with video recording information to enable learning data supervision, and a monitoring mode where the wearable system autonomously classifies animal behavior. Keywords Ruminant monitoring, wearable sensor, accelerometry, behavior, activity, calving detection 1 1. Introduction Animal monitoring [16][3], has been attracting immense attention, both from academia and from the industrial sector, due to its promising impact on Precision Livestock Farming and on animal well- being, avoiding the cost and the errors associated with human monitoring. Inertial sensors by its turn have been validated as a viable and economical way to monitor animal behaviors and have been used to electronically analyzing what behaviors the animal performed during the day [1,2]; monitoring animal activity [3], which allows the identification of disturbing events and to infer energy consumption; or even in the detection of events related to animal health [4,5], such as detection of parturition [6–9], detection of estrus [10,11] or even mating [12]. Most existing commercial solutions, as well as academic work, have been developed for cattle, due to the greater value of these animals, for small ruminants there is a smaller set of monitoring solutions, but they focus especially on issues related to the location of the animals. For these ruminants, monitoring behavior and activity is mostly described in academic works, typically using on loggers [13–15], without the possibility of real-time monitoring. Present work presents a ruminant monitoring platform based on the use of wearable inertial sensors, integrated with an edge located animal behavior classification unit implemented in a gateway resident in livestock facilities, which is interconnected with a cloud application that aggregates data from different livestock facilities. Paper describes system components and tools and, it illustrates its operation in several monitoring scenarios. ⋆ Short Paper Proceedings, Volume I of the 11th International Conference on Information and Communication Technologies in Agriculture, Food & Environment (HAICTA 2024), Karlovasi, Samos, Greece, 17-20 October 2024. ∗ Corresponding author. † These authors contributed equally. pasg@ua.pt (P. Gonçalves); william@wisewaresolutions.com (W. Xavier); gustavo.corrente@wisewaresolutions.com (G. Corrente) 0000-0002-7696-4231 (P. Gonçalves); 0000-0002-0864-0809 (W. Xavier); 0000-0002-1370-4096 (G. Corrente) © 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop ceur-ws.org 26 ISSN 1613-0073 Proceedings 2. Monitor system overview The monitoring system, illustrated in Figure 1, includes sensor collars, gateways, and mobile devices (i.e. cellular phone, tablet) and can be integrated with video collection devices to enrich the monitoring process. Communication between the collars and the aggregating gateway is carried out opportunistically via a Bluetooth Low Energy (BLE) [17] interface, and the collars have an internal memory that allows monitoring data to be stored when there is no radio coverage with the gateway. When this coverage is recovered, the collars begin a process of transmitting the stored data to the gateway, which reconditions and transmits it to the application residing in the cloud. The system relies on data sent from various gateways to perform data mining and to build learning models, taking advantage of the diversity of facilities and characteristics of the herds. Figure 1: System overview BLE communication is also used to implement communication between collars and mobile devices, allowing individual monitoring in situ, as checking the operation status of the device, the battery charge, as well to configure it and change the firmware over the air. It is also used in the learning mode, a scenario in which a mobile app uses the device's camera to record video and synchronously collect sensor data from the animal. The collar also includes a Near Field Communications (NFC) [18] interface, a technology present in most mobile devices, which is used as a virtual collar control button, allowing the device to be turned on and off, or in an integrated with the BLE interface process, to perform collar maintenance and monitoring tasks as illustrated in Figure 2. Collar monitorization is performed centrally as well, through a web interface implemented by a cloud application, as illustrated in Figure 3. 27 Figure 3: Monitorization of collar Figure 2: Collar parameterization thought NFC Some learning processes require long periods of monitoring, such as calving, estrous and mating, so the system can additionally be integrated with video image collection devices, which are temporally synchronized with the gateway to guarantee the synchronization of telemetry data and the images, and thus allow the subsequent process of data supervision [19]. The collar includes a three-axis accelerometer and a thermometer, and it supports operating frequencies between 0.03 and 20 Hz. In monitoring mode, it uses a variable sampling rate that creates a new data sample whenever the algorithm detects a new behavior, or after 30 seconds have passed. In learning mode, the sampling frequency is parameterized according to the objectives of the specific learning process, with a value between 1 and 20Hz. The collar operates on battery power and guarantees an autonomy up to 150 days between battery charges. The gateway (Figure 4) is implemented by a microcomputer present in the livestock facilities, next to the collars, and it interconnects them with a cloud-resident application that stores, analyzes, and allows access to the data to the human operator, as illustrated in Figure 5. The gateway also implements simpler data analysis mechanisms, and generates alarms, such as equipment anomalies or those associated with animal behavior, such as birth detection. The cloud-resident application centralizes monitoring data from all livestock facilities and stores it for centralized analysis and updating learning models. Figure 4: iRunMon Gateway Figure 5: Web interface of cloud-hosted application 28 3. System operation Collar periodically reads sensor values and classifies animal behaviors according to the operating mode configured, as described in Table 1. Monitoring mode operation implements animal classification such as classifying behaviors according to the defined ethogram (eating, walking, chewing, lying down, resting) (Figure 6) or detecting birth events in the case of goats. In addition to classifying behavior with a 0,5 Hz frequency, it transfers monitoring data to the gateway, which in turn analyzes and transfers it to the cloud application. Monitoring mode allows up to 150 days of storage autonomy and 1600 days of battery autonomy. Learning modes were designed to carry out learning operations, whereby the system collects data from sensors and stores it with a timestamp of the moment of collection, so that this data can be externally annotated with the help of other information and use to carry out learning operations. To allow different learning processes with different dynamism, two modes with two sampling frequencies were implemented. The mode Learning samples data at a frequency of 1Hz and has a battery autonomy of 120 days, while Special Learning mode implements a 20Hz sampling and offers a battery autonomy of 60 days and a storage autonomy of 800 days. Table 1 System operation modes Mode Sampling Autonomy Storage autonomy Description Frequency (days) (days) Monitoring 0,5Hz* 150 1600 Envisage for offline monitoring Learning 1Hz 120 No limit Doesn’t use memory Special 20Hz 60 800 Learning mode supporting offline Learning operation Regardless of the mode of operation, the collar periodically transfers the classification of behaviors and accelerometry data (see Figure 7) to the gateway, so that it is transferred to the cloud- hosted application, where it can be mined and made available to the human supervisor. In the case of events that require timely intervention by the animal handler, such as birth detection events, the gateway's alarm generation module sends a notification message directly to the contact defined in the gateway. Figure 6: Behaviors distribution Figure 7: Animal activity throughout the day throughout the day The transfer of accelerometer data through the gateway also allows analyzing animal activity over time as illustrated in Figure 7, and comparing it with previous periods of the same animal or with other animals in the herd. The learning mode performs the sensing of animal behavior in terms of reading accelerometer and thermometer values, and subsequently sending the data stream abroad. This data is later supervised and used to build learning models. iRumMon allows two learning scenarios: for short learning processes in which the aim is to monitor behavior through human presence, an Android 29 app is used (Figure 8); for longer learning processes in which it is not possible to keep the human operator in the presence of the animal, a video image capture device (Figure 9) and gateway are used. In either case, communication is carried out via BLE, either with the Android app or with the gateway. Figure 8: Android device learning Figure 9: Video camera-based learning Figure 8 illustrates the Android app for learning. The app receives the data sent by a collar and synchronously records the video images through the Android device's camera. For the convenience of the subsequent learning process, the app timestamps the images and allows the extraction of the video and collar records, illustrated in Table 2. The process requires a scan of BLE devices and subsequent connection with the collar used by the animal under monitoring. After initiating the learning process, the human operator needs to track the monitored animal to ensure its continual presence in the video footage, facilitating the classification of its behavior in real-time. Due to the monotony of the task, the human operator can typically classify behaviors during the monitoring process by simply pressing the corresponding buttons in the application. Anyhow classification can always be reviewed, or carried out, when session monitoring data is extracted from the mobile device. The app also includes commands to stop recording, disconnect the session and even turn off the collar. Table 2 Monitoring data example Timestamp Acc_X Acc_Y Acc_Z Temperature (C) Behavior (mg) (mg) (mg) 1 709 551 104 150 -0.105 -0.031 -0.229 16.5 S 1 709 551 104 200 -0.092 -0.031 -0.220 16.5 S 1 709 551 104 250 -0.078 -0.032 -0.207 16.5 S 1 709 551 104 300 -0.081 -0.036 -0.214 16.5 S 1 709 551 104 350 -0.081 -0.031 -0.225 16.5 S In more temporally extensive learning processes, the collars are interconnected with the gateway and a video camera with temporal synchronization support, is used (Figure 9), such as an Internet access camera that allows automatic configuration of the system time. In this type of scenario, iRumMon allows the learning process regarding several animals simultaneously, as long as the collection of images of the animals involved is guaranteed. As in the monitoring scenario with the app, once the monitoring session is over, data from the various collars and video images are extracted to enable the data monitoring process. 4. Conclusions Animal monitoring using wearable inertial sensors is a low-cost technique with enormous possibilities for monitoring animals and their well-being. This paper presents an animal monitoring solution, developed for monitoring ruminants and which has been used, for example, to monitor the 30 activity and behavior of sheep, detecting goat births. The paper presents the system components and briefly describes their operating modes and characteristics. The system, whose development has been completed, should be equipped with a new, smaller and lighter version in the near future, in order to allow the monitoring of other animals, such as smaller animals, or even birds. Declaration on Generative AI The author(s) have not employed any Generative AI tools. References [1] Fonseca, L.; Corujo, D.; Xavier, W.; Gonçalves, P. On the Development of a Wearable Animal Monitor. Animals 2022, 13, 120, doi:10.3390/ani13010120. [2] Gonçalves, P.; Nóbrega, L.; Monteiro, A.; Pedreiras, P.; Rodrigues, P.; Esteves, F. SheepIT, an E- Shepherd System for Weed Control in Vineyards: Experimental Results and Lessons Learned. Animals 2021, 11, 2625, doi:10.3390/ani11092625. [3] Gonçalves, P.; Antunes, M.; Xavier, W.; Monteiro, A. Flock Nocturnal Activity: Is There a Rotative Guard? Applied Sciences 2022, 12, 11563, doi:10.3390/app122211563. [4] Kaler, J.; Mitsch, J.; Vázquez-Diosdado, J.A.; Bollard, N.; Dottorini, T.; Ellis, K.A. Automated Detection of Lameness in Sheep Using Machine Learning Approaches: Novel Insights into Behavioural Differences among Lame and Non-Lame Sheep. R Soc Open Sci 2020, 7, doi:10.1098/RSOS.190824. [5] Barwick, J.; Lamb, D.; Dobos, R.; Schneider, D.; Welch, M.; Trotter, M. Predicting Lameness in Sheep Activity Using Tri-Axial Acceleration Signals. Animals (Basel) 2018, 8, doi:10.3390/ANI8010012. [6] Smith, D.; McNally, J.; Little, B.; Ingham, A.; Schmoelzl, S. Automatic Detection of Parturition in Pregnant Ewes Using a Three-Axis Accelerometer. Comput Electron Agric 2020, 173, 105392, doi:10.1016/j.compag.2020.105392. [7] Gurule, S.C.; Tobin, C.T.; Bailey, D.W.; Hernandez Gifford, J.A. Evaluation of the Tri-Axial Accelerometer to Identify and Predict Parturition-Related Activities of Debouillet Ewes in an Intensive Setting. Appl Anim Behav Sci 2021, 237, 105296, doi:10.1016/j.applanim.2021.105296. [8] Fogarty, E.S.; Swain, D.L.; Cronin, G.M.; Moraes, L.E.; Bailey, D.W.; Trotter, M.G. Potential for Autonomous Detection of Lambing Using Global Navigation Satellite System Technology. Anim Prod Sci 2020, 60, 1217, doi:10.1071/AN18654. [9] Gonçalves, P.; Marques, M.R.; Belo, A.T.; Monteiro, A.; Braz, F. Goat Kidding Dataset. Data (Basel) 2022, 7, 89, doi:10.3390/data7070089. [10] Benaissa, S.; Tuyttens, F.A.M.; Plets, D.; Trogh, J.; Martens, L.; Vandaele, L.; Joseph, W.; Sonck, B. Calving and Estrus Detection in Dairy Cattle Using a Combination of Indoor Localization and Accelerometer Sensors. Comput Electron Agric 2020, 168, 105153, doi:10.1016/j.compag.2019.105153. [11] Yin, L.; Hong, T.; Liu, C. Estrus Detection in Dairy Cows from Acceleration Data Using Self- Learning Classification Models. J Comput (Taipei) 2013, 8, doi:10.4304/jcp.8.10.2590-2597. [12] Mozo, R.; Alabart, J.L.; Rivas, E.; Folch, J. New Method to Automatically Evaluate the Sexual Activity of the Ram Based on Accelerometer Records. Small Ruminant Research 2019, 172, 16– 22, doi:10.1016/J.SMALLRUMRES.2019.01.009. [13] Fogarty, E.S.; Swain, D.L.; Cronin, G.M.; Moraes, L.E.; Trotter, M. Can Accelerometer Ear Tags Identify Behavioural Changes in Sheep Associated with Parturition? Anim Reprod Sci 2020, 216, 106345, doi:10.1016/j.anireprosci.2020.106345. [14] Fogarty, E.S.; Swain, D.L.; Cronin, G.M.; Moraes, L.E.; Trotter, M. Behaviour Classification of Extensively Grazed Sheep Using Machine Learning. Comput Electron Agric 2020, 169, 105175, doi:10.1016/j.compag.2019.105175. [15] Fogarty, E.S.; Swain, D.L.; Cronin, G.M.; Moraes, L.E.; Bailey, D.W.; Trotter, M. Developing a Simulated Online Model That Integrates GNSS, Accelerometer and Weather Data to Detect Parturition Events in Grazing Sheep: A Machine Learning Approach. Animals 2021, 11, 303, doi:10.3390/ani11020303. 31 [16] Ren, K.; Karlsson, J.; Liuska, M.; Hartikainen, M.; Hansen, I.; Jørgensen, G.H. A Sensor-Fusion- System for Tracking Sheep Location and Behaviour. Int J Distrib Sens Netw 2020, 16, 155014772092177, doi:10.1177/1550147720921776. [17] Yang, J.; Poellabauer, C.; Mitra, P.; Neubecker, C. Beyond Beaconing: Emerging Applications and Challenges of BLE. Ad Hoc Networks 2020, 97, doi:10.1016/j.adhoc.2019.102015. [18] Coskun, V.; Ozdenizci, B.; Ok, K. The Survey on Near Field Communication. Sensors 2015, 15, 13348–13405, doi:10.3390/s150613348. [19] Dutta, R.; Smith, D.; Rawnsley, R.; Bishop-Hurley, G.; Hills, J.; Timms, G.; Henry, D. Dynamic Cattle Behavioural Classification Using Supervised Ensemble Classifiers. Comput Electron Agric 2014, 111, 18–28, doi:http://dx.doi.org/10.1016/j.compag.2014.12.002. 32