Arduino system and ultrasonic sensor for automation of the determination of water infiltration rate in soil

The velocity of water infiltration in soil is important for the design of irrigation systems, drainage, septic tanks, sanitary landfills, dams, channels for water distribution, soil and water management to control erosion and estimate surface runoff. Infiltration tests are generally done with rulers and visual reading, which can lead to errors. The present study therefore aimed to determine the Infiltration Velocity (IV) curves of water in the soil by the concentric ring infiltrometer method, using an Arduino microcontroller and an ultrasonic sensor to measure the lowering of the water depth. For that, in the same infiltration test, four readings in Automatic mode (AT) and four readings in Manual mode (MN) were performed simultaneously, in a redyellow Argisol type soil, in the Areal Basin, located in the southeastern region of Brazil. municipality of Taubaté, Vale do Paraíba, in the state of São Paulo. Adjustments of kostiakov curves and their equations were made from the data obtained in the field, and the values of R2 were determined, as well as the values of Basic Infiltration Velocities (BIV), Accumulated Infiltration (AI) and the Average Percentage Error (APE) of the calculated IS values and those estimated by the equations. The results show that the number of readings in the same test time in Automatic mode (AT) was 2.3 times higher than in the manual (MN). All tests showed that the Red-Yellow Argisol showed a high infiltration speed, and in the pasture area the BIV values were 1.9 times higher than those obtained in the forest area. The R2 determination coefficients for all curves are 0.99 in all tests and demonstrate the strong correlation between the data. The APE of the calculated and estimated IS values were low, and the biggest discrepancies that occurred were (APE = 0.30%) in the MN 4 test and (APE = -0.01%) in the AT 4. APE of MN mode BIVs for AT was 2.7%. These differences in IS values are reflected in the accumulated infiltration (AI) in the soil over time, and in this study the AI of the ATs tests was on average 4.1mm higher than in the MN tests, which corresponds to a difference of 41m3 ha. It was concluded that the use of the Arduino microcontroller with the ultrasonic sensor installed in the ring infiltrometer proved to be efficient in the field measurements and made the determination of the accumulated infiltration and the infiltration speed practical, proving to be an economical and technically viable alternative mainly due to the quantity of possible points to collect for each test and the greater reliability added to the low error values when compared to the manual.


INTRODUCTION
The rate of water infiltration into the soil is influenced by several factors, such as the type of soil, management, cultivation, physical properties (texture, structure, degree of compaction) and the moisture content of the soil. It is a process of great relevance, as it directly affects the runoff of water on the soil surface, which is the component of the hydrological cycle responsible for the processes of erosion and flooding in cities. In addition, knowledge of the infiltration speed is important for the design of irrigation systems, drainage, septic tanks, sanitary landfills, dams, channels for water distribution, soil and water management for erosion control and estimation runoff, etc.
In addition to the great difficulty in determining the BIV for different types of soil associated with a cover or use and the small number of studies carried out in Brazil, the 3 Arduino system and ultrasonic sensor for automation … Rev. Ambient. Água vol. 7 (supplement) -Taubaté 2020 hydrological classification based on the soil's soil characteristics appears as the most viable solution (Sartori et al., 2005) for most studies that use this information.
However, in Brazil the minimum infiltration rates found in general are much higher than those established by SCS in the definition of soil hydrologic groups.
Results of water infiltration tests in the soil of the Vale do Paraíba do Sul region, in the state of São Paulo with adjustments made using the Kostiakov equation were compiled by Sales and Targa (2015), in which concentric rings were used using methodology of concentric rings and with the measurement made by ruler, are those made in the different uses and ground coverings made.
The type of use and management of the soil interferes with the infiltration speed, due to the improvement of the physical characteristics of the soil. Studies with no-tillage system indicated values in the order of 571 mm h -1 (Cunha et al., 2009). In Lages, SC, average values of the initial and final water infiltration rates measured in grazed native fields were 700 and 90 mm h -1 , respectively; in conventional tillage, were 1940 and 280 mm h -1 and in direct seeding were 850 and 170 mm h -1 (Bertol et al., 2001). Cassol (2003) found an increase in water infiltration directly proportional to the increase in pasture residue height. Bertolani and Vieira (2001), for example, found water infiltration rates in an abrupt eutrophic Red Yellow Argisol much higher than the minimum infiltration rates given by SCS.
The most widely used method for determining the rate of water infiltration in soils is the concentric double ring infiltrometer, in which the water depth measurement can be done by establishing specific times or drawdowns. Measurement of water infiltration rate using rulers, scales and floats can cause gross errors due to the visual accuracy of the observer who collects the data and the time it takes to make the initial reading. Likewise, adjustment using the kostiakov potential equation is the most easily used and with the advent of using Excel, the most easily performed. In this way, the automation of this methodology can improve the accuracy of the data reading and also provide a better adjustment of the infiltration equation. Infiltration tests conducted with the use of a laser measuring tape and a thin Styrofoam disc on the water surface were performed by Santos et al. (2011) and by Sales and Targa (2015).
One of the ways to automate is to use microcontrollers both in control circuits and in systems that will provide information for the control; however, in both cases, basic programming is necessary so that the microcontroller knows what to do. These instructions are made from software prepared to convert the programming language used to the machine language. Thus, microcontrollers are considered by many to be small computers on a single integrated circuit, which contain processors, memory and input and output peripherals. They are used in specific applications or for general purpose applications. This type of equipment is increasingly becoming economically viable for the digital control of many devices and processes, due to its processing power and memory, especially due to its low power consumption, size and price.
One of these microcontrollers is the Arduino platform, which has made it possible for different uses to obtain data collected in the field faster. Arduino is a physical computing platform composed of single board microcontrollers and a development environment for writing programs for the boards, and can be used in a wide variety of applications. The hardware and software of this platform are open source, that is, the source code of the development environment and the schematic of the boards are freely available (Arduino, 2018).
Technological innovations allow the development of increasingly complex forms of automation, aimed at the most diverse tasks and in this sense, mainly in the environmental and agricultural areas, the use of the Arduino microcontroller with the ultrasonic sensor installed in the ring infiltrometer can prove efficient in field measurements and make accumulated infiltration (I) and infiltration speed (IS) more practical and reliable.
Examples of circuits developed in Arduino for applications in agriculture and monitoring of environmental variables can be found in Masseroni et al. (2016), Karami et al. (2018) and Targa et al. (2019) and Pereira et al. (2020). This study aimed to determine the Infiltration Speed (VI) curves of water in the soil using the concentric ring infiltrometer method with the use of an Arduino microcontroller and an ultrasonic sensor to measure the water depth drop.

Study area characterization
The present study was carried out at the São Vicente site, in the areal hydrographic basin, located in the southeastern region of the municipality of Taubaté  The climate of the region and the temperate type with mild summer, and by the climatic classification of the International Köeppen system presents a less humid period from April to September and a rainy period from October to March.
Tests of water infiltration in the soil were carried out at four different points, two in a place with tree cover and two with pasture. The tests were carried out in August, the driest period in the region of Taubaté, SP, with only 31 mm of average monthly precipitation (1964 to 2011) as (São Paulo, 2019), which is excellent for determining infiltration tests, because the infiltration curve can be produced in its entirety from the driest point to the saturation of the soil, depending only on the water that is placed in the test.

Characterization of the Areal basin
With regard to physical characterization, the Areal Hydrographic Basin is classified as a 3rd basin order with an area of 1.89 km² and its outlet is located at Latitude 23°05'50,52 S and Longitude 45°27'57,12. The thalweg of the watercourse has an extension of 3,112 km, and its source is at altitude 810m and its exutorio at 640m.

Concentric Ring Infiltrometer
This study used the Concentric Ring Infiltrometer (Figure 2), whose cylinders are 25 and 50 cm in diameter and 30 cm high. They were installed concentrically and driven 5 cm into the ground. The double ring tends to prevent lateral water transfer, so that the infiltration in the inner ring occurs vertically and there is no overestimation in the infiltration rate. The basic infiltration rate BIV or constant infiltration will be considered when the water reading in the inner ring is repeated at least three times in a row (Brandão et al., 2006).

Arduino microcontroller and ultrasonic sensor
An Arduino UNO R3 microcontroller ( Figure 3a) was used, whose platform consists of an open-source platform based on hardware and software for the areas of automation and robotics (Silva et al., 2014). Several types of sensors can be connected to this type of microcontroller, among which are those that can be used for measuring water level in hydraulic systems. In general, sensors used on the Arduino platform have the advantage of low energy consumption and can be powered by batteries and low voltage photovoltaic energy systems (Bitella et al., 2014). Tests were carried out with several sensors, including the hc-sr04 and Us-015 sensors, easily found on the market and at low cost, and the higher cost LV-MaxSonar-EZ4 sensor. However, these tests demonstrated that the Us-015 sensor proved to be more stable than the others, with respect to the oscillation of water slide readings, and, therefore, more efficient.
The sensor for measuring the lowering of the water depth in the soil water infiltration test (Ultrasonic Distance Sensor Us-015) Figure 3b, is composed of an emitter and a receiver of sound waves. The signal emitted, when colliding with water, is reflected back towards the sensor. This module was chosen due to its ease of purchase on the market, its low cost and good output resolution. Its specifications are: working voltage of DC 5 V, static current of 3 mA, working temperature between 0 ~ + 70°C, induction angle of less than 15°, detection range between 2 cm to 400 cm, detection of accuracy of 0.1 cm + 1% and size of approx. 45 x 20 x 1.6 mm. Figure 4 shows the diagram of mounting the ultrasonic sensor on the Arduino board. The ultrasonic sensor has a kind of high precision "stopwatch" that makes it possible to know how long the signal takes from the emission of the sound wave until its return. As the speed of sound in the air is known (340 m s -1 ), it is possible, in possession of the time it took the signal to go to the obstacle and back, to calculate the distance between the sensor and the obstacle using Equation 1. According to Pepperl+Fuchs (2015), the measurement accuracy of ultrasonic sensors usually refers to the absolute precision of the measured value at the analog output and based on the transit time of the echo, the measurement accuracy of an ultrasonic sensor depends on various physical parameters related to air, as well as internal tolerances. Air humidity has a negligible influence on the speed of sound, even at lower temperatures. However, at higher air temperatures, the speed of sound increases as humidity increases. Due to air pressure, the speed of sound decreases by less than 1% between sea level and 3,000 m altitude. Atmospheric fluctuations in a specific location are insignificant and the effects on the speed of sound are 7 Arduino system and ultrasonic sensor for automation … Rev. Ambient. Água vol. 7 (supplement) -Taubaté 2020 hardly measurable.
To capture the data read directly into Microsoft Excel, the software Parallax Data Acquisition tool (Parallax Inc., 2018) was used, which is a free add-in tool that allows the acquisition of up to 26 channels of data collected by microcontrollers and organizes numbers in columns within a spreadsheet in real time. This made possible the assembly of graphs, calculations and other analyses according to the programming of the lines of code in Arduino (Silva et al., 2014).

Experimental procedure
In order to carry out water infiltration tests in the soil, the site was initially cleaned, the concentric rings were installed in the soil and the Arduino was connected to the computer. After the rings had been driven into the soil at a depth of 5 cm, the water was placed in the two rings and, with a graduated ruler, positioned vertically on the inner wall of the inner ring. The water layer was read, and notes were made in a printed table of the values of water volume placed in the ring, at predetermined time intervals, and the time was recorded with the aid of a watch with a stopwatch. The data were later processed in an electronic spreadsheet. The reading differences between two time intervals represents vertical infiltration. The height of the water slide on the two rings was maintained at around 15 cm, and a maximum variation of 2 cm was allowed, at which time water refills and readings of the new height were made. This process was carried out until the infiltration rate reached a constant value, evidenced by the repetition of consecutive readings. It is important to note that the ruler used in the ring for manual measurement was installed inverted to the traditional pattern, that is, with decreasing values downwards, precisely to facilitate the comparison of data with the automatic method, as the sensor measures the distance from the water to the receiver. At the same time as the manual reading was done, the pre-installed equipment reads automatically when the microcontroller starts to operate ( Figure  5). The Arduino microcontroller in this study was programmed in such a way that the ultrasonic sensor automatically takes the readings and the time and distance values are automatically launched in a Microsoft Excel spreadsheet at 30-second intervals. As a measure to facilitate identification, the time and reading values at the time of each refill were recorded manually.

RESULTS AND DISCUSSION
The data obtained in the field from the performance of four infiltration tests in four different locations in Red-yellow Argisol in the Areal Basin, in an automatic and manual way, were plotted in a Microsoft Excel spreadsheet in order to obtain the speed graphs. Infiltration (IS) and Accumulated Infiltration (AI) and adjust the Kostiakov equations, according to the methodology described in (Bernardo et al., 2019).
When analyzing the tests, it was verified that although the duration of the tests was the same in each location, the number of readings in the automatic test was slightly higher than twice the readings performed in the manual test. This evidently has two reasons: in the manual test there is necessarily a more pronounced lowering of the blade so that the observer can visually identify this variation on the ruler in mm and record it, while in the automatic test the frequency of readings is pre-established , so that while manually a person can register a single reading per minute; in the automatic, you can take sixty readings in 1 minute.
The first infiltration test in the automatic and manual modes was carried out in the geographical position Latitude 23°05'50.50" S and Longitude 45°27'57.11" in an area with a lowland characteristic covered with native forest vegetation. The Basic Infiltration Velocity (BIV) at that location was 1.74 mm min -1 and was achieved with 72 and 35 readings, respectively, in the automatic and manual measurement process.
The second infiltration test in automatic and manual mode was carried out in the geographical position Latitude 23°05'50,52" S and Longitude 45°27'57,12" in an area with lowland characteristics covered with native forest vegetation. 65 readings of water blade height were taken in the automated measurement process and 30 readings in the manual process. In the automatic test, the Basic Infiltration Velocity of the soil was (BIV =2.21 mm.min -1 ) while in the manual procedure it was (BIV = 2.26 mm min -1 ).
The third test, in automatic and manual mode, was carried out in the geographical position Latitude 23°05'50,51" S and Longitude 45°27'57,10" in an area covered with pasture vegetation. Eighty-one water-blade height readings were taken in the automated medication process and 35 readings in the manual process. In the automatic test, the BIV was determined to be 3.97 mm min -1 , and in the manual the BIV was determined to be 3.77 mm min -1 .
The fourth test, in automatic and manual mode, was performed in the geographical position Latitude 23°05'50,52" S and Longitude 45°27'57,12" in an area covered with pasture vegetation. Eighty-two water-blade height readings were taken in the automated medication process with the Arduino sensor and 35 readings in the manual process. In the automatic test, the Basic Infiltration Velocity BIV was 3.67 mm min -1 , while in manual mode the BIV was 3.50 mm min -1 .
The infiltration velocity as a function of time graphs, referring to the infiltration tests performed in the Automatic (AT) and Manual (MN) measurement modes in locations 1,2,3 and 4 in the Areal Basin are shown in Figures 6 (a) and (b), respectively. To enable a better visualization, the potential type curves were linearized, transforming the values of the x and y axes of the graphs into logarithms.
It can be seen in relation to Figure 6a and 6b that there are differences in the initial values of the Infiltration velocity curves which modify their slope, and therefore the decay coefficient of each one is also different. In general, in the automatic test the values started in less than 1 minute, while in the manual, in order to notice a difference, the first readings took place after 1 minute. Regarding the behavior of the infiltration curves of Figure 6a, it is observed that the curves corresponding to the AT -1 and AT -2 tests are parallel, while AT -3 and AT -4 9 Arduino system and ultrasonic sensor for automation … Rev. Ambient. Água vol. 7 (supplement) -Taubaté 2020 intersect. This behavior is also observed in the Manual reading test. However, it is observed that AT -3 and AT -4 have a greater proximity than MN -3 and MN -4, because in this, a greater dispersion in the data is observed in relation to the adjusted curves. From the graphs of Figures 6a and 6b, Kostiakov equations were then adjusted for the values of velocity of water infiltration in the soil obtained in the field automatically and manually. Basic Infiltration Velocity (BIV), Accumulated Infiltration (AI), Determination Coefficient (R²) and Average Percent Error (APE) values were also established, which are described in Table 1. The percentage error measures the percentage of the error in relation to the real value and can be calculated using Equation 2 and 3, adapted from Machado and Cabrita (2009, p. 26).  As can be seen in Table 1 the soil of the basin is Argisol Red -Yellow, the infiltration speed and accumulated infiltration increased from Site 1 to Site 4. This is probably due to the fact that Sites 1 and 2 have native forest cover, and due to the presence of vegetable remains on the surface and shading, they maintain a higher moisture content, providing less infiltration (Panachuki et al., 2006). Conversely, the grazing areas in Sites 3 and 4, were drier and did not present compaction, as they have been at rest for several years. Although they have been classified hydrologically as soils (type B) of moderate infiltration, the order of the values found for the rate of infiltration in these soils are in the range of 104 to 280 mm h -1 , that is, much higher than the standard of this hydrological classification of SCS-USDA, as Bertolani and Vieira (2001) have already observed.
The Basic Infiltration Velocity (BIV) is the lowest value that the soil can infiltrate after it has been saturated; thus, it is the maximum limit of infiltration capacity of that soil for the design of irrigation structures, dams, infiltration ditches, embankments toilets and cemeteries.

11
Arduino system and ultrasonic sensor for automation … Rev. Ambient. Água vol. 7 (supplement) -Taubaté 2020 The process of water infiltration in the soil depends on the type and arrangement of soil particles, soil moisture, type of surface, height of the water blade during the test, quality of water recharge, accuracy with which the values are read, and the thickness of the saturated layer. The areas in native forest presented values of Basic Infiltration Velocity (BIV) more stable between the Automatic and Manual test modes than the areas with pasture, and in addition, the average BIV in the pasture area was of the order of 1.7 times higher than that found for the native forest area.
The initial IS in the AT -1 and MN -1 tests were 31 and 23 mm min -1 , respectively, and the final was 1.74 mm min -1 for both. The IS increased from 38.57 mm min -1 at the beginning of the test to 2.26 mm min -1 at the end of the AT -2 test and from 30 mm.min -1 to 2.21 mm min -1 in the MN -2 test. The values found for IS at the beginning and end were 31.20 and 3.97 mm min -1 for the AT -3 test and 20 and 3.77 mm min -1 for the MN -3 test, respectively. In Area 4, the values found for IS at the beginning and the final results were 42.20 and 3.67 mm min -1 for the AT -4 test and 57.14 and 3.50 mm min -1 for the MN -4, respectively.
Regarding the data obtained in the tests and the adjusted equations, it can be inferred that the adjustment by a power-type equation by the Kostiakov method showed a coefficient of determination R² above 0.99 in all tests, which demonstrates the strong correlation between the data.
The values of Average Percentage Error (APE) calculated from Equations 2 and 3, for each set of IS obtained by the tests and those estimated by the equations, were small and negative. The greatest variations in the APE values occurred in Test 4, with values varying from -0.01% in AT -4 and -0.30% in MN -4 and then in Test 2, with -0.17% in AT -2 and -0.04% in MN -2; the others showed small variations between them. On average, BIV's EPA between the automatic method and the manual was 2.7%. On average, the accumulated infiltration (AI) values in the tests (Table 1) were 209.05 mm and 204.95 mm, respectively, for the ATs and MNs tests. This 4.1 mm difference corresponds to a volume of 41m³ ha -1 , which gives an important inference to the need for precision and representativeness of the values obtained in the tests.

CONCLUSION
It was concluded that the use of the Arduino microcontroller with the ultrasonic sensor installed in the ring infiltrometer proved to be efficient in the field measurements and made the determination of the accumulated infiltration and the infiltration speed practical, proving to be an economical and technically viable alternative, mainly due to the quantity of possible points to collect for each test and the greater reliability added to the low error values when compared to the manual.