Clear Sky Science · en
Intelligent fire detection in agriculture using machine learning and embedded systems for risk prevention and improved sustainability
Why protecting farms from fire matters
Across the world, farmers are feeling the strain of hotter, drier weather and more frequent wildfires. A single blaze can wipe out harvests, damage soil, and threaten local food supplies. This paper presents a practical way to spot fires early on farms using a small, low-cost electronic device and smart computer programs, so that danger can be caught in time even in remote fields with little or no internet access.
Farms at risk in a warming world
Modern agriculture depends on stable weather, yet climate change is driving longer heat waves, drought, and more wildfires. Traditional fire watch methods, like patrols or distant cameras, are slow, expensive, and often miss small outbreaks. For many rural communities, especially those far from cities and network infrastructure, there is an urgent need for simple tools that can watch over crops around the clock, warn of trouble within seconds, and help protect food production without relying on complex cloud services.
A small box that watches for smoke and flame
The researchers built an autonomous fire detection unit around a palm-sized Raspberry Pi 3 B+ microcomputer. This device connects directly to smoke and flame sensors placed in the field. The sensors continuously measure how much smoke and flame is present, and the Raspberry Pi records these readings locally with precise time stamps. A small screen shows the current danger level and a buzzer sounds when risk becomes high, allowing nearby workers to react immediately. Because everything runs on the device itself, the system can operate in isolated farms that lack reliable internet or centralized servers. 
Teaching the device to judge fire danger
Simply sensing smoke and flame is not enough; the system must also decide how serious a situation is. To do this, the team trained several machine learning models—computer methods that learn patterns from data—on real measurements collected with their prototype. They defined three categories: normal conditions with no fire, a warning state with possible danger, and confirmed fires. Using a relatively small but carefully cleaned dataset, they applied models called logistic regression and random forest, along with linear regression to produce a continuous risk score. The models learned how combinations of smoke and flame levels correspond to these risk states, and how quickly changes over time signal rising danger.
How smart software boosts reliability
In tests, the random forest model stood out. It correctly classified fire risk levels with about 99% accuracy and similarly high scores for how many real fires it caught and how few it missed. The simpler logistic model also performed well, but random forest handled more complex patterns in the data and proved more stable across repeated trials. To guard against faulty sensors or odd environmental conditions, the researchers added an anomaly detection step using an approach called Isolation Forest. This added layer flags unusual readings that do not match normal behavior, which can indicate either a hidden fire pattern or a failing sensor. The team also analyzed when incidents tended to occur during the day, identifying time windows when closer monitoring may be especially useful. 
Toward smarter and more resilient farming
By combining inexpensive hardware, local data processing, and well-chosen machine learning methods, the proposed system offers farmers a practical early-warning tool for fire. It does not depend on fast internet links or large data centers, making it suitable for remote agricultural regions. The results suggest that such smart, embedded systems can significantly reduce the risk of fire damage, support more secure food production, and help farms adapt to a changing climate. With future additions—such as more environmental sensors, improved algorithms, and possibly solar power—this approach could evolve into a broader farm safety and resource management platform that protects both crops and the surrounding environment.
Citation: Morchid, A., Elbasri, A., Qjidaa, H. et al. Intelligent fire detection in agriculture using machine learning and embedded systems for risk prevention and improved sustainability. Sci Rep 16, 9773 (2026). https://doi.org/10.1038/s41598-026-40378-w
Keywords: smart agriculture, fire detection, machine learning, embedded systems, rural sustainability