Blog Home

This low-cost device uses tinyML on Arduino to detect respiratory diseases in pigs

Arduino TeamJune 30th, 2021

One major drawback to the largescale farming of animals for meat consumption is the tendency for diseases to spread rapidly and decimate the population. This widespread issue is what drove Clinton Oduor to build a tinyML-powered device that can perform precision livestock farming tasks intelligently. His project works by continuously monitoring the noise coming from pigs and makes a determination about what they mean, such as if a cough is indicative of a respiratory illness or a squeal denoting stress. 

Oduor gathered the sound samples for his dataset by downloading around seven minutes of coughing pig sounds and then split them up into one-second-long files. After using a trick called data curation that allows for more samples to be generated from previous ones, he trained a neural network with Edge Impulse and was able to achieve a 99.7% accuracy. As for deployment, the model runs on an Arduino Nano 33 BLE Sense, which has an onboard microphone for picking up ambient sounds. When coughing is detected, it sends some data via I2C to a MKR FOX 1200 board that broadcasts a message over the Sigfox network. 

The developer plans on collecting more data from various pig species and at different stages of growth to further enhance the diversity of the model and increase its accuracy. As a more advanced challenge, he would also like to have his device recognize specific cough patterns for certain types of respiratory diseases. You can read more about his project here.