Real Time Water Quality Monitoring System for Smart City in Malaysia

Journal homepage: http://ejournal.upi.edu/index.php/AJSE/ ASEAN Journal of Science and Engineering 2(1) (2022) 47-64 © 2021 Universitas Pendidikan Indonesia Amin et al., Real Time Water Quality Monitoring System for... | 48 DOI: http://dx.doi.org/10. 17509/xxxxt.vxix pISSN 2776-6098 eISSN 2776-5938|


INTRODUCTION
Water is one of the most important substances on earth. Human, plants and animals need water to survive. Apart from drinking water to survive, people have many other uses for water such as washing and recreation. It is very crucial that the drinking water is clean, clear, free of germs and chemicals. However, rapid economic development has begun to increase industrial pollution and the degradation of urban surroundings (Borhan and Ahmed, 2019) In Malaysia, 98% of the total water use originates from the rivers (Huang et al., 2015). Although Malaysia is blessed with many rivers, but large quantity of water resources available in the catchment unfortunately does not guarantee adequate supply to all users because of the river pollution (Bao, 2010). Generally, water pollution in Malaysia is caused by point and non-point sources. Point sources comprise of sewage treatment plants, manufacturing and agriculture-based industries as well as animal farms. Non-point sources are caused by activities that involve earthwork operations, logging and land clearance (Sahid et al., 2009). Department of Environment (DOE) have identified approximately 2,292 industries as significant water pollutant sources in Peninsular Malaysia. The major potentially polluting industries were 928 (40%) food and beverage factories, 324 (14.1%) rubber producing premises and 270 (11.4%) chemical producers. Based on the distribution of water pollution sources by state in Peninsular Malaysia, the majority was found in the most industrialized states in the Peninsular Malaysia; Selangor (414), Johor (384), Pulau Pinang (328) and Perak (253) (Muyibi, Ambali, and Eissa, 2008).
The water operators in Malaysia are facing serious challenges to ensure consumers have continuous access to clean water and to ensure a sustainable water future. However, the recent incidents of river pollution in Malaysia have highlighted the severity of the water crisis in Malaysia. The controversial water pollution incidents in 2020 include the cases of river pollutions from remnants of chemical substances which had polluted Sungai Kim Kim (Sukaimi, 2020), industrial premises released effluents with solvent-like odour into Sungai Selangor (Babulal, Solhi, and Bala Krishnan, 2020), and illegal dumping of waste by irresponsible quarters into the sewerage system to Sungai Semenyih (Ram, 2020). These incidents had caused water disruptions in many places Selangor, disrupt livelihood of fisherman (Ahmad, 2019) and also harm the health of the people. In 2020 alone, there are 8 oc-currence of water disruptions in Selangor, one of the most urban city in Malaysia. Water disruptions in Selangor are increasingly becoming a problem, often leaving millions of households high and dry for several days to even a week with notice issued only at the last minute causing inconveniences to businesses and industries reliant on steady water supply. The rivers that are most commonly polluted are Sungai Semenyih and Sungai Selangor. As Klang Valley is hit by repeated water cuts, observers have once again questioned water management agencies' efficiency. The main culprit of the disruption ranges from burst pipes to river streams being polluted with solvents, due to odour pollution that was later identified to have come from a factory in Rawang. Water supply restoration took around one to six days and these incidents are becoming more frequent and causes stress and frustration amongst the urbanite. Many researches and studies have been conducted to combat water pollution and provide solutions to this problem. These new techniques proposed the use of wireless sensor network (WSN). Proposed a system that consists of three parts: data monitoring nodes, data base station and remote monitoring center. This system is suitable for the complex and large-scale water environment monitoring, such as for reservoirs, lakes, rivers, swamps, and shallow or deep groundwater. Another work on WSN features a high power transmission Zigbee based technology together with the IEEE 802.15.4 compatible transceiver that can be deployed for an ad hoc or continuous monitoring purpose (Rasin and  2009). Alkandari, Alnasheet, Alabduljader, and Moein (2012) also use architecture of a WSN system deploying the sensors of the network on sea surface that monitor the water characteristics such as temperature, PH, dissolved oxygen, etc., and provide various convenient services for end users who can manage the data via a website with spreadsheet from a long distance or applications in a console terminal. Recent work that was based on Internet of Things for in-pipe water used testing water samples and upload the data over the Internet. The system provides an alert to a remote user, when there is a deviation of water quality parameters from the pre-defined set of standard values Geetha and Gouthami (2016). Mohd Kassim, Rozman, Zulhairi, and Abu Bakar Sajak (2020) developed a device to detect the pH value of water and the level of turbidity of the water. The end-user can get the result instantly via an app called Blynk as it connected to a smartphone.
The sensor that detects the pH value will pass through the information to the Arduino, and the result will be shown on the mobile devices. In this paper, a prototype with four sensors had been proposed and build. Besides pH and turbidity, a flow sensor and a temperature sensor had been added to ensure that the prototype been equipped with all the necessary sensors to measure the necessary parameters of any water sample.

Introduction
SDLC is known as software development Life Cycle where it is a framework defining tasks performed at each step in the software development process. There are few types of SDLC model that can be used. In this project, agile model is used because it is very simple to use and understand. Using this model, projects can be developed easily rapid processes can be achieved.

Agile Model
The information that is needed in this project was gathered and analysed based on the related project so that the project objective and scope can be determine. Figure 1 this methodology had been chosen to be used in this project because the resource requirements are minimum, it is suitable for fixed or changing requirements, it delivers early partial working solutions, it is a good model for environments that change steadily and it have minimal rules hence documentation easily employed see. These factors are suitable for Internet of Things project.   shows the block diagram of Real time sense water monitoring system. Arduino Uno will be used as the microcontroller for this project. The sensors needed in this project consist of pH sensor, Turbidity sensor and conductivity. Wi-Fi module is used to send the results to the smart phone via Wi-Fi. The results were sent through Blynk software where the results will be shown on the smartphone. Figure 3 the main controller for this project is Arduino Uno. It is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller. It can be simply connect it to a computer with a USB cable or power it with AC-to-DC adapter or battery to get it powered up.

pH sensor
Figure 4 pH sensor is a device to measure the level of acidity or alkalinity of a solution, the pH scale ranges from 0 to 14. The pH indicates the concentration of hydrogen [H] + ions present in certain solutions. It can accurately be quantified by a sensor that measures the potential difference between two electrodes: a reference electrode (silver / silver chloride) and a glass electrode that is sensitive to hydrogen ion. This sensor gives an output in the form of analog signal. It requires ADC (Anolog-to-Digital Converter) before connected to the Arduino.

Turbidity sensor
Turbidity sensor detects water quality by measuring level cloudiness/haziness in the water see Figure 5. It able to detect suspended particles in water by measuring the light transmittance and scattering rate which changes with the amount of total suspended solids (TSS) in water. As the TTS increases, the liquid turbidity level increases. This Arduino turbidity sensor have both analog and digital signal output modes. Mode can be selected according to the MCU as threshold is adjustable in digital signal mode. It needs to be connected to the ADC before connected to the Arduino.

Temperature sensor
Figure 6 the DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with non-volatile user programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor. It has an operating temperature range of -55°C to +125°C and is accurate to ±0.5°C over the range of -10°C to +85°C. In addition, the DS18B20 can derive power directly from the data line ("parasite power"), eliminating the need for an external power supply. The DS18B20 is a small temperature sensor with a built in 12bit ADC. It can be easily connected to an Arduino digital input. Temperature is an important factor to consider when assessing water quality. In addition to its own effects, temperature influences several other parameters and can alter the physical and chemical properties of water.

Flow sensor
Flow sensor can easily measure the flow of liquids (water) see Figure 7. The sensor has a 7mm coupling on both sides and is therefore easy to connect to a 6mm hose. The output of the sensor gives 98 pulses per second with a duty cycle of approximately 50% for each liter of fluid passing through per minute: Q [L/min] = fpulse [Hz]/98.

Wi-Fi module
Figure 8 the ESP8266 Wi-Fi Module is a self-contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your Wi-Fi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor. Each ESP8266 module comes pre-programmed with an AT command set firmware so that it can simply hook with an Arduino board and get about as much Wi-Fiability as a Wi-Fi Shield offers. The ESP8266 module is an extremely cost-effective board with a huge, and ever-growing community.
This module has a powerful enough on-board processing and storage capability that allows it to be integrated with the sensors and other application specific devices through its GPIOs with minimal development up-front and minimal loading during runtime. Its high degree of on-chip integration allows for minimal external circuitry, including the front-end module, is designed to occupy minimal PCB area. The ESP8266 supports APSD for VoIP applications and Bluetooth co-existence interfaces, it contains a self-calibrated RF allowing it to work under all operating conditions and requires no external RF parts.   Figure 9 is blynk a new platform that allows user to quickly build interfaces for controlling and monitoring hardware projects from iOS and Android device. After downloading the Blynk apps, user can create a project dashboard and arrange buttons, sliders, graphs, and other widgets onto the screen. Using the widgets, user can turn pins on and off or display data from sensors. Blynk supports most Arduino boards, Raspberry Pi models, the ESP8266, Particle Core, and a handful of other common microcontrollers and single-board computers, and more are being added over time. Arduino Wi-Fi and Ethernet shields are supported, though it can also control devices plugged into a computer's USB port as well.

Arduino IDE
Arduino is an open-source platform used for building electronics projects. It consists of both a physical programmable circuit board or a microcontroller and a piece of software, or IDE (Integrated Development Environment) that runs on computer to write and upload computer code to the physical board see Figure 10.

DEV-C++
Dev-C++ is a free full-featured integrated development environment (IDE) distributed under the GNU General Public License for programming in C and C++ see Figure 11. It is written in Delphi. It is bundled with, and uses, the MinGW or TDM-GCC 64bit port of the GCC as its compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC-based compiler. Figure 12 shows the project's flowchart from the start until the end where the results will be displayed on the mobile device.   Figure 13 shows the circuit design of developing and assembling hardware for Real time sense water monitoring system. It is shown that all the components and sensors were connected to a board circuit and certain wire from the sensor were also been connected to the Arduino. The only sensors that was not connected the Arduino is the temperature sensor. Figure 14 shows all the components that have been assembled. All the sensors are shown in the Figure 14.

HARDWARE AND SOFTWARE INTERGRATION TESTING
To ensure all the components, parts and process are working accordingly, the sensors had been tested individually to ensure there is data transmission from the sensor and to Blynx. The code of each sensor are essential to ensure the hardware and software integration.

Testing of pH sensor
pH probe is one in every of the pH sensor components that accustomed to interact with water liquid. The top of the pH probe must be poke into the liquid in order to gather the pH rate. Figure 15 pH probe will be connected with the pH board before connecting to the Arduino Uno Board and then sends the acquired data to blynk. pH board will scan the acidic rate produced when the pH probe touched the liquid. Figure 16 shows the coding for pH sensor. Figure 17 this a part of the system, the Temperature sensor has been operating along with the Arduino board to gather temperature data in Fahrenheit Celsius from the liquid . The temperature sensor will detect the water liquid whether it is at high or low than expected in temperature level. Within the Figure 4 and 2, the temperature sensor is poked until it reaches the silver part. This is to ensure that all part of the sensor covers by the water. Below Figure  18 shows the codes for the sensor.    Figure 19 shows the waterflow of flow sensor, this will show just to ensure that the water flows within the sensor. Be sure that the directions to pour the liquid was in the correct directions so that the sensor could give out readings effectively. Make sure to do this procedure in the safest place possible because it will start to get wet because of the flow rate that will enter the sensor from a hole to another. If the liquid enters on the other direction side of the sensor, the data collected will not be shown.

Testing of temperature sensor
The Figure 20 shows the code for flow sensor.

Testing turbidity sensor
On this next procedure, turbidity sensor was tested to measure the cloudiness or haziness of a substance or liquid see Figure 21. The sensors will be placed in the water and the turbidity board will give an exact reading for the water. Figure 22 shows the codes for turbidity.

Figure 23
Wi-fi module (ESP8266) will be connected to arduino and it will be set ssid username and password as 'Wifi_Project and '1111aaaa'. After the ESP has been set we have to set our wi-fi hotspot on our mobile devices exactly as stated. Only then the connection will be automatically developed from blynk to the Arduino. Codes is shown on Figure 24.    First row shows the readings for temperature that was pointed in Celsius. The Second column shows the reading for the flow rate, as it appears there is currently no readings because there is no water flow from the sensors. Third column, which shows the pH rate is currently shows the determination of a specific reading value for the liquid substance whether it as acidic or alkaline and lastly the fourth column shows the result readings obtained for the cloudiness of the substance which was stated as turbidity.

pH measurements
pH electrodes can measure taste sensations can be measured in exact figures as Figure 26. Whether something is perceived as acidic or alkaline depends on the hydrogen ion (H+) concentration in the solution. The pH value is defined, by the Sorenson Equation, as the negative logarithm of the H+ concentration in a given solution as Figure 27. In other words, at a high concentration, e.g. 1 mol/L = 100, pH = 0 (ACIDIC) at a low concentration, e.g. 10-14 mol/L, pH = 14 (ALKALINE). Hence, different substances are objectively compared with each other, where pH 0 is extremely acidic, pH 14 extremely alkaline, and pH 7 neutral.  In the last few years, the measuring of pH has gained in importance. In the control and regulation of chemical and biological processes, it has become indispensable to monitor the pH values. The pH result in the water sample shown in Figure 25, clearly indicate that the water is acidic.

Turbidity findings
Turbidity is the cloudiness or haziness of a fluid caused by large numbers of individual particles that are generally invisible to the naked eye, similar to smoke in air. The measurement of turbidity is a key test of water quality.
Fluids can contain suspended solid matter consisting of particles of many different sizes. While some suspended material will be large enough and heavy enough to settle rapidly to the bottom of the container if a liquid sample is left to stand (the settable solids), very small particles will settle only very slowly or not at all if the sample is regularly agitated or the particles are colloidal. These small solid particles cause the liquid to appear turbid.
Turbidity (or haze) is also applied to transparent solids such as glass or plastic. In plastic production, haze is defined as the percentage of light that is deflected more than 2.5° from the incoming light direction see Figure 27.   Figure 4, 5, and 2 shows the colors of readings within each of the water substance that was tested within different polluted substance. All the measurements were taken based on NTU (Nephelometric Turbidity Units) and as it was stated that measurements that are below than 19 are considered low in turbidity which has clear water. If the measurements are within a range of 21-50 that means it is in a moderation when it comes to the cloudiness of the water. And lastly 75-240 and above shows that the turbidity readings were very high which means the water substance are very cloudy and it is not safe to be used daily. In the water sample taken, the turbidity level is 2966 which is very high and indicated a polluted water.

Flow and temperature findings measurements
Since the water sample is in still mode, there is no flow measurement indicated in the Blynk app. However, for real life testing in any blockage of water in the drainage this parameter will be most useful. While the temperature reading shows that the water sample is taken in a room temperature.

CONCLUSION
The real time sense water monitoring system has been successfully developed. The system has been tested and results have been collected and presented as a picture format. Also, the system achieved its objectives whereby it can read precise data fast simultaneously.
The prototype of real time sense water monitoring integrates many sensors such as turbidity sensor, temperature sensor, flow sensor and pH sensor into one and the development of this system prototype is interesting and quite unique. Developing this system's prototype utilizes a bunch of clear, inexpensive materials. There are two limitation for this project one is time consumption, This system should be operated in a long period of time due to the heat that caused from the wi-fi module and it could damage component. The other one is the system could only detect on sample at a time, even though it is time consuming, the result retrieved were instantaneous and simultaneously.
Some recommendations are proposed to help the workers manage the implementation process and increase the productivity of the water monitoring system. Firstly ,the design of the prototype can be improved. A minimum and easy carry system will make the process of bringing it anywhere to test samples could be a lot easier for the administrator to do the testing. Making the design more portable and simpler in the future.

ACKNOWLEDGEMENTS
This project is sponsored by the MIIT, Universiti Kuala Lumpur.

AUTHORS' NOTE
The author states that there is no conflict of interest regarding the publication of this article. The author confirms that the paper is free from plagiarism. There are still many shortcomings and need further research from this article so that the resulting battery is used like a conventional battery.