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  . Dumping untreated or partially treated wastewater into water sources results in water contamination thereby degrading the quality of water sources.
The Tanzania’s Environmental Management Act of 2004 and the Environmental Policy for Water Quality Standards of 2007 require all factories to purify their effluent before releasing it to avoid environmental pollution. However, like many developing countries, the release of untreated wastewater remains common practice in Tanzania   caused by lack of infrastructure, technical and institutional capacity, and financing  , highly efficient wastewater treatment technologies and inadequate water quality monitoring and control systems  . 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  .
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  .
Monitoring the wastewater discharged into water sources is, therefore, important  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  . 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  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  is fueled by its low cost, distributed intelligence and reduced installation and maintenance expenses  . 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.
2. Related Works
The application of WSN in environmental monitoring, particularly in water quality monitoring, has been addressed in several research papers. In  , the author presented ThingSpeak based sensing and monitoring system for IoT with MATLAB analysis. The IoT capability of this system was enabled by ESP-8266 Wi-Fi module and ThingSpeak cloud. The presented system relies on Wi-Fi network connectivity which may not be feasible in remote places where GSM/GPRS network is the only option. Devassy et al.  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  , 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  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  . 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.
3. 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.
3.1. 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, interfaced to the Arduino microcontroller unit by a sensor interface shield, the tentacle shield, from Whitebox Labs. Arduino mega 2560 R3, an open source electronics prototyping platform, is used as the microcontroller unit. Wireless communication module on top of the WSN sensor node provides wireless capabilities to the WSN sensor node. It transmits the sensor data wire-
Figure 1. The proposed cloud-based WSN for monitoring industrial wastewaters discharged into water sources.
Figure 2. WSN sensor node hardware architecture.
Table 1. Summary of sensor specifications.
lessly to the WSN gateway node. All the sensors were calibrated so as to obtain accurate readings of water quality parameters being measured.
Wireless communication capability of the proposed system is enabled by XBee wireless transceivers. XBee wireless transceivers are opted because of their low cost and power consumption. XBee modules use the IEEE 802.15.4/ZigBee networking protocol for fast point-to-multipoint or peer-to-peer networking  . The 802.15.4 Protocol is better suited for slower, long-term applications in which access to external power is problematic therefore battery life is important  . The XBee transceiver at the WSN sensor node is configured as an END DEVICE whereas the XBee transceiver at the WSN gateway node is configured as a COORDINATOR. XCTU software was used for the configurations of the XBee modules.
Figure 3 presents the design and hardware implementation of the power supply module used at both the WSN sensor node and the WSN gateway node. The power supply module is equipped with rechargeable batteries, battery holder, and dc-to dc booster. For testing the developed prototype, two 3.7 v, 3200 mAh Li-ion batteries are used.
3.2. WSN Gateway Node
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
Figure 3. Design and hardware implementation of the power supply module. (a) The design of the power supply module; (b) Hardware implementation power supply module used in testing the developed prototype.
Figure 4. Hardware architecture of the WSN gateway node.
communication between the SD card and the Arduino Uno is via Serial Peripheral Interface (SPI) data communication protocol.
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.
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.
3.3. 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    . IoT brings intelligence to the interconnected objects  with minimal human interventions  . For the purpose of connecting sensors to IoT, the focus of paper is on ThingSpeak  cloud platform.
Figure 5. Flowchart of data processing at the WSN gateway node.
ThingSpeak is an open IoT platform that provides real time data collection, analysis and actuation with an Open API  . 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  and Xively  . 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  . Carriot is expensive and less user friendly since it doesn’t offer any ready-made dashboard.
3.4. 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  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  and Twilio  .
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.
Figure 7 SMS trigger 1 is when the pollution is detected by the sensor nodes and WSN gateway node send SMS notification to the SMS gateway service where by an SMS alert is triggered and sent to the monitoring center as detected pollution. 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.
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.
Figure 7. The proposed SMS gateway service.
Figure 8. Telerivet conditions set to trigger SMS notification alerts.
4. 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 we can see the variations of the sensor measurements of the monitored parameters with time. Field chart 1 captures the variations of conductivity of the water. For example June 16, 2017, a significant change of EC from 281 µS/cm at 3:08 GMT to 1177 µS/cm at 3:23 GMT was captured. This increase of EC remained around 1200 uS/cm for a period of around 4 hours. Field chart 2 graphs the variations
Figure 9. Hardware implementation of the system: (a) The WSN sensor node; (b) The WSN gateway node.
Figure 10. Testing of the developed prototype at Nduruma sub-catchment. (a) Installation of the WSN sensor node at the test site; (b) WSN sensor node taking measurements at the test site.
Figure 11. Sensor data visualization using ThingSpeak interactive line chart.
of pH in water. Taking the record of June 15, 2017, the pH decreased from 7.09 at 20:21 GMT to 4.39 at 20:36 GMT thereafter remained around pH of 4 for about 10 hours. The same can be said about the field chart 3 which graphs the variations of dissolved oxygen in the water. From these variations, a trend of continuous deviant measurements would indicate the water pollution.
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.
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.
This research work was supported by the University of Dodoma (UDOM) through Higher Education Students’ Loans Board (HESLB) of Tanzania. Authors express their gratitude to the University of Dodoma and Nelson Mandela African Institution of Science and Technology (NM-AIST) management and staffs for their administrative support.
 Tanzania Bureau of Standards (TBS) (2006) Municipal and Industrial Wastewaters General Tolerance Limits for Municipal and Industrial Wastewaters (TZS860:2006). National Environmental Standards Compendium, Tanzania Bureau of Standards, Dar es Salaam, 1-8.
 Derbew, Y. and Libsie, M. (2014) A Wireless Sensor Network Framework for Large- Scale Industrial Water Pollution Monitoring. HiLCoE Journal of Computer Science and Technology, 2, 95-101. https://doi.org/10.1109/ISTAFRICA.2014.6880619
 Faustine, A., Mvuma, A.N., Mongi, H.J., Gabriel, M.C., Tenge, A.J. and Kucel, S.B. (2014) Wireless Sensor Networks for Water Quality Monitoring and Control within Lake Victoria Basin?: Prototype Development. Wireless Sensor Network, 6, 281-290.
 Prasad, A.N., Mamun, K.A., Islam, F.R. and Haqva, H. (2015) Smart Water Quality Monitoring System. 2015 2nd Asia-Pacific World Congress on Computer Science and Engineering, 1-6. https://doi.org/10.1109/APWCCSE.2015.7476234
 Hangan, A., Vacariu, L. and Cret, O. (2013) A Prototype for the Remote Monitoring of Water Parameters. 2013 19th International Conference on Control Systems and Computer Science, 29-31 May 2013, 1-5.
 Perera, C., Liu, C.H. and Jayawardena, S. (2015) The Emerging Internet of Things Marketplace from an Industrial Perspective?: A Survey. IEEE Transactions on Emerging Topics in Computing, 3, 585-598. https://doi.org/10.1109/TETC.2015.2390034
 Gubbi, J., Buyya, R., Marusic, S. and Palaniswami, M. (2013) Internet of Things (IoT): A Vision, Architectural Elements , and Future Directions. Future Generation Computer Systems, 29, 1645-1660.