MQTT-Based Architecture for Real-Time Data Collection and Anomaly Detection in Smart Livestock Housing
This study designed a message queuing telemetry transport (MQTT)-based communication framework to acquire environmental data with stable, low-latency response (soft real-time capability) and detect anomalies in smart livestock housing. We validated the performance of the proposed framework using actual sensor data. It comprises environmental sensor nodes, a Mosquitto MQTT broker, and a GRU-based anomaly detection model, with data transmission via a WiFi-based network. Comparing quality of service (QoS) levels, the QoS 1 configuration demonstrated the most stable performance, with an average latency of ~150 ms, a data collection rate ≥ 99%, and a packet loss rate ≤ 0.5%. In the sensor node expansion experiment, responsiveness (≤200 ms) persisted for 10-15 nodes, whereas latency increased to 238.7 ms for 20 or more nodes. The GRU model proved suitable for low-latency analysis, achieving 97.5% accuracy, an F1-score of 0.972, and 18.5 ms/sample inference latency. In the integrated experiment, we recorded an average end-to-end latency of 185.4 ms, a data retention rate of 98.9%, processing throughput of 5.39 samples/s, and system uptime of 99.6%. These findings demonstrate that combining QoS 1-based lightweight MQTT communication with the GRU model ensures stable system response and low-latency operation (soft real-time capability) in monitoring livestock housing environments, achieving an average end-to-end latency of 185.4 ms.
Authors
- Meonghun Lee (ORCID: https://orcid.org/0000-0001-8863-7580)
- K.Y. Ko (ORCID: https://orcid.org/0009-0009-0685-4158)
Institutions
- Sunchon National University (KR)
Publication Details
- Journal
- Sensors
- Published
- 2025-11-25
- DOI
- https://doi.org/10.3390/s25237186
- Primary Topic
- Food Supply Chain Traceability
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- Ministry of Agriculture, Food and Rural Affairs
- Rural Development Administration
- Ministry of Science and ICT, South Korea