Automated Alert System for River Water Level and Water Quality Assessment using Telegram Bot API

Technology has advanced to the point that it can assist people in their daily lives. Human beings may benefit from this development in a variety of ways. Progress in river water monitoring is also one of them. There are many advantages in improving the river water monitoring system. The objective of this project is to develop an automated system for monitoring river water levels and quality with push notification features. Internet of Things (IoT) was implemented in this research by using NodeMCU as a microcontroller to connect both ultrasonic sensors and pH sensors to the Internet. An ultrasonic sensor is used to read the water level, and a pH sensor is used to read the water pH values. The results show the successful output from all of 10 time attempts to obtain more accurate test results. The results will be averaged to be analysed and concluded from the test. All the tests include testing for the accuracy of the ultrasonic sensor, the accuracy of the pH sensor, and the performance of the internet connection using integrated Wi-Fi module in NodeMCU microcontroller. The system test also shows that it performs perfectly with the requirement needed to send the real-time status of the water level, water quality and an alert to the user using the Telegram Bot API. This research can help to increase the level of awareness of the river water monitoring system. This research was done by looking at people's problems in the vicinity of the river area by producing a system tool that helps to monitor the river water in real-time status.


HIGHLIGHTS
• Monitoring system is a method that can be used to persistently updated on the river water status • Ultrasonic sensor is using soundwave to detect the water surface area • pH sensor is using two electrodes in the sensor to measures the pH level • Telegram application is an open-source cloud-based instant messaging service.

ABSTRACT
Technology has advanced to the point that it can assist people in their daily lives.Human beings may benefit from this development in a variety of ways.Progress in river water monitoring is also one of them.There are many advantages in improving the river water monitoring system.The objective of this project is to develop an automated system for monitoring river water levels and quality with push notification features.Internet of Things (IoT) was implemented in this research by using NodeMCU as a microcontroller to connect both ultrasonic sensors and pH sensors to the Internet.An ultrasonic sensor is used to read the water level, and a pH sensor is used to read the water pH values.The results show the successful output from all of 10 time attempts to obtain more accurate test results.The results will be averaged to be analysed and concluded from the test.All the tests include testing for the accuracy of the ultrasonic sensor, the accuracy of the pH sensor, and the performance of the internet connection using integrated Wi-Fi module in NodeMCU microcontroller.The system test also shows that it performs perfectly with the requirement needed to send the real-time status of the water level, water quality and an alert to the user using the Telegram Bot API.This research can help to increase the level of awareness of the river water monitoring

INTRODUCTION
A river was a natural and typical freshwater that flows towards the ocean, sea, lake and also to another river.Rivers have been a source of food since time immemorial, especially to the locals.However, rivers could also cause floods and pollution which could be a huge harm to the local people.The flood is the most destroying catastrophic event that had been experienced in Malaysia.Flood regularly occurs on the east coast of peninsular Malaysia due to heavy rains brought by the northeast monsoon winds, especially in Kelantan, Terengganu and Pahang.Sometimes, these floods brought a great destruction which made the government to suffer in repairing the damage caused by the floods itself.In addition, there were also cases where the people did not go to the higher ground in time and ended up facing their own death.Because of this, flood risk management in Malaysia is not just merely about flood risks, but also comprises of a specific government system that encapsulates management perspective that combines prevention, mitigation, preparedness, and response (Nurul & Hitoshi, 2020).
Current method used which is the siren system warning also had caused someone who lived far away from the siren or lived in a soundproof house being unable to hear the siren.Moreover, one of the major reasons is the residents themselves when they did not take the warning siren seriously.It was discovered that the siren's crisis cautioning sound could not be separated from the sounds utilized during its typical activity (non-emergency cases) and, in this manner, had neglected to react to it during a real crisis (Sayers et al, 2013).One of the cases that can be referred to is a flash flood disaster in the Cameron Highlands, Malaysia, happened on October 23, 2013, when authorities were forced to release water from the Sultan Abou Bakar dam due to an emergency release.At the time of the discharge, a siren was activated, however the same siren has previously been used for non-life-threatening water releases.As a result, the warning wasn't properly interpreted (Perera et al., 2020).
Human activities, especially in manufacturing and development, had caused pollution to the river, damaging ecosystem and harming humans (Nasirian, 2007).The status of river water quality in Malaysia also has long been a source of concern for local governments, government agencies, and the public at large.Malaysian rivers, such as the Juru River in Penang, the Skudai River in Johor, and the Klang River in Selangor and Kuala Lumpur, are all considered contaminated (Othman et al., 2020).Sungai Langat water also has been considered unsafe to drink without being treated first due to synthetic pollution from pointed and non-point pollution sources, even though it was one of the critical water sources in Selangor, Malaysia.Besides that, low awareness of water quality could endanger our health in the future.There was a cycle when toxins were in the water.Toxins moved from the water consumed by animals and plants which humans ate until the contaminants entering the food chain (Afroz & Rahman, 2017).This is due to the facts majority of the people are still lacks of knowledge about the level of water quality measurement.
Previous work related to the water monitoring system was published by Gowthamy et al. (2018) that proposed Smart Water Monitoring System using IoT.Gowthamy et al. (2018) research's objective was to develop a real-time system based on the Internet of Things (IoT) to monitor water level and quality using several sensors such as ultrasonic and pH sensors.This previous project used Arduino Uno and Wi-fi module as a component to send the data instead of using NodeMCU that had built-in Wi-fi.This system also had not equipped with an alert system to notify the users.
Another previous research was proposed by Asha and Vidadala (2020), which was a wireless-based water level monitoring system using Arduino and Bluetooth.They have developed a system to measure water level using a sensor connected to the Arduino as a microcontroller and then send information to the registered mobile phones using a Bluetooth module.Compared to this project, they used Bluetooth module as a component to send information and buzzer as an alert to the users.This paper was proposed to develop a monitoring system with the ability to send alert notifications through the Telegram API Bot.In the next section, the methodology of the system developed will be discussed, as well as the test result that were conducted in the project.

METHODOLOGY
The waterfall model of methodology was adapted in this project.Five phases in this model have been adapted, which were the initiation phase followed by the planning phase, the development phase, the testing phase, and lastly, the documentation phase.All these phases will be used as a guide in this research until completion.

Proposed Architecture
Figure 1 shows the general purpose of the system.This project was developed for monitoring water level and pH level in real-time status.The water level was measured by using an Ultrasonic sensor and pH level using a pH sensor connected to a microcontroller.The architecture from the prototype, that takes data from both sensors were sent to the NodeMCU to be analysed.The NodeMCU with built-in Wi-Fi was connected to the access point that has been configured to connect to the Internet.The following process was continued in the HTTP API cloud server, and then the message was sent to a Telegram API Bot, which replied it into a chatbot.Users then could easily monitor water status using the Telegram application on the phone or the computer just by sending the command message through it.Water level was measured by an ultrasonic sensor connected to the microcontroller (Mohammad, 2009).Figure 2 showed the flowchart for water level monitoring.An ultrasonic sensor has two different components, which are the transmitter and receiver.First, the transmitter will transmit a sound wave to the surface, and then the reflected soundwave from the surface will be received by the receiver.The duration from transmits and receive of soundwave will be used to measuring the distance.NodeMCU will perform calculations, and if the water level exceeds the limit of save level, an alert will be sent to the user.For measuring pH level, an electrode pH sensor was used.pH sensor had two electrodes in the sensor.The first electrode is the reference electrode, and the second electrode is known as an internal electrode.When the pH sensor probe was dipped in the liquid test, the electrochemical potential was created by hydrogen ions in the liquid exchanging other positively charged ions and supplied to the electronic amplifier module, which detects the potential between both electrodes and the difference between these potentials gives the pH value.Figure 3 shows the flow of the pH sensor in the system.The results from the pH sensor were sent to the microcontroller, and then alert was sent to the users if the pH level was under 6.5 or exceeds 8.5 value which was out range of the neutral water pH value.

Prototype Development
For the prototype development, this project used a square container to house a breadboard with a microcontroller and power supply adapter.A hole was created on the side of the container for the Ultrasonic sensor and pH sensor wires.On the container's lid, the LCD will be placed to display the data to the user.The power supply of the prototype was obtained from a power bank or Universal Serial Bus (USB) port.Figure 4 shown the prototype that had been built for the system.used by the sensor.The Ultrasonic sensor was used in the project to measure the water level.Ultrasonic sensor transmitter sends the sound wave, and the receiver acts as a microphone to receive the echo from the sound wave.The distanced was determined by measuring time lapses between the sending and receiving of the sound wave.Next for water quality monitoring, a liquid pH sensor was used to measure the pH level of water.An LCD display was used to display the reading from ultrasonic sensor and pH sensor and the brightness of LCD was controlled by potentiometer.
For the source code, Arduino IDE software was used as a platform to write the code and upload the code to the microcontroller which was NodeMCU.The Telegram bot was created as a platform for the user to receive the information about the status of water level and pH level that the user can also access it from smartphone or computer.

FINDINGS AND DISCUSSIONS
The system was evaluated by testing the performance of prototype's sensitivity.This testing was conducted to see the output from the prototype through the LCD, and the result was sent to the telegram bot.The prototype was able to send the alert to the telegram bot when the water level exceeds the level set in the system and when the pH level was at alkali or acid level.The LCD would display the water level and the pH level with the status neutral, acid or alkali.Table 1 showed that the water monitoring system test result that was conducted.The result showed that LCD display and Telegram bot has succeed to display a realtime reading from the ultrasonic sensor.The result also showed that the system was capable to send an alert to the user when the water level exceeded above 11 cm that has been set in the system.6 showed the sample output from Telegram for water monitoring push notification.On the left highlighted in red, it showed the output system which was sent to the user.Meanwhile, on the right highlighted in red, it showed the system was sending an alert to the user that the water was at the danger level.Figure 7 showed that the result from the pH sensor accuracy test from different types of liquid.All the results read by the system were compared to the result by litmus paper.It showed that the system reading was able to give a precise read of pH level.Table 2 showed the results from pH monitoring system test that had been conducted.An alert had been set if the pH level was below 6.5 and above 8.5.According to the Environmental Protection Agency (EPA) and World Health Organization (WHO), the acceptable pH range of drinking water is between 6.5 and 8.5.
The system test successfully showed the LCD with the accurate real-time reading and sent the information to Telegram user.The table also showed that the system succeeded in sending an alert when the pH level was below 6.5 or above 8.5 to the user.8 showed that the system sent a real-time reading to the user.On the left highlighted in red, it showed the reading for the drinking water.On the right highlighted in red, it showed an alert that was sent from the system to the user because the pH was at the Alkali level.

CONCLUSION AND RECOMMENDATIONS
The prototype system had successfully passed all the testing that had been conducted.The project's objective was achieved which was to develop a system that could measure water level, and quality level of water and sent the information to the user using Telegram.The reading of water level height measured using ultrasonic was accurate comparing to manual measurement.Using the pH sensor, the pH reading of different types of liquid could be obtained quickly and precisely.Although all the objectives had been fulfilled, this project had several limitations.Due to the COVID-19 pandemic, the prototype system was not appropriately tested to the public or in real environment.Instead, the demo was only shown to the respondents via video demonstration.For the future work, this system can be improved by testing the system in real environment so that the data collection can be more accurate than the indoor simulation testing.

Figure 1 :
Figure 1: Automated Monitoring System for River Water Level and Water Quality Architecture

Figure 2 :
Figure 2: Flowchart for Water level monitoring

Figure 3 :
Figure 3: Flowchart for pH level monitoring

Figure 4 :
Figure 4: Prototype of Automated Alert System for River Water Level and Water Quality Assessment using Telegram Bot API

Figure 5 :
Figure 5: Schematic diagram for the prototype

Figure 6 :
Figure 6: Output on the Telegram bot for water monitoring push notification

Figure 8 :
Figure 8: Output on a Telegram bot for pH monitoring push notification

Table 1 :
Water monitoring system push notification test result

Table 2 :
pH monitoring system push notification test result