Mastitis is one of the most common and economically significant diseases affecting dairy cattle, leading to reduced milk yield, poor milk quality, and increased veterinary treatment costs. Early detection of mastitis is essential to prevent severe infection, minimize economic losses, and improve overall herd health management. Conventional diagnostic techniques such as the California Mastitis Test (CMT), somatic cell count analysis, and microbial culture require laboratory facilities, trained personnel, and considerable processing time, making them less suitable for routine on-farm monitoring.
To address these limitations, this study proposes the development of a low-cost portable mastitis screening device capable of providing rapid and on-site detection using sensor-based monitoring and IoT technology. The system operates through a two-stage detection approach. Initially, the udder surface temperature is measured using a DS18B20 digital temperature sensor to identify abnormal thermal variations caused by inflammation. Subsequently, milk samples are analyzed using pH and electrical conductivity (EC) sensors to detect biochemical changes associated with mastitis infection. These sensor outputs are processed using an ESP32 microcontroller, while an ADS1115 analog-to-digital converter improves the accuracy of analog signal readings. The processed results are displayed on a LCD display and simultaneously transmitted to a web-based monitoring system through Wi-Fi connectivity for real-time remote observation.
The system incorporates calibration procedures and threshold-based algorithms to classify mastitis conditions into normal, moderate risk, and high-risk categories. Experimental testing demonstrated observable increases in udder temperature, milk pH, and electrical conductivity in suspected mastitis conditions, validating the effectiveness of the selected biological indicators. The developed prototype offers a reliable, affordable, and farmer-friendly solution for early mastitis detection and digital herd health monitoring. This technology has the potential to support preventive dairy management, reduce economic losses, and contribute to smart and sustainable dairy farming practices.
Introduction
Dairy farming is crucial for food security and rural livelihoods, and maintaining the health of dairy cattle is essential for consistent milk production. Mastitis, an inflammation of the mammary gland caused mainly by bacterial infection, is one of the most common and economically significant diseases in dairy cattle, leading to reduced milk yield, poor milk quality, and higher treatment costs. Early detection is critical to minimize losses, but traditional methods like visual inspection, California Mastitis Test (CMT), somatic cell count (SCC), and microbial cultures are time-consuming, lab-dependent, and often impractical for small- and medium-scale farms.
Advances in sensor technology have enabled the development of portable, low-cost, real-time mastitis detection devices. Such systems use multiple parameters—udder temperature, milk pH, and electrical conductivity (EC)—to identify early signs of infection on-site without laboratory intervention. Infrared thermography, EC, and pH measurements have been validated in prior research as reliable indicators of mastitis, with multi-sensor integration improving diagnostic accuracy.
Proposed System:
Integrates temperature, pH, and EC sensors with an ESP32 microcontroller for real-time data processing.
Results are displayed on an LCD/OLED screen and transmitted to a web interface for remote monitoring and record-keeping.
Calibrated sensors and threshold-based detection ensure high accuracy and reliability.
Portable and cost-effective design allows easy use directly on the farm, supporting early intervention and better herd management.
Methodology:
Components include DS18B20 temperature sensor, pH and EC probes, ADS1115 ADC for analog conversion, ESP32 microcontroller, and LCD display.
The device continuously monitors parameters, compares them with mastitis thresholds, and provides immediate on-site detection.
Advantages:
Rapid, real-time detection and record-keeping
Non-invasive and animal-friendly
Affordable for small- and medium-scale farms
High accuracy and reliability
Remote monitoring via web interface
Results:
Testing demonstrated that the device accurately measures udder temperature, milk pH, and EC, reliably identifies mastitis, provides immediate feedback, and enables effective remote monitoring. Its performance correlates closely with conventional laboratory tests, proving it suitable for practical, on-farm use.
Conclusion
The development of the Low-Cost Portable Mastitis Screening Device successfully demonstrates an efficient, reliable, and affordable method for early detection of mastitis in dairy cows. By integrating an infrared temperature sensor, pH and electrical conductivity probes, and a microcontroller-based processing unit, the device enables real-time measurement and immediate analysis of udder and milk health parameters. The inclusion of a web interface allows farmers to monitor herd health remotely, maintain records, and take timely action, reducing the risk of severe infections and economic losses.
The device’s non-invasive design ensures animal comfort while providing consistent and accurate results comparable to conventional laboratory tests. Its portability, ease of use, and low cost make it highly suitable for small and medium-scale dairy farms. Furthermore, the system’s modular architecture allows for future upgrades, such as additional sensors or automated alerts, enhancing farm management efficiency.
Overall, this project highlights the potential of sensor-based, IoT-integrated solutions in transforming dairy farming practices by enabling early diagnosis, improving animal welfare, and increasing productivity. The successful implementation of this device demonstrates a practical approach to modernizing traditional herd management techniques, contributing to sustainable and economically viable dairy farming.
References
[1] Zalewska, M., et al., 2025. “The Quality and Technological Parameters of Milk Obtained from Dairy Cows with Subclinical Mastitis.”
[2] Korelidou, V., Simitzis, P., Massouras, T., & Gelasakis, A.I., 2024. “Infrared Thermography as a Diagnostic Tool for the Assessment of Mastitis in Dairy Ruminants.”
[3] Swaranaa, M., 2024. “A Comprehensive Survey on Mastitis Detection Techniques: Infrared Thermography and Strategies for Subclinical Mastitis Prevention.”
[4] Ramuada, M., 2024. “A Practical Guide to Diagnosing Bovine Mastitis: Electrical Conductivity and Other Methods”.
[5] Gayathri, S.L., 2024. “Seasonal Mastitis Assessment in Holstein Friesian Cows Using Infrared Thermography.”
[6] Zhang, Q., Yang, Y., Liu, G., Ning, Y., & Li, J., 2023.”Dairy Cow Mastitis Detection by Thermal Infrared Images Based on CLE-UNet.”
[7] Singh, K., et al., 2023. “Association of Electric Conductivity, Milk pH and Milk Constituents with Udder Health in Zebu Cattle.”
[8] Deeksha & Sindhu, S., 2021. “A Review of Infrared Thermography: Boon in Early Detection of Mastitis.”
[9] Rukmana, et al., 2021. “Mastitis Detection System in Dairy Cow Milk Based on Fuzzy Inference System Using Electrical Conductivity and Power of Hydrogen Sensor Value.”
[10] Paudyal, S., et al., 2019. “Use of Milk Electrical Conductivity for the Differentiation of Mastitis-Causing Pathogens.”
[11] Kim, H., Min, Y., & Choi, B. (2019). “Real-time temperature monitoring for the early detection of mastitis in dairy cattle.”
[12] Ndirangu, P.N., et al., 2019. “A Novel pH-Based Pen-Side Test for Detection of Sub-Clinical Mastitis.”
[13] Kandeel, S.A., Megahed, A.A., & Constable, P.D., 2019. “Evaluation of Hand-Held Sodium, Potassium, Calcium, and Electrical Conductivity Meters for Diagnosing Subclinical Mastitis and Intramammary Infection in Dairy Cattle.”
[14] Martins, et al., 2019. “Biosensors for On-Farm Diagnosis of Mastitis.”
[15] Sharma, S.D., Gupta, V.K., & Sood, R.S., 2018. “Ability of Milk pH to Predict Subclinical Mastitis and Its Limitations.”
[16] Sathiyabarathi, M., et al., 2016. “A Potential Non-Invasive Tool to Monitor Udder Health Status Using Infrared Thermography.”
[17] Çolak, A., Polat, B., Okumu?, Z., Kaya, M., Yanmaz, L., & Hay?rl?, A., 2008.”Early Detection of Mastitis Using Infrared Thermography in Dairy Cows.”
[18] Norberg, P., & Hogeveen, H., 2004. “Electrical Conductivity and pH as Indicators of Subclinical Mastitis in Dairy Cows.”
[19] Nielen, M., 1992. “Electrical Conductivity of Milk: Measurement, Modifiers, and Application in Mastitis Detection.”
[20] Marschke, R.J., & Kitchen, B.J., 1985. “Detection of Bovine Mastitis by Bromothymol Blue pH Indicator Test.”