The Use of An Arduino Uno Ultrasonic Sensor in Desalination Equipment's Water Filling Control

A sensor called an ultrasonic sensor works by converting electrical quantities into physical quantities (sound) and vice versa. An Arduino Uno is required to activate the system's ultrasonic sensor. The reservoir's water level is determined using ultrasonic sensors. The purpose of this investigation is to learn how to put together, program, and utilize the HC-SR04 Arduino Uno ultrasonic sensor with the Arduino IDE (Integrated Development Environment) application. Controlling the water in the desalination system is required so that the water entering the reservoir does not waste or overflow and pollute the desalinated water. An ultrasonic sensor is attached to a seawater desalination system using the evaporation method, and the sensor is put on the edge of the evaporation pond in order to conduct experimental testing of the ultrasonic sensor on the device. The desalination tool can operate more efficiently and under control with the help of the HC-SR04 ultrasonic sensor by automatically filling the water in the evaporation pond. The sensor will automatically supply the water shortage when the seawater evaporates. Results of experimental observations made with the HC-SR04 ultrasonic sensor on an evaporation bath with three water filling cycles are available. so that after 7 days, 13% of the volume that was filled in the evaporation basin has evaporated.


Introduction
In human life, as well as for coastal communities who require clean water or water fit for consumption for their everyday lives, the requirement for clean water is of the utmost importance.Water must be clear, odorless, and have no change in color before it can be considered fit for drinking.It also must not include any salt.[1].Desalination technology can help those in need of clean water by providing it.The conversion of saltwater into freshwater is known as desalination.Evaporation is one of the techniques used in desalination technology.This method uses heat to evaporate seawater, which is then condensed to generate clean water.Electricity, gas, and sunlight are just a few of the resources that are employed as a heat source [2].A seawater holding tank serves as a seawater container in the evaporation process in this evaporation technique.The position or presence of water in the reservoir is denoted by the word "water level."A tool is required to determine the capacity of the water being filled because as water is being filled, the water level will rise and may even exceed the reservoir's capacity.This situation will result in water waste.[3].
People are encouraged by current technological advancements to think creatively as they explore new ideas and leverage the capabilities of already-existing technology to make daily tasks easier for humans.2019 [4].The employment of microcontrollers, as an example of the evolution of digital technology, will have a significant impact on the simplicity of human activity processes [5].A microcontroller is a piece of technology that serves as the most basic type of tiny microcomputer.Microcontrollers are a common component of current electronic equipment, not just in high-tech gadgets but also in more basic devices that might benefit from technology to make life easier [6].Applications for this ultrasonic sensor include determining water levels, robot control systems, and others.Microcontrollers can be utilized to create electronic systems that use ultrasonic sensors as a determinate of the distance of an object in a space [7].
Ultrasonic sensors are frequently used to measure water levels.An ultrasonic sensor is a sensor that can emit sound waves in addition to converting physical quantities (sound) into electrical values and vice versa.Sound waves with an ultrasonic frequency are those with a frequency of 20,000 Hz.Human ears are not capable of hearing ultrasonic sound.Solids, liquids, and gases can all be penetrated by ultrasonic sound [8].There are various components to the ultrasonic sensor, including the ultrasonic sensor.The SRF05 is a non-contact ultrasonic distance sensor that can measure distances between 3 cm and 3 m with an output pulse length that is comparable to object distance [9].It works by transmitting a beam of ultrasonic waves and then timing the time it takes for the waves to reflect back from the object.The two HC-SR04 ultrasonic sensors are ultrasonic wavebased distance measuring sensors, and they can measure distances of up to 400 cm by emitting ultrasonic waves and then receiving them back from an ultrasonic receiver [10].Last but not least, the PING ultrasonic sensor can measure objects from 2 cm to 300 cm.It operates by sending out pulses whose width corresponds to the object's distance; these pulses' widths range from 155 uS to 18.5 uS [11].In general, a water pump machine that is effective for taking water and sending it into the tendon is still used to fill the tendon with water.When the water reservoir is empty, the water pump machine must be manually turned on, and when the water reservoir is full, the pump must be manually shut off [12].The purpose of this study is to learn how to put together, program, and use the Arduino IDE (Integrated Development Environment) software to fill the evaporation tub using an ultrasonic sensor on an Arduino Uno.

b. Tools and Materials
The HC-SR04 ultrasonic sensor, Arduino Uno, Arduino IDE, relays, jumper cables, breadboards, water pumps, hoses, and buckets were the equipment used in this investigation.Sea water is utilized as the primary ingredient in the evaporation method of desalination.

c. Work procedures
An experimental approach was applied during the study's work procedures.The author experiences and performs his own experiments on the subject being examined as part of the experimental technique of data collection.In order for the writer to reach conclusions, you must feel it for yourself and figure out the reality behind it based on the process that has been encountered.The stages of this study's experimental methodology are as follows: 1. Observation (survey of research locations) A site survey was carried out to ensure the conditions where a desalination device equipped with an ultrasonic sensor could be installed.

Design
The ultrasonic sensor, Arduino Uno, breadboard, relay, and nine jumper wires are the tools used in the construction of the first Arduino Uno microcontroller, which must prepare all the electronic components to be installed.The circuit required as a guide and foundation for putting tool design into practice is as depicted in the following picture.Following the creation of the design, programming is done to control the Arduino Uno with connected components.The Arduino IDE (Integrated Development Environment) software is used to program the board.It is tested after programming the HC-SR04 ultrasonic sensor to see how the procedure functions.In order to test if the sensor will automatically turn on, a seawater tank with a 20 cm capacity was filled to the top and left to recede 19 cm.

d. Data Analysis
Descriptive analysis of the data was employed in this study.With the presentation of the data in the form of descriptions, depictions, and explanations connected to the study conducted and delivered as well as possible so that it is understandable, this method is meant to acquire data utilized in research.This study is descriptive in nature, covering all steps from initial planning to sensor assembly and testing on a desalination unit.

a. Ultrasonic Sensor Assembly with Supporting Components
Putting the ultrasonic sensor along with the supporting parts that were created in the earlier stage, followed by the real integration of the electronic parts to combine with the mechanical circuit.Then, using programming in the Arduino IDE software, the logic to control it is applied to the system.Software called Arduino IDE is used to write programs with commands in them and upload them to the Arduino Uno microcontroller to carry them out.Using the C programming language, one may create program code that serves as instructions and seeks to run the system so that it can function in accordance with the program code that has been uploaded to Arduino Uno.Because program code is the most crucial component in creating a tool, the system cannot function without it [13].

b. Ultrasonic Sensor Design
The ultrasonic sensor component is designed with instructions on where to install it and how to connect it to an Arduino Uno.This ultrasonic sensor measures the water's depth and transmits the information to Arduino for processing.The ultrasonic sensor contains four pins that serve as a connection between its various parts.VCC is linked to a breadboard at +5 volts, Trig to an Arduino at 9 volts, Echo to an Arduino at 10 volts, and GND (ground) to a breadboard at 0 volts.Using this breadboard, you may create basic electronic circuits (Figure 2).

c. Relay Design to Arduino Uno
Relay is a device with an actuator consisting of coils of copper wire that acts as an electronic switch.A magnetic field will develop in the iron core as a result of the copper coil on the iron core with a 5 volt power source on both ends.This enables the relay to be employed in the construction of this tool as a switch to turn on other electronic components [14].This relay is a part that will subsequently be attached to the water pump in order to drive the water pump.The relay contains 3 pins that serve as a connection between its many parts; 8 Arduino functions are attached to IN to read program input; GND and VCC are connected to -and + breadboards, respectively; this breadboard serves as a trial prototype without the need for soldering.A relay design is created to explain where to position the relay and how to link it to an Arduino Uno (Figure 3).

d. Ultrasonic Sensor Design with Supporting Components
The design of this ultrasonic sensor circuit serves to regulate and detect objects in front of it by utilizing ultrasonic waves of around 40 kHz sound wave speed).Nine jumper wires of the same color are required to link the ultrasonic sensor to the Arduino Uno, this relay, and the breadboard.This ultrasonic sensor has 4 pins with different functions, starting from VCC (5V power supply), trigger as (sender), echo as (receiver), and GND (ground) (Santoso, 2015) (Figure 5).The explanation behind Figure 5 above is as follows: 1.The Arduino Uno is linked to the ultrasonic sensor through its four colored wires (orange, blue, green, and yellow).Each has TRIG, ECHO, VCC, and GND.Trig pin is connected to Arduino 9, Echo pin is attached to Arduino 10, GND is connected to (-) breadboard, and VCC pin is connected to +5v. 2. There are colored cables (white, black, and gray) connecting Arduino Uno in the relay portion.Everybody has IN, GND, and VCC.The GND pin is connected to the (-) breadboard, the VCC pin is connected to the (+) breadboard, and the IN pin is connected to Arduino pin number eight.

e. Programming
Programming is done with the intention of loading a program that will carry out the programmer's instructions.The programming process for the HC-SR04 ultrasonic sensor makes use of a program that will be controlled by an Arduino uno board and makes sure that the program developed with the Arduino IDE software can be run in accordance with the previously planned design.There is an Arduino IDE display, as seen in Figure 6.first be opened.Then, the desired program module must be created.Then, the USB cable must be connected to the Arduino Uno, which has been developed with an ultrasonic sensor.Finally, the program must be uploaded.Once uploading is finished, the sensor can be evaluated.
A program code that serves as a seawater height detector in the evaporation tub is incorporated into the ultrasonic sensor's design and is as follows: To begin, write the following code: int (integer) trig_pin = 9, int echo_pin = 10, which stand for initialization of the Arduino Uno's ultrasonic sensor pin and water pump pin, respectively (Figure 7).Third, developing a command program that repeatedly executes each command as shown in Figure 9 by constructing a void loop.The water pump is immediately turned on and the evaporation tub is filled when the distance between the sensor and the water level is less than 10 cm, in addition to the void loop.

f. How Ultrasonic Sensors Work in Evaporation Tubs
The next stage is to test the ultrasonic sensor design prototype tool after it has been put into practice.Tool testing is done to determine whether the intended functions are functioning as intended or not [15].To identify problems with the system so that they may be fixed later, testing is done.To assess the sensor's level of performance, tool testing is also helpful.Results of the ultrasonic sensor trial, which was conducted during practice and consisted of three tests over the course of seven days, are shown in table 5 of the sensor trial.Turns on, the water machine automatically turns on and fills with water so that the water level becomes 20 cm and the machine automatically turns off after it is full Based on table 1, experimental observations on the ultrasonic sensor were conducted on May 17-20, 2022, with a water level of 20 cm and an active sensor response.Then, water evaporation occurred, causing a decrease in the water level by 1 cm for 3 days, and on May 20-24, 2022, there was a decrease in the water in the tub with a remaining water level of 19 cm before it was refilled to 20 cm with an active sensor response.The sensor reaction went well during the seven-day tests, which involved filling the sensor three times with water.This is so that the Arduino Uno can determine how much water has been accommodated in the tub by receiving a signal from the HC-SR04 ultrasonic sensor, which measures the water level in the holding tank.When the tub's water reservoir is full, a signal is immediately delivered to stop the water pump.

Conclussion
The assembly and programming of the Arduino uno HC-SR04 ultrasonic sensor are a mutual connection between the ultrasonic sensor, Arduino uno, relay, and breadboard with a connecting device in the form of a jumper cable, it can be inferred from the findings and discussion above.The constructed tools are then programmed using the Arduino IDE software in accordance with the programmer's specifications.According to the test results, the sensor illuminates correctly as the water level drops.If the reservoir is full, the Arduino Uno HC-SR04 ultrasonic sensor will send a signal, and the water pump will shut off on its own.

Figure 5 .
Figure 5. Ultrasonic Sensor Design With Supporting Components

Figure 6 .
Figure 6.Display of the Program in the Arduino IDE SoftwareFigure 6 shows the Arduino IDE software's program display.Writing program code and running all the electronics that are used and processed by Arduino Uno as a water pump controller are done using the Arduino IDE.The Arduino IDE software must

Figure 7 .
Figure 7. Initialization of Ultrasonic Sensor Pins

Figure 8 .
Figure 8. Initialization of Ultrasonic Sensor Pins

Figure 9 .
Figure 9. Display of the Program in the Arduino IDE Software