Sensors 23 09733
Sensors 23 09733
Sensors 23 09733
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 1 and Fernando Muñoz-Chavero 1
1 Department 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.)
2 Department 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)
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 invalu-
able 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 low-
power 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.
• 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
Sensors 2023, 23, x FOR PEER REVIEW 3 of 20
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.
Figure1.1.System
Figure Systemarchitecture.
architecture.
Sensors 2023, 23, 9733 • Risk evaluation and notification (Figure 3): Each time environmental data are 4 ofcol-
19
lected in the data logger functionality, the risk level of the area is evaluated. By de-
fault, there is no risk and the system acts as a data logger. However, if it detects a
risk, it immediately
immediately sends a sends a risk
risk alert alertwith
along alongall with all the information
the information from thefrom the sensors.
sensors. In this
In this case, the server receives the alert and manages the necessary
case, the server receives the alert and manages the necessary notifications so that the notifications so
that the
farmer is farmer is aware
aware that therethat there is aon
is a problem problem
the farm.on Intheaddition,
farm. In the
addition,
devicethe device
installed
installed
on the farm onhasthevisual
farm warning
has visual warning
lights lightsatthat
that flash flash frequencies
different at different when
frequencies
they
when athey
detect detect
certain a certain
level of risk level
in theofarea.
risk This
in thefunctionality
area. This functionality enables a and
enables a low-power low-
power andsolution
once-a-day once-a-daythatsolution that is also
is also capable capable of
of detecting detecting
rapid changesrapid
andchanges
improving and
improving system
system responsiveness. responsiveness.
Figure3.3.Risk
Figure Riskevaluation
evaluationand
andnotification.
notification.
•• Training
Trainingandandupdating
updatingofofthe
themachine
machinelearning
learningalgorithm
algorithm(Figure
(Figure4):
4):Once
Onceaamonth,
month,
the server uses the collected environmental data to retrain each machine learning
the server uses the collected environmental data to retrain each machine learning al-
Sensors 2023, 23, x FOR PEER REVIEW algorithm. These algorithms, which are specifically trained for each sensor
gorithm. These algorithms, which are specifically trained for each sensor node, arenode,
5 of 20
are updated thanks to the Firmware Over The Air (FOTA) feature. This allows
updated thanks to the Firmware Over The Air (FOTA) feature. This allows the algo- the
algorithm to adapt
rithm to adapt to different
to different terrain
terrain conditions,
conditions, depending
depending on where
on where the device
the device is in-
is installed.
stalled.
Figure4.4.Training
Figure Trainingand
andupdating
updatingmachine
machinelearning
learningalgorithm
algorithmfunctionality.
functionality.
2.2.
2.2.Sensors
SensorsNodes
Nodes
The
The sensornodes
sensor nodeswere
werespecifically
specificallydeveloped
developedfor
forthis
thiswork
workand
andthey
theyare
aremade
madeupupof
of
two different boards. On the one hand, the Core Board is responsible for the processing
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 sensoriza-
and control of the peripherals, and on the other hand, the Sensor Board carries out the
tion. The core of the first board is a STM32L152RE microprocessor (ST microelectronics
sensorization. The core of the first board is a STM32L152RE microprocessor (ST microe-
manufacturer), a microprocessor based on an ultra-low power ARM Cortex M3, with a
lectronics manufacturer), a microprocessor based on an ultra-low power ARM Cortex M3,
clock of 32 MHz and able to operate between 1.65 and 3.6 V. This microcontroller allows
with a clock of 32 MHz and able to operate between 1.65 and 3.6 V. This microcontroller
us to run a real-time operating system (FreeRTOS), which helps to concurrently perform
allows us to run a real-time operating system (FreeRTOS), which helps to concurrently
sensor data collection, machine learning algorithm execution and data transmission.
perform sensor data collection, machine learning algorithm execution and data transmis-
As additional peripherals to the microprocessor, the core board (Figure 5) is
sion.
equipped with:
As additional peripherals to the microprocessor, the core board (Figure 5) is
•equipped
EEPROM with:memory for storage of data acquired by the sensors.
• A SIM7080 NB-IoT transceiver (SIMCOM manufacturer), used to send the collected
• dataEEPROM
to the memory
server. Itfor storage of data
communicates withacquired by the sensors.
the microprocessor based on AT commands
• and A SIM7080 NB-IoT transceiver (SIMCOM
a standby power consumption of 3 µA. manufacturer), used to send the collected
• datacard,
SIM to the server. It
required forcommunicates
connection to with the microprocessor
the mobile NB-IoT operatorbased on AT commands
network.
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 es-
sential for managing workflows.
sion.
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
Sensors 2023, 23, 9733 5 of 19
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
Programminginterface
interface(JTAG).
(JTAG).
•• Access
Accesstoto the
the I2C, SPI and
I2C, SPI and UART
UART communication
communicationinterfaces.
interfaces.These
These interfaces
interfaces areare
es-
essential for managing workflows.
sential for managing workflows.
Figure5.5.Core
Figure CoreBoard.
Board.
ECONATURagricultural
ECONATUR agriculturalexpertise
expertisewas
wasused
usedto
toidentify
identifywhich
whichsensors
sensorsare
arethe
themost
most
appropriateto to
appropriate identify
identify pestdisease
pest and and disease risks, obtaining
risks, obtaining thesensors:
the following 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 1 shows the different sensors evaluated according to the characteristics
mentioned above.
Power
Sensor Resolution (bits) Temp. Tolerance (◦ C) Hum. Tolerance (%) Price (€)
Consumption (µA)
Active: 430
SHTC3 16 ±0.2 ◦ C ±2% 1.05
Sleep: 0.6
Active: 710
HDC1080DMBR 14 ±0.2 ◦ C ±2% 3.84
Sleep: 0.1
Active: 600
SHT30-DIS 16 ±0.2 ◦ C ±2% 2.97
Sleep: 0.2
Active: 300
SHT20 14 ±0.2 ◦ C ±3% 4.57
Sleep: 0.15
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 compo-
nents that are intended for additional tasks to be carried out during the overall project.
tions, 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.
Sensors 2023, 23, 9733 6 of 19
As can be seen in Figure 6, the sensor board designed has some non-welded compo-
nents that are intended for additional tasks to be carried out during the overall project.
Figure6.6.Sensor
Figure SensorBoard.
Board.
Figure7.7.Sensor
Figure SensorNode.
Node.
Atthe
At thefirmware
firmware level,
level, drivers
drivers were created
created toto manage
manage eacheach sensor
sensorandandmanage
managethe the
externalperipherals,
external peripherals,as aswell
well as
as all
all the
the FreeRTOS
FreeRTOS tasks
tasks required.
Theabove
The abovetasktask diagram
diagram (Figure
(Figure 8), where blue arrows
arrows represent
represent queues
queuesand andorange
orange
ones, RTOS semaphores, can be described follows: vInitialisation is responsible forini-
ones, RTOS semaphores, can be described as follows: vInitialisation is responsible for ini-
tializing all
tializing all the
the environmental
environmental sensors
sensors and the NB-IoT
NB-IoT transceiver,
transceiver, asas well
well as
as detecting
detecting
whetherFOTA
whether FOTAisisrequired.
required. The
The vMeasureTempHum and vMeasureRainfall
vMeasureRainfall tasks
tasksthen
thencollect
collect
thetemperature
the temperatureand andhumidity,
humidity,and and rainfall,
rainfall, respectively,
respectively, andand pass
pass themthem to the
to the vMa-
vMachine-
chineLearningAlgorithms 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 manage-
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 de-
bugging 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
Sensors 2023, 23, x FOR PEER REVIEW 8 ofwith
20
them, and vModemManager task stores the data to be sent in the future in case the network
is unavailable at that moment.
Figure8.8.FreeRTOS
Figure FreeRTOStasks
tasksdiagram.
diagram.
2.3.Decision
2.3. Decision Tree
Tree
A decision
A decision tree tree algorithm
algorithm has the particularity
particularity that
thatititisishuman
humanreadable
readableand andcompu-
compu-
tationally simple,
tationally simple, soso it
it can
can be
be easily
easily implemented
implemented in in the
the sensor
sensor node.
node.ItItisisessential
essentialtotobe
be
ableto
able tohave
have anan easy-to-integrate
easy-to-integrate algorithm because the the nodes
nodes will
willuse
useedge
edgecomputing
computingtoto
detectififthere
detect thereisisany
any type
type ofof risk
risk and
and quickly
quickly notify it.
Thealgorithm
The algorithmwas wasinitially
initially trained
trained using
using databases
databases from from meteorological
meteorological stations,
stations, such
such
as thatasofthat of IFAPA
IFAPA [18],using
[18], and and using the knowledge
the knowledge of agricultural
of agricultural experts
experts for labeling
for labeling pest
pestdisease
and and disease
risks.risks. The input
The input features
features of theofalgorithm
the algorithm are current
are current temperature,
temperature, max-
maximum
imum daytime
daytime temperature,
temperature, currentcurrent
humidity,humidity,
maximum maximum
daytimedaytime
humidityhumidity and current
and current rainfall.
rainfall.several
Finally, Finally, severaltrees
decision decision
weretrees weretoadjusted
adjusted to detect
detect a certain a certain
number number
of pests andof pests
diseases
and diseases at different depths and sizes. Figure 9 shows a shallow decision tree to un-
derstand 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
Sensors 2023, 23, 9733 8 of 19
at different depths and sizes. Figure 9 shows a shallow decision tree to understand how
itemergence
works through
of newifpests
otherand/or
conditions withbased
diseases different environmental
on the variables
labels established by theare involved.
agricultural
In general,
experts. 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.
Figure
Figure 9. Decision tree
9. Decision tree for
for disease
diseaserisk
riskevaluation.
evaluation.Tamb
Tamb = ambient
= ambient temperature,
temperature, HRHR = relative
= relative hu-
midity and
humidity HR_Max
and HR_Max = relative maximum
= relative maximum humidity
humidityin the lastlast
in the 24 24
h. h.
TheThe
algorithm outputs
algorithm an an
outputs as-
sessment ofofrisk,
assessment risk,i.e.,
i.e.,BAJO
BAJO(low),
(low),MEDIO
MEDIO(medium)
(medium)andandALTO
ALTO(high).
(high).
The threshold
Once the sensor of was
the decision
installed,trees
the will
datachange over
collected time.
were Thus,
used by each sensorto
the server node will
further
have its
train theown specificand
algorithm decision tree. Depending
improve on theitdistribution
it. In this way, was possible of the sensor nodes,
to update the nodesthey
with these
will be ableremotely
to obtaintrained
differentalgorithms.
temperature, The server isand
humidity prepared
rainfallto retrain
values, the algorithms,
especially in large
which
crops, socanthebepest
remotely updated
and disease on the sensor
risk assessment will nodes
change.atThis
anyfeature
time. allows
The re-trainability
the algorithm
of
to the
adapt algorithms
to the typegives the advantage
of terrain, of making
type of crop, newtype
type of pest, algorithms that
of disease, can beetc.
climate, adapted
to theThe emergence
sensor node, through the algorithm, sends notifications as soon as a changeby
of new pests and/or diseases based on the labels established the
in risk
agricultural experts.
level is detected, as opposed to waiting an entire day to send the information to the server.
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,
2.4. Server
they will
Withberegard
able totoobtain different
storage, data temperature, humidityand
exploration, analysis andvisualization
rainfall values, of especially
the infor-
in large crops, so the pest and disease risk assessment will change. This
mation received by the remote nodes, a microservices architecture is available to guaran- feature allows
the algorithm to adapt to the type of terrain, type of crop, type of pest,
tee scalability and isolation between the different applications involved in the process. type of disease,
climate, etc.
Figure 10 shows a diagram with the basic microservices architecture involved in the in-
The sensor node, through the algorithm, sends notifications as soon as a change in risk
formation management system, as well as other intermediate middleware resources use-
level is detected, as opposed to waiting an entire day to send the information to the server.
ful for the correct development of the system (security layers, load balancing manage-
ment,
2.4. reverse proxy, etc.).
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 scala-
bility 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.).
Sensors2023,
Sensors 2023,23,
23,9733
x FOR PEER REVIEW 10 of
9 of2019
Figure10.
Figure 10. Server
Server functional
functional block
block diagram.
diagram.
The first
The first block
block belongs to the sensor sensor nodes
nodes deployed
deployedin inthe
thecrop,
crop,which
whichsendsendsensor
sensor
data via the NB-IoT network to the server. The data are sent every
data via the NB-IoT network to the server. The data are sent every day unless a certain day unless a certain
type
type
of riskofhas
riskbeen
has detected.
been detected.
Theserver
The server module, which forms the core core ofofthis
thissection,
section,isiscomposed
composedofofmicroservices
microservices
(applications) that
(applications) that operate in isolation
isolation but
but are
are able
able toto communicate
communicatewith witheacheachother.
other.The
The
mainservices
main services deployed
deployed in the server are:
•• DataDatastorage:
storage:ItItoversees
overseesthethestorage
storageofofall alldata
datacollected
collectedbybythethe sensor
sensor nodes,
nodes, both
both for
for visualization
visualization andand to train
to train the the decision
decision treetree algorithm.
algorithm.
•• DataDataprocessing:
processing:This Thismicroservice
microserviceperforms
performsthe the whole
whole algorithm
algorithm retraining
retraining proce-
procedure,
dure, which is executed every month and generates new algorithms
which is executed every month and generates new algorithms to be updated, through to be updated,
through
FOTA, inFOTA,
sensorin sensor nodes.
nodes.
•• Email service:
Email service: It is responsible for building
building and and sending
sendingweekly
weeklye-mail
e-mailnotifications
notifications
on the
on the status
status ofof the
the environmental
environmental variables
variables sensed,
sensed,andandforforsending
sendingnotifications
notificationsofof
pestand/or
pest and/or disease
disease risk
risk detection.
detection.
•• Frontend:
Frontend: The The frontend microservice
microservice is is responsible
responsiblefor forproviding
providingthe thenecessary
necessaryweb
web
interface so
interface so that
that the
the user
user can easily access the contentscontents stored
stored on on the
theserver.
server.
•• Backend:
Backend: It It supports
supports the frontend
frontend operations,
operations, makingmakingany anydata
dataititrequires
requiresavailable
available
and ensuring that
and ensuring that all all requests are secure.
•• Other
Othermicroservices:
microservices:This Thispaper
paperisisfocused
focusedon onthethemain
main features
features ofof
thethe system,
system, how-
however,
ever, microservices
other other microservices are executed
are executed in parallel,
in parallel, such as security
such as security layers and layers
loadand load
balancing
balancing management.
management.
Finally,there
Finally, thereisisaablock
blockfor
forthe
thepresentation
presentationofofinformation
informationtoto the
the user
user and
and support
support for
for export
the the export of original
of original andand system-processed
system-processed data,
data, as well
as well as importing
as importing external
external data.
data.
The web
The web interface
interface is presented in Figure
Figure 11. ItIt shows
shows thethe geographical
geographicalarea
areawhere
where
some of
some of the
the terminal
terminal nodes
nodes created have been located.
located. Other
Otherfeatures
featuresintegrated
integratedininthe
the
websiteare
website arevisualization
visualization (Figure
(Figure 12)
12) and the export/import
export/import ofofthe thedata.
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,
Sensors2023, 23,9733
x FOR PEER REVIEW 1110ofof 20
19
Sensors 2023, 23, x FOR PEER REVIEW 11 of 20
Figure12.
Figure 12.Temperature
Temperature and
and humidity
humidity measurements obtained on
on the
the platform.
platform.
Figure 12. Temperature and humidity measurements obtained on the platform.
2.5. Notification
On the web System
page, the data acquired from the different sensors are displayed. For in-
On the web page, the data acquired from the different sensors are displayed. For in-
stance,
A keyin Figure 12, the system
issue for graphs oftothe temperature data
as in degrees Celsiuswhen
(upper chart)
stance, in Figure 12,this
the graphs is warn
of the the farmer,
temperature data early as possible,
in degrees Celsius (upperthere is a
chart)
and and/or
pest humidity in percentage
disease risk. The(lower chart) over
notification a period
system must of
beone week to
adapted arethe
shown.
farmer’s needs
and humidity in percentage (lower chart) over a period of one week are shown.
The
and, at ability
theability
same toto export
time, the data
be quick, was
easy introduced
and intuitive to
to allow
use. Inthem
this to be displayed
case, on other
The export the data was introduced to allow them to be two different
displayed types
on other
media
of and/or to
notifications create
have beennew machine learning algorithms that can be used in the sensor
developed:
media and/or to create new machine learning algorithms that can be used in the sensor
nodes,
•nodes, as well
E-mail: as other functionalities.
Notifies,
as well as otheronce a week, the pest and disease risks that have occurred during
functionalities.
that full week, providing the overall risk of each day and graphs with the profile of
the risks obtained throughout each day. It also includes information on the evolution
of the monitored variables.
An extract of the email notifications (Figure 13) is presented in which the percentage
of the average daily pest risk for seven days is shown.
• E-mail: Notifies, once a week, the pest and disease risks that have occurred during
that full week, providing the overall risk of each day and graphs with the profile of
the risks obtained throughout each day. It also includes information on the evolution
of the monitored variables.
Sensors 2023, 23, 9733 An extract of the email notifications (Figure 13) is presented in which the percentage
11 of 19
of the average daily pest risk for seven days is shown.
Figure13.
Figure Graphof
13.Graph ofpest
pestrisk
risklevels
levelsover
over77days
days(extract
(extractfrom
fromnotification
notificatione-mail).
e-mail).
• Visual notifications: As farmers may not have internet access, an offline solution is
• Visual notifications: As farmers may not have internet access, an offline solution is
offered using visual notifications. A red LED blinks, with an active time of 200 ms, at
offered using visual notifications. A red LED blinks, with an active time of 200 ms, at
a frequency of 30 s when medium risk is detected and at 15 s when high risk.
a frequency of 30 s when medium risk is detected and at 15 s when high risk.
Both types of notifications coexist, leaving the farmer with two different ways to
Both types of notifications coexist, leaving the farmer with two different ways to de-
determine that everything is correct in their crop. Moreover, thanks to the storage of all
termine that everything is correct in their crop. Moreover, thanks to the storage of all no-
notifications on the server, any type of alert (sound warning, Telegram bot, SMS, etc.) can
tifications on the server, any type of alert (sound warning, Telegram bot, SMS, etc.) can be
be applied according to the needs of each farmer.
applied according to the needs of each farmer.
2.6. Power Consumption Analysis
2.6. Power Consumption Analysis
To test the performance of the system, several field experiments were carried out.
To
Thetest the performance
laboratory tests were offocused
the system,
on twoseveral field experiments
key points: the correct were carried out.
data collection of all
The laboratory tests were focused on two
sensors and the energy consumption of the terminal node. key points: the correct data collection of all
sensors and the energy
A calibration of theconsumption
temperature of and the terminalsensor
humidity node.was performed using a commer-
A calibration of the temperature and
cial temperature and humidity sensor, RS-1367. Once humidity sensor wascompleted,
this was performeditusing a com-
was verified
mercial temperature and humidity sensor, RS-1367. Once this was completed,
that the readings of the sensors were correct. At the end of the calibration, it was possible it was ver-
ified that the readings of the sensors were correct. At the end of the
to carry out data transmission tests to the server, in order to ensure the correct operation calibration, it was
possible to carry out data
of daily transmissions. transmission
It was teststhe
verified that to daily
the server, in order were
transmissions to ensure the with
fulfilled correctall
operation of daily
sensor samples transmissions.
correctly It was
collected, withverified that the daily time
their corresponding transmissions
stamps. were fulfilled
with all sensor samples
Secondly, the power correctly collected,ofwith
consumption the their
device corresponding
was verifiedtime withstamps.
Keithley 2450
Secondly,(Keithley
SourceMeter the power consumption
manufacturer), of thein device
shown Figure 14.wasThis
verified with
analysis wasKeithley
divided2450into
SourceMeter (Keithley manufacturer), shown
eight different phases, separated by red lines, as follows: in Figure 14. This analysis was divided into
eight
1. different phases,
The first phase is separated
responsiblebyfor red lines, asthe
verifying follows:
connection to the destination server. To
1. The first phase is responsible for verifying
do this, the connection to the service operator is the connection
made through to theitsdestination
APN and the server.
con-
To do this, the connection to the service operator is made through
nection is checked for security by means of SSL certificates. This takes approximately its APN and the
32 s with an average consumption of 52 mA.
2. As can be seen in Figure 14, this is the longest phase of the node’s duty cycle. It has
a duration of 34 s during which the connection to the MQTT broker (secured by a
username and password) used for the transmission of data through a TCP connection
that guarantees the delivery of the information is carried out. This phase is also used
to check whether there is new firmware to update the node by means of the FOTA
(Firmware-Over-The-Air) functionality available. This phase is characterized by an
average consumption of 45 mA.
3. In contrast to phase 2 and due to the capacities of the microcontroller, this phase is
the shortest of the whole active cycle and is responsible for taking measurements,
collecting the data stored in local memory and local processing. It uses an average
current of 20 mA for 0.67 s. This phase will be repeated every 30 min, with a 2 mA for
0.67 s, with a marginal consumption cost for the overall calculation of consumption.
Sensors 2023, 23, 9733 12 of 19
4. Once the information has been collected, the node creates the subscription to corre-
sponding MQTT topic to send the data. Once the data have been sent, the unsubscribe
action of the topic is carried out. This phase is carried out in a period of 29 s with an
average consumption of 38 mA.
5. Phase 5 is responsible for disabling all possible processes and the configuration of
the microprocessor and its peripherals, as well as the NBIoT transceiver in ultra-low
power mode. This process requires a time of about 17 s and a consumption of 42 mA
on average.
6. During this phase, the device is in the low-power mode induced in phase 5. This phase
will be interrupted by phase 7 every 20 s, at which time the WDT of the microprocessor
is powered up. It is important to note that the node will be active during most of this
phase, hence the importance of minimizing the power consumption of this phase as
much as possible. In the present development, it has been reduced to 5 µA.
7. This is the power supply phase of the WDT, which periodically interrupts phase 6 to
ensure that the device can recover from unknown or error conditions. This action is
carried out for a time of 0.42 s and involves an average consumption of 1.21 mA.
8. The detection and quantification of rainfall by the node does not respond to any
periodic or predictable pattern: it is totally conditioned by weather conditions. At this
point, the device has a hardware interrupt that is activated by the sensor mentioned
in Section III during which an increase of 3 L/m2 of rainfall is added to the local
Sensors 2023, 23, x FOR PEER REVIEW 14 of 20
history (to be transmitted in the next transmission to the server). This action implies
an average consumption of 2.15 mA during 0.6 s.
Figure14.
Figure 14.Node
Nodepower
powerconsumption
consumption analysis.
analysis.
Oncethe
Once the power
power consumption
consumptionofofeach each phase is known,
phase is known, the autonomy
the autonomyof theofnode
thede-
node
pends on two main factors: the frequency at which data are transmitted
depends on two main factors: the frequency at which data are transmitted and the capacity and the capacity
ofofthe
theselected
selectedbattery,
battery,ininour
our case
case 17,000
17,000 mAh.
mAh.
On the other hand, the numberofof
On the other hand, the number times phase
times 8 is 8activated
phase directly
is activated depends
directly on the on
depends
amount of rainfall at the deployment site. According to [19], Colombia is
the amount of rainfall at the deployment site. According to [19], Colombia is the country the country with
the highest rainfall in the world, with an amount of 3240 L/m 2, while in Spain it is 535 L/m2
with the highest rainfall in the world, with an amount of 3240 L/m2 , while in Spain it is
[20].
535 L/mThis would
2 [20]. mean
This a consumption
would of 1.28 mAh
mean a consumption of (in
1.281 year)
mAh in (inthe worstincase
1 year) the and 0.21
worst case
mAh per year in Spain, which would have the effect shown in Table 2 on the autonomy of
the node.
and 0.21 mAh per year in Spain, which would have the effect shown in Table 2 on the
autonomy of the node.
Although one daily dispatch could be considered sufficient, given the nature of the
information being measured, Table 2 respectively shows the autonomy of the nodes in
case of two or four daily dispatches of information. If we consider 5 years of autonomy
necessary in order to amortize the maintenance costs, we can see how this condition is met
in every case, even in the rainiest area of the world with a daily dispatch. Therefore, the
node design can be considered validated in terms of energy consumption.
Once all the tests had been verified, the device was to be installed, after carrying out
coverage tests in the location to be installed, with different mobile operators. The study
was carried out with two different operators. These were both determined to be
Sensors 2023, 23, x FOR PEER REVIEW 15 suitable
of 20
and, consequently, the farm was considered suitable for this type of technology.
Figure15.
Figure 15. Sensor
Sensor node
node installation
installationininalmond
almondtree
treecrops.
crops.
Sensors 2023, 23, 9733 14 of 19
Figure16.
Figure 16.Distribution
Distribution of
of sensor
sensor node
node network
networkon
onthe
thecrop.
crop.
3.3.Results
Results
Followingthe
Following the deployment
deployment of of the
the sensor
sensornodes
nodesininlalaAñoreta
Añoreta(Cordoba,
(Cordoba, Spain), tests
Spain), tests
were carried out with the aim of validating all system functionalities: data
were carried out with the aim of validating all system functionalities: data logger; logger; risk
risk
assessmentand
assessment andnotification;
notification; and
and the
the training
trainingand
andupdating
updatingofofthe machine
the machine learning algo-
learning algo-
rithm.InInaddition,
rithm. addition,the
theinstallation
installationininaareal
realenvironment
environment waswas used
used to
to test
test the
the robustness
robustness of
the system: the durability of the equipment, the battery life, correct data transmission in
areas with a tendency for low mobile coverage and management of the server database.
The tests were carried out between February and May 2022, in an almond crop.
In the months prior to the installation of the system, it was decided to collect data from
the nearest IFAPA weather station (Santaella) to the crop where the sensor network was to
be installed in 2022 in order to train the decision tree algorithm. When sensor nodes were
deployed, algorithms were run and results were obtained in which there was a high pest
risk between April and May. These results were presented to the experts, who reported
that aphids were recorded on the crop during that period.
In February, the risk of the crop was evaluated, remaining healthy during the derma-
logical stage of flowering and fruit set, with no incidence of any type of disease or pest.
During this time, it was verified that the sensor nodes identified the risk as low in both
cases (pest and disease). In addition, it was verified that data transmissions during that
month were correct, with no loss of data. There were no false positives and none of the
sensor nodes had to be reprogrammed.
Figure 17 shows that there were no signs of pests and diseases anywhere, with the
leaves of the almond trees showing a uniform green colour.
This trend continued until 20 March 2022, when the sensor nodes started to report
medium pest levels. Upon detecting this risk, the farmer went to check the farm and agreed
that this coincided with the start of positive adult aphid counts, although at very low levels
(one to three aphids per leaf).
These aphid levels can be seen on the top leaf of Figure 18, which contains three aphids
and a small colony of thirteen green aphids detected on the lower right leaf.
On the days following the medium risk alert, the sensor nodes continued to maintain
the medium risk level. This trend continued until 30 March, when it changed to a high pest
level. On the following days, the farm was visited to verify the presence of aphids in the
almond trees.
In Figure 19, leaves are infested with aphids, visualising colonies of more than
40 per leaf. In this way, it was possible to confirm that the sensor nodes were correctly
warning of the possible risks that could appear in the crops.
dermalogical stage of flowering and fruit set, with no incidence of any type of disease or
pest. During this time, it was verified that the sensor nodes identified the risk as low in
both cases (pest and disease). In addition, it was verified that data transmissions during
that month were correct, with no loss of data. There were no false positives and none of
the sensor nodes had to be reprogrammed.
Sensors 2023, 23, 9733 15 of 19
Figure 17 shows that there were no signs of pests and diseases anywhere, with the
leaves of the almond trees showing a uniform green colour.
This trend continued until 20 March 2022, when the sensor nodes started to report
medium pest levels. Upon detecting this risk, the farmer went to check the farm and
agreed that this coincided with the start of positive adult aphid counts, although at very
low levels (one to three aphids per leaf).
These aphid levels can be seen on the top leaf of Figure 18, which contains three
aphids and a small colony of thirteen green aphids detected on the lower right leaf.
On the days following the medium risk alert, the sensor nodes continued to maintain
the medium risk level. This trend continued until 30 March, when it changed to a high
pest level. On the following days, the farm was visited to verify the presence of aphids in
the almond trees.
In Figure 19, leaves are infested with aphids, visualising colonies of more than 40 per
leaf. In this way, it was possible to confirm that the sensor nodes were correctly warning
of the possible risks that could appear in the crops.
Figure18.
Figure 18.Almond
Almondtree
treewith
withaafew
fewaphids
aphidson
onsome
someof
ofits
itsleaves.
leaves.
Sensors 2023, 23, 9733 16 of 19
Figure 18. Almond tree with a few aphids on some of its leaves.
Figure19.
Figure 19. Almond
Almond tree
tree completely
completely infested
infested with
with aphids.
aphids.
During these months, the algorithm was remotely updated to check the correct per-
formance 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.
Ching-Ju Olivier
Features N. Materne et al. [23] T. T. Win et al. [24] This Work
Chen et al. [21] Debauche et al. [22]
Air temperature, air
humidity, CO2 ,
Temperature,
Temperature, Temperature, illumination intensity, Temperature,
humidity, pressure,
Sensors humidity, mobile humidity, barometer, soil temperature, soil humidity,
sunlight level,
phone, UAV rain, gauge, . . . humidity, soil rain gauge
water level
moisture, leaf
wetness
AI algorithm
Server Node Server Server Node
execution
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
Each 1 h Each 5 min Each 30 min - Each day
interval
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.
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 fund-
ing 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 Monitor-
ing & 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 Proceed-
ings 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.