An Integrated Cloud-Based Wireless Sensor Network for Monitoring Industrial Wastewater Discharged into Water Sources

This paper presents a prototype of an Integrated Cloud-Based Wireless Sensor Network (WSN) developed to monitor pH, conductivity and dissolved oxygen parameters from wastewater discharged into water sources. To provide realtime online monitoring and Internet of Things (IoT) capability, the system collects and uploads sensor data to ThingSpeak cloud via GPRS internet connectivity with the help of AT commands in combination with HTTP GET method. Moreover, the system sends message alert to the responsible organ through GSM/GPRS network and an SMS gateway service implemented by Telerivet mobile messaging platform. In this prototype, Telerivet messaging platform gives surrounding communities a means of reporting observed or identified water pollution events via SMS notifications.


Introduction
Water pollution by chemicals from municipal and industrial wastewater has become one of the public concerns particularly in developing countries where only 8% undergoes treatment of any kind [1]. Dumping untreated or partially treated wastewater into water sources results in water contamination thereby degrading the quality of water sources. effluent before releasing it to avoid environmental pollution. However, like many developing countries, the release of untreated wastewater remains common practice in Tanzania [1] [2] caused by lack of infrastructure, technical and institutional capacity, and financing [1], highly efficient wastewater treatment technologies and inadequate water quality monitoring and control systems [3]. For instance, the survey conducted in 2016 by the Tanzania's National Environmental Management Council (NEMC) in the lake zone found that only 2% of 100 firms in Lake Zone adhere to the environment preservation regulations [4].
The extremely low level of wastewater treatment reveals an urgent need for technological upgrades, especially in developing countries, to support the achievement of Sustainable Development Goal (SDG) target 6.3 [1].
Monitoring the wastewater discharged into water sources is, therefore, important [2] in order to provide early detection and warning in cases of violation of permissible discharge standards. However, wastewater monitoring in Tanzania is still based on manual practices including field visits, sampling and laboratory tests which are insufficient to satisfy the current monitoring requirements emphasizing on continuous and dynamic water pollution monitoring [5]. Higher degree of effectiveness is required to satisfy these monitoring requirements.
A wireless sensor network (WSN) is a network comprising of sensing, computing and wireless communication nodes [6] that allow monitoring and gathering data of specified parameters in the environment including water quality. Rapid and extensive application of WSN seen recently in environmental monitoring and industrial monitoring and control applications [7] is fueled by its low cost, distributed intelligence and reduced installation and maintenance expenses [8]. Hence, the emergence of WSN in environmental and monitoring and industrial monitoring provides a promising approach for continuous, dynamic and real-time wastewater monitoring.
In this paper, an integrated-cloud based WSN prototype is developed to monitor wastewater discharged into water sources. The prototype monitors pH, conductivity and dissolved oxygen parameters of discharged wastewater. The selected parameters are used to provide the generic contamination information, including contamination by toxic compounds in the discharged wastewater. While monitoring the selected parameters, a continuous series of deviant measurement would indicate pollution discharge.
The experimental results show that the proposed system is capable of real-time online monitoring of the selected parameters in an IoT environment enabled by the ThingSpeak open API. Moreover, the community involvement in reporting pollution discharge events, via SMS notification, in the proposed system provides an added advantage to the proposed system.

Related Works
The application of WSN in environmental monitoring, particularly in water quality monitoring, has been addressed in several research papers. In [9], the author presented ThingSpeak based sensing and monitoring system for IoT with MATLAB  [10] developed a low cost system for online monitoring and control of industrial effluents in IoT environment. The authors presented a Raspberry Pi based system to monitor and control pH, conductivity and the temperature of the effluents in a tank. Another work is exposed in [11], a smart water quality monitoring system to monitor pH, Oxidation Reduction potential (ORP), conductivity, and temperature using IoT and remote sensing. However, the presented approach is based on the expensive waspmote microcontroller board as compared to Arduino microcontroller boards.
Locally, the work in [7] proposed a WSN system prototype for water quality monitoring in Lake Victoria Basin (LVB). Data collection, storage, and data visualization were based on Water Resource Governance System (WaGoSy); an innovative and integrated ICT solution designed to address challenges of water resources governance facing the LVB [7]. However, the WaGoSy is still in pilot stage and need evaluation. The systems presented so far do not involve the surrounding community in reporting pollution events. Involving people living around water sources in reporting water pollution events via SMS notifications could play a vital role in water pollution monitoring and management since they're the ones who are affected by the pollution discharges. Animal deaths and people sickness are some of the effects the surrounding community experiences due to water pollution by industrial wastewater discharges.

The Proposed System
The proposed cloud-based wireless sensor network (WSN) for monitoring industrial wastewater discharged into water sources is depicted in Figure 1. The main parts of the proposed system are WSN sensor node, WSN gateway node, Cloud platform for IoT, and the SMS-gateway.

WSN Sensor Node
A WSN sensor node is used as a terminal device to collect the water quality data from water sources and transmits the collected data to the WSN gateway node through wireless communication module. The WSN sensor node consists of sensor units, sensor interface shield, Arduino microcontroller, power supply and wireless communication module as shown is Figure 2. The sensor unit consists of pH, conductivity and dissolved oxygen sensors from Atlas Scientific, as summarized in Table 1 Figure 4 illustrates the hardware architecture of the WSN gateway node consisting of microcontroller unit, GPRS module, XBee module, SD card module and power supply. Arduino Uno microcontroller is used as a processor to acquire and process received sensor data from WSN sensor nodes through the XBee module. SIM800C Arduino GSM/GPRS shield from Elecrow was selected to implement the GSM/GPRS module. SD card module is used to provide an extra storage space of the system in case GSM connectivity is not available. The   Once the WSN gateway node receives the sensor data from the WSN sensor node via the wireless communication module, the WSN gateway node processes the received sensor data as described in the flowchart of Figure 5.

WSN Gateway Node
To upload data to ThingSpeak cloud through the GPRS internet connectivity, a set of AT commands in combination with the HTTP GET method are used. At First, a TCP connection to the api.thingspeak.com is established by the AT command AT+CIPSTART. Sensor data must be converted into string, hence data can be updated by using command AT+CIPSEND followed by the HTTP GET method with the API Key and the sensor data. After data is sent, connection must be closed by AT+CIPCLOSE.

IoT Cloud Platform
IoT is interconnection of objects (things), such as sensing and actuating devices, and other smart appliances utilizing the internet as a means of communication [11] [14] [15]. IoT brings intelligence to the interconnected objects [16] with minimal human interventions [14]. For the purpose of connecting sensors to IoT, the focus of paper is on ThingSpeak [17] cloud platform.  ThingSpeak is an open IoT platform that provides real time data collection, analysis and actuation with an Open API [17]. In the ThingSpeak cloud, data are stored in channels; a channel can be private or public. Once the channel has been created, sensor data can be uploaded by accessing the ThingSpeak API with a write key. Read key is used to access data in a private channel. Figure 6 depicts the created unique public access ThingSpeak channel with channel ID 269889 and four data fields to collect and store the sensor data.
There are several reasons for choosing ThingSpeak over other IoT cloud platforms such as Carrio [18] and Xively [19]. Notable advantages of using ThingSpeak as an IoT cloud platform includes, an open source API, simplicity in data exportation, easier data visualizations using live graphs, and the availability of public channel for data storage. Compared to ThingSpeak, Xively provides only trial version for free and notification services are minimally present [20]. Carriot is expensive and less user friendly since it doesn't offer any ready-made dashboard.

SMS Gateway Service: Community Involvement
The SMS gateway service of the proposed system provides a tool for reporting pollution being detected by the WSN sensor nodes and the pollution as observed by the community people around the water sources. To implement the SMS gateway service, Telerivet [21] mobile messaging platform is adopted in the proposed system.
To act as SMS gateway, the platform requires Telerivet's Android app installed on the internet enabled Android smartphone. The use of SWAHILI as one of the backend language makes Telerivet messaging platform the perfect choice to be used in Tanzania, where the first language is SWAHILI, as compared to other SMS platforms like TERA [22] and Twilio [23].
The proposed SMS gateway service handles two types of SMS trigger notifications; Detected water pollution and reported water pollution as illustrated in Figure 6. The ThingSpeak channel created for data collection and storage.  SMS trigger 2 is when the community reports water pollution events on water sources caused by discharged wastewaters.
To handle appropriate trigger notification, contact groups in Telerivet android app are created so as when an SMS notification is received from respective contact group, Telerivet triggers appropriate pollution alert and send the alert to the monitoring center as well as to the other authorities. Contact group GAT-EWAY contains all the contacts of the GPRS modules SIM cards. On reception of SMS notification from this group, the Telerivet will trigger pollution alert notification "DETECTED POLLUTION ALERT". This is the pollution detected by the WSN node whenever the discharge is violating the discharge standards. The other contact group, COMMUNITY group has contacts from community people such as environmental officers. Received SMS from this group will trigger "REP-ORTED POLLUTION ALERT" to the monitoring center. Figure 8 indicates the Telerivet conditions set to accomplish this. For the community SMS to trigger pollution alert to the monitoring center, the SMS must contain the word pollution and either the following keywords pollution indicator.
1) Deaths-Keyword indicator of animal, plants, bird's deaths or deaths aquatic organisms like frogs etc. after consumption of the polluted water.
2) Sickness-Keyword indicator of people sickness after consuming the polluted water.
3) Smell-Unpleasant smell from the discharged wastewater. 4) Color-Colored discharged wastewater. Once the SMS gateway service receives SMS containing the word pollution and having either the pollution keywords indicators, the SMS gateway generates SMS alert which is sent to the monitoring center as reported water pollution. Through this SMS gateway service, the community around water sources is involved in monitoring and identifying any potential pollution due to discharge of industrial wastewaters.

Experimental Results and Discussions
The process of acquiring the measurements from wastewater is done by the WSN sensor node at an interval of 15 minutes. The WSN sensor node reads the monitoring parameters and then passes the readings to the WSN gateway node. The WSN gateway node processes the received sensor data as shown in the flowchart of Figure 5. Figure 9(a) and Figure 9(b) show the hardware implementation of the WSN sensor node and the WSN gateway mode respectively. Functionality and practical application of the developed prototype were verified by testing the system at Nduruma sub-catchment as shown in Figure 10.
Visualization of the uploaded sensor data is accomplished using the Thing-Speak live graphs as shown in Figure 11. ThingSpeak live graphs plots live sensor data as they are being uploaded to the channel. From Figure 11     Data visualization helps the people in the monitoring center to monitor and identify potential pollution events caused by the discharged wastewater in real time by observing the trends of variations of the sensor measurements. Form the results shown above the proposed system can achieve continuous, dynamic and real-time online monitoring of the wastewater discharged into water sources.

Conclusion
The presented prototype demonstrates an integrated cloud-based wireless sensor network for monitoring industrial wastewater discharged into water sources. The IoT capability of the presented prototype is enabled by the ThingSpeak API. Thing-Speak open API promises an efficient, flexible and easy IoT platform for implementing the proposed system. The sensor data is visualized in live interactive ThingSpeak plots thereby giving the monitoring personnel the ability to monitor and identify potential pollution events caused by the discharge of wastewater from industries in real time. Moreover, the tabular form of the uploaded sensor data is also available in CSV format which can then be imported into powerful programs like spreadsheet for record keeping and even in report generation of the collected data. The presented prototype also provides an SMS-gateway service through which the people living around water sources can use to report, via SMS, any observed water pollution resulting from the discharge of wastewater. Future work will focus on more community involvement in industrial effluents monitoring systems.