Smart Farming: The 3 Elements of an AI Pest Detection System
Mouser ElectronicsMouser Electronics
Every year, across the globe, farmers lose up to 40% of their crops to pests and disease. On their own, invasive insects inflict at least $70 billion worth of losses. And, as the Earth continues to warm, crop-eating bugs are migrating to entirely new areas, making the problem even worse.
Indiscriminate pesticide use is not the solution.Â
“Over-reliance on pesticides impairs the natural balance of the crop ecosystem,” says the Food and Agriculture Organization (FAO) of the United Nations. “It also contributes to a vicious cycle of pest resistance, which can lead to increased pesticide use with little change in crop losses to pests and diseases.”Â
The FAO recommends “rational use of pesticides” among other strategies for safe pest management in global agriculture. However, such “rational use” requires increased visibility for targeted, low-impact responses.
In other words, farmers need to know which bugs are eating their crops. They need to know when they visit, and where they are, exactly.
The Internet of Things can help. Here’s a proof-of-concept proposal for an IoT pest-detection system that should be simple enough to build, whether you’re an IoT product developer or a tech-forward farmer.Â
The pest-detection system we propose boils down to three key elements. We’ll explore each of them in this article.
The pest-detection system we propose must have at least four capabilities. It must:Â Â
To meet all of these goals, we propose the following three-component IoT pest-detection system:Â Â
Pest detection starts with devices in the field. Our design for an AI pest-detection device contains two main components:Â
AI pest-detection devices will be deployed in the field; swapping batteries out will be extremely inconvenient (and therefore expensive). That’s why these devices must operate with very low power consumption.Â
By using a 2.4 Ghz proprietary protocol for local data transmission, from the device to the gateway, we eliminate the need for multiple SIM cards—and keep power use low by eliminating network scans.Â
The other way to program the microcontroller is for limited activity. The user will need to determine how often devices collect images—and therefore use energy waking up, taking a picture, processing the image at the edge, transmitting the data, and finally going back to sleep.  Â
That might be once an hour, once a week, or anywhere in between. Imagine a spectrum, with reading density on one end and energy conservation on the other. Each user must decide where on that spectrum to locate their sensors.Â
So what technology might create such a device? We used the Arduino Nicla Vision for the camera module/microcontroller and the WĂĽrth Elektronik Thyone-I radio module for connectivity.
Of course, we still needed a way to transmit data from the field to the cloud. That’s where our next component comes in.Â
Edge IoT systems in agriculture need to balance low power with wide-area connectivity. The cellular technologies built for massive IoT—LTE-M and NB-IoT—meet these needs.Â
For each localized cluster of sensor nodes, this system uses a cellular gateway running on LTE-M and/or NB-IoT. Remember that our sensors send data to this gateway using a 2.4 Ghz proprietary protocol, eliminating the need for individual SIM cards.Â
Only one SIM card is needed per gateway, and this handles the transmission of aggregated sensor data to the cloud.Â
We connected a Thyone board to an Adrastea-I FeatherWing kit; the Thyone board receives data from the sensors, and the Thyone-I FeatherWing passes it on to the cloud.
But how does the sensor node process image data to identify pests in the first place? It runs machine learning software at the edge, bringing us to the final element of our proposed pest-detection system.Â
For our system to work properly, we couldn’t rely on the typical cloud-based machine learning. That would use more power and reduce efficiency.Â
Instead, we chose edge-based machine learning through TinyML, which can run directly on our camera/microcontroller boards. This approach decentralizes data processing from the cloud to the edge, improving both functional efficiency and security.Â
Machine learning is the real strength of this proposal. It allows you to train your models, customizing a detection system for threats specific to a given field. Customized machine-learning models can help save pest-control costs considerably. Here’s one example of how.
Take caterpillars, a common pest in soybean fields. Caterpillars aren’t always a threat, however. They only eat crops during one phase of their lifecycle, consuming ravenously until they reach a certain size, at which point they start preparing for metamorphosis.Â
By training your machine learning models on only smaller caterpillars, your system can learn to ignore the larger, harmless stage of the bug’s life. That way you can address only the real threat, reducing pesticide use to improve safety, reduce environmental impacts, and, of course, save money.Â
A word of warning about training machine learning models, however: you must create the largest, most comprehensive dataset possible. Look for images that depict your targeted pest from many different angles, in all sorts of lighting conditions. That’s the only way to ensure high accuracy rates.
The good news is that training machine learning models aren’t just for AI laboratories anymore. We used the Edge Impulse platform to train our AI pest-detection models. All you have to do is input the datasets, and Edge Impulse creates the model for you. It’s an affordable, time-efficient way to create powerful machine learning models—like the ones you need to build a highly effective IoT pest-detection system.Â
To sum up, you can build a cellular AI pest-detection system that runs machine learning at the edge yourself. Many components will work perfectly to build something like we just described, but here’s what we used:Â
Of course, this is just one design proposal for IoT and AI pest detection—and there are many other ways to tackle the same challenge. However, any effective pest-detection system will likely rely on the three main elements of sensor nodes, cellular gateways, and machine learning at the edge.
The Most Comprehensive IoT Newsletter for Enterprises
Showcasing the highest-quality content, resources, news, and insights from the world of the Internet of Things. Subscribe to remain informed and up-to-date.
New Podcast Episode
Recent Articles