Full text
Citation: Blanco-Carmona, P.; Baeza-Moreno, L.; Hidalgo-Fort, E.; Martín-Clemente, R.; González- Carvajal, R.; Muñoz-Chavero, F. AIoT in Agriculture: Safeguarding Crops from Pest and Disease Threats. Sensors 2023,23, 9733. https:// doi.org/10.3390/s23249733 Academic Editor: Raffaele Bruno Received: 7 November 2023 Revised: 5 December 2023 Accepted: 6 December 2023 Published: 10 December 2023 Copyright: © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). sensors Article AIoT in Agriculture: Safeguarding Crops from Pest and Disease Threats Pedro Blanco-Carmona 1, Lucía Baeza-Moreno 1, Eduardo Hidalgo-Fort 1,* , Rubén Martín-Clemente 2, Ramón González-Carvajal 1and Fernando Muñoz-Chavero 1 1Department of Electronic Engineering, University of Seville, 41092 Seville, Spain; [email protected] (P.B.-C.); [email protected] (L.B.-M.); [email protected] (R.G.-C.); [email protected] (F.M.-C.) 2Department of Signal Processing and Communications, University of Seville, 41092 Seville, Spain; [email protected] *Correspondence: [email protected] Abstract: A significant proportion of the world’s agricultural production is lost to pests and diseases. To mitigate this problem, an AIoT system for the early detection of pest and disease risks in crops is proposed. It presents a system based on low-power and low-cost sensor nodes that collect environmental data and transmit it once a day to a server via a NB-IoT network. In addition, the sensor nodes use individual, retrainable and updatable machine learning algorithms to assess the risk level in the crop every 30 min. If a risk is detected, environmental data and the risk level are immediately sent. Additionally, the system enables two types of notification: email and flashing LED, providing online and offline risk notifications. As a result, the system was deployed in a real-world environment and the power consumption of the sensor nodes was characterized, validating their longevity and the correct functioning of the risk detection algorithms. This allows the farmer to know the status of their crop and to take early action to address these threats. Keywords: Internet of Things (IoT); Wireless Sensor Network (WSN); NB-IoT; smart agriculture; Artificial Intelligence (AI) 1. Introduction Each year, up to 40% of the world’s agricultural productivity is lost to the ravages of pests and diseases [ 1 ]. A significant proportion of this staggering loss can be attributed to the lack of timely detection and identification of these threats. In the past, this problem was visually detected, by observing changes in the appearance of the crop. However, this is a tedious and time-consuming process when trying to assess the condition of each individual plant. To date in human history, there have been four agricultural revolutions [ 2 ]. The earliest of these was known as traditional agriculture, where individuals solely relied on manual labor and animal power to tend to their crops. In the mid-20th century, the second was characterized by the introduction of powered machinery systems, allowing a decrease in manual labor and an increase in productivity, coupled with the use of fertilizers and pesticides. The late 20th century marked the introduction of automated agriculture and monitoring crops. Finally, the most recent revolution incorporates the fundamental principles of Industry 4.0, involving advances such as Artificial Intelligence, the Internet of Things and Big Data, introducing new applications: smart metering [ 3 , 4 ] and artificial intelligence to optimize crop productivity [ 5 , 6 ], effectively addressing issues related to pests and diseases without resorting to conventional pesticide use. Other notable developments include intelligent irrigation methods [ 7 ], monitoring systems to manage smarter farms [ 8 ], the monitoring of water consumption levels [ 9 ] and efforts to reduce both environmental impact and resource depletion [10,11]. Sensors 2023,23, 9733. https://doi.org/10.3390/s23249733 https://www.mdpi.com/journal/sensors
Sensors 2023,23, 9733 2 of 19 With regard to pests and disease risk detection systems, several solutions have been proposed. These include computer vision techniques that analyze images for signs of pest infestation [ 12 ] or disease manifestation [ 13 ]. There has also been research into plant diseases using aerial images taken by unmanned aerial vehicles (UAVs) [ 14 ]. In addition, some systems have been developed to collect environmental data to aid both pest and disease detection [ 15 ]. Some approaches even combine different technologies to address this problem [16]. The Internet of Things (IoT) and Artificial Intelligence (AI) have proven to be invaluable tools in this respect. By applying these two technologies together, a remarkable fusion known as the Artificial Intelligence of Things (AIoT) has emerged, showing immense potential. Some of the most interesting features of this new paradigm include: • The availability of new low-cost sensors, which make it cheaper to create wireless devices and allow for a multitude of sensors adapted to the desired needs. • Wireless communications, such as NarrowBand-IoT (NB-IoT) [ 17 ], which allow high coverage in rural environments. •Low-power microprocessor systems, which ensure the longevity of AIoT devices. •The ability to analyze situations and make decisions. The main objective of this paper focuses on the successful implementation of a lowpower and low-cost AIoT pest and disease risk detection system. It should be noted that several existing systems rely on image analysis, although with inaccurate results when applied to large areas, while others use expensive and high-maintenance UAVs to achieve the desired results. In addition, some systems collect environmental data using AI algorithms to facilitate the development of energy-efficient and cost-effective solutions. This paper starts with an overview of the entire system, explaining how it works. This is followed by an explanation of the most important components of the system, namely sensor nodes and the server. In addition, emphasis is placed on the development of the algorithm used for the detection of pest and disease risks, as well as on the notification system in the case of risk detection. Then, it provides a description of the experimental results obtained and comparisons with other similar systems, to finally summarize the conclusions obtained from this work. 2. Materials and Methods 2.1. System Overview 2.1.1. System Architecture The system architecture is shown in Figure 1where orange arrows represent uplink and purple ones downlink communications. The system is composed of three blocks: • Sensor nodes: The sensor nodes are tasked with collecting data from environmental sensors. Using the NB-IoT network, this information is then wirelessly transmitted to the server. In addition, these sensors are evaluated in real time using a machine learning algorithm. This is used to determine if any pest or disease threats are emerging in the agricultural landscape. In cases where risks are detected, notifications are immediately sent to the farmer, alerting them to potential problems in specific areas of their crop. A decision tree algorithm was chosen for this AIoT system because of its compatibility with low-power nodes and its innate simplicity for human comprehension. • NB-IoT: The NB-IoT module acts as a wireless communication tool within the NB-IoT network, which is managed by mobile operators. This module establishes direct connections and is designed to provide sensor nodes with a long range and longer battery life due to its IoT-compatible infrastructure. This compatibility makes it an essential component for unattended devices deployed in agricultural environments, bringing significant benefits to these systems.
Sensors 2023,23, 9733 3 of 19 • Server: The server receives data from the sensor nodes and stores it in a database. This data is then used to continuously train the machine learning algorithm. It is important to note that the server also manages important risk alerts generated by the sensor nodes. These alerts are immediately sent to the farm owner, allowing them to react in a timely way and take the necessary measures to prevent any potential loss of crop or production yield. Sensors 2023, 23, x FOR PEER REVIEW 3 of 20 Figure 1. System architecture. The system is composed of three blocks: • Sensor nodes: The sensor nodes are tasked with collecting data from environmental sensors. Using the NB-IoT network, this information is then wirelessly transmitted to the server. In addition, these sensors are evaluated in real time using a machine learning algorithm. This is used to determine if any pest or disease threats are emerging in the agricultural landscape. In cases where risks are detected, notifications are immediately sent to the farmer, alerting them to potential problems in specific areas of their crop. A decision tree algorithm was chosen for this AIoT system because of its compatibility with low-power nodes and its innate simplicity for human comprehension. • NB-IoT: The NB-IoT module acts as a wireless communication tool within the NB- IoT network, which is managed by mobile operators. This module establishes direct connections and is designed to provide sensor nodes with a long range and longer battery life due to its IoT-compatible infrastructure. This compatibility makes it an essential component for unattended devices deployed in agricultural environments, bringing significant benefits to these systems. • Server: The server receives data from the sensor nodes and stores it in a database. This data is then used to continuously train the machine learning algorithm. It is important to note that the server also manages important risk alerts generated by the sensor nodes. These alerts are immediately sent to the farm owner, allowing them to react in a timely way and take the necessary measures to prevent any potential loss of crop or production yield. 2.1.2. Description of System Functionality The sensor network has three different use functionalities: • Data logger (Figure 2): Sensor nodes collect temperature, humidity, and rainfall data every 30 min. This information is stored in their memory. Every day, these data are sent to the server. Sending data every day was chosen as a compromise between the requirement for immediacy whilst minimizing power consumption, thus increasing battery life. A daily transmission frequency is adequate to monitor crops. If for some reason the sensor node detects a problematic situation, it would immediately send Figure 1. System architecture. 2.1.2. Description of System Functionality The sensor network has three different use functionalities: • Data logger (Figure 2): Sensor nodes collect temperature, humidity, and rainfall data every 30 min. This information is stored in their memory. Every day, these data are sent to the server. Sending data every day was chosen as a compromise between the requirement for immediacy whilst minimizing power consumption, thus increasing battery life. A daily transmission frequency is adequate to monitor crops. If for some reason the sensor node detects a problematic situation, it would immediately send all the stored data information with an appropriate warning, as can be seen in the ‘risk assessment and notification’ functionality. Sensors 2023, 23, x FOR PEER REVIEW 4 of 20 all the stored data information with an appropriate warning, as can be seen in the ‘risk assessment and notification’ functionality. Figure 2. Data logger functionality. • Risk evaluation and notification (Figure 3): Each time environmental data are collected in the data logger functionality, the risk level of the area is evaluated. By default, there is no risk and the system acts as a data logger. However, if it detects a risk, it immediately sends a risk alert along with all the information from the sensors. In this case, the server receives the alert and manages the necessary notifications so that the farmer is aware that there is a problem on the farm. In addition, the device installed on the farm has visual warning lights that flash at different frequencies when they detect a certain level of risk in the area. This functionality enables a lowpower and once-a-day solution that is also capable of detecting rapid changes and improving system responsiveness. Figure 3. Risk evaluation and notification. • Training and updating of the machine learning algorithm (Figure 4): Once a month, the server uses the collected environmental data to retrain each machine learning algorithm. These algorithms, which are specifically trained for each sensor node, are updated thanks to the Firmware Over The Air (FOTA) feature. This allows the algorithm to adapt to different terrain conditions, depending on where the device is installed. Figure 2. Data logger functionality. • Risk evaluation and notification (Figure 3): Each time environmental data are collected in the data logger functionality, the risk level of the area is evaluated. By default, there is no risk and the system acts as a data logger. However, if it detects a risk, it
Sensors 2023,23, 9733 4 of 19 immediately sends a risk alert along with all the information from the sensors. In this case, the server receives the alert and manages the necessary notifications so that the farmer is aware that there is a problem on the farm. In addition, the device installed on the farm has visual warning lights that flash at different frequencies when they detect a certain level of risk in the area. This functionality enables a low-power and once-a-day solution that is also capable of detecting rapid changes and improving system responsiveness. Sensors 2023, 23, x FOR PEER REVIEW 4 of 20 all the stored data information with an appropriate warning, as can be seen in the ‘risk assessment and notification’ functionality. Figure 2. Data logger functionality. • Risk evaluation and notification (Figure 3): Each time environmental data are collected in the data logger functionality, the risk level of the area is evaluated. By default, there is no risk and the system acts as a data logger. However, if it detects a risk, it immediately sends a risk alert along with all the information from the sensors. In this case, the server receives the alert and manages the necessary notifications so that the farmer is aware that there is a problem on the farm. In addition, the device installed on the farm has visual warning lights that flash at different frequencies when they detect a certain level of risk in the area. This functionality enables a lowpower and once-a-day solution that is also capable of detecting rapid changes and improving system responsiveness. Figure 3. Risk evaluation and notification. • Training and updating of the machine learning algorithm (Figure 4): Once a month, the server uses the collected environmental data to retrain each machine learning algorithm. These algorithms, which are specifically trained for each sensor node, are updated thanks to the Firmware Over The Air (FOTA) feature. This allows the algorithm to adapt to different terrain conditions, depending on where the device is installed. Figure 3. Risk evaluation and notification. • Training and updating of the machine learning algorithm (Figure 4): Once a month, the server uses the collected environmental data to retrain each machine learning algorithm. These algorithms, which are specifically trained for each sensor node, are updated thanks to the Firmware Over The Air (FOTA) feature. This allows the algorithm to adapt to different terrain conditions, depending on where the device is installed. Sensors 2023, 23, x FOR PEER REVIEW 5 of 20 Figure 4. Training and updating machine learning algorithm functionality. 2.2. Sensors Nodes The sensor nodes were specifically developed for this work and they are made up of two different boards. On the one hand, the Core Board is responsible for the processing and control of the peripherals, and on the other hand, the Sensor Board carries out the sensorization. The core of the first board is a STM32L152RE microprocessor (ST microelectronics manufacturer), a microprocessor based on an ultra-low power ARM Cortex M3, with a clock of 32 MHz and able to operate between 1.65 and 3.6 V. This microcontroller allows us to run a real-time operating system (FreeRTOS), which helps to concurrently perform sensor data collection, machine learning algorithm execution and data transmission. As additional peripherals to the microprocessor, the core board (Figure 5) is equipped with: • EEPROM memory for storage of data acquired by the sensors. • A SIM7080 NB-IoT transceiver (SIMCOM manufacturer), used to send the collected data to the server. It communicates with the microprocessor based on AT commands and a standby power consumption of 3 µA. • SIM card, required for connection to the mobile NB-IoT operator network. • Programming interface (JTAG). • Access to the I2C, SPI and UART communication interfaces. These interfaces are essential for managing workflows. Figure 5. Core Board. ECONATUR agricultural expertise was used to identify which sensors are the most appropriate to identify pest and disease risks, obtaining the following sensors: Figure 4. Training and updating machine learning algorithm functionality. 2.2. Sensors Nodes The sensor nodes were specifically developed for this work and they are made up of two different boards. On the one hand, the Core Board is responsible for the processing and control of the peripherals, and on the other hand, the Sensor Board carries out the sensorization. The core of the first board is a STM32L152RE microprocessor (ST microelectronics manufacturer), a microprocessor based on an ultra-low power ARM Cortex M3, with a clock of 32 MHz and able to operate between 1.65 and 3.6 V. This microcontroller allows us to run a real-time operating system (FreeRTOS), which helps to concurrently perform sensor data collection, machine learning algorithm execution and data transmission. As additional peripherals to the microprocessor, the core board (Figure 5) is equipped with: •EEPROM memory for storage of data acquired by the sensors. • A SIM7080 NB-IoT transceiver (SIMCOM manufacturer), used to send the collected data to the server. It communicates with the microprocessor based on AT commands and a standby power consumption of 3 µA. •SIM card, required for connection to the mobile NB-IoT operator network.
Sensors 2023,23, 9733 5 of 19 •Programming interface (JTAG). • Access to the I2C, SPI and UART communication interfaces. These interfaces are essential for managing workflows. Sensors 2023, 23, x FOR PEER REVIEW 5 of 20 Figure 4. Training and updating machine learning algorithm functionality. 2.2. Sensors Nodes The sensor nodes were specifically developed for this work and they are made up of two different boards. On the one hand, the Core Board is responsible for the processing and control of the peripherals, and on the other hand, the Sensor Board carries out the sensorization. The core of the first board is a STM32L152RE microprocessor (ST microelectronics manufacturer), a microprocessor based on an ultra-low power ARM Cortex M3, with a clock of 32 MHz and able to operate between 1.65 and 3.6 V. This microcontroller allows us to run a real-time operating system (FreeRTOS), which helps to concurrently perform sensor data collection, machine learning algorithm execution and data transmission. As additional peripherals to the microprocessor, the core board (Figure 5) is equipped with: • EEPROM memory for storage of data acquired by the sensors. • A SIM7080 NB-IoT transceiver (SIMCOM manufacturer), used to send the collected data to the server. It communicates with the microprocessor based on AT commands and a standby power consumption of 3 µA. • SIM card, required for connection to the mobile NB-IoT operator network. • Programming interface (JTAG). • Access to the I2C, SPI and UART communication interfaces. These interfaces are essential for managing workflows. Figure 5. Core Board. ECONATUR agricultural expertise was used to identify which sensors are the most appropriate to identify pest and disease risks, obtaining the following sensors: Figure 5. Core Board. ECONATUR agricultural expertise was used to identify which sensors are the most appropriate to identify pest and disease risks, obtaining the following sensors: temperature, humidity and crop precipitation. Market research for different sensors was carried out. These were chosen based on the following criteria: accuracy and energy consumption. On the market, temperature and humidity sensors are usually included in a single sensor. Table 1shows the different sensors evaluated according to the characteristics mentioned above. Table 1. Evaluation of temperature and humidity sensors. Sensor Resolution (bits) Temp. Tolerance (◦C) Hum. Tolerance (%) Power Consumption (µA) Price (€) SHTC3 16 ±0.2 ◦C±2% Active: 430 Sleep: 0.6 1.05 HDC1080DMBR 14 ±0.2 ◦C±2% Active: 710 Sleep: 0.1 3.84 SHT30-DIS 16 ±0.2 ◦C±2% Active: 600 Sleep: 0.2 2.97 SHT20 14 ±0.2 ◦C±3% Active: 300 Sleep: 0.15 4.57 As all sensors had very similar tolerances and the resolution of 14 to 16 bits was not significant for our application, it was decided to prioritize the power consumption, choosing the SHT20 sensor, as it has the lowest power consumption. Regarding the rain gauge, they are usually associated with complete weather stations, but a low-cost, low-consumption solution was needed. Therefore, the WH-SP-RG rain gauge with pulsed output was chosen, which minimized the cost and guaranteed low energy consumption. Thus, the sensor node was equipped with a temperature and humidity sensor SHT20 and a WH-SP-RG rain gauge. As can be seen in Figure 6, the sensor board designed has some non-welded components that are intended for additional tasks to be carried out during the overall project.
Sensors 2023,23, 9733 6 of 19 Sensors 2023, 23, x FOR PEER REVIEW 6 of 20 temperature, humidity and crop precipitation. Market research for different sensors was carried out. These were chosen based on the following criteria: accuracy and energy consumption. On the market, temperature and humidity sensors are usually included in a single sensor. Table 1 shows the different sensors evaluated according to the characteristics mentioned above. Table 1. Evaluation of temperature and humidity sensors. Sensor Resolution (bits) Temp. Tolerance (°C) Hum. Tolerance (%) Power Consumption (µA) Price (€) SHTC3 16 ±0.2 °C ±2% Active: 430 Sleep: 0.6 1.05 HDC1080DMBR 14 ±0.2 °C ±2% Active: 710 Sleep: 0.1 3.84 SHT30-DIS 16 ±0.2 °C ±2% Active: 600 Sleep: 0.2 2.97 SHT20 14 ±0.2 °C ±3% Active: 300 Sleep: 0.15 4.57 As all sensors had very similar tolerances and the resolution of 14 to 16 bits was not significant for our application, it was decided to prioritize the power consumption, choosing the SHT20 sensor, as it has the lowest power consumption. Regarding the rain gauge, they are usually associated with complete weather stations, but a low-cost, low-consumption solution was needed. Therefore, the WH-SP-RG rain gauge with pulsed output was chosen, which minimized the cost and guaranteed low energy consumption. Thus, the sensor node was equipped with a temperature and humidity sensor SHT20 and a WH-SP-RG rain gauge. As can be seen in Figure 6, the sensor board designed has some non-welded components that are intended for additional tasks to be carried out during the overall project. Figure 6. Sensor Board. The sensor node, comprised of the two assembled boards, the battery (LSP33600-20F), the antenna and the sensors, is shown in Figure 7: Figure 6. Sensor Board. The sensor node, comprised of the two assembled boards, the battery (LSP33600-20F), the antenna and the sensors, is shown in Figure 7: Sensors 2023, 23, x FOR PEER REVIEW 7 of 20 Figure 7. Sensor Node. At the firmware level, drivers were created to manage each sensor and manage the external peripherals, as well as all the FreeRTOS tasks required. The above task diagram (Figure 8), where blue arrows represent queues and orange ones, RTOS semaphores, can be described as follows: vInitialisation is responsible for initializing all the environmental sensors and the NB-IoT transceiver, as well as detecting whether FOTA is required. The vMeasureTempHum and vMeasureRainfall tasks then collect the temperature and humidity, and rainfall, respectively, and pass them to the vMachineLearningAlgorithms task, which is responsible for detecting whether there are pest and/or disease risks using the decision tree algorithms. If there is no risk, the system goes into standby mode, and if there is a risk, it sends it over NB-IoT via the vModemManager. In addition, data is periodically sent, whether there is a risk or not. Additionally, there is a debugging task (vDebug), watchdog management (vResfreshIWDG), low power management (vPortSupressTicksAndSleep) and management of different alarms (RTCAlarmA- BCallback). Thanks to this multi-tasking system, a high level of system reliability is achieved, enabling long-term deployment by allowing actions to be taken in the event of system failure, such as: vResfreshIWDG task restarts the system when the microprocessor goes into an unknown state, vMeasureTempHum and vMeasureRainfall tasks run sequences to reboot and/or shut down and power up sensors in the event of a lack of communication with them, and vModemManager task stores the data to be sent in the future in case the network is unavailable at that moment. Figure 7. Sensor Node. At the firmware level, drivers were created to manage each sensor and manage the external peripherals, as well as all the FreeRTOS tasks required. The above task diagram (Figure 8), where blue arrows represent queues and orange ones, RTOS semaphores, can be described as follows: vInitialisation is responsible for initializing all the environmental sensors and the NB-IoT transceiver, as well as detecting whether FOTA is required. The vMeasureTempHum and vMeasureRainfall tasks then collect the temperature and humidity, and rainfall, respectively, and pass them to the vMachine-
Sensors 2023,23, 9733 7 of 19 LearningAlgorithms task, which is responsible for detecting whether there are pest and/or disease risks using the decision tree algorithms. If there is no risk, the system goes into standby mode, and if there is a risk, it sends it over NB-IoT via the vModemManager. In addition, data is periodically sent, whether there is a risk or not. Additionally, there is a debugging task (vDebug), watchdog management (vResfreshIWDG), low power management (vPortSupressTicksAndSleep) and management of different alarms (RTCAlarmA-BCallback). Thanks to this multi-tasking system, a high level of system reliability is achieved, enabling long-term deployment by allowing actions to be taken in the event of system failure, such as: vResfreshIWDG task restarts the system when the microprocessor goes into an unknown state, vMeasureTempHum and vMeasureRainfall tasks run sequences to reboot and/or shut down and power up sensors in the event of a lack of communication with them, and vModemManager task stores the data to be sent in the future in case the network is unavailable at that moment. Sensors 2023, 23, x FOR PEER REVIEW 8 of 20 Figure 8. FreeRTOS tasks diagram. 2.3. Decision Tree A decision tree algorithm has the particularity that it is human readable and computationally simple, so it can be easily implemented in the sensor node. It is essential to be able to have an easy-to-integrate algorithm because the nodes will use edge computing to detect if there is any type of risk and quickly notify it. The algorithm was initially trained using databases from meteorological stations, such as that of IFAPA [18], and using the knowledge of agricultural experts for labeling pest and disease risks. The input features of the algorithm are current temperature, maximum daytime temperature, current humidity, maximum daytime humidity and current rainfall. Finally, several decision trees were adjusted to detect a certain number of pests and diseases at different depths and sizes. Figure 9 shows a shallow decision tree to understand how it works through if other conditions with different environmental variables are involved. In general, the prediction of the algorithm is a certain pest/infestation risk level classified into three types: low, medium and high. An example is shown in Figure 9 of a decision tree evaluation with Tamb = 24, HR = 10, HR_Max = 40, assuming a medium level of risk for diseases. Once the sensor was installed, the data collected were used by the server to further train the algorithm and improve it. In this way, it was possible to update the nodes with these remotely trained algorithms. The server is prepared to retrain the algorithms, which can be remotely updated on the sensor nodes at any time. The re-trainability of the algorithms gives the advantage of making new algorithms that can be adapted to the Figure 8. FreeRTOS tasks diagram. 2.3. Decision Tree A decision tree algorithm has the particularity that it is human readable and computationally simple, so it can be easily implemented in the sensor node. It is essential to be able to have an easy-to-integrate algorithm because the nodes will use edge computing to detect if there is any type of risk and quickly notify it. The algorithm was initially trained using databases from meteorological stations, such as that of IFAPA [ 18 ], and using the knowledge of agricultural experts for labeling pest and disease risks. The input features of the algorithm are current temperature, maximum daytime temperature, current humidity, maximum daytime humidity and current rainfall. Finally, several decision trees were adjusted to detect a certain number of pests and diseases
Sensors 2023,23, 9733 8 of 19 at different depths and sizes. Figure 9shows a shallow decision tree to understand how it works through if other conditions with different environmental variables are involved. In general, the prediction of the algorithm is a certain pest/infestation risk level classified into three types: low, medium and high. An example is shown in Figure 9of a decision tree evaluation with Tamb = 24, HR = 10, HR_Max = 40, assuming a medium level of risk for diseases. Sensors 2023, 23, x FOR PEER REVIEW 9 of 20 emergence of new pests and/or diseases based on the labels established by the agricultural experts. Figure 9. Decision tree for disease risk evaluation. Tamb = ambient temperature, HR = relative humidity and HR_Max = relative maximum humidity in the last 24 h. The algorithm outputs an assessment of risk, i.e., BAJO (low), MEDIO (medium) and ALTO (high). The threshold of the decision trees will change over time. Thus, each sensor node will have its own specific decision tree. Depending on the distribution of the sensor nodes, they will be able to obtain different temperature, humidity and rainfall values, especially in large crops, so the pest and disease risk assessment will change. This feature allows the algorithm to adapt to the type of terrain, type of crop, type of pest, type of disease, climate, etc. The sensor node, through the algorithm, sends notifications as soon as a change in risk level is detected, as opposed to waiting an entire day to send the information to the server. 2.4. Server With regard to storage, data exploration, analysis and visualization of the information received by the remote nodes, a microservices architecture is available to guarantee scalability and isolation between the different applications involved in the process. Figure 10 shows a diagram with the basic microservices architecture involved in the information management system, as well as other intermediate middleware resources useful for the correct development of the system (security layers, load balancing management, reverse proxy, etc.). Figure 9. Decision tree for disease risk evaluation. Tamb = ambient temperature, HR = relative humidity and HR_Max = relative maximum humidity in the last 24 h. The algorithm outputs an assessment of risk, i.e., BAJO (low), MEDIO (medium) and ALTO (high). Once the sensor was installed, the data collected were used by the server to further train the algorithm and improve it. In this way, it was possible to update the nodes with these remotely trained algorithms. The server is prepared to retrain the algorithms, which can be remotely updated on the sensor nodes at any time. The re-trainability of the algorithms gives the advantage of making new algorithms that can be adapted to the emergence of new pests and/or diseases based on the labels established by the agricultural experts. The threshold of the decision trees will change over time. Thus, each sensor node will have its own specific decision tree. Depending on the distribution of the sensor nodes, they will be able to obtain different temperature, humidity and rainfall values, especially in large crops, so the pest and disease risk assessment will change. This feature allows the algorithm to adapt to the type of terrain, type of crop, type of pest, type of disease, climate, etc. The sensor node, through the algorithm, sends notifications as soon as a change in risk level is detected, as opposed to waiting an entire day to send the information to the server. 2.4. Server With regard to storage, data exploration, analysis and visualization of the information received by the remote nodes, a microservices architecture is available to guarantee scalability and isolation between the different applications involved in the process. Figure 10 shows a diagram with the basic microservices architecture involved in the information management system, as well as other intermediate middleware resources useful for the correct development of the system (security layers, load balancing management, reverse proxy, etc.).
Sensors 2023,23, 9733 9 of 19 Sensors 2023, 23, x FOR PEER REVIEW 10 of 20 Figure 10. Server functional block diagram. The first block belongs to the sensor nodes deployed in the crop, which send sensor data via the NB-IoT network to the server. The data are sent every day unless a certain type of risk has been detected. The server module, which forms the core of this section, is composed of microservices (applications) that operate in isolation but are able to communicate with each other. The main services deployed in the server are: • Data storage: It oversees the storage of all data collected by the sensor nodes, both for visualization and to train the decision tree algorithm. • Data processing: This microservice performs the whole algorithm retraining procedure, which is executed every month and generates new algorithms to be updated, through FOTA, in sensor nodes. • Email service: It is responsible for building and sending weekly e-mail notifications on the status of the environmental variables sensed, and for sending notifications of pest and/or disease risk detection. • Frontend: The frontend microservice is responsible for providing the necessary web interface so that the user can easily access the contents stored on the server. • Backend: It supports the frontend operations, making any data it requires available and ensuring that all requests are secure. • Other microservices: This paper is focused on the main features of the system, however, other microservices are executed in parallel, such as security layers and load balancing management. Finally, there is a block for the presentation of information to the user and support for the export of original and system-processed data, as well as importing external data. The web interface is presented in Figure 11. It shows the geographical area where some of the terminal nodes created have been located. Other features integrated in the website are visualization (Figure 12) and the export/import of the data. Figure 10. Server functional block diagram. The first block belongs to the sensor nodes deployed in the crop, which send sensor data via the NB-IoT network to the server. The data are sent every day unless a certain type of risk has been detected. The server module, which forms the core of this section, is composed of microservices (applications) that operate in isolation but are able to communicate with each other. The main services deployed in the server are: • Data storage: It oversees the storage of all data collected by the sensor nodes, both for visualization and to train the decision tree algorithm. • Data processing: This microservice performs the whole algorithm retraining procedure, which is executed every month and generates new algorithms to be updated, through FOTA, in sensor nodes. • Email service: It is responsible for building and sending weekly e-mail notifications on the status of the environmental variables sensed, and for sending notifications of pest and/or disease risk detection. • Frontend: The frontend microservice is responsible for providing the necessary web interface so that the user can easily access the contents stored on the server. • Backend: It supports the frontend operations, making any data it requires available and ensuring that all requests are secure. • Other microservices: This paper is focused on the main features of the system, however, other microservices are executed in parallel, such as security layers and load balancing management. Finally, there is a block for the presentation of information to the user and support for the export of original and system-processed data, as well as importing external data. The web interface is presented in Figure 11. It shows the geographical area where some of the terminal nodes created have been located. Other features integrated in the website are visualization (Figure 12) and the export/import of the data. On the web page, the data acquired from the different sensors are displayed. For instance, in Figure 12, the graphs of the temperature data in degrees Celsius (upper chart) and humidity in percentage (lower chart) over a period of one week are shown. The ability to export the data was introduced to allow them to be displayed on other media and/or to create new machine learning algorithms that can be used in the sensor nodes, as well as other functionalities.
Sensors 2023,23, 9733 16 of 19 Sensors 2023, 23, x FOR PEER REVIEW 17 of 20 Figure 18. Almond tree with a few aphids on some of its leaves. Figure 19. Almond tree completely infested with aphids. Figure 19. Almond tree completely infested with aphids. During these months, the algorithm was remotely updated to check the correct performance of this functionality, with satisfactory results. Furthermore, it was verified that all the devices correctly worked, without the need to replace batteries, no problems were detected in coverage failure, and no samples were lost. 4. Comparative Study and Discussion In this article, a comparative study of the developed system with previously proposed systems was carried out. Table 3compares the main characteristics of the AIoT systems. Table 3. Comparative with others AIoT Systems. Features Ching-Ju Chen et al. [21] Olivier Debauche et al. [22]N. Materne et al. [23] T. T. Win et al. [24] This Work Sensors Temperature, humidity, mobile phone, UAV Temperature, humidity, barometer, rain, gauge, .. . Air temperature, air humidity, CO2, illumination intensity, soil temperature, soil humidity, soil moisture, leaf wetness Temperature, humidity, pressure, sunlight level, water level Temperature, humidity, rain gauge AI algorithm execution Server Node Server Server Node Detect pests Yes Yes Yes No Yes Detect diseases No Yes Yes Yes (with images) Yes Alerts via internet Yes Yes No No Yes Visual alerts No No No No Yes Evaluation period Each 1 h Each 5 min Each 30 min - Each 30 min Transmission interval Each 1 h Each 5 min Each 30 min - Each day Network LoRa LoRa ZigBee LoRa NB-IoT Autonomy - - - - 17 years
Sensors 2023,23, 9733 17 of 19 Comparing these systems, the use of edge computing in [ 22 ] and this work stands out, as the system does not depend on the server for the execution of the algorithm. Additionally, the system by Chen et al. lacks disease detection. While N. Materne et al. [ 23 ] used ZigBee, the three other systems use LoRa, and this work employs NB-IoT. NB-IoT, in contrast to ZigBee and LoRa, has the advantage that it is a self-managed network, being operated by the mobile operators. In this case, this network is available in almost 100% of the Spanish territory, with very competitive prices. The algorithms presented in this work are retrainable, so they have high flexibility to changes such as new pests, new diseases, the type of crop, the type of terrain, etc. If the algorithm detects an increased risk, the system alerts the farmer. An important point is the presence of visual alerts in the system presented in this article, which is essential for the farmer not to be completely dependent on the Internet. It is understood that different farmers will want different methods of notification. As all alarms are stored on the server, the developed system allows the integration of any type of alarm, either physical (e.g., audible alarm), information technology (e.g., Telegram bot) or mobile (e.g., SMS). This work permits the use of edge computing techniques, minimizing the power consumption of the sensor node, and does reduce the response time when notifying of a certain risk in the crop. The evaluation time is 30 min, close to the other systems. On the other hand, the transmission interval increases by up to one transmission per day. In addition, the number of sensors has been minimized, only using those that experts have considered necessary for this application. This results in a competitively priced, low-power and low-cost device. 5. Conclusions This work demonstrates that it is possible to develop a pest and disease risk detection system using AIoT technology by developing low-power and low-cost sensor nodes. To this aim, all system functionalities (data logger, risk assessment and notification, training and updating of the machine learning algorithm) were validated with satisfactory results in a real-world environment. In addition, a decision tree algorithm is proposed capable of detecting the pest and disease risk levels in crops. ECONATUR agricultural experts have determined that it is possible to assess pest and disease risks based on crop temperature, humidity and rainfall measurements, minimizing the number of sensors required and therefore reducing the cost of the sensor node. Thanks to continuous data acquisition, this system can continuously improve the algorithm and be remotely updated. Having a sensor nodes network in the crop allows for the detection of the location where the risk has emerged and will make it possible to study the evolution of pests and diseases in the crop. The advantage of retraining and updating algorithms allows for an adaptation to new pests and diseases, as well as different types of terrain and/or crops. This system employs edge computing techniques, increasing transmission intervals via NB-IoT and uses a minimized sensor suit, allowing for a low-power, low-cost solution. The system also provides a high level of responsiveness to changes that may be detrimental to the crop, as under risk-free conditions the transmission rate may be one day, but if a risk is detected, the transmission is immediate. The risks detected are communicated to the farmer by means of alerts. Two are proposed in this work: visual alerts and e-mail alerts. However, thanks to the reception of risk reports, the server is ready to implement any other type of alert that a farmer may request. With the results obtained, the feasibility of AIoT systems used to detect pests and diseases in crops was demonstrated, providing early risk warnings of crop issues. In this way, it allows the farmer to quickly act and minimize annual production losses. Author Contributions: Conceptualization, P.B.-C., R.M.-C., R.G.-C. and F.M.-C.; methodology, P.B.-C., L.B.-M., E.H.-F., R.M.-C., R.G.-C. and F.M.-C.; software, P.B.-C., L.B.-M. and E.H.-F.; validation P.B.-C., L.B.-M., E.H.-F. and R.M.-C.; formal analysis, P.B.-C. and L.B.-M.; investigation, P.B.-C.,
Sensors 2023,23, 9733 18 of 19 L.B.-M., E.H.-F. and R.M.-C.; resources P.B.-C., L.B.-M., E.H.-F., R.M.-C., R.G.-C. and F.M.-C.; data curation, P.B.-C., L.B.-M. and E.H.-F.; writing—original draft preparation P.B.-C., L.B.-M. and E.H.-F.; writing—review and editing, P.B.-C., R.M.-C. and R.G.-C.; visualization, P.B.-C., L.B.-M. and E.H.-F.; supervision, P.B.-C., R.G.-C. and F.M.-C. All authors have read and agreed to the published version of the manuscript. Funding: The authors would like to thank the Spanish ministries of innovation and science for funding this research under Grant PID2019-107258RB-C31 funded by MCIN/AEI/10.13039/501100011033 and Industry, Trade and Tourism under research project IAgri (ref. AEI-010500-2020-188). Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Data are contained within the article. Acknowledgments: Authors would like to thank the agricultural company ECONATUR. Conflicts of Interest: The authors declare no conflict of interest. References 1. FAO Launches 2020 as the UN’s International Year of Plant Health. 2019. Available online: https://www.fao.org/news/story/ en/item/1253551/icode/ (accessed on 2 September 2023). 2. Liu, Y.; Ma, X.; Hancke, G.P.; Abu-Mahfouz, A.M. From Industry 4.0 to agriculture 4.0: Current status, enabling technologies, and research challenges. IEEE Trans. Ind. Inform. 2021,17, 4322–4334. [CrossRef] 3. Ullo, S.L.; Sinha, G.R. Advances in Smart Environment Monitoring Systems Using IoT and Sensors. Sensors 2020 ,20, 3113. [CrossRef] [PubMed] 4. Jawad, H.M.; Nordin, R.; Gharghan, S.K.; Jawad, A.M.; Ismail, M. Energy-Efficient Wireless Sensor Networks for Precision Agriculture: A review. Sensors 2017,17, 1781. [CrossRef] [PubMed] 5. Thangaraj, R.; Anandamurugan, S.; Pandiyan, P.; Kaliappan, V.K. Artificial intelligence in tomato leaf Disease Detection: A Comprehensive Review and discussion. J. Plant Dis. Prot. 2021,129, 469–488. [CrossRef] 6. Ayed, R.B.; Hanana, M. Artificial intelligence to improve the food and agriculture sector. J. Food Qual. 2021 ,2021, 5584754. [CrossRef] 7. García, L.; Parra, L.; Jiménez, J.M.; Lloret, J.; Lorenz, P. IoT-Based Smart Irrigation Systems: An overview on the recent trends on sensors and IoT systems for irrigation in precision agriculture. Sensors 2020,20, 1042. [CrossRef] [PubMed] 8. Almalki, F.A.; Soufiene, B.O.; Alsamhi, S.H.; Sakli, H. A Low-Cost platform for environmental smart farming monitoring system based on IoT and UAVs. Sustainability 2021,13, 5908. [CrossRef] 9. Soh ZH, C.; Shafie MS, B.; Shafie, M.S.; Sulaiman, S.N.; Ibrahim, M.H.; Abdullah SA, C. IoT Water Consumption Monitoring & Alert System. In Proceedings of the 2018 International Conference on Electrical Engineering and Informatics (ICELTICs), Banda Aceh, Indonesia, 19–20 September 2018. [CrossRef] 10. Linaza, M.T.; Posada, J.; Bund, J.; Eisert, P.; Quartulli, M.; Döllner, J.; Pagani, A.; Olaizola, I.G.; Barriguinha, A.; Moysiadis, T.; et al. Data-Driven Artificial Intelligence applications for sustainable precision agriculture. Agronomy 2021,11, 1227. [CrossRef] 11. Shankar, P.; Werner, N.; Selinger, S.; Janssen, O. Artificial Intelligence Driven Crop Protection Optimization for Sustainable Agriculture. In Proceedings of the 2020 IEEE/ITU International Conference on Artificial Intelligence for Good (AI4G), Geneva, Switzerland, 21–25 September 2020. [CrossRef] 12. Nagar, H.; Sharma, R. A Comprehensive Survey on Pest Detection Techniques using Image Processing. In Proceedings of the 2020 4th International Conference on Intelligent Computing and Control Systems (ICICCS), Madurai, India, 13–15 May 2020. [CrossRef] 13. Mohanty, S.P.; Hughes, D.; Salathé, M. Using deep learning for Image-Based plant disease detection. Front. Plant Sci. 2016 ,7, 1419. [CrossRef] [PubMed] 14. Xin, Z.; Han, L.; Dong, Y.; Shi, Y.; Huang, W.; Han, L.; González-Moreno, P.; Ma, H.; Ye, H.; Sobeih, T. A Deep Learning-Based approach for automated yellow rust disease detection from High-Resolution Hyperspectral UAV images. Remote Sens. 2019 , 11, 1554. [CrossRef] 15. Truong, T.; Dinh, A.; Wahid, K.A. An IoT environmental data collection system for fungal detection in crop fields. In Proceedings of the 2017 IEEE 30th Canadian Conference on Electrical and Computer Engineering (CCECE), Windsor, ON, Canada, 30 April–3 May 2017. [CrossRef] 16. Azfar, S.; Nadeem, A.; Ahsan, K.; Mehmood, A.; Siddiqui, M.S.; Saeed, M.; Ashraf, M. An IoT-Based system for efficient detection of cotton pest. Appl. Sci. 2023,13, 2921. [CrossRef] 17. NarrowBand IOT. Available online: https://www.3gpp.org/news-events/1733-niot (accessed on 8 September 2023). 18. Instituto de Investigación y Formación Agraria y Pesquera (IFAPA). Listado de Estaciones. Available online: https://www. juntadeandalucia.es/agriculturaypesca/ifapa/riaweb/web/estaciones (accessed on 4 August 2023).
Sensors 2023,23, 9733 19 of 19 19. Fundación Aquae. ¿Cuál es El País Donde Llueve Más? ¿Y Menos? 2021. Available online: https://www.fundacionaquae.org/ wiki/en-que-pais-llueve-mas-y-menos-colombia-y-egipto/#:~:text=%C2%BFCu%C3%A1l%20es%20el%20pa%C3%ADs%20 donde%20m%C3%A1s%20llueve?,mm%20de%20lluvia%20por%20a%C3%B1o (accessed on 11 October 2023). 20. Resumen de La Evolución de Las Precipitaciones en España. 2023. Available online: https://www.aemet.es/documentos/es/ serviciosclimaticos/vigilancia_clima/resumen_precipitaciones/resumen_precipitaciones.pdf (accessed on 16 October 2023). 21. Chen, C.; Huang, Y.; Li, Y.; Chang, C.; Huang, Y. An AIOT based smart agricultural system for pests detection. IEEE Access 2020 , 8, 180750–180761. [CrossRef] 22. Debauche, O.; Mahmoudi, S.; Elmoulat, M.; Mahmoudi, S.A.; Manneback, P.; Lebeau, F. Edge AI-IoT pivot irrigation, plant diseases, and pests identification. Procedia Comput. Sci. 2020,177, 40–48. [CrossRef] 23. Materne, N.; Inoue, M. IoT Monitoring System for Early Detection of Agricultural Pests and Diseases. In Proceedings of the 2018 12th South East Asian Technical University Consortium (SEATUC), Yogyakarta, Indonesia, 12–13 March 2018. [CrossRef] 24. Win, T.T.; Markon, S. IoT and AI Methods for Plant Disease Detection in Myanmar. Master’s Thesis, Kobe Institute of Computing, Hyogo, Japan, 2018. Available online: https://www.researchgate.net/publication/326988635_IoT_and_AI_methods_for_plant_ disease_detection_in_Myanmar (accessed on 4 September 2023). Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.