Refill Water Management System Using an IoT-Based Water Flow Sensor

: The primary and crucial use of water is as a drink. It is crucial for meeting the fluid needs of the human body. Dying from dehydration can occur when 15% of body weight is lost from not having enough water. Currently, numerous water refill points are accessible, sourced from both boreholes and mountain springs. Water is traditionally measured in transportation cars by filling the container without tracking the water input and output. This study aims to create a reusable water-filling control device that will track the inflow and outflow of water in the storage tank with the help of a Water Flow Sensor. The data obtained is based on analysis using the Arduino Uno in determine the volume of water, which is sent to the web server via the ESP8266 Wifi Module, providing the water volume information is shown directly on the management system app. Real-time viewing of the water volume data from the water flow sensor is possible in the refill water management app. After carrying out experiments; the 1,500 ml experiment showed the highest accuracy at 99.47%. The deviation of the 1,500 ml experiment is only 0.53%, showcasing the potential benefits of an automated water management system.


Introduction
Water is essential for humans as the human body is made up of approximately 70% water [1].The body meets its requirement for water by consuming both water and food.The amount of water each individual needs to drink differs based on their body weight and level of physical activity.According to the Ministry of Health's overall recommendations for a balanced diet, individuals should drink at least 2 liters (equivalent to 8 glasses) of water daily to fulfill the body's hydration requirements and sustain good health [2].
There are now many places that provide water refilling services, either from boreholes or from mountain springs.The transportation of water from the car is measured in the conventional way by filling the water storage tube without knowing the amount of water entering and leaving.Manual records are made for water entering and leaving the storage tube using an expedition book, so a management system is needed to assist in calculating the volume of water entering and leaving the water filling pipe [3].With the advancement of technology in the industrial world, companies will generate greater revenue because they are more efficient in production, marketing, storage, and data management [4].
Some previous studies have used microcontrollers, for example in research on designing a water discharge information system using Arduino which discusses making a prototype system to monitor water usage by consumers.The purpose of this study is to offer solution options to the difficulties in water distribution in the irrigation area which experiences limited availability of clean water to meet the needs of daily water use [5].Arduino UNO equipped with Arduino Atmega328 microcontroller and additional components such as flowmeter sensor, selenoid valve, and water pump, is converted into an automatic system for water taps.This system operates the work of water taps automatically with the help of timers and flowmeter sensors to set the opening schedule and limit the volume of water flowing in each tap [6] [7] [8].

Literature Review 2.1. Water
All living beings on Earth require water in order to survive.There is no substitute for water in the essential function it serves in life.The primary and essential role of water in life is for consumption.This is particularly crucial for maintaining the body's fluid requirements.A 15% deficit in body weight from lack of fluids could result in death from dehydration [9].As a result, it is recommended for adults to drink a minimum of 1.5 -2 liters of water each day in order to keep their body hydrated and aid in metabolism [2].Water plays a crucial role in the human body by transporting nutrients as a solution and removing essential substances.For instance, oxygen dissolves prior to reaching the blood vessels near the alveoli [10].

Internet of Things
Internet of Things (IoT) is a concept aimed at expanding the benefits and connectivity of continuously connected internet.In principle, IoT (Internet of Things) refers to objects that can be uniquely identified as virtual representatives in internet-based networks [11] [12] [13].IoT works by machines interacting with each other automatically without the influence of users and not limited by distance [14]; the device works directly.The advantage of the IoT (Internet of Things) concept is the ability to do work faster, easier, and more efficiently [15].

Mikrocontroler
A microcontroller is a compact electronic device that serves as a system controller and can typically store programs internally.Microcontrollers typically come equipped with a CPU, memory, special I/O, and additional support units like an Analog-to-Digital Converter (ADC) [16].
Microcontrollers have RAM and extra I/O equipment which results in a very compact board size, making it a major benefit.MCS51 is an 8 bit CMOS microcomputer that features 4 KB Flash PEROM which is capable of being both erased and written on up to 1000 occasions [17].This microcontroller is made with advanced high-density non-volatile memory technology.The Flash PEROM program memory can be programmed either within the system or with a typical non-volatile memory programmer [18].The MCS51 microcontroller, which has a flexible 8-bit CPU and Flash PEROM combination, turns into a reliable and adaptable microcomputer [19].

Arduino
Arduino is a platform that is open and utilized for building electronic projects.Arduino consists of a physical circuit board, also referred to as a microcontroller, and software or IDE (Integrated Development Environment) that operates on a computer [20].The software known as the Arduino IDE is commonly used to write and upload code from a computer to the physical Arduino board.

Wifi Modul
The ESP8266 chip is a system on chip that has a built-in TCP/IP protocol stack, so it can be easily connected to a microcontroller via 802.11b/g/n Wi-Fi Direct (P2P) serial communication [28].The Esp8266 Wifi module can function as a host or as a device to send data over a Wi-Fi network [29].

Wemos D1 R2
The Wemos D1 R2 microcontroller, although similar to the Arduino Uno, is actually built on the ESP8266-12 module.Utilizing the C programming language, beginners can easily program with the many libraries available, thus simplifying the process [30].The Arduino IDE can be used to program the Wemos D1 R2.This module has 11 digital I/O pins, 1 analog input pin, microUSB, and a power jack for 9-24V power input [31].

Time Clock
RTC is an important part used to provide information about time.Time here can range from seconds, minutes, days, months to years.Arduino like UNO does not have an internally integrated RTC.Therefore, for applications that require time measurement, we have to attach it separately [32].To keep the RTC working, it usually comes with a battery that is often referred to as a "CMOS" battery [33].Gambar 4. Real Time Clock

Water Flow Sensor
A Water Flow sensor measures the amount of water flowing and triggers the motor in liters.This sensor includes various parts like a plastic valve, a water rotor, and a hall effect sensor.The engine will change its position and speed based on the rate at which the water is flowing.The hall effect sensor on this device will recognize a voltage signal in the shape of a pulse and transmit it to Arduino Uno for utilization as water flow rate information [34].
The water flow sensor operates by having the magnetic rotor rotate based on the rate of water flow passing through the valve [35].When the hall effect sensor is influenced by the magnet in the rotor, a voltage pulse signal will be generated.The voltage pulse output matches the input voltage level, varying in frequency based on water flow rate [36].A controller or microcontroller can convert the signal into digital data.Gambar 5. Sensor Water Flow

Methodology
Starting the process of designing a water discharge counter involves initiating it at the waterflow sensor, which serves as the input for the water discharge sensor.The data from the waterflow sensor is transmitted to the arduino at mega 2560, where it is then analyzed and shown on the 16x2 LCD screen.Next, the data on water usage will be temporarily saved in the SD card module along with additional time data gathered from the RTC module.Once the log data is stored on the SD card, it will be transmitted to the web server using the Wemos D1 module as an Internet data transmitter.The log data is kept in a database server accessible via a web-based application for managing a water depot.It is a tool that functions to send connected information from the device to the application.g) Database Server As a tool to accommodate information on the results of the calculation of water volume.

h) Internet connection
As a communication tool that connects the wifi module with the application.i) Web-based PC-Client application Is a device used to order water and monitor the flow of water discharge.
There are three steps involved in completing the whole procedure, from input, main process, to generating output.The process involves: 1) Gathering of Data The water flow sensor operates by having the magnetic rotor rotate at a speed that correlates with the flow rate of water passing through the valve.The magnetic field's impact on the rotor will influence the hall effect sensor to generate a voltage pulse signal (Pulse Width Modulator).The voltage pulse output matches the input voltage level and frequency of water flow.The controller or Mega2560 microcontroller can transform the signal into digital data, which will then be converted into units of liters.The Water Flow Sensor is made up of various parts such as a plastic valve, water rotor, and hall effect sensor.

2) Processing of data
The data collected by the water flow sensor will be structured and analyzed by the Mega 2560 microcontroller.The data produced by the mega 2560 microcontroller will first be saved on the SD card before being transmitted to the database.Information is transferred from the SD card storage to the database by utilizing the FIFO principle via communication with the wemos module.Within the web server, a PHP script will be responsible for handling the incoming data.Afterwards, the script will autonomously execute whenever data is transmitted from the device.This program will manage the information received from the mega 2560 microcontroller and show it in real time with a user-friendly interface.

3) Representating of data
The data that has been entered into the database will then be shown in graphic form on the web page.This visualization is intended to facilitate users in viewing information about water volume.The use of PHP and javascript in making web pages for visualizing water volume data provides a data update feature every second.

Finding and Discussion
System testing is done after the system implementation process.Testing is done by measuring 500 ml of water 10 times, 1,000 ml of water 10 times, and 1,500 ml of water 10 times.Water measurements are taken repeatedly aims to get the average value of each measurement amount, and determine the accuracy of this system.determine the accuracy of this system.
Tabel 1. Measurement for 500 ml, 1000 ml and 1500 ml 1) Experiment for 500 ml The results of measuring 500 ml of water for 10 trials can be seen in Table 1.
Based on the data in Table 1, it is obtained that the average difference in water volume is 70 ml, about 14% of the measured water is more or exceeds the amount that should be 500 ml.Therefore, the accuracy of the system in the 500 ml experiment is 100% -14% = 86%.
2) Experiment for 1,000 ml The results of measuring 1,000 ml of water for 10 trials can be seen in Table 1.
Based on the data in Table 1, it is obtained that the average difference in water volume is 95 ml, about 4.5% of the measured water is more or exceeds the amount that should be 1,000 ml.Therefore, the accuracy of the system in the 1,000 ml experiment is 100% -4.5% = 95.5 %.
3) Experiment for 1,500 ml The results of measuring 1,500 ml of water for 10 trials can be seen in Table 1.
Based on the data in Table 1, it is obtained that the average difference in water volume is 8 ml, about 0.53% of the measured water is more or exceeds the amount that should be 1,500 ml.Therefore, the accuracy of the system in the 1,500 ml experiment is 100% -0.53% = 99.47%.

Data Outliers
Outliers are data points that significantly differ from other observations.In this case, we are looking for measurements that are unusually high or low compared to the rest of the data for each volume.
Based on the Table 1, some potential outliers identified:  For 500ml The value of 450ml in experiment 2 seems significantly lower than the other values, which are mostly around 600ml.

 For 1000ml
The value of 900ml in experiment 4 and 8 is notably lower than the others, which are primarily around 1100ml.

 For 1500ml
No obvious outliers are immediately apparent, although the data is more spread out compared to the other volumes.

Statistic Analysis of the System Testing Data
Based on the data in Table 1, taking into value the deviation point of each result obtained in the experiment, it can be seen that:  In the 500ml experiment, out of 10 experiments, only one experiment gave the correct result.
The deviation value greater than 500 ml is at 650 ml, or 130% higher than the value that should be.While the deviation value smaller than 500 ml is at 450 ml, or 90% lower than the value that should be. In the 1,000ml experiment, out of 10 experiments, there were two experiments that gave the correct result.The deviation value greater than 1,000 ml is at 1,300 ml, or 130% higher than the correct value.While the deviation value that is smaller than 1,000 ml is at 900 ml, or 90% lower than the value that should be. In the 1,500 ml experiment, out of 10 experiments, only one experiment gave the correct result.The deviation value greater than 1,500 ml is at 1,600 ml, or 107% higher than the value that should be.While the deviation value smaller than 1,500ml is at 1,320 ml, or 88% lower than the value that should be.
Table 2 shows the analysis of the system testing data based on the Table 1, while Table 3 shows the standard deviation of the system testing data.Based on Table 2 and Table 3, it shows that the system performs well with a high degree of accuracy across all measured volumes (500ml, 1000ml, and 1500ml).The average measured values are very close to the expected values, with accuracies ranging from 99.36% to 99.79%.
To show the proportion of parts (experiment results) to the given standard value, a graph visualization is used, as shown in Figure 7.

Conclusion
This article discusses the use of technology to improve water management.The use of technology such as microcontrollers like Arduino can improve the water management system in water refilling.The accuracy of the system in measuring water volumes of 500 ml, 1,000 ml, and 1,500 ml varied, with the the 500ml volume has the highest variability as indicated by the largest error bars.The 1500ml volume has the least variability, with relatively smaller error bars.
Overall, the result shows that the system's measurements for the 500ml and 1000ml volumes are fairly accurate, with the measured values clustering closely around the target values.1,500 ml experiment showing the highest accuracy at 99.47%.The deviation of the 1,500 ml experiment only 0.53%, showcasing the potential benefits of automated water management systems.It presents the results of experiments measuring water volume, showing that the system is most accurate when measuring 1,500 ml of water.
This suggests that the system is reliable in terms of measuring water volume.If these factors are well-controlled, the system's accuracy is likely to remain high.However, it's important to consider factors that might affect these results in a real-world setting, such as: • Environmental conditions (e.g., temperature, humidity) • Measurement device calibration • Human error during measurements Experimental results with measurements of 500 ml, 1,000 ml, and 1,500 ml varied.This is because the output specifications of the water flow sensor are unstable (measurement device calibration).Further research needs to be done to make the water flow sensor more stable so that more stable measurement results can be obtained with a good level of accuracy.Besides that it is necessary to use more data points are needed for the 1500ml volume to draw any conclusions about its accuracy.Overall, the test results are promising and indicate that the system is on track to meet its accuracy requirements.

Figure 6
Figure 6 illustrates the architecture of the system.

Figure 6 .
Figure 6.Architecture of the System

Table 2 .
Statistic Analysis of the System Testing Data

Table 3 .
Standard Deviation of the System Testing Data