Implementation of Faulty Sensor Detection Mechanism using Data Correlation of Multivariate Sensor Readings in Smart Agriculture

Ahmed Dhahir Malik, Ansar Jamil, Khaldoon Ammar Omar and Mohd Helmy Abd Wahab, "Implementation of Faulty Sensor Detection Mechanism using Data Correlation of Multivariate Sensor Readings in Smart Agriculture”, Annals of Emerging Technologies in Computing (AETiC), Print ISSN: 2516-0281, Online ISSN: 2516-029X, pp. 1-9, Vol. 5, No. 5, 20th March 2021, Published by International Association of Educators and Researchers (IAER), DOI: 10.33166/AETiC.2021.05.001, Available: http://aetic.theiaer.org/archive/v5/v5n5/p1.html. Research Article


Introduction
IoT becomes a modern system in that all things around us are linked to the network. The general definition of IoTs is still in the establishment procedure. The International Telecommunication Union (ITU) describes IoT as a universal infrastructure for the data society allowing developed solutions through inter-connecting virtual and physical objects based on evolving inter-operable data and communication methods [1]. Based on the cluster of European Research Projects on the IoT, IoT can be considered a dynamic worldwide network infrastructure with simply integrated active contributors. IoT can also be considered as a combination of the Internet network, configured sensors, and near field communications. This technology leads to fresh business chances (e.g., automobiles with configured sensors, smart thermostats, and jet, which are prepared with modern sensors to monitor remotely) [2]. Small Smart network Sensors are used in various industries such as smart home, exact farming, logistics, and industrial automation. Equipped with smart sensors, this device has the capabilities of identity, identification, networking, and processing. By giving each device a unique ID, it generates unprecedented data and creates new business chances.
Agriculture application is important to humans because it produces food and normally becomes the main source of the economy in a country. It also provides many work opportunities for people. Farmers still use traditional cultivation methods, which leads to lower crop yields and fruit yields. Productivity needs to be improved from traditional to automatic machines. In agriculture, it is necessary to introduce modern science and technology to increase productivity [2].
IoT environments such as precision agriculture are becoming increasingly well-known and get increasing focus over the past decades. By applying the smart sensors and intelligent actuators, these IoT solutions provide easy applications to the farmer. Each IoT device collects agriculture data from various types of sensors and sends it to the cloud. It can monitor soil efficiency, fertilizer efficiency, rainfall, water reservoir storage capacity, temperature, humidity, etc. IoT devices are lightweight and have limited computational abilities often exposed to uncertain surroundings lead to recurrent faults. Many other factors influence productivity which are insects and pests that can be controlled by spraying pesticides directly, wildlife and bird attacks for the growth of agriculture, unpredictable rainfalls, lack of water, and improper use of water [4].
A faulty detection mechanism plays an important role to ensure the agriculture system always in full operation. For example in a smart NFT hydronic system, it requires a pump to operate for 24 hours to supply nutrients and water to the plants. During the case of the pump does not function or electricity blackout, the plants only able to survive for a few hours duration. You can imagine, if this faulty is not detected early, all plants on the system will be dead. This will cause losses to the farmer. Another example in different smart agriculture systems, agriculture parameters such as soil humidity, soil pH, greenhouse temperature, etc must be monitored continuously and becomes crucial information to achieve a high yield of crops. If one sensor becomes faulty, the growth of the crops will be affected and the farmer does not achieve the production target. Because of this, a good smart agriculture system implementation must include a faulty sensor detection mechanism in its design.
The remainder part of this paper is organized as follows: In Section 2, we present the previous work. Section 3 presents the developed smart agriculture system. In Section 4, we present the implementation of the Multi-FSDM faulty sensor detection mechanism. In section 5 the actual performance of Multi-FSDM in the developed smart agriculture system. Finally, the conclusion of our work in Section 6.

Previous Works
IoT systems suffer generally from several kinds of faults cause by hardware faults, depleted battery energy, and human errors. These faults in IoT surroundings cannot be accepted because it can cause many terrible problems. Thus, keeping the integrity of the information is a vital necessity in IoT applications [3]. Because of this, many existing faulty detection mechanisms have been proposed to detect faulty sensors for IoT using several techniques and methods, and one of them is using correlation values between actuators or sensors.
In [5], the authors proposed and implement an automatic irrigation system based on the Arduino board. The irrigation system collects information about three various environmental parameters such as temperature, moisture, and water using a temperature sensor, a moisture sensor, and a water flow sensor accordingly. The real-time data are collected, received, and transmitted to the internet and can be viewed using a website. Besides that, the user can also control the sprinklers and the irrigation pumps from a faraway via the website. www.aetic.theiaer.org In [6], the authors proposed an irrigation system that can be controlled anywhere using the internet, in which internet connectivity is established using a Wi-Fi module. The system is using the Arduino platform equipped with three types of sensors, which are a temperature sensor, a moisture sensor, and a PH sensor to collect soil parameters that are temperature, moisture content, and PH level. The irrigation is performed based on the moisture sensor reading. If the moisture level is less than a specific threshold level, Arduino sends a notification to the IoT cloud platform. The main advantage of the system when compared with the other systems that remotely monitor farms using IoT is a better efficiency while reducing the expenses.
In [3], the authors proposed an automatic method (DICE) that detects and identifies the faulty device with context extraction in IoT environments. This method is fast, reliable, and works in twophase. In the first phase, the system pre-computes or extracts the context information based on the sensor correlation and the transition prospect between the sensor cases which is known as the context. In the second phase, the data of the sensor or actuator are examined in real-time. If violate the context that pre-computed before, then a faulty sensor is detected. To identify the faulty sensor, the system compares the problematic context with the most probable context.
In [7], the authors proposed a sensor detection mechanism based on spatiotemporal crosscorrelation between sensors. In the process of finding the spatiotemporal correlation, the mechanism uses two sequential mathematical tools. The first tool is probability calculation using Markov Random Field (MRF) to determine the condition of a sensor either working or faulty. The second tool is learning and training of each sensor basis on its neighbors. In the case of a faulty sensor, the corrupted data could be changed according to the learned and trained data during the learning and training mode.
In [8], the author proposed a Multivariate Faulty Sensor detection Mechanism (Multi-FSDM) using multivariate sensor reading in the algorithm. The mechanism uses two methods to decide on sensor state condition: logical and correlation methods. The logical method was implemented in a smart parking system. Three sensors, which are ultrasound, IR, and hall-effect are used in the system to detect the availability of parking lots. Based on the sensor readings, the mechanism compares the state of all sensor and determine the condition of each sensor. Any incomparable sensor readings are considered as an indication of faulty sensors. The correlation method is applied in a smart agriculture system, which uses three types of sensors: soil water, soil moisture, and soil temperature sensor. The correlation between these sensors is calculated for a give specific time interval. Any wrong correlation is considered as a faulty sensor occurs. The main advantages of Multi-FSDM are it uses multivariate sensor readings on the same IoT device and does not require training and learning process.
This paper extends work in Multi-FSDM by implementing the mechanism in a smart agriculture system. As in paper [8], it used manipulated sensor data from the smart agriculture system to create faulty on one sensor and test the detection mechanism in Microsoft excel. Because of this, we extend this work by implementing Multi-FSDM in the actual smart agriculture system to detect any faulty sensor in real-time. Several experiments were conducted to test the performance of the algorithm in a real environment. Fig. 1 shows the overall smart agriculture system. The system diagram shows three sensors are used (a temperature, a moisture, and a water sensor) for the soil data. The soil temperature sensor is responsible for measuring the soil temperature, the soil moisture sensor is responsible for sensing the percentage of soil humidity and the water sensor is responsible for measuring the amount of water in the soil. These sensor readings are collected by the main part of the system, which is Arduino Uno. The system collects sensor reading every 30 seconds periodically. For every five sensor readings, the correlation values between sensors are calculated. Multi-FSDM uses the calculated correlation values to determine each sensor state either in a good or faulty condition. All sensors are considered in a good condition when the sensor readings are correlated. However, any uncorrelated sensor reading indicates one or more faulty sensors occur on the system. Then, the www.aetic.theiaer.org mechanism can determine which sensor is at fault. The same process is repeated for the next five sensor readings. Fig. 2 shows the flowchart of the operation of Multi-FSDM in detecting faults in the system. All sensor readings and state of sensors are sent to the ThingsBoard using the ESP8266 Wi-Fi module that establishes a Wi-Fi connection to the internet. Inside ThingsBoard's graphical user interface, each sensor reading and state can be viewed clearly and graphs of sensor data are produced. Fig. 3 shows the actual prototype of the smart agriculture system.  Arduino Uno board is connected with three types of sensors which are soil temperature, soil moisture and water sensor, ESP8266 Wi-Fi module, and power supply. When the power is switched ON, Arduino collects current readings for all sensors. After collecting the sensor readings, Arduino processes the data and computes correlation values between the sensors. The water sensor module www.aetic.theiaer.org is responsible for measuring the percentage of water. The module consist of a water board, separated control board, power indicator LED and potentiometer to adjust its sensitivity. This module needs to be connected to a 5V supply voltage. The output of this module is connected to an analog input of the Arduino board. The soil hygrometer module (FC-28) is a simple device for measuring soil moisture or other similar materials. The probe for the sensor is built using two large exposed pads that acting as a variable resistor. As the soil moisture increase, the conductivity between pads is also increased resulting in a lower resistance. The DS18B20 temperature sensor is selected to measure soil temperature. DS18B20 is a 1-wire programmable temperature sensor that is widely used in temperature measurement for various mediums such as chemical solution, soil, etc. It can measure temperature from -55°C to +125° with an accuracy of ±5°C. DS18B20 is manufactured by Maxim Integrated. Fig. 3 shows the developed prototype of the smart agriculture system.

Software Implementation
The software implementation of the smart agriculture system can be divided into two parts. The first part is the main coding development using Arduino Uno Integrated Development Environment (IDE). The second part is software development for the IoT platform called ThingsBoard to view collected sensor readings and display the status of sensors remotely. Arduino IDE is used in coding development and program Arduino board and ESP8266 Wi-Fi module. Arduino IDE uses Arduino programming language which is a reliable programming www.aetic.theiaer.org language that is suitable and convenient to be used with Arduino Board and making the connection between Arduino Board and ESP8266 module. Fig. 4 shows the serial monitor output for the three sensor readings. ThingsBoard is an open-source IoT platform that can be accessed by anyone. ThingsBoard is used to display each sensor's readings, correlation values between sensors, and the state of sensors. The sensor can be considered as stuck-at-fault faulty. Other sensors are considered in a good state. • In the case of all sensors give different readings, correlation can be performed. The state of each sensor can be determined based on the following condition and assumption: o In the case of the correlation between temperature and moisture sensor or temperature and water sensor, are negative and the correlation between moisture and water is positive that means no fault occurs in the system. o In the case of the correlation values between temperature and moisture sensor, temperature and water sensor, and moisture and water sensor different from no fault condition that means the fault occurs in one or more sensors in the system. Multi-FSDM decides for each sensor state either good or faulty based on Table 1.

Results
The dashboards of ThingsBoard platform consists of two types of widget which are float time series and four cards. The float time series shows all sensor readings of the soil over time. Three cards show the correlation state between two sensors (Positive or Negative) and one card shows the sensors state (good or faulty).  Fig. 6 shows the dashboard of ThingsBoard when the system is working properly with all sensors in good condition (no faulty). The result shows that a negative correlation value between temperature and moisture sensor that is -0.38. Correlation between temperature and water sensor is also a negative value that is -0.16. A positive correlation value between moisture and water sensor that is +0.38. Other than this, the dashboard shows sensor state with 'NO_FAULT' status that means all sensors in good condition. This finding is as expected because Multi-FDSM does not detect any faulty sensor for these combinations of correlations according to Table I.  Fig. 7 shows the dashboard of ThingsBoard when the system has a faulty temperature sensor. The result shows that a positive correlation value between temperature and moisture sensor that is +0.09. The correlation value between temperature and water sensor is also a positive value that is www.aetic.theiaer.org +0.13. A positive correlation value between moisture and water sensor that is +0.89. Other than this, the dashboard shows that the sensor state with 'TEMP' status means that the temperature sensor is in a faulty condition. This result is as expected based on the decision making of Multi-FDSM as shown in Table 1. Fig. 8 shows the ThingsBoard output for a faulty temperature sensor. The system gives the correlation value between temperature and water sensor a positive value that equal to +0.15. The correlation value between temperature and moisture sensor is a negative value that equal to -0.10. Then, a negative correlation value between moisture and water sensor that is -0.08. Multi-FDSM made a decision based on these correlation values, which is a faulty moisture sensor according to Table 1.  Fig. 9 shows ThingsBoard output for faulty water sensor. The correlation between temperature and water sensor is a positive value equal to +0.05. The correlation between temperature and moisture sensor is a negative value equal to -0.11. Then, a negative correlation value between moisture and water sensor that is -0.52. The sensor state shows 'WATER_SENSOR' status, which means the system has a faulty water sensor. This is as expected based on Multi-FDSM decision making for sensor state determination as Table 1.

Conclusion
In this paper, Multivariate Faulty Sensor Detection Mechanism (Multi-FSDM) was implemented and its performance was tested in a smart agriculture system. This system has been designed using Arduino Uno with the ESP8266 module, which is attached to establish a Wi-Fi www.aetic.theiaer.org connection allowing internet connectivity. The developed smart agriculture system was attached with three-sensors: water sensor, moisture sensor, and temperature sensor. ThingsBoard is selected as the IoT cloud platform. The sensor readings are collected periodically and send to the ThingsBoard via the internet. Multi-FSDM calculates the correlation between each sensor reading to determine the health condition of each sensor. When all sensors are in good condition, all sensor readings are correlated with each other. However, when any sensor becomes faulty, sensor readings become uncorrelated. Once uncorrelated sensor readings occur, this means a faulty sensor is detected. Each of the sensor states is also sent to the ThingsBoard platform. Based on the findings, it is proven that Multi-FSDM able to detect each sensor state on the smart agriculture system either in a good or a faulty condition. As future work, Multi-FSDM can be implemented in other IoT applications such as smart home systems, smart traffic light systems, etc.

Acknowledgement
The project is financially supported by Universiti Tun Hussein Onn Malaysia (UTHM) under H132-TIER 1 Grant.