An Industrial Cloud-based IoT System for Real-time Monitoring and Controlling of Wastewater

Wastewater treatment is considered the most important process for reducing pollutants in wastewater to levels that nature can cope with. At many Sewages treatment plants, industrial wastes cause more difficulties in the treatment process than any other single problem where the plant operators have to deal with. These plants may not be designed to handle these types of wastes and the accelerated deterioration of sewage treatment plant structures. In this paper, we propose a new IIoT cloud-based model for real-time wastewater monitoring and controlling. The proposed system monitors the power of hydrogen (pH) and temperature parameters from wastewater inlet which will be treated in Wastewater treatment plant and avoid impermissible industrial wastewater which the plant cannot deal with. The system collects and uploads real-time sensor readings to the cloud via an IIoT Wi-Fi Module. Additionally, it reports observed or identified unexpected industrial wastewater inlets via SMS notifications and alarms and controls the valves of the gates. This is needed to change the path of the water to the industrial wastewater treatment plant that can treat this type of wastes. Experimental work shows the effectiveness of the proposed system compared to related work.


INTRODUCTION
Wastewater treatment is a method of improving and purifying water by removing some or all pollutants, allowing it to be reused or returned to the environment. Surface water, such as rivers or the ocean, or groundwater, are both possible destinations for discharge. When untreated or inadequately treated wastewater is discharged into water sources, it pollutes the water. which degrades the quality of the water. Egyptian authorities enacted Law 48 (1982) to safeguard the Nile River and waterways from pollution. Only treated effluents are allowed penetration to release to waterways, according to the law, which is clearly recognized from Decree No. . The requirements and specifications for issuing the license, as well as the logistics of applications, are clearly defined [1]. However, due to a shortage of infrastructure, technical and institutional expertise, as well as financial resources, Egypt, like many other developing countries, continues to release untreated wastewater. In addition, highly efficient wastewater treatment technologies are in short supply, as are water quality monitoring and control systems [3]. Biological treatment is now used in the majority of wastewater treatment plants. Biological treatment is an essential part of any wastewater treatment system [4]. It is a technology that cleans water primarily by the use of bacteria, protozoa, and maybe other specialist microorganisms. The benefit of biological therapy over other treatment techniques such as chemical oxidation, thermal oxidation, and so on is evident, both in terms of capital investment and operating costs. As a result, it has solidified its position in any integrated wastewater treatment plant. The discharge of industrial wastes into municipal sewerage systems causes some objectionable effects on the biological treatment operation by affecting bacterial growth which is one of the main factors of the biological treatment success. Temperature, pH value, oxygen, and toxic substances are the most critical elements that influence bacterial growth rate [5]. All of these elements can be managed within a biological treatment system to maintain optimal bioenvironmental conditions for microbial growth. Both treatment and the environment are affected by the acidity or alkalinity of wastewater. The pH scale is a logarithmic scale that measures the inverse concentration of hydrogen ions. Lower pH readings indicate increased acidity, whereas a high pH indicates increased alkalinity (pH of 7 is neutral). To maintain beneficial organisms, the pH of wastewater should be kept between 6 and 9 [7]. Acid, cleaning chemicals, and other pH-altering substances can render wastewater treatment ineffective. Due to the effects of temperature, accurate measurement and reporting of pH data have been a long-standing issue. The temperature of wastewater is essential for two factors: (1) temperature affects biological processes, and (2) temperature has an impact on chemical processes, reaction proportions, and aquatic life. Because of molecular dissociation, as the temperature of any solution rises, the viscosity reduces, the mobility of its ions in the solution increases, and the number of ions in the solution rises. Since pH translates the values of the concentration of the hydrogen ion into numbers between 0 and 14, So any change within the temperature of wastewater causes a change in pH. Most biological treatment systems operate in the 20°C to 40°C temperature range. Aeration tanks and percolating filters operate at a temperature of the wastewater that ranges from 12°C to 25°C, even though air temperature and airflow rate have a major impact on heat loss in percolating filters. The biological activity and metabolic increase as the temperature increases, resulting in faster elimination of substrate. Increased metabolism at higher temperatures, on the other hand, may cause oxygen limitations [7]. The importance of IIoT has been demonstrated by its use in mission and safety-critical systems. Because it handles critical and sensitive data, a detailed search is required to determine its susceptibility to security issues. In recent years, IIoT security has been a prominent topic in academia. Security Goals and needs for IIoT systems have been examined by several researchers [8], [9], [10], and a variety of solutions have been offered to solve various security difficulties in IIoT. As a result, we still have to develop or modify the appropriate security solutions for IoT scenarios to match the particular requirements in IIoT for the security concerns that exist in both IoT and IIoT. Because of the differences between IoT and IIoT, IIoT has its own set of security concerns, which are primarily focused on securing critical industrial control systems. IIoT development provides traditional industry systems with connectivity, realtime intelligence, and scalability. It does, however, create new attack surfaces for industrial systems. Existing security solutions are becoming less effective and applicable as the number of interconnected networks and devices grows. To solve the security issues posed by IIoT to traditional industry systems, new security designs and practices are required. Monitoring the wastewater inlet into the plant is important to provide early detection and alerts in cases of impermissible wastewater inlet to the sewage plant, which is not designed for industrial wastewater treatment and the workers are not qualified to deal with such water (acidic or alkaline), as can be seen from the above. However, wastewater monitoring is still done manually, with site visits, samples, and lab testing, which are incapable of meeting today's monitoring criteria, which emphasize continuous monitoring of water pollution [11]. Chemical pollution of water from local and industrial wastewater become a public concern, especially in developing nations, where only 8 percent of the total wastewater is treated [1]. As a result of the growth of IoT in industrial and environmental monitoring, a viable solution for dynamic, continuous, and real-time wastewater monitoring has emerged. In this paper, an integrated cloudbased IoT model is developed to monitor the inlet wastewater to the Sewage treatment plant. The following is a description of how the paper is structured. Section II Industrial Internet of things (IIoT) and its Contribution in wastewater management. Section III presents the Literature Review of IoT. Section IV describes wastewater monitoring and controlling system challenges. Section V presents the proposed system. Section VI describes the comparison study. Finally, Section VII concludes the paper and forecasts possible future work.

II. Industrial Internet of things (IIoT) and it's Contribution in wastewater management
The Internet of Things (IoT) is predicted to be the next phase in the information revolution, ushering in the societal transformation that will compete with the internet. IoT has become a common word in several fields in recent years. Several attempts have been made in this way [12][13] [14], which described the IoT as a collection of interconnected devices that can send, process, or receive data with or without the need for an Internet connection. According to Juniper Research [15], By 2024, the total number of Internet of Things connections will have increased to 83 billion, up from 35 billion in 2020. Over the next four years, this is a 130 percent increase. The industrial sector was highlighted as the main driver of this expansion in the research. The increased use of private networks that utilize cellular network standards is expected to drive this expansion, according to the report. The Internet of Things (IoT) is expected to be the latest technological revolution, affecting many aspects of daily life. It has revolutionized the way humans and robots communicate and interact. The IoT revolution has now entered the industry field, ushering in the 4th industrial revolution [16]. The Industrial Internet of Things (IIoT) has emerged as a result of the widespread deployment and expansion of IoT devices in the industry, allowing organizations to reduce quality management costs and increase operator productivity. The (IIoT) enables previously unimagined interactions between technology, software, and humans. Manufacturing systems become smart with unique advantages in production agility, quality, and efficiency when IIoT capabilities are integrated with artificial intelligence tools. The Industrial Internet of Things (IIoT) is a subsection of the Internet of Things that is aimed specifically at industrial applications and the development of industrial communications [17]. Decentralization, connectivity, and interoperability are all improved. IIoT devices collect a large amount of exchanged information that has grown in volume, diversity, and complication [18]. As a result, the data volume that IIoT devices must manage is typically substantially more than that of normal IoT applications.  [21]. When WLANs or cellular networks are inaccessible, WiFi Direct (WFD), WiFi Hotspot (WFH), and Bluetooth (BT) are three widely used techniques that could enable wireless connections and communications for IIoT devices. The protocols of the application layer which runs on top of them must be minimal and take into account the constraints of IIoT devices. As a result, security solutions and protocols developed for the IoT might be used in the IIoT.
Wastewater treatment is a complicated process that involves a variety of technologies and processes. As a result, a wastewater management system typically necessitates a great deal of upkeep and updates to remain effective. They also go through changes when they come into contact with water that has varied chemical compositions. Some of the major issues that water treatment system faces are the inability to automatically optimize processes for varying water contamination and flow, modifying processes for specific water requirements, and variations in chemical volume adjustments and water chemistry needs. The Industrial Internet of Things creates a network of physical things by using various sensors as endpoints, allowing for large-scale remote monitoring. This network enables the responsible authorities to pay attention to various operations at a wastewater treatment plant. A network of sensors allows for the monitoring of various water characteristics such as pH, temperature, pressure, chemical composition, TDS, and so on. This data can be synthesized into actionable insights using a centralized platform with automation and analytics. Water flow rates throughout the entire treatment facility can also be measured with smart water flow meters. Using IIoT in water treatment and management systems allows authorities to track water composition and establish an enterprise asset management (EAM) system as well as a computerized maintenance management system (CMMS). Both systems, in conjunction with IIoT, enable the collection of performance and operating data for the entire treatment plant. This improves data gathering capabilities and provides real infrastructure monitoring. Performance characteristics of machines can be monitored utilizing real-time data collected from various embedded sensors, resulting in increased equipment productivity and a reduction in maintenance tasks. The Industrial Internet of Things (IIoT) in wastewater management can also be utilized to determine residual chemicals after treatment. This data can also be used to determine the efficacy of the treatment process and ensure that water quality requirements are fulfilled before it is discharged into a body of water.

III. Literature Review
The application of IoT and IIoT in environmental remote monitoring and controlling, especially in water and wastewater quality systems has been discussed in many research papers. After reviewing some of them, the following examples show other existing IoT and IIoT middleware solutions for remote monitoring and controlling water and wastewater quality. In [22] a low-cost IoT-based water level monitoring system was presented in real-time.
The water data collected from ultrasonic sensors were stored on a cloud server (bespoke). A web-based remote dashboard displays the results of the water measurements, also the presented system used a buzzer alarm and a Twitter handle as a part of the alerts system. The presented system monitors the level of the tank of water and alerts users without autocontrolling the water follow into the tank and the reading of the ultrasonic sensors may not give high accuracy of water level.
In [23], a smart water system was developed for approximately the water level in the tank to prevent overflow or leakage with auto water pump on/off. The authors used laser sensors for water level detection and the sensors values transmitted through HC12 [24] to the Adarfruit cloud platform via a Wi-Fi module. The cloud platform was designed in such a way that would show the graphical representation of water level and instantaneous value of the current status of water. Another work is exposed in [25], an implementation of IoT technology to overcome the complexity and the high cost of the existing systems by using a Wi-Fi module to send the water parameter data to the server, which can then be displayed on the webserver. The presented system reduced power consumption depending on the time interval of sense. However, this approach is to display the data on the webserver and LCD without a graphical representation of these data by time. [26] presents a complete smart monitoring water quality detecting system.
The system is floated and tested at "Tasik U TeM" and the data was collected in both offline and online measurements in two assessments. A "WeMos D1" Wi-Fi module is used to transmit the collected sensing data to the "ubidots" platform database for the online assessment. However, the presented system is based on two methods for recording the data in the database via the ubidots platform and a graphical representation via another platform "Wix Webpage" for only two parameters using pH and turbidity sensors. The work in [27] is for cloud computing in industrial environments.
Using "Raspberry pi "as a communication module for remote monitoring and control is used to develop a smart industrial system to detect abnormal behavior and equipment failure. Their proposed architecture is flexible to extend to a wide range of IoT-based applications in which the analysis of collected data sets could enable fast and precise decisionmaking. In [28], the authors proposed a new SCADA system for real-time water quality monitoring that integrates with IoT technology. The data analytics is handled by the SCADA server, which then generates reports for the web and a mobile app. Meanwhile, they aimed to overcome the disadvantages of the current SCADA systems such as the difficulty of adding a new sensor due to the wired network between the SCADA and the Plc controller. Arduino "Atmega 328" microcontroller and GSM modem were used.
The system is small in size, lightweight, and low in cost, but it could be more effective if they could control through. In [29], The authors provided a MATLAB analysis of a ThingSpeak-based sensing and monitoring system for IoT.
To implement the IoT Operation, the project used five different types of sensors to sense and monitor temperature, light intensity, air quality, humidity, heat, rain-sensing, sea level pressure, and barometric pressure in the surrounding area. An ESP-8266 Wi-Fi module with a ThingSpeak cloud configuration enabled the system's IoT capability. With the ability to execute MATLAB code in the ThingSpeak channel, the data was read from the ThingSpeak channel for analysis or visualization in MATLAB. also, data could be written to the ThingSpeak channel from MATLAB and visualized the results on the channel. In [30], they presented real-time pH monitoring and control system of local wastewater using IoT for gardening and agriculture applications. The system was programmed to use a solenoid valve that was operated automatically. For online monitoring of water pH and temperature, the Arduino Mega 2560 and a Wi-Fi transceiver (Wi-Fi shield) were utilized, as well as an android app. The microcontroller and Wi-Fi module can transmit and receive and instructions within a 100-foot interior limit and 300-foot LOS communication range if needed. Locally, the work in [31], to monitor parameters of wastewater discharged into water sources in the Nduruma sub-watersheds, real-time online monitoring integrated IoT was proposed. The proposed prototype's IoT capability was enabled by a ThingSpeak API cloud to upload sensor data via GPRS internet connectivity. The telerivet messaging platform was utilized in this prototype to provide local communities with a way to send SMS warnings on water pollution that has been seen or detected.
In [32], applying IoT technology, a smart wastewater online monitoring system has been built to remote monitor wastewater information and identify harmful effects. The authors use five smart sensors to measure the primary five water parameters of heating value, acidity or alkalinity percentage, total suspended particle (TSP), turbidity, and total dissolved solids (TSS). Microcontroller technology involving GSM-GPRS module to send the collected data to the webserver through modem was used together with a specific website for monitoring wastewater data.
To the best of our knowledge, previous research covers realtime monitoring of wastewater parameters with low-cost systems IoT devices, most of them lack clarity on how to make decisions and control according to the measured data by sensors and they used third-party cloud platforms for data monitoring and analysis. There were no additional options for sending data while the Wi-Fi connection is disconnected, and no custom dashboard, custom reporting, or warning services have been used.

IV. Wastewater Monitoring and Controlling System Challenges
Traditional methods of inlet wastewater monitoring involve the manual collection of water samples and the manual reading of the sensors, followed by laboratory analytical techniques to enable early detection and warning in the event of impermissible inlet wastewater to the sewage plant. Such methods take a while to execute and are no longer considered efficient. The existing methods have several challenges: a. Poor Spatio-temporal coverage When we need to collect data generated by various items but at the same time and location, a Spatio-temporal covering is particularly effective. The analysis of wastewater quality data, which must be densely analyzed from both spatial and temporal viewpoints has a significant impact on the efficacy of wastewater treatment management strategy. The current system provides temporally monitoring (hourly) via individuals with sparse coverage due to a limited number of sensors. Sensors can only be installed at a limited number of locations due to the high capital cost of installation, especially within an urban area, as well as maintenance costs. This results in limited Spatio-temporal resolution, which is insufficient to understand the exposure of discharged industrial wastewater to the wastewater plant's inlet and can lead to inaccuracies in wastewater pollution estimation. The proposed system requires high spatio-temporal coverage, auto-monitoring, and controlling to be more efficient than the current system.

b. Limited Scalability
It's difficult to add additional sensors to the existing system because PLC controllers with Analog/Digital modules were used in most of them, and the installation and connection would be expensive. The proposed system requires scalability to add more sensors in the same location without increasing the cost.

c. Missing warning methods for the impermissible wastewater and a lack of critical decision-making
The current system depends on human monitoring and controlling, however, if the monitored individual is not noticed this can lead to make harmful in the treatment process and for the equipment. There are no other warning methods that can lead to warn the labors to take immediate action to avoid harm.

d. Low Efficiency
The current system needs continuous monitoring and quick decision-making in the event of discharging industrial wastewater, In the current traditional used methods needs a large number of workers qualified for dealing with various types of water for continuous monitoring and controlling, which requires high cost for this number of workers, High accuracy and high-cost equipment and measuring instruments, as well as an automatic control system, are required if an automatic control option is chosen to monitor and control the income gates and manage the measured data. Moreover, there is no data analysis, daily/weekly reporting, or prediction of the industrial wastewater discharge at the entrance of the treatment plant. As a result, the current system is inefficient, and it must be improved without increasing costs.
Therefore, the requirements of the proposed system are to provide solutions to all of the above in terms of (1) scalability by adding a number of additional sensors as needed at the lowest cost, (2) providing Temporal and spatial coverage by monitoring data in real-time, monitoring more parameters at the same station and managing and monitoring several stations at the same time,(3) Adding more security options to protect the system from attacks,(4) analyzing data and preparing reports, which increases the efficiency of the system,(5) adding a warning system with notifications such as email, voice alarm and SMS. Fig. 1 depicts an overview of the proposed framework for monitoring and controlling industrial wastewater discharged into wastewater treatment plants. By collecting data on wastewater parameters such as temperature and pH. The collected data is updated in the webserver which can be retrieved from anywhere in the world. As industrial wastewater is detected, an SMS warning is triggered and sent to the monitoring center, and the IoT Module can regulate the solenoid valves to close the inlet gates and redirect the water to a treatment plant for industrial wastewater. The collected data for wastewater parameters (temperature and pH) from wastewater pumping stations to wastewater treatment plants is sent to a server database, which aids in the prediction of the time of discharge of industrial wastewater to the treatment plant as well as the region where the wastewater is discharged, and this is where the government comes in to take its action against this infraction. Fig. 2 shows the proposed system's general environment, which includes three parts: an IoT sensing device, an IoT gateway device, and an IoT cloud platform. The sensor's data will be sent to the IoT gateway. After receiving the data, the IoT gateway device sends it to the IoT cloud platform over a wireless or cellular network connection. Finally, the IoT cloud platform receives the sensor data and stores it in its database for advanced processing of data or built application. With the help of an IoT gateway, the IoT cloud could receive a specific command from users via an application programming interface (API) and transfer it to an IoT device. Fig. 3 shows the building block of the proposed system. The system consists of five main components: Power Source, Sensing Devices, IoT-Device to the cloud, Data management, and cloud-to-user interface. The data storage component collects the received sensor data that has arrived in the cloud system. The data processing component can analyze any stored data. A web interface allows users to access the collected data.  Fig.4 shows the flow of the activities of the system. The architecture of the system is shown in Fig. 5 which consists of various sensors, communication modules, and a centralized server. In this architecture, sensors are fitted in the Wastewater plant inlet and used to measure the pH and temperature. The sensed data is then sent to the IoT Module, which sends it to the server, where we can monitor all of the data in real-time, also we can view the data on LCD beside the Location. The IoT module will control the plant's inlet valves based on sensors data to prevent industrial wastewater from entering when the sensors readings exceed the setpoint, an alarm message is sent to the phone using a GSM module, and a sound alarm is played in the Plant. The valves will return to their normal mode, which is to open the way for wastewater to enter until the sensor readings return to normal. When the user detects warnings from one of the pumping stations, he can control the inlet valves remotely by sending a command to the server via the monitoring screen, which is received by the IoT module, and the user can predict when the industrial wastewater will arrive at the treatment station. Data collected on the server helps in the preparation of different reports for the appropriate authorities.

C. The Hardware Parts
• NodeMcu Esp8266 [33] The proposed system uses NodeMcu Esp8266 to send data to the cloud via Wi-Fi connection and it is programmed via Arduino IDE to handle the process of controlling the measured data.

• GSM Module SIM 800L [34] [35]
The proposed system uses SIM 800L to send data to the cloud via GPRS connection in case of the Wi-Fi connection is lost, as well as to send SMS warning alarms to the user. The NodeMcu Esp8266 module is programmed to check the Wi-Fi connection.
• DS18B20 Temperature Sensor [36] The proposed system uses DS 18B20 sensor to measure the temperature of the wastewater at the treatment plant's inlet and pumping stations, the NodeMcu Esp8266 module is programmed to receive the measured temperature data. The pH of a solution is measured using an analog pH meter, which reflects the acidity or alkalinity. It's commonly utilized in aquaponics, aquaculture, and environmental water testing. The data from the pH sensor is collected on the analog pin of the NodeMcu using the BNC adaptor.

• Analog pH Sensor [37]
This analog signal is converted into a digital signal using the ADS1115 16-Bit Analog to Digital Converter (ADC).

• ADS1115 4-Channel 16-BIT ADC Module [38]
Adafruit Industries made a 4-Channel ADC board based on IC ADS1115 which is suitable for microcontrollers that require ADC with high resolution, Over I2C, the ADS1115 provides 16-bit precision at 860 samples per second. It runs on 2V to 5V power/logic, measures a wide range of signals, and is extremely simple to use.
The proposed system uses an Analog pH meter sensor to measure the pH of the wastewater at the treatment plant's inlet and pumping stations as an Analog signal, ADS1115 module used to convert the Analog signal to a digital signal, the NodeMcu Esp8266 module is programmed to receive the measured pH data as a digital signal.

• Arduino IDE
The Arduino Integrated Development Environment (IDE) is a Java-based cross-platform framework for programming language processing and wiring projects derived from the IDE. It is aimed at teaching programming to artists and other beginners in the field of software development. It provides a code editor that includes syntax highlighting, brace matching, and automatic indentation, as well as the ability to compile and publish programs to the board with just one click. A "sketch" is a program or code developed for Arduino. Arduino programs can be written in C or C++. The Arduino IDE includes "Wiring," a software library derived from the original Wiring project that simplifies some common input/output functions. The proposed system uses the Arduino IDE platform to write the system's programming code, then compiles and uploads the program to the NodeMcu Esp8266 module.

• Visual Studio
Visual Studio is a useful tool for writing, debugging, and creating code, and also publishing apps. Beyond the basic editor and debugger included in most IDEs, Visual Studio includes compilers, code completion tools, graphical designers, and a variety of additional capabilities to make the software development process easier. The proposed system uses the Visual Studio platform to develop a web form for monitoring real-time data and controlling the equipment remotely via the cloud, as well as building reports for data analyzing.

E. IoT Cloud
Integration of the Internet of Things (IoT) and cloud computing has the potential to maximize the use of both. Because IoT systems are mostly made up of interconnected widespread and constrained devices, they can take advantage of essentially unlimited cloud entity resources, such as storage and compute capabilities, to store and process their sensed data. IoT could improve cloud computing by broadening its reach to include real-world applications. To put this concept into practice, and to provide an interaction layer between IoT and cloud computing those accounts for a wide range of network communication protocols as well as security and data management challenges, a cloud software platform is required. We were aware of certain IoT cloud services, such as: Blynk, Thingspeak, Google Cloud Platform, Exosite IoT Platform, Ayla IoT Platform. Just a few examples. These have two major drawbacks: cost and complexity. You have to pay for those services, and you also have to learn how to implement all of their services, as well as their APIs and possibly a bunch of other stuff that doesn't seem required to us to be able to just interchange bytes between devices. We just want something a little easier, something we can handle ourselves. The main reason is that we want to do it ourselves, we don't want to rely on a third party to connect our devices, and because we'll be designing the code and hardware for our devices, it seems like a good idea to establish our own ways of connecting them as IoT devices as well. The second reason is that it is important to learn how to do it. We will have a better knowledge of the IoT world if we know everything we need to know to get there. Also, because we are quite familiar with php, C#, and Asp.net, we are unafraid to implement anything in C# or other programming languages for our embedded devices, or to implement whatever is required to meet our goals. We built a simple IoT dashboard that can accept various IoT device connections, display a list of active devices, and chart the data. Also, the processed data collected from the sensors were stored in a database. It will also be used for data analysis, data visualization, and data prediction. We tested this by registering a free hosting account and creating php pages to receive data from an IoT module via Wi-Fi or GSM module and store it in a database. Dynamic web pages in the asp.net language have been developed to display all data from the database as well as all activated IoT devices. New Devices can be added with their details and location of implantation. Daily and weekly reports feature have been added for all stored data, including sensor reading reports, fault reports, and the time of their occurrence. It is also possible to remotely control all IoT devices via the web server by sending the command to the database and then receiving the command via an IoT device from the database, this is performed by programming the IoT module using the Arduino program. We can customize it to make it a good fit for our business.
Everything is ours to change, integrate, and maintain, from data collecting to the end-user experience. The main concern is always security, this is the riskiest part in our opinion and we 'll get over that. It is more work to construct what we want, but we get a lot more flexibility. The cloud-to-device interface, authentication, data management, and cloud-touser interface are the five main components of the proposed system. The cloud-to-device interface connects the cloud platform system to its IoT device counterpart, acting as a data transmission endpoint. Before permitting sensor data to be transferred to the cloud, the communication interface contacts the authentication component to confirm that the relevant IoT device is legitimate. The identification, sensing, connectivity, computing, services, and semantics are the parts of the IoT building block that are all covered in [40].

F. RESTful HTTP Interface
Fig . 11 shows the RESTful HTTP design which is used in the proposed system. Three main actors are used to design a RESTful HTTP interface: an IoT gateway device acting as an HTTP client, a RESTful HTTP server, and Database.

Figure 11: RESTful Interface Design
First, the IoT devices send the sensor data they've collected in the form of an HTTP request. The HTTP server then stores the sensor data to the database and returns a response indicating that the operation was completed successfully. To send control commands, the user sends the command through the monitoring dashboard, then is uploaded to the database, and the IoT device will receive it via RESTful HTTP requests. Table 1 shows the request and response formats in detail. The Request code shown below is the programming code of the IoT module using Arduino IDE.

G. SMS Service
The SMS service of the proposed system provides a tool for reporting aberrant values and problems, this service is implemented using the SIM800L module. Th e proposed SMS service handles three types of SMS notific ations: • Detection of industrial Wastewater discharged into the wastewater Resources and into the treatment plants which are being detected by sensors. The GSM module will send the following SMS notification to the Control Center: "Industrial Wastewater Detected in Location ....". • The Disconnection of Wi-Fi of any IoT modules.
The GSM module will send the following SMS notification to the Control Center: "Check Wi-Fi Connection of the Location ....", then the GSM module will upload the data to the Database using HTTP request according to the programming of the IoT module. • No response from any of the IoT modules that the server module can detect. The GSM module will send the following SMS notification to the Control Center: "Check the Power of the Location ...." (Fig. 12). • The reading value of any sensor equal Zero, The GSM module will send the following SMS notification to the Control Center: "Check the Connection on the Sensor ……… of the Location ....".

H. Data Analysis and Reporting Service
Data analysis and the development of reports related to various data are two of the most critical criteria for following up on the efficiency of the system's work and the continuity of performance. In this proposed system, the data from linked devices must be processed, and sensor readings must be reviewed and matched with laboratory reports to determine the effectiveness of the devices and the validity of the data according to reality, Also, by analyzing the data and reviewing the graph of different values at different times, we can predict future events.
The proposed system provides a set of reports based on a set of criteria that will facilitate the search and make data analysis easier and faster, as well as determine the extent to which they are beneficial. For example, the user can create a Report for pH data based on the location, the date selected, daily and monthly data (Fig. 13). As shown in (Fig. 14-a) and ( Fig. 14-b) the monthly report of Average (pH values/day) of two different locations. (Fig. 15) and (Fig. 16) show the daily report of (pH values/day) of the WWTPC9 Location. And All data of selected date.

I. Experimental Results and Discussions
Sensors are used to collect measurements from wastewater at 15-minute intervals. The sensors collect data on the monitoring parameters and send it to the IoT module. The data from the sensors is processed by the IoT module, as indicated in the flowchart (Fig. 4). (Fig. 17) shows the hardware implementation of the proposed system. The system's functionality and practical application were verified by testing it at "C9 Wastewater treatment Plant, Port said, Egypt "as shown in (Fig. 18-a) and (Fig. 18-b). Overview of the monitoring and controlling Dashboard is shown in (Fig.  19).
The Web Server is used to visualize the uploaded sensor data. Because the system is configured to continuous mode, it is refreshed every 5 seconds, the data is monitored often and displayed on every action. The sensing period has been set at fifteen minutes; however, the monitoring interval can be modified as needed. As shown in (Fig. 20-a), (Fig. 20-b), and (Fig. 20-c), The obtained values will be graphed and    The variations of the sensor's measurements of the monitored parameters (pH and Temperature) with time for the pumping stations may be seen in (Fig. 20-a) and (Fig. 20-b), (Fig. 20c) shows the measurements of the monitored parameters for the Treatment Plant. For example, in (Fig. 21), taking a record of July 28, 2021, the measure of Pumping station (1), the pH in water decreased from 7.82 at 4:20 pm to 5.18 at 4:36 pm, at 5:05 pm, the pH value decreased from 7.92 to 5.42 at the treatment plant, this variation occurred about 30 minutes indicating that the industrial wastewater which discharged into the pumping station (1), the water was pumped to the treatment plant at the same time and it was the nearest station to the treatment plant. Because of the high follow of the discharged industrial wastewater, the sensors in the treatment plant detected it and the actions were taken as a result (OFF gates, Buzzer alarm, Red Led, SMS notification to the supervisor, alarm notification on the dashboard for the monitor person). Also, the monitoring person can control the gates (OFF/ON the inlet gates) of the wastewater treatment plant to change the path of the industrial wastewater to the industrial wastewater treatment plant (Fig. 22). The notification alarms (SMS, web notification) from Pumping stations can allow the supervisor to predict the time of the arriving water depending on the follow and the distance between the pumping station and the treatment plant, so he can monitor the inlet water by visual and detecting the color of water which can tell us by experience the type of industrial water.

Comparative Study
In this section, we compare our proposed system to those proposed in [28] and [31] and the outcome of the comparison is represented in Table 2.
The proposed system improves the existing works in the following ways: a) Using IoT, an integrated sensor is used to analyze the accuracy of data in real-time. These sensors could share data among various wastewater stations in the city because they are connected to IoT networks. b) New sensors can be easily added to the proposed IoT system, which increases the reliability and the scalability and of the system. c) The replacing of GPRS-based communication with WIFI/GPRS-based communication, communication overhead, and network speed are greatly reduced when data rates are high. d) Network management enables users to connect to any available WIFI network for flexibility of use in different locations, rather than being restricted to a fixed WIFI network in the current location. e) Communication management supports auto transfer mode between WIFI and GPRS connections in the case of WIFI disconnection to ensure continuous data transfer. f) The primary advantage of any system is that the operators in each station have fast access to various reports to make decisions. g) The proposed system has the advantage of enabling remote ON/OFF Control in different wastewater stations. h) The proposed system provides various alert options. The proposed system can provide an efficient IoT-based dynamic, continuous, and real-time online monitoring of the industrial wastewater discharged into wastewater treatment plants, as well as remote control of the water's path to avoid all forms of damage. The system is designed for low cost, small size, high sensitivity, easy operation, and lightweight. It minimizes the time involved in lab testing. The results are recorded in the cloud so that any previous data of testing can be selected easily. No wired Networks were used. The system has more scalability of sensors and reduces power Consumption: it is easy to add new sensors and new IoT devices, and more than two sensors can be connected to one IoT module. The wastewater department can easily analyze the data and make reports. And SMS notifications keep all administrators up to date on all events and allow for continuous follow-up, making control, monitoring, and decision-making easier. It reduces the manpower as less manual work is needed. The government can identify the company that discharged illegal industrial wastewater based on the data and take action against the guilty parties.

VII. Conclusion & Future Work
The internet of things (IoT) is the field in which our proposed monitoring system belongs. Our main intentions of this research work were to create a small, economical, flexible, easily configurable, and portable system that could monitor, and control industrial wastewater discharged into wastewater treatment plants and prevent damage in the treatment process and equipment and protect the workers which are not qualified to deal with such this type of water. The system can achieve reliability and feasibility in the monitoring processing by verifying the parameters of water and the warnings notifications made the system more flexible and controllable. This research protects the natural ecosystem of water resources. Based on the comparison study, the proposed system outperforms the existing system and related works.
More water parameters will hopefully be added in future work so that all water parameters can be analyzed. Further improvisation will develop a custom dashboard using the mobile application would be ideal for such application in consumer networks. Physical parameters such as DO, turbidity, conductivity, Residual Chlorine, wastewater Flow will be added to the system using additional sensors to propose a complete SCADA system that integrates with IoT technology for real-time monitoring of all pumping stations and treatment plants, Automatic control for all equipment based on results and sending SMS notifications for abnormal values and necessary actions taken by the users. Furthermore, it is vital to protect sensor data communication via wireless networks from intrusion. Machine learning will be used to supplement the system, which will be a terrific addition to the system in keeping with the current developments in the world.