## Abstract

Faced with water scarcity and its rising costs, it is necessary to use it in a rational way. This study proposes the development of an autonomous system of water monitoring in condominiums (smart houses), through meters that use turbine flow sensors and ZigBee technology for sending data to a coordinator, allowing monitoring of the consumption at various points of a building in almost real time. Users can read the consumed volume using a smartphone application. This stimulates a more rational way of using water, besides enabling alerts for leaks in pipes, faucets, showers and toilets. The accuracy of this sensor was compared with a mechanical flow meter and an ultrasonic sensor in the laboratory, all presenting errors smaller than 10% of readings for water flow above 2 L/min. The quality of the ZigBee network was analysed, in terms of interference with Wi-Fi, Bluetooth devices and a microwave oven, to assess if there are data losses in the sensor network and only Bluetooth caused losses, showing robustness in the combined ZigBee and Wi-Fi.

## HIGHLIGHTS

• Wi-Fi and Zigbee wireless technology can coexist well with other networks.

• A simple flow sensor can be installed in a residence and monitor water consumption with a satisfactory accurateness.

• Monitoring water consumption in real time promotes a rational way of consuming water, besides decreasing water bills.

• The cost can be attractive to a condo's management company prorate water use in condominium.

## INTRODUCTION

In developing countries such as Brazil, water companies do not yet have systems that show consumption variations in real time; the standard is only a single measurement at the end of the month in each residence. According to Lima & Navas (2011), real-time water monitoring systems encourage a conscious use of water by the user, in addition to being able to identify leaks. In most of the residences, the user has no idea of the consumption of each sector of his house. It is important to monitor consumption at these points, besides being able to diagnose possible leaks in the building water network and in the city water network when some consumption presents certain discrepancies in relation to normality. Leakage losses in residences are usually detected only after a certain period, causing an increase in the water bill and damaging building elements. The purpose of this monitoring is not only to provide economy in the water bill at the end of the month, but also to offer a contribution to the sustainable development of the planet.

The United Nations (UN) says a person needs around 110 L/day to meet their daily consumption and hygiene needs. In Brazil, the average is 200 L/day per person, while in countries like Ethiopia, the number is 15 L/day per person. In the United States, on the other hand, the average is 575 L/day per person (WWAP 2015).

An index that correlated the water resource utilization and economic development was proposed by Qi et al. (2020). The study analysed two different places in China, comparing the variation of the index over 15 years. This index decreased, in view of technologies adoption in the water infrastructure being also a good tool for future decisions, considering the past, present situation and future development of the stress degree of available water resources that will impact on the economic development.

A literature review, listing 92 water demand datasets and 120 related peer reviews publications compiled in the last 45 years, was carried out. It was observed that the use of smart sensors enabled greater spatial and temporal resolutions and thus improved the understanding of the behaviour of water consumers and then modelling of water demand, with the advance of high-resolution sensors being able to make multiple readings in a short period of time (Di Mauro et al. 2021).

The payment of water bills also made users tend to change their consumption habits. Empirical studies have shown that the price elasticity of demand in developed countries ranges from 0.3 to 0.7; that is, if the price doubles, consumption would reduce between 30 and 70% (Boyle et al. 2013). This reduction in consumption should be greater in developing countries since the cost of the water has a larger impact on low-income families' budget than on higher ones.

A study carried out in Armenia analysed the introduction of water metering for municipal supply, which was almost nonexistent in the early 2000s. This process led to good water savings (about four times reduction) in the short term, but afterwards the consumption rose again and only dropped when water tariffs increased. Besides stimulating water savings to households, metering also helped the water company to identify and prevent thefts and corruption practices (Harutyunyan 2015).

Olsson (2021) discussed automation in the urban water supply, presenting different upcoming technologies related to water usage in cities, wastewater management and the use of sensors for monitoring them. However, automation has some aspects to be considered such as uncertainty, feedback, and complexity, and these innovations must be monitored by a human, in the face of a possible failure or lack of consideration of some real factor that the computer cannot identify or predict, thus generating inadequate results with reality.

Intrusive metering consists of one sensor for each water-consuming appliance, and non-intrusive measurement, which is based on the reading of the total water consumption of the building, in a single point of the house. In the case of non-intrusive measurement, as it provides a reading of the total consumption of the building, a characterization can be done using software such as Trace Wizard® and Ident flow®. Studies have shown that detailed information on the water consumed by individual devices can help consumers reduce their consumption significantly (Cominola et al. 2015).

Ethem Karadirek (2020) proposed an experimental analysis, comparing different types of sensors varying the flow and pressure ranges of use, and analyzing errors in the measurement. He discussed several factors to be analyzed when choosing a type of sensor, such as size, accuracy, cost, maintenance requirement and water quality. This showed that some sensors have higher accuracy in low flow rates and others in high flow rates, in spite of belonging to the same class of accuracy. It was also shown that the effect of water pressure on measurement error was more expressive at low flow rates.

Duan et al. (2020) reviewed the phenomenon of the hydraulic transient, showing the numerical models and methods (domain of the time and the frequency) presented in the literature that try to solve the phenomenon. This phenomenon not only brings negative effects to the pipe (damaging physical effects of the pipe, for example), but also helps in mapping the condition of the pipe along its length. The use of smart meters in the network can assist in the identification of transients, in a real situation in which numerical methods or simulations cannot accurately express the occurrence of the transient.

For these water meters, Wireless Sensor Networks (WSN) are often used, which can collect and send information to wireless transceivers coupled to sensors and actuators in general, with the advantage of having much more mobility compared to a wired network. In some cases, the cost of installing a wired network is high or its installation may be impracticable depending on the condition of the place where it is being installed (Salomão 2009).

In this context, there is the concept of a Wireless Local Area Network (WLAN), designed for a high-end data network, besides providing long range and capacity for several devices, with seamless roaming and message forwarding. In turn, a Wireless Personal Area Network (WPAN) is designed to operate for shorter distances, functioning in the Personal Operating Space (POS). In this type of network, little infrastructure is necessary, allowing less power consumption. Three classes of WPAN have been defined by the IEEE 802.15 Working Group: data rate, quality of service and battery drain. The high-data rate WPAN (IEEE Std. 802.15.3™) is used for multimedia application that needs a high quality of service, while the medium-rate WPAN's (IEEE Std. 802.15.1™/Bluetooth®) is commonly used in electronic devices such as mobile phones. Lastly, low-rate WPAN's (IEEE Std. 802.15.4™) provide low power and low-cost requirements, in view of having a low data rate (Gutierrez et al. 2011).

Some protocols are often used for wireless communication: UWB (ultra-wideband), Wi-Fi, Bluetooth, and ZigBee. The first one is used for high-speed data rates, but the communication has a short range. Wi-Fi (that is based on IEE 802.11) has a high-speed data and a good range (up to 100 m) but has high power consumption. ZigBee is based on IEE 802.15.4 standard and has a lower data rate (250 kbps with a distance of up to 70 m) compared to Wi-Fi (possible 11 Mbps), but it is still enough for several types of applications of sensors, with the advantage of low power consumption and little or no infrastructure required (Ahriman & Nugroho 2011).

When a smart water meter uses batteries as the only available energy source, the drawbacks of this solution include a finite capacity energy reservoir and consequently a limited lifetime. If frequent data collection from the smart meter is requested, this drawback is particularly significant and then batteries must be changed frequently which creates some limitations. The main sources of ambient energy considered suitable for wireless sensors can be summarized as: solar, mechanical, thermal and radio waves (Tan et al. 2006). One type of mechanical energy source is represented by the action of a turbine wheel rotating in the path of a fluid stream. The flowing fluid impinges on the turbine blades, imparting a force to the blade surface and setting the rotor in motion. This rotor in motion is the basic element of a turbine flow meter, which translates the mechanical action of the turbine rotating in the liquid flow around an axis into a user-readable rate of flow. When a steady rotation speed has been reached, the speed is proportional to fluid velocity. The use of water movement represents a powerful source of energy for autonomous devices such as water meters (due to the electrical energy generated as a function of kinetic energy), being typically applied in agriculture and in water systems in the urban environment. The effects of variations in the number of turbine blades, the angle of the blades in relation to the flow, their width, among other variables that influence the energy generated and the loss of flow pressure caused by the blades, were studied by Boisseau et al. (2016).

The present research aims at connecting Wi-Fi, ZigBee, a turbine flow generator and turbine flow meter to building an autonomous water meter. We want to verify if ZigBee and Wi-Fi can peacefully coexist to build an Intelligent Urban Water Network. Furthermore, the quality of the communication using the architecture proposed was evaluated, in terms of interference of the wireless network, and a cost analysis with the mechanical flow meter single-jet or MultiJet meters was carried out.

## METHODS

In this research, a Sea® (China) brand turbine-type hall flow sensor was used for each desired flow measurement point (model YF-S201B and Hydroelectric power Micro-hydro generator DB-268 BK (China)). Prior to the installation of the sensors at the monitoring points, each flow sensor was first calibrated in the hydraulics laboratory at the State University of Maringa. A known flow rate was then sent to the sensor, and the calibration coefficient that related the number of pulses emitted by the sensor to the flow through it was adjusted. The procedure was also performed by increasing and decreasing the flow rate of the tube, and thus comparing it to the actual (known) flow rate with the flow rate supplied by the flow sensor, varying the water flow to 5, 10 and 15 L/min.

After calibration, a flow measurement comparison was performed between this type of sensor, an ultrasonic sensor, and a conventional flow meter, all installed in the same pipeline in the laboratory. Several values from 0.125 L/min of flows up to the limit of 12 L/min were submitted to the piping, thus having the reading of each sensor for each flow range, this way having the measurement error of each sensor for each flow read. For the conventional flow meter, a timer was used to register time for the pointer to turn 360°, which corresponded to 1 L, so the volume was divided by the time and the flow rate was obtained. For the turbine type hall flow sensor, there was a prototyping board (Arduino) that converted the number of turns to flow according to the previously calibrated coefficient. Finally, for the ultrasonic sensor, the board calculated the pulse time difference between the transducers, thus determining the flow velocity and, from the tube area, the flow rate was obtained.

Later, for the study, a family house of 130 m2 was used in which four flow monitoring points were determined: two showers (points 1 and 3 in Figure 1(c)), one washbasin (point 2) and the water supply pipe (point 4) from the water box. All dimensions are in meters in Figure 1(c).

Figure 1

(a) System coupled to the monitoring shower; (b) details of the system – Xbee 3 coupled to the board, water flow sensor and hydroelectric generator; (c) interference monitoring points and water consumption monitoring points in the building.

Figure 1

(a) System coupled to the monitoring shower; (b) details of the system – Xbee 3 coupled to the board, water flow sensor and hydroelectric generator; (c) interference monitoring points and water consumption monitoring points in the building.

Attached to each turbine-type flow sensor there is a radio frequency module that works with ZigBee wireless communication technology, made by Digi® (Hopkins, USA), Xbee 3 surface-mount module attached to a XBee SMT Grove Development Board USB. These modules work at 2.4 GHz frequency and their advantage when compared to Wi-Fi is the low power consumption and the fact that they allow a network with multiple nodes communicating. Following their manufacture, they have a range of up to 90 m indoors, depending on obstacles such as walls and metal surfaces, and up to 3,200 m outdoors. They have a transmission rate of 250 kbps and a sensitivity of –101 dBm, meaning they can ‘pick up’ a signal of –101 dBm. They are powered by a source ranging from 2.7 to 3.6 volts, operating at 31 mA, and can be reduced by 1 μA when in sleep mode, providing a long battery life.

The Xbee module is responsible for capturing the pulses generated by the water sensor and transmitting them to the grid coordinator, i.e. to another grid module. The system coupled to a shower and its details are shown in Figure 1(a) and 1(b) and interference monitoring points and water consumption monitoring points in the building in Figure 1(c).

In this way, the network coordinator captures the data from each sensor (which is sent by the routers) and a microcontroller handles this data, converting it into accumulated volume from the previously calibrated coefficient.

The network coordinator was set to application programming interface (API) mode, which is a more robust and complete communication mode when compared to transparent mode (AT). In that mode, the data contains various information starting from 23 bytes, each containing different information such as length, type of information, address of the transmitter, data itself.

The micro controller used was the ESP 8266, in which was loaded a code in C + +, responsible, in general, for recognizing the bytes that contained the address of each router, obtaining the number of pulses generated by each sensor from the RF Data packet byte, thus calculating and printing the accumulated volume from each sensor. In addition, this microcontroller also has a Wi-Fi module, which oversees sending the processed data to the Firebase® server, where the user could have access to the consumption of the nodes remotely, being able to access them through a computer or also by an app developed for the Android® system for smartphones. The architecture to build the Intelligent Urban Water Network proposed is illustrated in Figure 2.

Figure 2

The architecture of the Intelligent Urban Water Network proposed.

Figure 2

The architecture of the Intelligent Urban Water Network proposed.

In this way, three different analyses and tests were carried out during this research, as explained below.

### Water consumption/hydro power generation

Water consumption of the building was analysed by consumption points (shower, washbasin), in addition to the total water consumption, and then compared with the data gathered by the mechanical flow meter from the Sanitation Company of Paraná (SANEPAR), which is used for the purposes of monthly charging of the water tariff.

For this occasion of flow measurement, at each consumption point tested, the XBee 3 surface-mount module was used (plugged into a XBee surface-mount Grove development board), coupled to a board assembled with an electrical circuit with resistors and a Metal-Oxide-Semiconductor Field Effect Transistor and a rechargeable battery (Lithium, 3,800 mAh), as shown in Figure 1(b).

To each of the sanitary points described as 1–4 in Figure 1(c) were coupled a turbine type flow sensor (responsible for counting the pulses, measuring the water flow from the rotation of the internal blades) and a hydroelectric generator, which uses the water movement to supply energy and recharge the battery. Both are attached to the described board, which also includes the Xbee 3 operating in sleep mode, configured as sleep mode (1) – called pin hibernate mode in the XCTU software. In this mode, the Xbee is in a power down mode consuming current in the order of μA, when powered with 3.3 volts, supplied by the board. When having water movement, the sensor rotates and the Field Effect Transistor is responsible for changing the voltage from 3.3 to 0 volts, making Xbee return to the active state and thus being able to send data to the coordinator.

The materials used in these tests were:

• XBee 3 surface-mount module plugged into a XBee surface-mount Grove development board from Digi® International (Hopkins, USA);

• Water Flow (hall) sensor model YF-S201 (China);

• Hydroelectric Generator model DB-268 (China);

• Board assembled with an electrical circuit with resistors and a Metal-Oxide-Semiconductor Field Effect Transistor and a rechargeable battery (3,800 mAh);

• Jumpers and connectors.

### Interference tests on ZigBee network

Using the Digi's XCTU software, it is possible to perform range tests between the ZigBee network coordinator and the routers, thus obtaining parameters such as RSSI (received signal strength indicator), which measures the strength of the signal received in the device. This parameter will not be the focus of this analysis on the article, because it is directly influenced by the background noise (that causes more or less signal attenuation), changing all the time due to the other wireless networks of the house, and thus not being a precise parameter of quality of the ZigBee network. It is even possible to evaluate the percentage of packets that were not received in relation to the sent ones, thus determining whether data is lost or not in wireless communication, called packet error rate (PER). In this study, PER was used as the parameter to analyse the wireless communication.

Before performing the communication tests, a spectrum analyser was used to verify the signal intensities as a function of frequency, to analyse the background noise (interference) in the building in which the sensor network was installed.

The spectrum was analysed in different situations to check the background noise in the 2.4 GHz frequency band as follows:

• 1.

Wi-Fi routers, Bluetooth devices and the microwave device switched off

• 2.

Two Wi-Fi routers switched on

• 3.

Bluetooth device turned on, all the routers turned off and the microwave oven turned on

• 4.

All devices turned on.

Through these analyses, it was possible to verify which frequency spectrum band had the highest background noise in each situation described. It was also possible to simulate the range tests of ZigBee devices by varying their working channels in order to simulate the free channel and the busiest channel for each described situation, aiming to identify interference and possible loss of data packet under less or more adverse background noise conditions. The location of the devices in the study residence is shown in Figure 1(c), where the dimensions are in meters.

The channel assignment is static on the ZigBee network, so it scans the spectrum and locates the channel with the lowest background noise before choosing the channel. If there is a new source of interference, this channel is not changed by the network, unless the user forces its change. Thus, all electronic devices of the house were first turned off, and the ZigBee network was formed, therefore assigning a channel. After the network was formed, with the assigned channel, the tests in XCTU were performed for each situation described. Subsequently, for each situation, the analyses were repeated, but forcing the ZigBee to work on the most favourable and unfavourable channels in terms of background noise according to the analysis performed with the spectrum analyser.

The materials used in these tests were:

• Spectrum Analyzer Rohde & Schwarz® (Munich, Germany), FSH8 100 KHz–8 GHz;

• Rohde & Schwarz® Model HE400LP 450 MHz Antenna – 8 GHz;

• Two XBEE S2C PRO from Digi® International (Hopkins, USA);

• Arduino UNO;

• Wi-Fi 2.4 GHz router with power X;

• Mobile with communication Bluetooth 4.2, A2DP, LE, EDR;

• JBL® (China); sound box with Bluetooth communication;

• Microwave oven; and

• Jumpers and connectors.

### Cost analysis to use the system in condos and individual houses

In this section, a cost analysis of the system will be carried out, which can be installed in individual residences or in a multifamily condominium. In an individual residence, as already described, they usually have only one measurement per month, for the purpose of charging the tariff. A real-time measurement at several points has several advantages as explained previously, mainly in helping to reduce water consumption. For a multifamily condominium, the idea is also interesting especially for older buildings that usually have only a total water measurement, and the bill is divided by the number of housing units. Thus, a sensor installed in each unit can help in the apportionment of water consumption, where each family will pay for the amount they are actually using, making the collection fairer and also encouraging the person to consume less water.

## RESULTS AND DISCUSSION

### Hydraulic analysis – tests on laboratory and water consumption on the building

First, laboratory test results were obtained in which the flow rate of each sensor was compared with the known reference flow rate that passed through the pipe. The results of the percent deviation, that is the measurement error of the sensor with the actual flow through the pipe, are shown in Figure 3.

Figure 3

Error of each device.

Figure 3

Error of each device.

The standard for mechanical flow meters in Brazil establishes maximum permissible error ranges that should be used in flow meter acceptance testing. For Class ‘B’ water meters, the permissible error is 5% for the flow between the minimum flow and four times the minimum flow; and for flow rates above this value, the error shall not exceed ±2%. It can be concluded that for flow rates below 1 L/min, the Hall sensor has large errors. They are less accurate at low flow rates because of the bearing drag that slows the rotor. It is also not recommended to work at high flow rates given that bearing wear or damage can occur.

In this range, the flow meter showed the best results. For flow rates above 2 L/min, the Hall sensor (turbine type flow sensor) showed good results, along with the other two meters, which obtained errors of less than 10% in relation to the reference flow rate.

These errors, while not large, are above the 5% allowable by the Class B water meter standard for the interval between the minimum flow rate and four times this value, which in practice correspond respectively to 0.5 and 2 L/min. For longer ranges, the errors were also greater than the 2% tolerable limit.

Another point that can be studied which was not considered in this research is shown by Mendoza & Benavides-Muñoz (2021), who made a study in the laboratory analysing several water meters of different ages in different flow ranges, verifying the errors of the flow reading over the years. They concluded that for small flow ranges, below 750 L/h, the meters had a tendency of sub-accounting over the years, and the errors increase almost 2% per year. For ranges above that, the errors have remained practically stable over the years. In view of this study, the age of the water meter is another point to be considered regarding its reading accuracy. Musaazi et al. (2021) also had similar findings in another study, which showed that the age of the sensor has a negative correlation with the annual volume read, that is, according to the time the sensor had greater reading errors, errors that remained practically constant after five years. Thus, they suggest that this would be a good time to change the meter in a network for example. A shorter time than this would be impracticable in view of its initial cost, and a time longer than this would bring considerable differences in the measurement of water consumption, due to sub metering, an effect that becomes even more significant with time. They also concluded that the pressure effect was not very significant over time, that is, the meters did not degrade faster when they were subjected to greater network pressures. So, the effect of age must be studied in more detail for the hall sensors, analysing how degradation occurs over time.

In the residence studied, water consumed at four nodes was analysed. In a day, for example, the consumption of water in the shower (node 1) had an average of 111 L at the beginning of the research, where only one person used the bathroom. After three months from the beginning of this research, the average water consumption dropped from 111 to 85 L (a decrease of 30%) a day in node 1. The nodes were not analysed for a longer time to verify the decrease in water consumption in the medium/long term, due to the installation of sensors and the real-time monitoring of the consumption. Future research may carry out a more in-depth analysis of this.

This result converges with other studies related to the reduction of consumption. Sønderlund et al. (2016) made a review of studies about managing water use based on consumption feedback, focused on recent technologies such as smart meters, and revealed promise in the use of these smart sensors to inform and educate householders to reduce water consumption. In this review, 17 of 21 studies indicated reductions of between 2.5 and 28.6%, when detailed consumption is frequently presented to the consumer. However, some of them reported that the reduction was only in the short term, thus the reductions dwindled over time. On the other hand, according to Davies et al. (2014), who conducted a five-year survey in a city in Australia, these reductions did not decline over time. They were based on family groups that had smart meters in their homes coupled with displays installed in the building that showed water consumption, while the others (control group) had conventional metering. The groups that had the consumption display had this device for three years and reduced their consumption by 6.4% per month compared to the period prior to the test, a percentage that remained in the following two years of consumption monitoring but without the displays installed, attesting that the reduction in consumption and awareness has been maintained over the long term. In the control group, consumption in the same three years increased by 1.3% compared to the period preceding the survey.

In Brazil, there are still no studies that deal in depth with the possibility of decreasing water consumption due to the use of sensors. Costa & Soares (2020) argued that the installation of a smart meter system in the city of Brasilia did not result in reduction of the water consumption (in short-term analysis) but it reduced the labour of reading the consumption of meters, bringing money savings. However, with this current research, it was seen in practice that a smart sensor deployed in the shower reduced consumption by 30% in the short term. As described in the literature and verified in this study, the tap level is effective for the user to better understand his water consumption and thus be able to reduce it. Households generally have a total monthly measurement, for the purpose of charging tariffs, but it is difficult through this measure alone to understand the consumption of different equipment in a house, i.e. faucets, showers, toilet etc.

The total consumption in node 4 was also analysed, which corresponds to the mechanical flow meter, i.e. all water entering the building, coming from the public water network. The average water volume spent was 1,128 L, which results in about 282 L per person per day. The mechanical flow meter of the water supply company was also read, which is used to collect the monthly fee, which has an average value of 1,280 L, corresponding to a difference of 13.5% between readings. This fact, combined with the laboratory tests already presented, leads us to conclude that in fact, according to Cloete et al. (2016), the turbine hall flow sensor presents higher measurement errors for low flow rates, given the friction of the blades that decreases the movement of the same, generating smaller numbers of flow. It was noticed because when the reading of the hall flow sensor reached zero, the mechanical flow meter still alleged the flow of a small amount of water. Even so, the use of the Hall sensor can still detect leaks, as it can read low flow rates, albeit with less accuracy. The lowest value it could read before turning to 0.00 was 0.14 L/min.

These results were obtained through the mobile application created, which provided the accumulated volume data at the hydraulic points. The data that the app showed was taken from the Firebase® server, which received the information from the ESP 8,266 microcontroller. The code loaded in the ESP provided the consumption in each monitored point (tap, shower) and the app in the smartphone showed the accumulated volume, in litres, of each desired point. It was also possible to reset the consumption after a certain time, and so the app again generated the accumulated consumption from that moment on the desired hydraulic point.

The energy consumption of the system at each flow measurement point was also measured, using an ammeter, which showed 9 mA of electric current consumption of the Xbee 3 module coupled to the XBee surface-mount Grove development board, when in active mode. As soon as the device enters sleep mode, the indication LEDs turn off, and the current measured was about 0.6 mA. This current can be further reduced if the Xbee 3 micro module is used, which does not need the Grove development board, thus increasing the battery life.

The hydroelectric generator, in turn, supplies the maximum voltage of 12 volts to the battery, and in terms of current, a maximum value of 25 mA, which varies depending on the rotation of its blades, as illustrated in Figure 4.

Figure 4

Variation of voltage (V) and current (mA) with variation of flow (L/min).

Figure 4

Variation of voltage (V) and current (mA) with variation of flow (L/min).

The life cycle of the system battery, without having to remove it from the sensor to charge with an external element, for example, depends on the use of the device to which the sensor is attached. If the consumption point is not used, that is, the Xbee remains in sleep mode, the approximate battery life (for 3,800 mAh) is 160 days. In the case of consumption, and depending on the flow of the consumption point, this time may increase as the current supplied by the generator tends to be greater than the current consumed by the system.

With the data generated by the app, the user can read the amount of water consumed in those points of the building, making people change their habits of using the water, reducing the time in the shower for example. The reduction of water over time could be part of future studies about the subject.

### Interference tests

#### Situation 1: Devices off – interference-free spectrum

ZigBee shares the same radio frequency with Bluetooth, Wi-Fi and cordless phones: the ISM (industrial, scientific and medical) band 2.4 GHz, the operation band is from 2.4 to 2.483 GHz and is divided into different channels, to avoid interference and loss of data. For Wi-Fi, ZigBee and Bluetooth, the channel bandwidths are 22, 2, and 1 MHz respectively. Thus, it is possible to realize that channels allocations can overlap with each other, resulting in interference and lost packet data. Before transmitting data, ZigBee and Wi-Fi search a quiet channel and both have a collision avoidance algorithm.

In this situation, all Wi-Fi, Bluetooth, and microwave devices inside the house were switched off. Even so, there was background noise due to devices outside the building (neighbouring Wi-Fi routers for example), as seen in Figure 5(a). The Xbee devices (coordinator and Zigbee router as shown in Figure 1(c)) were configured with maximum power (level 4, +18 dBm), and the channel automatically assigned, shown in XCTU program settings, was channel 24 (corresponds to 2,470 MHz). In the ZigBee, each device can listen to the channel before the transmission, to minimize the collisions between the devices and the data loss. Besides that, this protocol does not change channel if a heavy interference occurs. If a ZigBee channel is overlapped with a busy Wi-Fi channel, up to 20% of ZigBee packets will be retransmitted because of packet collisions (Woodings & Gerrior 2005).

Figure 5

Results of the spectrum analyzer in each situation described from (a) to (e).

Figure 5

Results of the spectrum analyzer in each situation described from (a) to (e).

For the spectrum analyser, the range chosen to analyse the intensities was 200 MHz, with a central band of 2.4 GHz, sufficient range to analyse the signals of the mentioned communication protocols. The analyser had the Max Hold function activated, thus maintaining the amplitude peaks found by the antenna at each frequency. Because the antenna was directional, it was pointed in various directions to pick up the signals from all directions. In this situation, there was no loss of packets in the communication, and the RSSI value, for both the remote node and the coordinator, was of the order of –80 dBm, which shows a relatively weak signal, due to the attenuation of obstacles like walls and the distance between the nodes.

#### Situation 2: Wi-Fi devices on

In situation 2, the spectrum analyser had the following aspect, shown in Figure 5(b), which showed some signal peaks in the intensity ranging from 2,426 to 2,428 MHz, corresponding to Wi-Fi channel 6.

The range test performed in XCTU did not detect packet loss in this situation. After this test, the same procedure was performed, forcing the Xbee to work in the worst case (channel 15) and in the best case (channel 13), in view of the analysis performed in the spectrum analyser. In both situations there was no packet loss. For this situation, in which the ZigBee coordinator and the Wi-Fi router are located a little more than 4 m away, there was no considerable interference of Wi-Fi over the ZigBee network.

#### Situation 3: Bluetooth devices on

Bluetooth technology uses 79 distinct channels in its spectrum, which continuously ‘hop’ at a rate of 1,600 times per second, to avoid possible interference, called frequency-hopping scheme (Roth 2013). With the advancement of wireless communication networks (Faludi 2010), the receivers have the sensitivity (the weakest signal that the receiver can detect) to pick up signals up to –100 dBm. Morimoto (2018) explains the behaviour of the radio frequency waves, which are electromagnetic waves that respect the inverse square law. The intensity of these waves is inversely proportional to the square of the distance between the sending and receiving sources. In this way, radio waves require great energy to be transmitted due to attenuation with distance.

In this situation, a cell phone was paired with a sound box through Bluetooth communication. The spectrum analysed for this occasion is illustrated in Figure 5(c).

The range test performed for Xbee working on channel 24, which is the channel assigned by it at the beginning, coincidentally the best channel in this situation also had a packet error rate in the order of 80%. For the worst case, which is the Xbee working on channel 20, which had the highest interference in this case, no data packet was received.

#### Situation 4: Microwave oven on

In this situation, only the microwave oven was turned on and the spectrum analysed is shown in Figure 5(d).

For this situation, in the test performed with Xbee working on the automatic channel, there was no loss of packets. For both the worst case (Xbee working on channel 21) and the more favourable case (Xbee on channel 11), there was no packet loss, concluding that for the distance tested, around 10 m between the oven and the module Xbee, there was no considerable interference, even with the microwave on, which resulted in very considerable background noise, as shown in Figure 5(d).

#### Situation 5: All electronic devices on

In this situation, all electronic devices described were turned on and thus the spectrum shown in Figure 5(e) was reached. For this situation, in the test performed with Xbee working on the automatic channel, the packet loss was around 93%, due to the high interference in all bands of the spectrum. Modifying the channel to 26, which represents the lowest interference range (most favourable situation), the error rate was 87%, while in channel 22 (highest interference), this rate was 76%. These numbers do not make sense, in view of the fact that in channel 22, supposed to be the worst channel, the PER was the smallest. This can be explained due to the frequency hopping, where probably channel 22 was the best in the moment that the spectrum was analysed, but a few moments later this channel was busy for the sake of the change of frequency (channel) that the Bluetooth devices were operating.

According to Thonet et al. (2008), another advantage of using ZigBee is that it operates well even though it is in coexisting Wi-Fi applications (Web surfing, file transfer, video streaming). The packets can have latency, because of the numbers of retransmissions, but they are delivered successfully even in the most adverse interference conditions.

Faced with the number of retransmissions, the ZigBee sensor battery consumption is higher. Besides this ZigBee has little impact on Wi-Fi, while Wi-Fi affects the ‘delivery’ of the ZigBee packets, causing interference, however this influence varies according to the intensity of traffic and the number of nodes of each network. For a network that contains three nodes of each technology, the ZigBee network packet delivery rate is more than 90%. By increasing to nine Wi-Fi nodes on the same network, the delivery percentage drops to 70% (Mardini et al. 2012).

Soo et al. (2007) related that the distance between the devices and the frequency range are two factors that considerably influence the interference between ZigBee and Wi-Fi. For over 8 m between devices, the loss of packets in the ZigBee network is reduced, while for 4 m, the loss in the Wi-Fi network is reduced. If the offset between the centre frequencies of the bands of each network is greater than 7 MHz, the ZigBee network will lose few packets. In addition, it was also stated that the Bluetooth network does not significantly interfere with the ZigBee network, while the radiation caused by the microwave oven does not affect the ZigBee network since the distance between the device and the ZigBee device is a few meters.

The packet loss results sent are presented in Table 1 (results given by the software XCTU, in the range test), in which percentage indicates the number of packets sent that were successfully received by the ZigBee network coordinator for each situation presented.

Table 1

Interference results

Automatic channelBest channelWorst channel
Without interference 100% (Channel 24)
Wi-Fi on 100% (Channel 24) 100% (Channel 13) 100% (Channel 13)
Bluetooth on 20% (Channel 24) 3.33% (Channel 24) 0% (Channel 20)
Microwave oven on 100% (Channel 24) 100% (Channel 11) 100% (Channel 21)
All devices on 6.67% (Channel 24) 13.33% (Channel 26) 23.33% (Channel 22)
Automatic channelBest channelWorst channel
Without interference 100% (Channel 24)
Wi-Fi on 100% (Channel 24) 100% (Channel 13) 100% (Channel 13)
Bluetooth on 20% (Channel 24) 3.33% (Channel 24) 0% (Channel 20)
Microwave oven on 100% (Channel 24) 100% (Channel 11) 100% (Channel 21)
All devices on 6.67% (Channel 24) 13.33% (Channel 26) 23.33% (Channel 22)

### Cost analysis to use the system in condos and individual houses

Most of the cities in Brazil use a traditional mechanical flow meter and the cost in Brazil is approximately 20$USD (currency conversion 1USD = 5 R$ Brazilian currency). The proposed final system (hall meter) cost was 40$USD (20 for ZigBee, 10 for hydrogenerator and 10 for the water meter). Approximately 25$ USD refer to custom taxes for the electronics components. This is the price for each measurement point, so the price for a house will depend on the number of the desired points to be monitored. If we consider an ultrasonics flow meter, the price goes up to 200\$ USD for a meter without wireless transmission for the consumer data. Because the hall flow meter does not meet the accuracy required by Brazilian law, sanitation companies are unlikely to be interested in purchasing the product. However, the product is interesting for the user who wants to measure the consumption of their home according to the sectors of the building, installed at the points of consumption directly, or for users of old condominiums, who have only one measurement for all residential units, in which the water tariff for billing residents is made by dividing the water total consumption by the number of housing units, so those who consume little water must pay for those who consume a lot of water. Thus, the smart sensor in this case generates a fair division of the apportionment of water in the condominium. Considering the average consumption per inhabitant of 200 L/day and the price of water and sewage at 3 USD/m3, a residence with four inhabitants spends an average of 72 USD/month. If the use of smart flow encourages a 10% reduction in consumption, each smart meter monitoring point can be paid in up to six months for the resources that are saved.

Furthermore, the installation of a smart meter does not need to break walls or coverings, it is just required that the residence has access to a wireless internet network, which is reality for most of the population in Brazil. Besides this, these sensors have relatively simple operation and long service life, without the need for maintenance for many years.

In Brazil, since there is no commercial product available that allows the monitoring of water consumption as described in this article, coupled with the high rates of customs tax, there are still barriers to be overcome for the system to become a reality for the majority of the population. However, the sensor market in this country is still very incipient, a fact that may change with the increase of manufacturers, which should reduce the acquisition costs of the system, coupled with the greater demand for the product, which is still little known in most of the countries. It is expected that in the future, with the rising costs of drinking water and the awareness of the need for more rational use, the use of smart sensors will be a reality for the population.

The drawbacks of the system can be related to the user's privacy, as their data will be sent to a server or they can even be accessed by another user who breaks into the wireless network. Another negative point is the need for cloud services for data storage, given the large amount of data from the sensors. However, it is expected that with the increasingly common use of cloud services, storage costs can become more accessible. In addition, the increasingly widespread and common use of the smartphone facilitates the application of the system in homes, even by a user who is not skilled in that area. The use of sensors for a rational consumption of water is not limited to saving money for the user, spending less on the water bill, but also on the environmental and sustainable issue, especially nowadays where there are changes in precipitation patterns and climate change, which reduces water sources in some cities.

Another advance that is being tested for future research is coupling a valve, which will permit controlling the flow remotely by a smartphone. It will facilitate the use (open or close) of these sanitary devices by people who have some physical restriction in relation to hand movements for example and help to stop flow in the case of leak detection.

## CONCLUSIONS

In the present work the architecture to build an Intelligent Urban Water Network was proposed in which the user can follow in real time the water consumption at different points of his residence, through a smartphone application, and save the data in the cloud. For this, turbine type flow sensors were used to measure the water consumption in the desired points of a house, so that the user could read the accumulated volume of water consumed in each point.

Before installation of the system in the residence, laboratory tests were carried out comparing three types of water meters, varying the water flow and analysing their accuracy. For flow rates above 2 L/min, the turbine type flow sensor (hall sensor) had good measurements, in addition to the mechanical flow meter and ultrasonic sensor that obtained errors less than 10% of measurement, although this error goes above what is allowed by the Brazilian standard for water meters.

In the residence studied, four points were monitored with the installation of turbine type flow sensors coupled to hydroelectric generators and electronic devices that sent consumption data to the app on the smartphone where the user could read the water consumption of the points. The hall sensor had a 13.5% smaller accumulated volume measurement compared to the mechanical flow meter from the water company at the end of a measurement day, attesting to its low accuracy in flow rates below 1 L/min, but still usable to measurement due to its low cost and simplicity of operation. Another important point was the reduction of water consumption in the short term, which was 30%, because of monitoring consumption in the house studied.

In terms of interference, Wi-Fi devices do not represent interference on the ZigBee network, considering the distance of a few meters between them. When there is Bluetooth operating close to ZigBee, the transmitter or receiver resulted in data loss for the ZigBee network and had a significant impact on various frequency bands of the analysed spectrum. It is also important to note that these data losses are associated with the fact that the mobile phone, which sent the music data to the amplifier box, is close (a few centimetres) from the ZigBee coordinator. The microwave oven, despite causing too much background noise in the analysed spectrum, did not cause data loss in the ZigBee network, considering the distance of approximately 10 m between them. For the situation with all connected devices on (in the distances described), packet loss was quite significant due to interference caused by these devices on the ZigBee network.

In general, it was possible to combine elements from different manufacturers and thus propose a smart sensor system for measuring water consumption in a residence without the need of electricity availability at water consuming points, and so it could also be used in an industrial environment or even in an urban water network.

## DATA AVAILABILITY STATEMENT

All relevant data are included in the paper or its Supplementary Information.

## REFERENCES

Ahriman
F.
Nugroho
E.
2011
ZigBee and Wi-Fi network interface on wireless sensor networks
. In:
Makassar International Conference on Electrical Engineering and Informatics (MICEEI)
,
Makassar, Indonesia
, pp.
54
58
.
Boisseau
S.
Duret
A. B.
Perez
M.
Jallas
E.
Jallas
E.
2016
Water flow energy harvesters for autonomous flowmeters
.
Journal of Physics: Conference Series
773
,
1
4
.
Boyle
T.
Giurco
D.
Mukheibir
P.
Liu
A.
Moy
C.
White
S.
Stewart
R.
2013
Intelligent metering for urban water: a review
.
Water (Switzerland)
5
(
3
),
1052
1081
.
Cloete
N. A.
Malekian
R.
Nair
L.
2016
Design of smart sensors for real-time water quality monitoring
.
IEEE Access
4
,
3975
3990
.
Cominola
A.
Giuliani
M.
Piga
D.
Castelletti
A.
Rizzoli
A. E.
2015
Benefits and challenges of using smart meters for advancing residential water demand modeling and management: a review
.
Environmental Modelling and Software
72
,
198
214
.
http://dx.doi.org/10.1016/j.envsoft.2015.07.012
.
Costa
D. F.
Soares
A. K.
2020
Costs and impacts of a smart metering program in a water distribution system: case study in Brasília, Brazil
.
Environmental Sciences Proceedings
2
(
1
),
1
8
.
Davies
K.
Doolan
C.
Van Den Honert
R.
Shi
R.
2014
Water-saving impacts of smart meter technology: an empirical 5 year, whole-of-community study in Sydney, Australia
.
Water Resources Research
50
(
9
),
7348
7358
.
Di Mauro
A.
Cominola
A.
Castelletti
A.
Di Nardo
A.
2021
Urban water consumption at multiple spatial and temporal scales. A review of existing datasets
.
Water (Switzerland)
13
(
1
),
1
31
.
Duan
H. F.
Pan
B.
Wang
M.
Chen
L.
Zheng
F.
Zhang
Y.
2020
State-of-the-art review on the transient flow modeling and utilization for urban water supply system (UWSS) management
.
Journal of Water Supply: Research and Technology – AQUA
69
(
8
),
858
893
.
I.
2020
An experimental analysis on accuracy of customer water meters under various flow rates and water pressures
.
Journal of Water Supply: Research and Technology – AQUA
69
(
1
),
18
27
.
Faludi
R.
2010
A Practical Guide to the ZigBee Mesh Networking Protocol. Building Wireless Sensor Networks
.
O'Reilly
,
Sebastapol
,
USA
, pp.
1
328
.
Gutierrez
J. A.
Winkel
L.
Callaway
E. H.
Barrett
R. L.
2011
Low-Rate Wireless Personal Area Networks: … Enabling Wireless Sensors with IEEE 802.15.4TM
.
John Wiley & Sons
,
USA
, pp.
1
200
.
Harutyunyan
N.
2015
Metering drinking water in Armenia: the process and impacts
.
Sustainable Cities and Society
14
(
1
),
351
358
.
Lima
C. A. F.
Navas
J. R. P.
2011
Smart metering and systems to support a conscious use of water and electricity
. In:
Proceedings of the 24th International Conference on Efficiency, Cost, Optimization, Simulation and Environmental Impact of Energy Systems, ECOS
, Vol.
45
, pp.
961
973
.
Mardini
W.
Khamayseh
Y.
R.
Hijjawi
R.
2012
Interference problem between ZigBee and WiFi
. In:
International Proceedings of Computer Science and Information Technology
, Vol.
30
.
IACSIT, Hong Kong Conf.
, pp.
133
138
.
Mendoza
A. A.
Benavides-Muñoz
H.
2021
Evaluation of domestic water measurement error: a case study
.
AQUA – Water Infrastructure, Ecosystems and Society
70
(
2
),
217
225
.
Morimoto
C. E.
2018
Wireless Networks: Calculating Transmit and Receive Power
. .
Musaazi
I. G.
Sempewo
J. I.
Babu
M.
Kiggundu
N.
2021
Assessing the impact of working pressure on water meter registration
.
AQUA – Water Infrastructure, Ecosystems and Society
70
,
1
10
.
Olsson
G.
2021
Urban water supply automation – today and tomorrow
.
AQUA – Water Infrastructure, Ecosystems and Society
70
(
4
),
420
437
.
Qi
Z.
Xiao
C.
Zhang
B.
Liang
X.
2020
Generalized index of regional socio-economic consumption level of water resource
.
Journal of Water Supply: Research and Technology – AQUA
69
(
2
),
113
121
.
Roth
G.
2013
Bluetooth wireless technology. Available from: http://large.stanford.edu/courses/2012/ph250/roth1/ (Accessed 19 June 2019).
Salomão
A.
2009
Development of a ZigBee Module for Remote Monitoring of Water Consumption in Airport Facilities
.
M.S. thesis
,
Technological Institute of Aeronautics
,
São Paulo
,
Brazil
.
Sønderlund
A. L.
Smith
J. R.
Hutton
C. J.
Kapelan
Z.
Savic
D.
2016
Effectiveness of smart meter-based consumption feedback in curbing household water use: knowns and unknowns
.
Journal of Water Resources Planning and Management
142
(
12
),
1
13
.
Soo
Y.
Hong
S.
Wook
H.
2007
Mutual interference analysis of ZigBee and Wifi-b
.
Computer and Telecommunications Networking
51
,
3338
3353
.
Tan
Y. K.
Hoe
K. Y.
Panda
S. K.
2006
Energy harvesting using piezoelectric igniter for self-powered radio frequency (RF) wireless sensors
. In:
Proceedings of the IEEE International Conference on Industrial Technology
,
Mumbai, India
.
IEEE
, pp.
1711
1716
.
Thonet
G.
Allard-Jacquin
P.
Colle
P.
2008
ZigBee-WiFi coexistence
.
Schneider Electric White Paper and Test Report
1
(
38
),
1
38
.
Woodings
R. W.
Gerrior
M.
2005
Avoiding interference in the 2.4 GHz ISM band
.
Microwave Engineering Online
3
5
.
WWAP
2015
The United Nations World Water Development Report 2015: Water for a Sustainable World
.
UNESCO
,
Paris
, pp.
1
122
.
This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY 4.0), which permits copying, adaptation and redistribution, provided the original work is properly cited (http://creativecommons.org/licenses/by/4.0/).