Usage of IoT Framework in Water Supply Management for Smart City in Nepal

: An efﬁcient water supply management system can be one of the applications of the Internet of Things (IoT). Water is a basic physiological need, and smart management of water plays a signiﬁcant role in a smart city. This paper focuses on a mathematical model and IoT framework that aid in developing a smart city. A framework is developed for water supply management. The efﬁciency of the water supply can be measured by monitoring leakage conditions, overﬂow of water, automatic meter reading and online bill payments, and water consumption status of households, community, state, and eventually the whole country as well as the automatic water supply line cut-off. The system where the IoT is being deployed consists of embedded hardware in which sensors and microcontrollers provide messages and gain feedback from each other with the help of the internet, and this process can not only be monitored but also can be controlled from a remote location. The developed framework addresses all these aspects and mathematical equations are used and formulated while developing the IoT application. The mathematical equations are concentrated on consumption level (CL), leakage reporting (LR), and bill amount (BA) based on consumption. These become the point of contact for deploying IoT and eventually a framework is developed. This framework can be useful not only in water supply management but also in the management of road trafﬁc, pollution, garbage, home automation and so on. In a nutshell, this paper illustrates the usage of the IoT framework in water supply management which contributes to developing the smart city.


Introduction
The Internet of Things (IoT) is a contemporary area that is enticing many researchers [1]. Different definitions have been given by several researchers over the last two decades. Some emphasize the network character of IoT and others highlight the objects that are connected to this network. However, most of the definitions concentrate on internet-based connections and acquiring real-time data [2]. All of these definitions come down to viewing IoT as a pervasive network that connects various sensors with the internet and provides meaningful information. The importance of IoT is clearly explained in the above definition presenting the wide scope of IoT. However, it ignores the quality and capability factors of IoT which are of high importance for creating value to the public, particularly in the sense of smart government, and that is a major objective of IoT [1]. IoT can be understood as the ability of things to behave on their own, and share data and available resources by collection jobs. The usage of IoT will benefit not only the citizens but also the government in many ways. The federal government of the United States of America (USA) has been playing s significant role in supporting smart-building applications. The General Services Administration (GSA) is working to construct smart buildings for the federal government to fulfill the aim of technologizing the federal government buildings by connecting recent technologies that make them more energy-efficient [6]. Fortuitously, the world now has witnessed the germination of IoT. Although IoT was pronounced in 2000, it has now gained abundant attention in almost all areas that include scientific and industrial grounds like smart-home, industry, entertainment, robotics, agriculture, healthcare, and transportation [7].
To develop the smart building that consumes less energy is achieved through connected technologies, GSA has also taken the steps to modernize government building federal states [8]. The energy efficiency was achieved by integrating and connecting several low-cost sensors to fifty governmental buildings and estimated to save around 15 million annually. These buildings were aimed to gather at least 100 nodes that transmit data and could be used for operational effectiveness in each building. After noticing the advantages of the smart buildings US Department of State started to install online meters/smart meters to gain insights into energy consumption as well as water utilization [8]. Nepal's federal government is also playing an important part in encouraging and supporting smart building applications.
IoT, although in an early phase, has the ability to connect over the global network which makes it omnipresent. Special applications like a neural network that behaves and work like human and underlying subsequent models underpin the future architecture of the Unit IoT. The future IoT can enhance the interpretation of the relationship between IoT and the reality around us and, in return, these interpretations empower further development of IoT. This interrelatedness works as a never-ending cycle [8]. With the explosion of disruptive technology, it has become very difficult to draw the attention of users and make them adaptive to new technologies. Therefore, personalization has taken foremost importance in the development of technology to enhance user engagement. The IoT has taken a similar approach but on a much larger scale. Instead of just targeting an individual, IoT solutions can address larger problems by connecting governments, cities, and people and empowering them to serve each other on an unimaginable scale and in a multiplicity of ways. Thus, IoT works to personalize the engagement of society in technology by enhancing public services and derive a better way of living [9].
The overall framework can be squeezed into the macro-level and micro-level as depicted in Figure 1. The technology infrastructure level is referred to as the microlevel; this is because micro processing of data as well as sensor interfacing, and network computing are done in this layer. The macro-level concentrates more on public services that are related to creating value and demand for the citizens and this layer is referred to as the government layer [1]. This work emphasizes the micro-level framework only.
Most of the digital filters are used to remove unwanted signals called noise and are also used for shaping the spectrum and to detect the signals for analysis. There are two types of digital filter namely infinite impulse response (IIR) and finite impulse response (FIR) filters that are used for shaping the spectrum and detect the signals for analysis. Filter applications mostly include low pass filtering, range of frequency or band selection, and signal preconditioning as well. The shaping of the spectrum of the signal received from the ultrasonic sensor is important [10].
With the expansion in miniaturization of the internet, connected objects that collect and exchange data, in the past decade many such data has been produced. Due to a large number of data, IoT, and analytical solutions, many resourceful intuitions have been perceived by the people with data generation through the IoT devices. Nevertheless, these resolutions are at their early stage and lack an extensive study on a domain [11]. Without monitoring, anything cannot be controlled, and this applies to water resource management as well. A system based on IoT for monitoring water resource and managing it is formed by uniting three different layers: The device perception layer, the layer for information communication, and the third layer called the application layer [9]. In the first one, a sensor network is constructed. In the second layer, real-time data are acquired and in the third layer, information about water like the amount of water consumed, leakage information are stored. This data is then managed using several information technology (IT) tools and, finally, it is shared by the end users over the internet [12]. It is difficult to detect the impurities contained in the water just from our naked eyes, to overcome this difficulty turbidity sensor can be used. It helps to identify the particles floating in the water. This sensor works by emitting the light beam in the water and this light is scattered if any solid particles are suspended [13]. The turbidity sensor is placed at 90 degrees to the water surface and when it gets back the reflected light. Comparison between the transmitted and reflected amount of light can be used to investigate the thickness of solidified elements existing in the water [13]. It is really challenging to foster support for two different domain applications and build system software as well as platforms in IoT [14]. Several investigations and standardization exertions have been undertaken for maintaining the compatibility issues associated with the heterogeneity in IoT devices and the protocols related to communications [15]. These efforts have a great influence on IoT frameworks and layers related to service interoperability [16]. The system can go beyond the embedded system when it is linked with the internet, thereby making the connected objects to sense and communicate. This robust feature of the IoT can take multiple advantages from super-computing nodes remotely [17]. Complex decision-making tasks and responding to the local needs can be undertaken very fast with an IoT-based system without requiring human intervention [17]. Technology content in a smart city embraces a 'smart life-style' by improving the security of lives, assets and properties, utilization of energy, minimizing the waste as well as transportation and parking services [18,19].

Related Works
Some features of smart water applications are monitoring the water supply pipeline, quality of water in the water source and security measures in the IoT. Digital filters are used to remove unwanted signal called noise. Maintaining and ensuring the security of connected devices is always essential, this plays a role in establishing the integrity of information of clients/customers. For this, only relevant data/information should pass from the network in IoT so, essential frameworks or methodologies were established [20].
It was also important to monitor the quality of water by effective usage of IoT applications and electronic components/devices associated with it. The significance of this application helps preserve the quality of water and safeguard the health of people living around it. This system is economical as it uses inexpensive devices and virtualization of the network [21,22]. Another application was also developed to detect leakage in water pipes. Several IoT devices, deployment of cloud services as well as concepts of a wireless sensor network (WSN) were applied in detecting the leakages and alerting users. The significance of this application lies in knowing the amount of water wasted by leakage [23]. In recent days, wastewater monitoring and treatment using IoT is emerging, and this application would be helpful in saving water to a great extent which is useful for household activities [24,25]. The growth in technology has served to develop effective and efficient methods to solve many problems or serious issues. The IoT has gained big attention because of its fast processing and intelligent characteristics [26].
The technology in the IoT helps in easing the automatic management of water which is a valuable resource. This technology also helps in ensuring the quality of water by using a turbidity sensor in the system. In architecture called a smart water distribution system (SWDS), IoT and technologies related to the cloud are used for an erratic water supply. Most of the previous research works carried out assumed a continuous supply of water. None of the pragmatic steps were taken at any phase, and only rhetoric aspects were discussed. The research on the smart water distribution system plays a key role, especially in developing countries where the irregular supply of water is prevalent [27]. To enable the monitoring and control of the water grid equipment, thousands of sensors are deployed in the distribution network for an efficient water management system. However, the security procedures at the network level should not be undermined. Although several security provisions in IT and control procedures have been developed in the previous years, these cannot be directly used with the devices used in IoT applications [28].
Each sensor is assigned an IP address through the micro-controller and router to interface them in a single system. This helps in identifying the sensors in the network. This task can be undertaken by writing some lines of code in the Raspberry-Pi, a type of micro-controller, and provides a unique number to the sensors residing in the system. An experiment conducted to assigning the IPV4 address where multiple sensors, Raspberry-Pi, and TP-Link router were used was successful [29]. A smart city incorporates efficient storage and processing of data and generates information that can help enhance the lifestyles of the people, and that task is undertaken by most of the applications of big data. These types of applications aid in decision-making regarding the expansion of the service offerings in any smart city. Nevertheless, the right procedures and tools are needed for effective analysis of data [30]. These procedures and tools might in turn inspire communication and collaboration between related entities and provide amenities to many areas in the smart city, and these characteristics enhance customer experiences and provide several business opportunities [30].
Some physico-chemical variables can be united with spectroscopic techniques and smart sensing systems to calculate pollution parameters like oxygen demand and the approximation is computed by using multiple sensors fusion technique and an artificial neural network (ANN) algorithm [31]. The experiment, spectroscopic techniques, and smart sensing system have been successfully tested in a city called Pierre Benito in France. This experiment was tested over 71 water samples in this city and the result showed that the estimated amount of oxygen demand was in a good state when measured against previous conventional methods [31]. The detailed study of prevailing IoT frameworks indicates significant differences between the frameworks with respect to their context of study as well as the spectra of the components used in the framework and their entire level of expansion, their mode of differentiation, and notion. Most patently, the findings of this study illustrate lack of knowledge that concentrates on the public sector and government as well as IoT frameworks. The in-depth study and examination of current IoT frameworks suggest significant alterations with other IoT frameworks. These differences are noted in terms of their factors of analysis, parts or constituent directed in the spectra of framework and their detailed information; additionally, their angle of change or abstraction has noticeably illustrated a gap between public services, public enterprises and government well informed about the IoT framework [1].
One of the studies conducted in Surrey city in Canada depicted that within the concept of the IoT used in smart homes, 6000 houses consume more than 9000 cubic meters of water. This type of system can help the authorities to estimate the water billing rates based on the use of water. This study has also found that the flow of water to several areas depending on the need of an area can also be controlled. The forecasting undertaken by the system can also help authorities to control water resources depending on their reservoirs. The water can be stored in reservoirs and distributed according to the water consumption parameters [32].
To check the authenticity of the statistics regarding water usage and predict for future need the skewness measure has been used. Univariate usage of water consumption W1, W2, W3, WN is given by the following formula of skewness: where W − is the mean, s is the standard deviation, and N is the number of data points. While computing the skewness, the s is computed with N, rather than N − 1 [32].
Algorithms have been developed to obtain the data of the soil moisture that is essential in a smart irrigation system using IoT. Web service has been used for data collection from sensors and these data have been utilized in performing the statistical analysis to predict the soil moisture. The real-time monitoring of the soil moisture contributes in agricultural sector to a great extent [33].
WSN has also been used widely in IoT applications. The water has been computed by using float sensors in the tank. There is also consideration that the elevation difference between hub and nodes will affect the transmission, where most of the nodes will be placed near to the ground due to the height of the trough of less than 50 cm, where the hub's antenna has been placed 8 m high from the ground. With regard to this requirement and also due to the availability of free frequency, preliminary design of the system is to use the LoRa™ with 915 MHz center frequency. The alternative product of LoRa™, HopeRF RFM95 is used in this system. Atmel ATmega328 is used in the node side to read the water condition in the trough [34]. The overall topology of the system is depicted in Figure 2. As for the sensor hub, a Raspberry Pi 1 model B with 512 MB of random access memory (RAM) was used. ATmega was chosen for the nodes to satisfy the low power system for remote area purpose, while the choice of Raspberry Pi as the controller for the hub was based on the system on chip and complete embedded system that has SPI to communicate with HopeRF RFM95 [34].
The experiments carried out in a research entitled "Smart Water Management Platform: IoT-Based Precision Irrigation for Agriculture" involved abundant sensors, sending data every 10 min. The scenarios were executed with four different workloads determined by the number of sensors sending messages simultaneously. Each experiment took 1 min and was replicated 30 times, totalizing 16 h of running experiments. Asymptotic confidence intervals were calculated with a 99% confidence level. This configuration captured the response of a connection from the farm to the cloud using 4G connection, with 10 Mbps speed and a delay of 45 ms with a jitter of 5 ms. The result of the experiments concluded that while using MongoDB the utilization of the central processing unit (CPU) increased with the increasing numbers of sensors and the usage of RAM increased while using the IoT agent [35].
For implementing the smart water system using IoT, the sensors are placed in the center of the inner side of the tank cover and these sensors continuously provide information on the real-time status of water. This information is updated on the cloud and some cell phone applications can also be used to visualize the level of the water in the tank. The automatic functioning of the motor controls the amount of water in the tank [36].
The development of the IoT framework requires an experiment, a review of literature, a survey, and analysis. After performing all these activities, we need to verify and validate the developed framework using scientific methods. In this paper the type of experiment and survey we performed has been summarized and presented as a result of the survey and, through rigorous analysis, a framework has been recommended. Several research works have been undertaken before and the comparison of the research done previously is depicted in Table 2. i. Security, identity, and data permissions should be given the highest priority ii.
Stimulate innovation iii.
Reduce product development life cycle iv.
Offers Business intelligence, Information security, user interface / user experience (UI/UX) design, Mobile integration, embedded systems with Networking and communication.
Very general framework and does not include technical specifications required for implementation 2 Kaa [38] i. Scalability of connected devices ii.
Effective monitoring of the system iii.
Information exchange between linked devices The macro-level framework can be challenging for the one who wants to bring IoT framework into action 3 Cisco Cloud Connect [38] i. Powerful, automated, and high security in connectivity ii.
Uses Cisco Kinetic IoT platform to extract, move and compute the data The complexity associated with the IoT framework and more concentration against threats with a secure IoT architecture 4 Zetta [39] i. Server-oriented platform based on REST and NodeJS ii.
Reactive programming philosophy adopted iii.
Geo-distributed network Limited to Arduino and Linux 5 Salesforce [40] Entertains proactive and personalized activities from any device to bring clients closer More administrative tasks are focused on. i. Database management and business software ii.
Flexibility in creating company applications iii.
Supports the processing and builds large scale IoT networks iv.
Usage of advanced security to protect against external security threats Different devices have different security tool so it is not sufficiently justifiable to implement centralized security measures 8 SAP [42] i. Convenient environment to remotely manage and monitor all connected devices in the IoT framework ii.
Use IoT information to machine learning and AI applications 9 Microsoft Azure [39] i. Real-time data enabled in the server ii.
Strongest safety mechanisms iii.
Superb scalability iv.
Simple integration Use MS IoT suit to integrate the existing system to MS-Azure 10 Google Cloud Platform [39] i. End to end platform used to process the large quantity of information ii.
Google's cloud data studio and Big Query advanced analysis can be done 11 IBM Watson [39] i.  There have been paradigm shifts in managing a water distribution network (WDN) that is mainly focused on minimizing the waste and leakage of water. A recent study has shown that the use of smart meters eases the users and the data obtained in a district metered area (DMA) using two procedures that are applicable when smart meters at the end of life were previously installed at all locations and when no smart meter was present, respectively. The first algorithm is based on the stepwise regression to measure demand time series and Fisher's test is used for the stopping criterion. The second methodology considered user typology and consumption in the annual bill. Both procedures were applied to a case study in Italy. The results proved that, the accuracy of the total demand pattern reconstruction of both procedures increases as the sample size grows [49].
A unique opportunity can be created by the fusion of smart meters and big data analytics in case of water management. A data-driven approach incorporating, extracting information on heterogeneous water end-use routines, the use of component in the user side, and temporal characteristics by using smart meter has been done. This approach was tested in 327 households in Australia. The result revealed three main water use profiles, shower, clothes washing and irrigation. A difference between usage time and the intensity of use existed in each class. Customer segmentation and analysis approach found that a concise snapshot of recurrent water use routines from the smart meter could be used to support the demand management strategies in water supply sector [50].
A comparison of two procedures namely, top-down and bottom-up approaches, was made with the aim of generating water demand time series data at single user and nodal scales. The top-down procedure includes non-parametric disaggregation based on the K-nearest neighbors approach. After defining the water demand patterns, the disaggregation is used to generate time series at the lower levels of spatial aggregation. The bottom-up procedure adopts beta probability distribution with tunable bounds or a gamma distribution in the first phase and Copula based re-sort is applied to the demand time series to impose existing rank cross-correlations between users and temporal lags in a second phase. Two case studies were considered for comparing these two procedures and both were related to a smart water network in Italy. The result displayed that bottom-up approach procedure performs better than top-down in terms of skewness and rank crosscorrelation at fine scale whereas; top-down procedure did better in terms of skewness and rank cross-correlation when aggregated demand was considered. Nevertheless, when the aggregation was considered at nodes there was affect in the performance of both top-down and bottom-up procedure [51].
With a motive of managing an urban water system, simulation was undertaken by examining three real world case studies that followed a single stochastic modeling strategy which is applicable at any fine time scale to preserve distributional and dependence properties of the process. This modeling strategy is based upon the Nataf's joint distribution model and, particularly, on the quantile mapping of an auxiliary Gaussian process to establish the processes with the target marginal distribution and correlation structure. The result of the simulation showed the efficiency of the simulation strategy in terms of reproducing the varieties of marginal and dependence properties encountered in water demand records from one minute up to one hour [52].
The anomalies like burst water pipes, leakage, and unauthorized consumption of water can be known if the demand reconstruction pattern is known. Therefore, to know the demand reconstruction two procedures; one is using smart meter at the end of life at all locations and the other is the data when smart meters were not present can be used. The first method uses stepwise regression that measures the demand time series aimed at both the selection of use locations and the model calibration. The second method consists of the application of criteria to identify the subset of representative locations on the basis of available data and other practical considerations like the annual bill (showing consumed amount of water) of the consumers. When both methodologies were applied in a case study in Italy, the result displayed that the accuracy of the total demand pattern reconstruction increases with the increase in sample size of the location [49]. This research focuses more on obtaining the data using smart meters an applying statistical models, regression and correlation to check the accuracy of the obtained data.
In 2020 Xenochristou and Kapelan in the United Kingdom focused on the estimation of the water demand by selecting machine learning models and this model was the so-called gradient boosting machine (GBM). This model was also used to identifying the one that achieves the best prediction accuracy. By using the models in postcode area it was found that GBM method combines prediction accuracy with ease of implementation. The spatial scale was used to allow sufficient data to train and test the model [53]. This model was based on the machine learning as well as statistical analysis and the system has to depend on the external entities to obtain data.
The consumption pattern was demonstrated by using 423 smart meters and radio frequency (RF) modules and the signal repeaters were installed at different locations. The research has not written about devices that have been used in the smart meters. However, an efficient process of obtaining the data regarding water consumption has been incorporated [54].
Although the different frameworks as presented in Table 2 and other relevant research works have their own features and limitations, they have significant importance to knowing if we are reinventing the wheel. Almost all of the frameworks have limitations of particular protocols, microcontroller, operating system (OS), network, security and scalability. However, in the IoT framework developed in this research fits for almost all of the IoT applications and can be said as a generalized IoT framework. Nevertheless, the water supply management sector has been considered to narrow down the research work. The detail of the framework is discussed in detail in the results and discussion section.
Nevertheless, the framework as an output of this research work does not focus only on the model but an entire ecosystem from generation of data to its effective application. As such, the following are the core features of this framework and the experimentation which can be regarded as the novelty of the developed framework: 1.
The experimental setup uses water-proof ultrasonic sensor which is new as compared to other smart meters. The use of ultrasonic sensors means that the installation is easy as it is independent of the water path but only dependent on the reservoir.

2.
The framework focuses both on data generation along with its application. The experimental setup defines a methodology of how the various hardware and software technologies can be layered such that each aspect of the system can be handled uniquely. For example, the sensor and module unit deals with the transducers along all the signal analysis for the retrieval of data. The control and processing unit can then perform further analysis for correctness of the data and further processing. 3.
The framework implements cloud based technologies in IoT to make any IoT system scalable.

4.
The framework also focuses on the actual use of data for forecasting or prediction, knowledge discovery as well as other Information system needs.

5.
The framework can be regarded as a general data acquisition, storage and analysis framework for IoT devices which point out the major units that are needed in the IoT rather than other primitive data-focused systems.

Proposed Methodology
This research is focused on developing the framework from a general technological perspective. Although this framework is illustrated by considering the water supply management sector, it can be used in multiple sectors like electricity management, automation of different firms, home automation, IT enabling the agricultural, and other different firms. The developed frameworks depend on automating things using IoT.

Development of Experimental Setup
Python programming language has been used to program the Raspberry-Pi. The Table 3 shows the specific technical details and uncertainty of the devices used in the experiment.  The research work used one full-on experiment to develop an automatic system to fill and store the water in a home using ultrasound technology as shown in Figure 3. This experiment uses two cylindrical water tanks. The local area network (LAN) cat6 cable has been used for communication between upper and lower tanks. Raspberry-Pi is used for networking and controlling the sensors. Trial versions of cloud computing have been utilized to store the data in the cloud. Two ultrasonic sensors are used, one in the bottom tank and the other in the upper one. The storage tank is in the lower position and from this tank the daily usage of water in the home takes place. A comparison is made between the levels of water between these two tanks to automatically switch on the motor. Ultrasonic Sensor1 and sensor2 used in the bottom tank and upper tank considers the mathematical relations that are based on Doppler's effect.

Working Mechanism
For the overall system, a mathematical model can be expressed as in Equation (1).
where, W L = Level of water in cm, L = Length/height of the tank in cm, V s = Velocity of sound = 330 m/s, T = Total time taken from transmitting and receiving the ultrasonic wave in seconds. Similar calculations are undertaken in both the tanks and a comparison is made. We again assume W U and W B as the water level in the above tank and bottom tank respectively. Based on the condition of water level in these two tanks motor is switched on. The condition is mathematically written as, W B > 30 cm and W B < 20 cm. No operations are carried out in other cases. However a simple voice message is given to the user such as "There is no water in the bottom tank" in their respective cell phone in case if W B < 25 cm. These are about automating the water in both the upper tank and lower tank. This application has another significant impact on controlling the overflow of the water. The overflow in each house in Nepal and India is one of the most serious and common issues.
Pumps can be regarded as one of the essential components in water supply management. Depending upon the geographical condition, a water supply system may rely completely on pumping. We must be aware that pumps consume some negligible amount of water, the cumulative amount of water from each houses can be of significant besides their energy costs and regular maintenance of the pump [55].
The overflow of the water occurs when the consumers forgot to turn off the motor and water is supplied from the tank which is in the bottom to upper. If this overflow could be controlled, a huge volume of water in an entire state or country could be saved.
The amount of water consumed by each house can be calculated by using the following Equations (2) and (3): Here, CL represents the consumption Level, water level in the lower tank is W L and new or changed water level in the lower tank is W L .CL represents the amount of water consumed in 24 h in a single house and r represents the radius of the cylindrical tank. These data are stored in an individual database that is remotely located and can be accessed by the house owner or the authorized government officials. Government agencies may use the following Equation (4) to estimate the bill amount (BA) of a month.
Here, rate is the price charged by the government or related departments for the per liter consumption of water. This BA is then sent to the individual cell phone of the consumers, Rupees (Rs) is the currency of Nepal.
The total consumption of all the houses in a state/province can be calculated by summing up the consumption of each house registered in the system in the same state/province as: However, in this research only, the data is generated in six spots (can be considered as six houses at different places). The above formula is a generalized version of how the data of overall state can be obtained.
This data can be useful for the provincial/state government for future planning after further analysis is performed. Furthermore, for state data, annual data are more meaningful for budget allocation. The annual data of any province/state can be computed using the following equation: Eventually, the overall consumption of water in a country can be discovered using the equation: Equations (5)-(7) provide the information for consumption of water in the entire country which can be used by the department of water supply. Table 3 provides the technical specifications and limitations of device associated in this research work.
The resolution of the ultrasonic sensor used in this research is 2 mm. Also, it cannot measure distances less than 20 cm and greater than 450 cm. Also, during the experiment, a minimum of 50 microseconds was needed for each consecutive measurement. Also, the sensor sometimes threw up an error measurement which was mitigated by using software that incorporates moving average and exception handling technique.
Uncertainty quantification of the sensors was conducted. The systematic uncertainty (S U ) is the sum of error data generated by the sensor (S E ) divided by the number of repeatability test and the random uncertainty (R U ) is the sum of error data generated while measurement (M E ) is taken in random manner. The total uncertainty T U is the square root of sum of square of measurement error and square of error data generated by the sensor. A repeatability test, i = 1 to 50, was conducted before deploying the IoT system in the field. The systematic uncertainty (S U ) has been obtained as S U = ±0.18% and the random uncertainty (R U ) has been obtained as ±0.16%. The total uncertainty has been obtained as ±0.24%, which is computed using the equation: The random uncertainty is less than systematic uncertainty and total uncertainty. Six different spots were considered for this study and the experiment as shown in Figure 2 was conducted for one house per spot. The experiment was carried out for 360 days. No flaws were discovered during the experimental period. Until 360 days there was no overflow of the water. The members of the house did not have to employ effort or time to switch on and off the motor. Here, N represents the number of states in any country.
The data of the consumed amount of water was sent to the server and in the unusual condition, an appropriate message was sent to the user. Using this IoT application, a water supply corporation can cut the water supply line of the house that does not make the payment on time. Similarly, leakage of water in each house can be noticed by using this IoT application. The algorithm to identify the leakage of water from the house has also been developed as follows: Step 1: Continuously monitor the volume of water in both the tanks in the time span of 10 s.
Step 2: Check the current volume with the previous volume of the bottom tank when the motor is off.
Step 3: If there is any deviation, enable the interrupt and notify the user.
Step 4: Compare the current with previous water volume in the upper tank at nighttime for one week.
Step 5: If there is a constant deviation for each day, enable the interrupt and notify the user. If the difference of water level (i.e., 0 < ∆W < 0.01 m) is considered an insignificant case (where LR = 0), and no operation is done. However, when the value of ∆W > 0.01 m, indicates that there is leakage (LR = 1) and in this case, special notification is given to the user. Most strikingly, it must be noted that the algorithm for leakage monitoring is calculated at nighttime for the only reason that the motor does not get on at that time. Similarly, the amount of leakage can be calculated by using the similar Equations (11) and (12) as that was used for finding the consumption level: Leakage Day = Leakage Volume House_Number litres (12) If the government or drinking water corporation wants to know the amount of leakage this year in the city, then, we use Equation (13): Leakage Day litres (13) The above equations are used only in the nighttime. So, it might be interesting to know how the volume or amount of leakage can be known for 24 h. As presented in the algorithm above to find leakage, a unitary method can be used to generalize the leakage after knowing the leakage amount for some hours in the night time.

Development of IoT Framework
Based on this experiment and conceptual analysis, and review of literatures, the framework as shown in Figure 4 has been proposed. The benefits derived from IoT can be felt only when IoT operates in a full-fledged manner. It is essential to have a concrete architecture and specific protocols for the IoT to fully emerge. To solve the problems, it is important to tear up the existing paradigm, thereby allowing the formation of systems that are open and interoperable that offer efficient and scalable communications [56]. Based on the different previous studies and experiment, the framework has been developed as shown in Figure 3; the sensor and module section comprise the sensor and its placement, analog to digital conversion, wireless sensor network, signal conditioning, and processing the digital signal.
In relation to the experimental setup and the framework, ultrasonic sensor has been used as the sensor for this specific purpose. The central processing unit used is a Raspberry Pi which facilitates sensor control as well as data storage and publishing to the web. The utmost importance of data consistency and lower distance of communication in household have been the major reasons behind using the ethernet. In terms of the online application unit, the database has been implemented in MYSQL and Web Interface in HTML, CSS and JS as frontend and PHP (Laravel) as backend. The web app is hosted online so that the various households under experiment can transmit the data simultaneously.
In order to achieve the maximum accuracy in data from sensors, an algorithm which takes the average of 10 data have been applied while also considering the difference of each following data so that any data measurement error by the sensor can be mitigated during the measurement stage. To limit the bandwidth usage, we applied burst transmission mode, where the data are stored locally for each household and only transmitted once per day in bulk. The local storage also prevents the loss of data in case of internet breakage. The output is then observed through any device connected to the internet given that user has the authentic credentials.
The experimental section as a whole in Figure 4 is realized by using full-on experiment as shown in Figure 3. The conceptual section of the developed IoT framework cannot be realized until and unless the devices are used in full-fledged manner either within a municipality, state or the entire country. The experimental section of the framework concentrated more on generating the real-time data. The conceptual section deals more with the management and efficient usage of the data. The voluminous data are generated from the experimental section at a high velocity, therefore big data analytics is very essential and servers like Amazon S3 (simple storage service) can be taken into consideration. The management of the data can also be undertaken by establishing own data center. After the data sets are obtained, the system can be trained to obtain the future values regarding demand and the supply of water. This can be one approach, another approach can be processing the data in an information system after the data mining and applying the statistical measures to perform trend analysis, and the information system itself can also forecast the amount of water needed for future. All of these operations come down to discovering knowledge from different viewpoints. This information along with consumer feedback can help to enhance the existing system to a great extent and this is a never ending process.
Machine learning (ML) contributes to developing efficient IoT products. The delay time before transmitting data should be minimized as far as possible but by doing so operational complexities are introduced by iCloud services [57]. The most important concern within an IoT network is security as diversity and the number of device in the system are a priority. ML algorithms in the IoT gateway help provide security to great extent in a system that comes with the challenges of securing IoT devices. Unusable or incongruities in data communication from extremity devices can be detected by using a gateway in the ANN [58].
Effective utilization of resources, knowledge-based economy, modest economy, and creativity, as well as innovation, are a pre-requisite for sustainability and growth of any city, and these are possible by making the city smart [59].
The easiest way to analyze the energy consumption of a society is to use an air quality monitoring service, an urban IoT application that keeps track of the energy consumption of a whole city. Analysis of data generated from this application is enough to understand how, where and when energy is consumed in a city. This information can be a basis for installing public infrastructures such as surveillance cameras, traffic control systems, streetlights, and everything else that runs on energy. Moreover, it allows setting an automated system that controls this infrastructure more efficiently [60].
Big data analytics can be used for radical change and governance of the cities with the aid of available mountains of data which provides a more jaded, wider range of understanding as well as control of chaos in urbanity, this also contributes to making the city smart [61]. Managing and controlling water resources is easy with IoT-based water monitoring system. It is fitted with a camera that takes an image of a traditional water meter and predicts the reading by calculating the angle of dial pointers in the image [62]. WiFi enables communication that can translate data from low-power sensors. However, collecting event-driven upload of data from numerous low-power sensors with low latency can be challenging. Nodes are generally scanned by access points in the WiFi to schedule transmission times of the uplink and that is a major cause of introducing large latency in the system [63]. The important data should only be transmitted through the WSN intersection points because of the limitations in power supply at these nodes. This not only speeds up the network performance but also is energy efficient [64]. The future of the IoT is not just a theory but a practical requirement. European directive for energy efficiency improvement calls for IoT with a similar capacity that can be integrated with their power grid. On the one hand, these devices will monitor problems and automate solutions at a much larger scale and, on the other hand, they will generate enough data on the complexity of management of a city to use this for planning a smart city [60].
Cities operate with a high efficiency thereby, providing and promoting improved services to citizens and existing businesses. The sensors and related modules play a significant role in generating data in IoT applications and frameworks. All the components may not be useful for a single system. Different components have different usage in different systems. However, the framework built here is for water supply management and consumption as well as leakage monitoring. The framework can be applied to different sectors as well. The second section is the control and processing unit. The key element in this section is either any microcontroller or any system on chip (SOC). Their versions also play an important role in developing the system. IP assignment, programming language, a memory of the system, the protocols used for communications, data encryption technologies/algorithms, all of them have several roles. This section can be regarded as the heart of the IoT system. The SOC or microcontroller acts as a gateway of the system from where the data goes out and data come in. The system is connected to the network either through LAN or WAN by interfacing the gateway to the Ethernet, is therefore Ethernet protocol should be adhered. A huge volume of data are generated from the system, all these data might not be important, so, data filtering should be done at this stage. Some big data analytics software tools can be used to obtain meaningful insights regarding water supply issues. Data center is essential to store the voluminous data. Once we have the data available at the data center, we can use those data to make better decisions using data mining tools or machine learning algorithms so that scientific and more accurate forecasting can be undertaken, in turn helping in making the city smart and obviously will benefit the citizens and government agencies. The overall framework built based on the experiment and rigorous study is depicted in Figure 3. Sooner or later the IoT will be recognized as a part of our lives. Extension of the services provided by this system in networking and communication from anywhere at any time is one of the major benefits derived from IoT applications.

Results and Discussion
The experiment using the setup as shown in Figure 3 was conducted for 360 days for 6 spots in Kathmandu valley but the data were generated for only 85 days. The status of consumption and leakage amount of water in these spots is shown in Figure 5. Problems were not reported by the house owners; they were delighted with having such a system installed at their house because this IoT application prevented the overflow of water and identified the leakage pertinent in all these six spots. The experiment tested in the IoT laboratory has been regarded as a baseline for the IoT framework development shown in Figure 3. The result of the system and the expectation of the house owners were almost similar. However, there were some problems regarding the mechanical part while installing the system in the water tanks of the owner in particular, while mounting the sensor in the cover of the tank. The observation of the consumption and leakage amount of water in each of the six spots is depicted in Figure 5. In some spots, the leakage was insignificant whereas in some it was highly significant. The plot also gives information that when leakage was reported automatically, the leakage area was identified by lessening the amount of leakage. After observation of the data acquired, we can easily use it to observe the various trends among each of the household under experimentation. For example: the average consumption of Spot 1 over 85 days is found to be 17.19 L, Spot 2 is 33.275 L, Spot 3 is 40.94 L, Spot 4 is 37.25 L, Spot 5 is 54.75 L and Spot 6 is 33.95 L. Similarly, the analysis can be expanded as mentioned in our framework for analysis of an entire city or province using big data analytics. Also, various methods can be implemented to forecast consumption in the near future. This forecast can help the water supply authority to predict the water resource needed in the future and plan for it accordingly. Consumers can use the data to predict and monitor their own water usage. Nevertheless, after applying the billing formula, the total cost required for water can be predicted which can help in budgeting for consumers as well as the authority.
Also, along with the consumption, leakage monitoring was undertaken. The aforementioned algorithm to detect leakage was used in the experimental spots. During the experiment, Spot 1 showed almost no leakage. During the time of Day 20 to Day 29, an average of 5.34 L of water is reported as leakage by the system. This was not alerted to the household though the system because it is still under the threshold which was defined to be 10 L per day although this threshold can vary. The threshold is set by speculative analysis only and it can be calculated by observing the various leakages after data from huge number of households is generated. In the case of Spot 2 and Spot 3, there was almost no leakage.
At Spot 4, the water usage at nighttime was observed to go over our threshold but there was no consistency and our system requires at least a week of consistency so that it was also not reported. Such inconsistency is expected because there are times when people intentionally use water but the volume is generally very small and large volumes are also inconsistent over a period of time. In Spot 6, large volumes of usage are observed (greater than our threshold), but still due to inconsistency, it is also marked as human use.
Although the data is seen in Figure 4 as leakage, it is actually the measure of leakage and does not necessarily mean that the leakage was reported. At Spot 5 though, during Day 22 to Day 36, an average of 10.38 L of leakage was observed which was considered a leakage by our system and the issue was reported to the people there.
Being completely based on the experiment and concept, the IoT framework was developed as shown in Figure 3. The experiment focuses only on implementing IoT on water supply management but we generalized it to scale it for different devices and metrics of every household. The framework expands the usage to different sectors and generalizes the various components in different parts while concentrating more on the technological infrastructure layer. However, this is one of the core parts of the IoT framework and this paper elucidates the required components as well as workflow.
Several opportunities can be unlocked by running a government based on data. This helps to discard the face-to-face delivery model and promulgate the policies in the interest of the public thereby creating much value to the people living around. For this reason, real-time data provided by the sensors in the flexible and scalable IoT-enabled system plays a significant role [65]. The primary concern of the environment-friendly IoT is user satisfaction and it is directly related to the quality of experience. Therefore, it is necessary to manage the network traffic in the core computing system of IoT because the demand of IoT services is increasing day by day [66].
The framework as developed is scalable to many houses and the IoT structure does not change; the same devices are installed in all the houses but the variable i.e., size of the tank varies according to the need of the household and it is addressed in the software section. Assigning the radius of the tank is a one-time effort that has to be made while installing the device/system. Each individual house is uniquely identified through an id given during the installation.
The framework as shown in Figure 4 has been tested for the experimental section by the setups shown in Figure 3. In the context of the conceptual section, it is expected to be implemented after the collection of a large amount of data and expanding the experimentation to a relatively large sample as compared to the 6 spots given in Figure 5. The conceptual section implements various techniques to gather meaningful information from the data collected from its previous counterpart. Big data analysis can be used on the humongous data which can be sent through machine learning for prediction or data mining to gain meaningful insights. This information can be used in various information systems for effective planning for the future, focused mainly on the water supply management in current experiment.
The framework focuses on the technical aspects required for generation of data as well as its collection and storage. It then expands its scope onto visualization for each consumer as well as central departments and analysis of the data for future planning by related authority. It incorporates both the hardware units for effective measurement of various data along with its processing after appropriate transmission and storage.
In order to assess the usability of the framework and the experiment in water supply management, a survey was undertaken to find out the total number of water supplies provided by the department of water supply and sanitation. The Table 4 is presented by classifying the data based on the province and districts in the entire country. The usability and the impact of the framework are wide since the number of water supplies all over the country (Nepal) is 4925831 (according to the survey conducted by the Department of Water Supply and Sanitation, 2017) and this number is increasing. Nepal is still using traditional metering technique to know the consumed amount of water and the usage of this system will transform the country in managing the water supply sector.
The tabulated data is shown in the map of Nepal in Figure 6. Present day teamwork and initiatives taken throughout the world to encourage IoT in aspect of smart cities are shown by current open source IoT platforms for understanding smart city applications followed by many ideal case studies [67]. It is anticipated that by 2020, mega-city corridors, integrated and networked smart cities will be developed. Likewise, it is presumed that, by 2025 60% of people around the globe will reside in urban areas [68]. In an IoT world, devices can be compiled as per their geographic location and evaluated through the application of analyzing systems [69]. The IoT enables remote sensing and controlling of objects over current network resources. Gartner estimates that by 2020, 260 million objects will be connected [70]. One of the bitter facts is sensor interfacing limits the number of connected devices and sensors to be connected in the IoT system which is also the crux for sensor data collection of wireless sensor networks in an IoT environment [71]. The deployment of applications related to the IoT could be tough and require large research and development efforts to tackle with the challenges, but it can provide substantial personal, proficient, and economic paybacks in the future [71]. Serviceoriented architecture (SOA) also entertains reusability of hardware and software. The major reason behind it is no specific technology requirements for service implementation [72]. In this type of architecture, it becomes authoritative for the service providers and for those who request to communicate having some purpose with one another regardless of the assorted nature of the prevalent information system edifice. This prerequisite is termed "semantic-interoperability". Recent trends and configuration management is assumed as one of the greatest hindrances to integration and association; however, this is the usual problem associated with semantic interoperability [73]. The main findings of the research are:

1.
A generalized IoT framework has been developed that is applicable to the water supply management sector as well as other sectors like electricity management, waste management, and other areas. However, this research concentrates on the water supply sector. This framework has been developed based on an experiment and the literature reviews of related research works.

2.
The IoT application generates data. The mathematical model and algorithms developed in the research can be applied on the generated data that are useful for the water supply management sector for planning (forecasting the water demand), billing purpose and leakage identification of water.

3.
The IoT framework developed in this research can be applied in several areas to ease business affairs, a citizen's life, and automate manual tasks. This research can be used as milestone to develop other efficient IoT frameworks.

Conclusions
The concept of a smart city is burgeoning. IoT framework plays a significant role in making the city smart. This paper focuses on effective management of a water supply using an IoT application to automatize the functioning of a motor in each house to manage the water in the reservoir tanks. The main features of the implemented approach are: a.
The experimental setup uses a waterproof ultrasonic sensor which is new as compared to other smart meters; b.
The framework focuses both on data generation along with its application; c.
The framework implements cloud-based technologies in IoT to make any IoT system scalable; d.
The framework also focuses on the actual use of data for forecasting or prediction, knowledge discovery as well as other information system needs.
Mathematical models were developed to compute the consumption amount and leakage amount of water in individual houses, which also helps in estimating the bill amount of each house. After observation of the data acquired, we can easily use it to observe the various trends among each of the household under experimentation. The average consumption of Spot 1 over 90 days was found to be 17.19 L, Spot 2 was 33.275 L, Spot 3 was 40.94 L, Spot 4 was 37.25 L, Spot 5 was 54.75 L, and Spot 6 was 33.95 L. Similarly, the leakage amount of water for these Spots was obtained. Spot 1 showed almost no leakage. During the time of Day 20 to Day 29, an average of 5.34 L of water was reported as leakage by the system. In the case of Spot 2 and Spot 3, there was almost no leakage. At Spot 4, the water usage at nighttime was observed to go over our threshold but there was no consistency and our system requires at least a week of consistency so that it was also not reported. In Spot 6, large volumes of usage were observed (greater than our threshold), but still due to inconsistency, it is also marked as human use. At Spot 5, during Day 22 to Day 36, an average of 10.38 L of leakage was observed which was considered leakage by our system and the issue was reported to the people there. Consumption and leakage of water of each province could be computed and eventually of the entire country. Based on this experiment and a rigorous study of recent papers in this field, a framework has been developed, and we have called this an IoT framework. This framework has been developed by combining experimental and conceptual parts. Although this paper is concentrated on water supply management, the developed framework can be utilized in other areas for making the city smart.
Though the developed framework is novel, it has limitations such as: a.
The framework focuses on storage and processing of huge amount of data so that load balancing and self-scaling servers are required. This causes the need to implement cloud computing. b.
Since many parts of Nepal still do not have internet access readily, this is hard to implement in rural areas in Nepal. c.
The experimental setup focuses on measurement of water resources in reserve tank so that it is not implementable in places with no reserve tank. d.
The experiment has still not implemented encryption for communication which can cause data spoofing in the current context. e.
The initial setup of each of the spot is done currently though hardware, which can be shifted to cloud for cloud administration and updates.
The research work does not end here, and future research can be carried out considering the following tasks: 1.
The above listed limitations can be mitigated to carry on the future research in the same area. The methodology to identify the quality of water can be used in future research works.

2.
Effective protocols can be defined for encryption based on the type of data without limiting the efficiency.

3.
Data analysis and modeling of data can be undertaken after collecting huge number of data and analyzing effective predictor variables for forecasting. 4.
The experimental setup uses market-available devices which can have high cost. These devices can be replaced by specialized modules and effectively reduce the cost. 5.
The framework does not focus on standardized software protocols and methodology as IoT is still in early stage and its scope is still not limited. So, the framework can be altered to have software standards based on the application. In addition, NOSQL can also be implemented.