We present the development of a sheep distress detection system that helps farmers efficiently monitor their sheep in the field. The motivation behind the project is to help farmers detect early attacks, injuries, or stress in their flock. In recent years, sheep farmers in Slovenia have faced a growing challenge: increasing attacks on their flocks by predators, especially wolves and also jackals.Reports from various regions show alarming trends — for example, in areas like Pohorje and along the Slovenia-Austria border, farmers have suffered major livestock losses, with individual attacks wiping out 15–20 sheep in a single night.These opportunistic predators strike rapidly, often leaving farmers with little time to react — most likley just arriving to a site of a massacre that has already occurred.
Our goal is to develop a sheep distress detection system using sound analysis and machine learning, embedded on low-power devices, to alert farmers in real time and help them react before it’s too late.
SolutionDevices are placed in the field, each using LoRaWAN communication to send real-time alerts when distress is detected. These alerts are shown directly in a mobile app, allowing the farmer to take timely action and prevent injury, stress, or animal loss.
DescriptionThe system is built around the Seeed XIAO nRF52840 microcontroller, which has an onboard microphone. Running on the microcontroller is a machine learning model trained with Edge Impulse to listen to sheep vocalizations and detect distress calls. When distress is detected, the device sends a wireless alert using LoRaWAN, which is shown in the connected app.For energy efficiency, the system runs continuous audio monitoring but limits other communications (like battery status and location updates) to a few times per hour.
Machine learning modelWe first imported recordings of sheep calls into Edge Impulse and manually classified them. We used the MFCC (Mel-frequency cepstral coefficients) process block to extract features from the audio samples and then trained a machine learning model.
Since it’s difficult to find real audio of sheep during an attack, the model’s accuracy is not yet ideal — but it serves as a proof of concept.
We then packaged the trained model into an Arduino-compatible library and uploaded it to the Seeed XIAO nRF52840 controller.
ConnectivityThe system uses LoRaWAN to transmit status updates and alerts to a central gateway. This long-range, low-power communication is ideal for covering wide pastures or remote areas where Wi-Fi or cellular networks are not available.
Android AppWe designed an Android app that shows a map of all active devices, along with their battery levels. When the app receives an alert sent over LoRaWAN, it immediately displays it, notifying the farmer of a potential distress event.
- Arduino device detects distressed sheep calls with ML model
- Alert is sent via LoRaWAN
- The app receives and displays alerts and status data
- Action can be taken
- Improve the machine learning model by expanding the audio dataset with more sheep sounds under various conditions.
- Add GPS integration for more precise location tracking.
- Work with farmers to gather insights
Our project shows how sound analysis and machine learning can help farmers detect sheep distress in real time, giving them a practical tool to reduce losses and improve animal welfare. With continued development and farmer feedback, this system has the potential to become an essential part of modern livestock monitoring.
Comments