Internet of Things for a Smart Campus: on-line Monitoring of Water Consumption in University Buildings

— Water and energy are among the greatest expenses of University buildings and therefore the monitoring of its consumption is of capital importance. In this work it is proposed a monitoring system based on the Internet of Things (IoT), consisting in a network of physical sensors embedded with electronics and software that allow getting real-time data of any measurable parameters such as level, flow, pressure, or power and make them available online. Such system can be a powerful tool for building managers and maintenance teams, helping to the optimization of water and energy use. An IoT system based on the premise of real-time monitoring with a public access internet interface is being developed for the Polytechnic School in Salvador, Bahia. The objective is to monitor a series of water meters as well as the level of the water tanks, creating a fast-response leakage detection system. These data will be deployed in a user-friendly interface that, as an additional feature, will also be able to show real-time data of electricity consumption as well as the renewable energy generated in the building through a series of solar panels and one small wind turbine. This system must be reliable and scalable in order to create a Smart Campus for the whole UFBA. In this paper, the architecture of such a system is presented together with the developed prototypes and the results of the monitoring of this particular building.


I. INTRODUCTION
This The concept of "Smart Water" refers to an advanced water network capable of detecting water leakages, automatically control the optimum working pressure and control the water quality. In addition, a smart water network must be integrated into a telecommunications network. That allows providing useful information for both the water utility and the consumer. The water utility is able to obtain data regarding the system operation variables (pressure, flow, etc) and the behavior of those variables with a demand that varies with time. Water, energy and gas companies use now smart meters, which transmit remotely consumption data, to generate the monthly bills. This automated process saves a lot of time and money when compared to the previous situation, where a human worker had to walkthrough visiting all and every of the consumption points and annotate the meter readings. The consumer can get useful information too. For example, the consumer can monitor its own consumption or get data about tariff periods or the quality of the water that is supplied to him. A smart water system is a fundamental part of a "smart city", which is a wider concept and encompasses information and control of most of the utilities of a city. Therefore systems for the supply of water, electricity, gas, transport services, meteorological data, or health care systems can be integrated, improving their overall performance. The analysis of the data generated by such smart systems can contribute to obtain conclusions and further improve the management of those systems.
At a smaller scale, this concept can be downsized to what can be called a "smart building". In recent years, the price of sensors, microcontrollers and related technological components has been progressively moving down, reaching a point where home automation is available for most households.
This, allied to the wide-spreading of internet connection has created a revolutionary context. It is now possible (and increasingly common) to control remotely the temperature of a house through a mobile app. This way, HVAC (heating, ventilation and air conditioning) can be switched off when the building is empty and switched on some time before arriving home. The distribution of hot/cold water for the HVAC system can also be controlled remotely through solenoid valves, allowing setting the temperature of each part of the building. Beside single buildings, big consumers of water, energy and gas can also get significant benefits with the use of smart meters and a real-time monitoring system. Hence, a typical situation for them would be a complex of several buildings, each of them demanding different quantities of water, energy, gas and HVAC according with their uses. Typically, a centralized utility department manages and gives maintenance to the distribution system and accompanies the consumption of the buildings. This is the case of institutional buildings such as hospitals, administrative complexes, prisons and military or educational facilities. Regarding the latter, a number of universities have adopted this concept and started a transition into what is called "smart campuses".
The Internet of Things (IoT) consists in a network of physical sensors embedded with electronics and software that allow getting real-time data of any measurable parameters such as level, flow, pressure, or power and making them available online [1]. Such a system can be a powerful tool for building managers and maintenance teams, helping to the optimization of water and energy use. Real-time monitoring can also be coupled with simple automation process.
For instance, the monitoring system could automatically send a text message or email to the building maintenance team in case of a leakage detection and even close the related water valves, isolating the part of the building where the leakage was detected. Also, solenoid valves coupled with soil humidity sensors allow the system to perform an optimal irrigation of the building gardens. In addition, the online display of data regarding the water and energy consumption of public buildings contributes to a culture of transparency and rational use of these resources.
An IoT system based on the premise of real-time monitoring with a public access internet interface is being developed for the Polytechnic School in Salvador, Brazil. The objective is to monitor a series of water meters as well as the level of the water tanks, creating a fast-response leakage detection system. These data will be deployed in a user-friendly interface that, as an additional feature, will also be able to show real-time data of electricity consumption as well as the renewable energy generated in the building through a series of solar panels and one small wind turbine. This system must be reliable and scalable in order to create a Smart Campus.
The prototype aims to detect a number of typical problems that occur in hydraulic systems of buildings. Some leakages are visible and thus easily detectable by the occupants. That is the case of leakages in the roof water tank or in the building piping system. Differently, leakages in the cistern or in the main pipe that comes from the city's waterworks are typically not visible and remain undetected during long periods. That type of nonvisible leakages usually has a great impact on the monthly bill. It is after that bill comes that some actions are carried out, usually through electronic leak detection. Many buildings in this location (Salvador, Brazil), in particular the older ones, have problems in the cistern due to bad waterproofing in the walls or due to the effect of roots of nearby trees, causing leakage through the tank walls and infiltration to the ground [10].
Another recurrent problem is the bad adjustment of the buoy that commands the pumping between the bottom and roof tanks. That can cause an excessive number of pump stops and starts if the buoy is set at a too high level. When the level lows to the set position, the buoy switches on the pump. As each time that the pump is switched on and off a high electric current crosses the motor, an excessive number of pumping greatly reduces the lifetime of the pump. On the contrary, if the buoy is set at a too low level or the buoy command disconnects, the roof water tank can get empty leading to water shortage in the building.
Besides reducing the time necessary to detect leakages and operation problems, a smart water system is useful to monitor the water consumption profile of a building. Water consumption during nighttime or during periods in which the building is empty can be attributed to the sum of small leakages within the building, for example in lavatories, toilets or faucets. This waste of water can be accurately measured through the minimum night flow registered in the flowmeter or through monitoring the level of the roof water tank.
It is presented a low cost system that can easily be developed in universities and technical schools worldwide, based on open-source software and a number of electronic sensors that are easily available in the market. After describing the architecture of the system and the variables that are to be measured, the main results of several months monitoring the building are presented. During that period, some of the problems related above were detected and corrected thanks to the proposed smart water system. II. METHODOLOGY Figure 1 illustrates the architecture of the system. The Arduino board is the core of the system and acts as a data concentrator, receiving real-time data from the sensors and sending "packages" of information to the web server. It is based on an open-source microcontroller board that has digital and analog Input/Output pins in which sensors and actuators can be connected. This microcontroller was chosen due to its affordable price, reliability and open-source software. It is capable to communicate with all the intended sensors: water and gas flow, level, pressure and power and with the web server as well. It also can perform simple automation tasks. A prototype was built to monitor jointly the water entry of the building and both the bottom and the rooftop tanks of the Polytechnic School. To measure the water consumption of the building, it was necessary to install a second meter downstream the main water meter, which is owned by the local water utility. The preferable option is an ultrasonic meter with configurable pulse outputs, as is more precise and insensitive to scale, sand and air bubbles. However, with the aim of develop a low-cost but precise system, it was preferred a multi-jet positive displacement meter. A reed switch, linked to an electromagnet was connected to the meter. This switch emits an electric pulse after each passage of 100 liters. The uncertainty of its measurement is ±2% at a flow rate between 1 and 10 m³/h [2].
To measure the level of the water tanks, it was used a submerged hydrostatic probe, coupled with an external barometric sensor. Both have a piezoresistive silicon with Hastelloy pressure sensor with automatic temperature compensation, giving a total uncertainty of ±3mm [3]. A less accurate, low-cost sensor (ultrasonic distance sensor) is being developed to replace this hydrostatic measuring system.
The aim of the prototype is to monitor the operation of the hydraulic system of a building. To do so, it is used a minimum of three sensors that send their measures to the prototype. the water entrance of the building is monitored through a sensor that registers the flow of water, coming from the city waterworks, which passes through the main flowmeter. This water can go directly to the roof tank if the pressure is high enough. This type of water supply is commonly used in Europe, for example, where the pressure in the water system is kept at high levels. Differently, in other countries such as Brazil, pressure in the waterworks is significantly lower, so a typical building's water system is composed of a bottom water tank (a cistern), a pump, and a roof tank from which water is distributed to the consumption points in the building. Therefore after the first sensor in the flowmeter, the monitoring of the system is completed with the level data of both the cistern and the roof water tank. The variables to be monitored are "flow of water entering the building", "level of water stored in the cistern" and "level of water stored in the roof tank". The volume of fresh water that is consumed in the building can be easily calculated from those three variables. Also, it can be inferred the rate of consumption of freshwater in the building, allowing to depict a graph of water demand in a period of time. Table I shows a summary of the information that can be obtained through this monitoring system. This basic monitoring system, composed by the three related sensors, can be upgraded through the installation of additional similar sensors. For example, additional pulsed flowmeters can be installed in the piping system that distributes water in the building, after the roof tank, thus allowing measuring the consumption of the different sections of the building. If the building has more than two water tanks, the level of the additional tanks can also be monitored. This may be the case if the building has a rainwater harvesting system, for example. The microcontroller board has digital and analog Input/Output pins in which up to 8 different sensors can be connected. Actuators can be connected in those pins as well, which allows some interesting functionalities: if an abnormal consumption is detected in any section of the building, the microcontroller can close a solenoid valve to cut the water supply in that part of the building. The pump can be switched on and off based on the level measured by the sensors in the water tanks, instead of the control buoy that is typically used.

Monitoring of the main flow meter
The monitoring of the main water meter showed a leakage in the pipes of the external areas of the building. This leak was observed and fixed the day after, but meanwhile 140 m³ of fresh water were lost in a single day (13/10/2015) as shown in the "Daily water meter readings" graph in Figure 2. The recorded event showed the importance of real-time monitoring of the water system which, if associated with automatic alarms, can minimize the time spent in malfunction and leakage detection.

Monitoring of the bottom water tank (cistern)
The monitoring of the cistern allowed confirming its water tightness. That is, fresh water was not been lost to the ground due to leakages within the cistern's wall. The record of the level in the cistern during two consecutive days is presented in Figure 3. The level drops during pumping periods, when the level in the roof water tank is low and the buoy located in that tank starts the pump that elevates water from the cistern. When the level in the roof water tank is high enough, the pump is stopped and the water level in the cistern suddenly begins to rise. It rises from a minimum of 1.3 m to its maximum level of 2.4 m. When the highest water level is achieved, the valve that allows water to enter into the cistern closes and the water level remains stable (flat), which indicates absence of water loss. The monitoring of the water level in the cisterns also allowed inferring that, in case of interruption of the water supply from the city's waterworks, the cistern would have enough water to cover two days of the building's water consumption.

Monitoring of the roof water tank
During the monitoring of the roof tank, it was detected a malfunction in the buoy that commands the pumps. As shown in the roof tank graph (Figure 4), the water level went down to 5 cm reaching the fire reserve and leading to water shortage in the building. In addition, the monitoring of the water level in the roof tank allowed the drawing of daily water demand profiles in the building (volume consumed per hour in a 24h basis). It also allowed an estimate of the water consumption during nighttime, which is caused mainly due to leakages, at around 250 liters/hour. Results are presented in Figure 5 and Figure 6, showing the water demand profiles of a holyday and a weekday, respectively.

IV. CONCLUSION
The monitoring of the roof water tank yielded valuable data about the water demand profile of the building. A significant consumption of water during night-time was identified, which could be related to small leakages within the building's plumbing system. This monitoring also gave a clear view of the operation of the hydraulic system: number and frequency of starts and stops in the pumps, how long does the pumping take, and operational levels of the reservoir. Altogether, these are valuable data for the optimization of the hydraulic system as can detect malfunctions that can reduce the service life of the pumps or produce either overflow or the emptying of the water tanks.
In conclusion, the prototype built for the monitoring of the water consumption attended the expectations and proved to be reliable. Its total cost was half the price of its commercial equivalent. This prototype would be more appropriate for the joint monitoring of the level of roof water tanks and the water flow of the tank outputs, which supply the different parts of the building. For the monitoring of the main water meter located in the street, it would be more interesting a commercial ultrasonic meter with integrated radio or MBus. The proposed system could be extended to the other buildings in the campus and complemented with other devices such as leak noise loggers or automatic pressure valves, in order to create a smart water network capable to achieve great reductions of the amount of water lost in leakages.