Water monitoring and analytic based ThingSpeak

Received Jul 15, 2019 Revised Jan 20, 2020 Accepted Feb 2, 2020 Diseases associated with bad water have largely reported cases annually leading to deaths, therefore the water quality monitoring become necessary to provide safe water. Traditional monitoring includes manual gathering of samples from different points on the distributed site, and then testing in laboratory. This procedure has proven that it is ineffective because it is laborious, lag time and lacks online results to enhance proactive response to water pollution. Emergence of the Internet of Things (IoT) and step towards the smart life poses the successful using of IoT. This paper presents a water quality monitoring using IoT based ThingSpeak platform that provides analytic tools and visualization using MATLAB programming. The proposed model is used to test water samples using sensor fusion technique such as TDS and Turbidity, and then uploading data online to ThingSpeak platform to monitor and analyze. The system notifies authorities when there are water quality parameters out of a predefined set of normal values. A warning will be notified to user by IFTTT protocol.


INTRODUCTION
Human society development had great effects on our environment, and every effort has been seeking to improve its preservation. Environment quality monitoring is one of these important efforts that have allowed the monitoring of different physical parameters to limit the more progress of environmental degradation. Collecting environmental data manually as a traditional monitoring method is ineffective, since of weak ability of warning in some environmental special cases such as (pollution). A period ago, digital information recorders were presented to enhance accuracy of surrounding environment monitoring, but even this is still lacked as online data analysis [1]. In the last years, energy generated from environmentally friendly, renewable, clean and efficient sources becomes one of the important engineering research areas.
One of the important environmental monitoring issues to be monitored is water diseases, which are becoming the main challenge to our health. Therefore, to guarantee best water quality is critical to keep a stable life for all. Water quality is distinguished from its appropriateness to a given application based on its biological, chemical properties. Water quality monitoring includes the detection of characteristic and their comparison with specific standards and predefined values. Water acceptability is usually determined by obeying the intended use criteria. For more accuracy and reliable analysis, it is important to collect more samples for better monitoring Manual technique introduces great complexity and it is considered inefficient comparing to real-time monitoring to get quick warning in order to ensure fast water pollution response [1].
Online monitoring poses challenges for person who have manually get the water quality parameters through sampling and testing at the testing center. IoT, which is a connected intelligent device that senses, interprets and interacts with the environment because of the combination of the Internet and the integrated sensor system. In the twenty-first century, the higher communication and strong criterions the (IoT). In this network, daily operation of objects becomes part of the network due to the connectivity and computing capabilities, which include the digital operation of the transceiver and microcontroller. The network model covers high stability and allows for unified collaboration between different device types such as surveillance cameras, environmental sensors and applications in various medical fields. Because of this goal, internet objects have developed extra design in many sites such as "pollution monitoring systems" and "water quality management systems." It includes many cheap sensors in the surround, those support the public via new quality monitoring services and feedback report without any burden at anytime and anywhere. Also it can be considered as explicitly advance as a quality of human life [2]. S. Geetha and S. Gouthami [3], present a simpler solution to water quality monitoring in pipes based on IoT. The developed model was used to test water samples then upload this data online to be analyzed. Their system provides a warning alarm for the remote control user, when there are quality of water parameters deviation from a predefined set of standard values. The data that is sent from this system was uploaded in the cloud "Ubidots" that offers a platform for user to capture data and convert it to useful information. M. Parameswari and M. Moses [2], use aqua care IoT to monitor the quality of water. The information collected from the sensor system was logically implemented across the network. They developed this system basing on an embedded system, logical address and communication application from Internet objects. P. Bokingkito and O. Llantosb [4], were developed a real-time system to monitor water temperature on a mobile that is capable of reducing dependence on the control site workforce to reduce costs and evaluate fish farming system. The implementation of the system led to monitor the water temperature from the main control unit online.
It also provides the system and displays information that includes statically value results. Chen and Han [5], at the Bristol port, they used different parameter to monitor water quality, which has successfully proved the feasibility, gather water quality data online and display on the Internet. They used another method that is based on image processing for water quality monitoring. Statically models and machine learning used to decide the quality parameters of water for input image video. K. Saravanan et. al, [6], propose (SCADA) system which integrates with (IoT) to monitor water quality in real time. It was aim to identify water pollution, leakage in the pipeline, as well as automatic measurement of parameters such as flow, temperature and color sensors in online with Atmega 368 and GSM Module. The system was implemented at Tirunelveli. The aim of this paper is to propose an effective online water monitoring system in real-time that can help health monitors to improve the monitoring operation. In general, the system provides information including normal, maximum, minimum and average statistical values for different water characteristics, also compares between different sites and different days for same city, results obtained from collected sensor that provide decision support to help and guide people in the city to avoid water usage for drinking. Further, the system can display the water characteristics that are continuously monitored online directly on smart phone.

INTERNET OF THINGS (IoT)
IoT is a modern communication model in the near future in which daily life objects which are provided with microcontrollers, digital communication transmitters and receivers, are controlled via appropriate protocols making a kind of communication network with each other and with users, and that is going to make it as an integral part of the Internet. The IoT concept aims to make the Internet more famous. Furthermore, by making easy interaction with a wide range of devices such as, home application, CCTV, surveillance sensors, engines, monitors, vehicles, etc. [7,8]. The IoT model is truly applicable in different areas (home, industrial automation, medical assistance, mobile health care, elderly assistance, smart power management, intelligent networks, cars and more) [9]. At present, this concept is increasingly being explained as the environment of interconnected people with objects, not only M2M, the IoT is about human and machine communication based common services.
This type of network consists of smart devices, stand-alone devices that are able to monitor their surroundings or interact with them. Moreover, "smart" term means that these objects are capable of obtaining data from the surrounding environment, then process them and communicate (share) them with other objects, and interact independently with the environment that relies on data that exploits embedded electronics, software sensors, and actuators, and communication capabilities. In another words, these smart objects, that are distributed in the surrounding environment and integrated into different contexts, can greatly improve people interaction with their environment, creating applications and services in any part [10,11].
Due to the widespread of IoT, many platforms have been developed to link heterogeneous objects over the Internet. the provider of IoT solutions for different smart things from many manufacturers is difficult due to the lack of standards such as communication protocols and interconnection. Therefore, it has been proposed a new development model that depends on the cloud user interface. There are many platforms developed for the business communities such as Xively, which allow companies to take advantage of the Internet features to securely connect their products with their users, manage their data improve the satisfaction of partners and customers, and make new source of revenue. Many other sources, such as ThingSpeak, allow user to manage data in different formats and share their data from different sources [12,13]. It is an open-source data platform based on cloud technology .It allows online data gathering, MATLAB analysis and activation using an open API. With applications and extensions, monitoring, MATLAB visualization, store data, and integrate the user data with a variety of third party platforms, include leading IoT platforms such as (Arduino,ioBridge, Twilio, Twitter, ThingHTTP and MATLAB). Sensor data are gathered in each channel containing 8 fields that can hold different type of data, one status field and three site fields. Various applications such as TimeControl (perform actions automatically at preset times using the ThingSpeak application), TweetControl (listening to Twitterverse and real-time interaction), React (reacts when channel data is compatible with some conditions), TalkBack Reaction measures, [14].

METHODOLOGY
The water quality problem can be analyzed in real time mainly using data analysis techniques such as MATLAB in ThingSpeak platform. To analyze different water quality parameters, the data is continuously collected using sensors that connected to Arduino, and then upload them to the ThingSpeak for monitoring and analysis purposes. ThingSpeak continuously reads the uploaded data and perform a customable statistics by using MATLAB code such calculates average, minimum and maximum value for entered data, comparison between different cities or between different time for same city, etc. the result art can be viewed with different form such bar chart, histogram, cage, etc.
The steps of our method is summarized as:  Read the water quality values online using, Turbidity and TDS sensor  Upload the data to ThingSpeak platform  Analyze the stream data collected using different codes of MATLAB  Finally display the results of the analysis in ThingSpeak MATLAB

SYSTEM ARTCHITECTURE LAYERS
Design the layered structure of a global network, which includes heterogeneous networks, is a major challenge mission that requires the identification and effectiveness of a similar group function and elements of networks as a class. The proposed IoT water monitoring system layers framework consists of four layers, It is the Perception layer (Devices and sensor in physical world), the Network layer (Ethernet shield and router), the Service Management layer (Mange the collected information), and the Application layer (User interface). Each layer below is described as:

Perception layer
This layer contains of some closely integrated sensors that are integrated with the physical environment. Sensor modules are compact devices used for physical monitoring condition or chemistry of the sensor object in real time [15], The primary responsibility of the layer is to gather information about the water quality, and the devices. The layer is also responsible for data transformation and transport of the aware data to the Network layer, also collect and distinguish information captured in a cost-effective manner [16]. Different sensors are used in such: Turbidity Sensor: The turbidity can be defined as reducing the transparency of the water caused by the presence of an unresolved suspended substance. The origin of molecules found in water can be minerals or organic. However, turbidity is not a direct measure of suspended particles in water, but it is a measure of the effect of scattering of the light. This sensor measures the amount of light diffused by suspended solids in water. As the amount of suspended solids increases in water, the water turbidity level increases. The unit of turbidity is NTU (Nephelometric Turbidity Units) [17,18].
TDS Sensor: TDS (Total Dissolved Solids) refers to the number of milligrams of soluble solids in one water liter. In general, the high value of the TDS refers to the more soluble solids were in the water, and the water was less clean. Hence, the TDS value can be used as a measure of water cleanliness. TDS pen is widely used for measuring the value of TDS, but it is unable to transfer data to the control system for real time monitoring to conduct some water quality analysis. The TDS sensor kit is highly accurate and can send data to the control system. It compatible with Arduino, plug and play, easy to use. TDS unit is ppm (parts per million) [17].

Network layer
The network layer transfers the data between the device and the many layers to achieve the sharing of data resources, including data packet routing and system topology. This layer classifies and aggregates the signal data gathered and transfers it to the servers [15].

Service management layer
This is the mind of IoT which is responsible for storing the information from bottom layers and, process it with analyzing ,and making decisions based on our analysis. It considers as an information management center where processing and analysis technologies and the expert system are key operational components [12].

Application layer
This layer represents the smart applications. The main function of this layer is providing intelligent services to end users such as information visualization and smart notification based on intelligent and netter analysis of information processed by the service layer. ThingSpeak provide more application in this layer such Analytics (analysis and visualization ) and Action (ThingTweet, React and ThingHTTP).

SYSTEM IMPLEMENTATION
Implementation of our method can be divided into two main parts: hardware implementation and software. The hardware include microcontroller, turbidity and TDS sensors, and Ethernet shield. The microcontroller processes the data captured by the turbidity and TDS sensor then sends the data ThingSpeak Platform using the Ethernet shield. Arduino Uno is used as microcontroller. Figure 1, show the hardware component of the our system. Basically, the hardware was programmed by using Arduino IDE software , writing the code and uploading it to the Arduino board. In software part the collected data are obtained from the hardware part are uploaded in database on line through Thingpeak platform. It can upload the data to the cloud from any device that supports the Internet. In our work the new channel is created in ThingSpeak platform as shown in Figure 2.

RESULTS
The result of our work is the output curve that generated by ThingSpeak for the purpose of monitoring. Different curve are used to monitor the water condition such TDS and turbidity for different places and different days for one place to comparison. There are cage meters is used to view the current water parameter value. Figure 3, shows the TDS for different places. Now a ThingSpeak visualization application is created with MATLAB coding to compare the TDS and turbidity between the places for same day, as shown in Figure 4. The TDS and turbidity comparison for same place with different days is performed, as shown in Figure 5. To analyze the water quality a new visualization is created that use the mean value for TDS and turbidity of last five sensors value and decides the water is drinkable or now. Figure 6, shows this visualization. ThingView is a smart phone application uses a graphical format to see sensor data stored in ThingSpeak. It lets you see ThingSpeak channels in an easy way by entering the channel ID. Figure 7, shows this application in our work.All the curves are considered as monitoring, to make the system work as smart, alert system different application is used. In this work it required to react to the TDS value of the water, so we will send an email when the value is greater than 300 ppm. To do so, we need ThingSpeak services, ThingHTTP and ThingSpeak React, also IFTTT Applet. IFTTT is a Web service that allows you to create small applications that work in response to other actions. It can use the IFTTT Webhooks service to create Web requests to trigger an action such SMS, email message, etc. The incoming action is an HTTP request to the web server, and the outgoing action is an e-mail message. At first IFTTT applet is created as shown in Figure 8, to activate the event on IFTTT ThingHTTP is used with URL of IFTTT applet. We now need an application that interacts with our reading sensor value and runs the ThingHTTP application. This can be done in ThingSpeak using the React application as shown in Figure 9. The system can be improved using swarm optimization techinques as in [19,20], fuzzy logic control as in [21], Artifical Intellgent as in [22,23] and using wireless sesnor netwok as [24,25].

CONCLUSIONS
The paper aims to improve an intelligent monitoring system of water quality for different places. The proposed system was successfully implemented in hardware and programmed using ThingSpeak platform. The system can be monitored through PC and smart phone application with a smart alert through ThingSpeak action application and IFTTT. It provides quick and easy monitoring of turbidity and TDS level to ensure clean water is maintained continuously. ThingSpeak has provided a suitable environment for analyzing and comparing the sensor data as observed in graphics and smart alerts. Based on the specified values, the react application informs the user through email message. According to the obtained results, the proposed system can be considers as suitable water quality monitoring system. It can be used this system to another application in healthcare and another systems.