Automatic Water Dispenser Based on Hand Gesture Detection Using Arduino

Water dispensers are electronic devices that are widely available in households and offices. In general, water dispensers use faucets to drain water. During the pandemic, many people avoid touching equipment used by many people. Various ways have been done so that the water dispenser can be operated automatically without touching the faucet. Previous research on water dispensers was only applied to one type of water. This study aims to make an automatic water dispenser without touching the faucet used for two types of water, namely hot water or cold water. This research is based on hand gesture detection to choose hot water or cold water. The APDS-9960 gesture sensor detects hand movements to select hot or cold water, and then a servo motor is used to open the water faucet. After that, the position of the glass is validated by the ultrasonic sensor HC-SR04, and water will flow for 30 seconds into the glass. The entire input and output process is controlled using Arduino. The results show that this automatic water dispenser can detect hand gestures at a maximum distance of 15 cm with a hand movement speed of 2 to 3.7 seconds. This automatic water dispenser can detect three kinds of glass, namely ceramic, clear glass, and plastic, at a distance of 1 to 3 cm, and the volume of water flowing for 30 seconds is 240 ml. Keywords—Water Dispenser, Arduino, Gesture Sensor APDS-9960, Ultrasonic Sensor HC-SR04, Servo Motor.


I. INTRODUCTION
Technological innovations in various fields of life are intended to facilitate human work. The water dispenser is one of the technological innovations that functions as a drinking water storage. Apart from being a place to store water, the primary function of the water dispenser is also to facilitate access to drinking water. The water dispenser is one of the electronic equipment that is a major need at household and office scale. There are many types of water dispensers on the market. One type of water dispenser selected in this study is a water dispenser with two faucets to drain the cold and hot water.
Most people try to limit themselves from interacting with crowds during a pandemic. This is one way to prevent the spread of disease during a pandemic. Various methods are used to minimize touching objects that are widely held by others. Several technological innovations have been carried out to prevent the spread of disease during the pandemic by making hand-washing devices that are activated by footrests [1], automatic hand sanitizer [2], touchless automatic hand-washer [3], automatic faucet without turning for hand-washing [4].
The ultrasonic sensor that is often found in the market is the ultrasonic sensor HC-SR04. This sensor works on the principle of wave reflection. The ultrasonic sensor functions to convert a sound value into an electrical value. So it is widely used to interpret the magnitude of the distance. Widely applied to various applications, including water level detection [12] [13], object detection, and water level [14]. The gesture is a non-verbal communication using body movements other than the mouth, such as hand movements, shoulders, fingers, facial expressions, etc. The APDS-9960 gesture sensor was used for hand gesture detection in this study. This gesture sensor converts physical movement information into digital information. Gesture detection has been used in previous studies as drone controllers [15], and robot controllers [16].
Servo motors are electronic devices that are often used in intelligent machines. The function of this servo motor is to push, pull or rotate an object. Servo motors are widely used in conjunction with other devices in various electronic applications [17] [18].
One of the water dispensers in the Indonesian market today is a dispenser with two faucets for hot and cold water. The water will flow after the user presses the faucet according to the desired type of water.
This water dispenser with a manual faucet is considered impractical, especially during a pandemic, because users still have to press the water faucet on the dispenser so that it is prone to disease transmission. Therefore, it is necessary to do automation to prevent disease transmission through this dispenser faucet.
Previous research on the automation of drinking water dispensers such as [19], but the study is only for water dispensers with one water faucet. It uses ultrasonic sensors to detect the glass as well as a switch to drain the water. Smart dispenser research for blind people [20], but only for water dispensers with one type of water faucet and using sound detection as a switch to drain water. Clean water dispenser research [21], but only for water dispensers with one water faucet and using RFID as a switch to flow water with three different glass volumes. Study on automatic drinking water filler with special glass [22], but only for one water faucet dispenser with a special glass detection as a switch to drain water.
Compared to previous research, the advantage of this research is the automatic water dispenser for type two water faucets, namely for hot and cold water. Hand gesture detection is used to select hot or cold water. So that the dispenser user can access the dispenser as needed without having to touch the water faucet. It is hoped that this design can prevent disease transmission during the pandemic.
II. METHOD In this section, the stages of the research carried out sequentially include is problem identification, literature study, system requirements analysis, hardware design, software design, implementation, testing, and conclusions.

A. Problem Identification
The stage of identifying the problem to be solved is called problem identification. The following issues can be recognized based on the explanation in the previous sub-chapter.: • Reducing the spread of disease during a pandemic • In general, water dispensers use faucets to drain water • There is an automatic water dispenser for one faucet, but there is no water dispenser for two faucets for hot and cold.

B. Literature Study
After identifying the problem, it is continued with a literature study. The literature study was conducted to study and understand everything related to this research, namely the field of electronics and microcontrollers. This research literature study comes from journals and books that are widely obtained from the internet.

C. System Requirements Analysis
System analysis is critical to the development of a system. This stage is a starting point that becomes a reference for the next development steps. If an analysis error occurs, it can result in a defective system and even system failure. Therefore, it is necessary to plan and produce a system that is as desired. The purpose of this system requirements analysis is to study and understand the weaknesses of the existing system. Then a new system will be created as a development of the old system. The system requirements analysis consists of analyzing initial conditions, the proposed system, hardware requirements, and software requirements.
1) Initial Condition Analysis: The object studied in this study is a water dispenser with two water faucets. Therefore, this section discusses the initial conditions of a water dispenser with two faucets (1 faucet for cold water and one faucet for hot water) according to the factory standard two faucet dispenser conditions on the market. In general, the distribution system scheme for the water dispenser can be seen in Figure 1.
2) Proposed System: As a development of the initial conditions, this water dispenser can be operated without touching the water faucet. The proposed system block diagram can be seen in Figure 2. In this study, a gesture sensor is used to pick hot and cold water. The water exit is only in one position to avoid mistakes while inserting the glass. Water will only come out if the glass is placed in a specific position. Finally, the faucet will pour water into the glass for a set amount of time. The Arduino module is used to control the input and output processes.

3) Hardware Requirements:
The hardware requirements can be explained as follows, based on the proposed system.: • The minimum specifications for the computer/laptop are core2duo or equivalent to 2GB RAM and 500GB hard disk used to program Arduino as system control. • Power Supply 12 volt 2 amperes is used to supply voltage for Arduino and other electronic devices. • Arduino Uno module is used as the main control of the system. • Water dispenser with two faucets.
• The APDS-9960 gesture sensor is used as a hand gesture detector. • Ultrasonic sensor HC-SR04 is used to detect the presence of glass. • Servo motor used as actuator drive.
• LEDs are used as indicators.
• Jumper cables for connection between electronic devices.
• The breadboard is used as a board for designing prototypes.
• Gear and actuator function as faucet pull the arm.
• Faucets, hoses, and pipes. 4) Software Requirements: Software with the following standards is required to support the hardware of the proposed system: Windows 7 Operating System and Arduino Software (IDE).

D. Hardware Design
As a first step, this section describes the mechanical design of an automatic water dispenser using hand gesture detection, as shown in Figure 3.  Figure 4 shows the architectural design of an automatic water dispenser using Arduino-based gesture detection. This system architecture aims to explain the workflow of the proposed system. The system architecture states how to define more specific input and output components in a structured manner to show the architecture of the proposed system components.
The first time the ultrasonic sensor detects whether the glass has been placed in the correct position. If the ultrasonic sensor fails to detect the position of the glass correctly, the system will not activate the gesture sensor to detect hand movements. On the other hand, if the position of the glass is detected correctly by the ultrasonic sensor, the ultrasonic sensor will send a signal to the Arduino for processing, then turn on the LED indicator of the glass, and the gesture sensor will be activated.
Furthermore, hand gestures are detected by the gesture sensor. If the hand moves from right to left, the gesture sensor will send a signal to the Arduino for processing, and then the Arduino will turn on the hot water indicator LED and activated the servo motor to pull the hot water faucet, so hot water flows into the glass. On the other hand, if the hand moves from left to right, the gesture sensor will send a signal to the Arduino for processing, then the Arduino will turn on the cold-water indicator LED and then activated the servo motor to pull the cold-water faucet so that cold water flows into the glass. This research is a combination of mechanical devices and electronic devices. In the previous section, the mechanical devices and system architecture have been described. An electronic device is an electronic circuit consisting of electronic components that form a unit for a particular purpose. The circuit schematic is a design map of an electronic circuit containing pictures of electronic components and connecting paths from one component to another.
This stage describes the circuit schematic, starting from the input module, output module, and overall schematic. As explained in the system architecture, the input module consists of an ultrasonic sensor module and a gesture sensor module, and the output module includes an LED indicator and a servo motor.
The schematic of the input module circuit for the ultrasonic sensor is shown in Figure 5. This circuit is used to detect the presence of glass. The HC-SR04 ultrasonic sensor module consists of 2 transmitter control pins (trig pins) connected to the Arduino microcontroller module on pin eight and as a receiver (echo pins) connected to pin 7 of the Arduino microcontroller module. In comparison, the ultrasonic sensor power supply pin is connected to the Arduino microcontroller module power supply pin.   Figure 6 is the circuit schematic for the APDS-9960 gesture sensor. This gesture sensor module is used for hand gesture detection. In this study, two types of motion were detected, namely hand wave motion to the right to choose cold water and hand wave motion to the left to choose hot water. The APDS-9960 gesture sensor module has six pins, consisting of pins VL, Vcc, Gnd, SCL, SDA, INT, which have a function as a positive power pin with a voltage of 3v-0.5v, a positive power voltage of 2.4v-3.6v, negative power, serial clock signal, serial data address for transmitting data and interrupt. The SDA sensor module pin is connected to the A4 pin of the Arduino microcontroller module. In contrast, the SCL module pin of the gesture sensor is connected to the A5 pin of the Arduino microcontroller module. The VCC power pin in the picture symbolized Vin is connected to the 5-volt voltage pin of the microcontroller module, and the sensor module's GND pin is connected to the GND pin of the microcontroller module.
The LED circuit schematic, as shown in Figure 7, is used as an indicator. Red LED light indicates hot water; green LED light means cold water, and amber LED light indicates the position of the glass has been detected. The negative pins of the three LED lights are connected in parallel with the GND pin of the Arduino microcontroller module. The positive pins of the red, yellow, and green LEDs are connected to pins 4, 5, and 6, respectively. The circuit schematic for the servo motor in this study was applied as a faucet puller actuator. The actuator is assisted using a gearbox so that the servo motor can pull the water faucet. Two servo motors are needed. Each servo motor is used to pull cold and hot water faucets. In the initial condition, the faucet is closed. When the faucet is pulled with a servo motor, the valve will open, and the water will flow into the glass already available at a certain position. The servo motor will pull the water faucet for a predetermined time of 30 seconds. The servo motor will automatically return to the original faucet position so that the water faucet valve will close and the water flow will stop. The schematic of the servo motor can be seen in Figure 8. The servo motor power pins, VCC, and GND, are connected in parallel with the microcontroller module's power pins, respectively. The servo motor is controlled by data pins that are connected to PWM pins 9 and 10 on the Arduino microcontroller module. The overall circuit schematic of this study is shown in Figure 9. This schematic is an overview of the overall electronic circuit of the system proposed in this study. Figure 9. Schematic of the whole system.

E. Software Design
Software design is the stage of software development as a reference in program development. The main target is a representation of the software on the Arduino Uno microcontroller. Describe the functions of each component, engineering structure, data control, and control of the inputoutput module which is connected to the Arduino microcontroller. Software design is very important because it can affect the system's performance, durability, and maintenance. The software design is represented using a flow chart, as shown in Figure 10.

III. RESULTS AND DISCUSSION
The system proposed in this study is an automatic water dispenser based on hand gesture detection using Arduino as the main control. The system is intended for the public to use the dispenser without direct contact and make it easier to use. This system is devoted to a water dispenser with two faucets, each of which is used to drain hot and cold water.
In addition, this system is made to be more sterile when placed in a public place and easier to use by everyone. This dispenser utilizes several sensors, one of which is an ultrasonic sensor that functions as a detector for the presence of glass and as a dispenser switch button.
The control system on this dispenser uses a hand gesture sensor that functions to determine hot and cold water. In principle, it is enough to move your hand in front of the gesture sensor to select the type of hot or cold water. The final result in Figure 11 of this study is an automatic water dispenser based on hand gesture detection using Arduino. Figure 11. Automatic water dispenser based on gesture detection.

A. Glass Presence Detection Test
This glass presence detection test is intended to detect the glass in a predetermined position. The test scenario is placing the glass in various positions and testing it with various kinds of glass, namely ceramic glass, clear glass, and plastic cups. The test for detection of the presence of this glass is shown in Figure 12. The ultrasonic sensor then detects the glass that has been placed in front of the ultrasonic sensor. When the ultrasonic detects the presence of glass, the middle led light will display a notification in the form of a yellow led light indicator. The test results for the detection of the presence of glass can be seen in Table 1.

B. Hand Gesture Detection Test
The first test is done by waving from right to left to choose hot water. Movement speed varies from slow to fast with a duration of 1 to 5 seconds. If the hand gesture is successfully detected, the water dispenser will automatically turn on the red LED and drain water from the hot water faucet, as shown in Figure 13. The second test was carried out by waving from left to right to choose cold water. If the automatic water dispenser successfully detects hand gestures, the green LED will be turned on, and water will flow from the cold-water faucet as shown in Figure 14. Based on the two test scenarios above, the overall test results can be seen in Table II.

C. Water Volume Test
This water volume test is carried out to measure the volume of water released by the dispenser. The scenario in this test is to set a different time duration every 10 seconds, then the volume of water is measured using a 1000 ml capacity measuring cup. This automatic dispenser drains water into the glass based on the duration of time. The longer the specified time duration, the more volume of water will be issued by the dispenser. The results of this water volume test are presented in more detail in Table 3. IV. CONCLUSION Based on the test results, the automatic water dispenser in this study can detect ceramic cups, clear glasses, and glass cups at a distance of 1-3 cm and cannot detect glasses more than 3 cm. The gesture sensor on the automatic dispenser in this study can detect hand movements with movement speeds between 1 to 3 seconds and cannot detect more than 3 seconds (very slow motion). The gesture sensor on this automatic dispenser can detect hand movements with a distance between 5 cm to 15 cm. According to the user's hand gesture, the dispenser can only dispense water at a distance of 5 cm to 15 cm and hand movement speed between 1 second to 3 seconds. Other than that, it does not release water. The volume of water flowing into the glass by this automatic dispenser is on average 80 ml per 10 seconds