The Design of Automatic Sprinkler based on Arduino Uno Microcontroller

The purpose of this study was to design a microcontroller based automatic plant watering system. The method used was an experimental method using two sensors, i.e. soil moisture sensor (measure soil moisture) and ultrasonic sensors (measure the distance of rotary direction regulator for DC motors). Arduino board is preferable as the main controller due to its simplicity. Tool testing was conducted through trials on soil samples and performance tests when the tool was operating. The parameters observed were solar intensity (Lux), ambient temperature (°C), RH (%), water discharge (ml/s), DC motor axis rotation (rpm), AC and DC voltage (Volt), and soil moisture (%). The tool testing showed that the designed watering system could works properly with less than 10% MAPE. When the sensor read the soil moisture value below 70% setting point, the pump and DC motor were turned on. Whereas, when the soil moisture value achieved 80% setting point, the pump and DC motor were turned off. Performance test was conducted for three days of observation. The founding shows that the designed automatic watering system could successfully provide as much as 2.52 litre of water during approximately 6 minutes of watering period.


Introduction
Control system has long been utilized by humans to maintain, instruct, control, and manage a designed system in order to work properly. The main purpose of a control system is to obtain optimum working environment that support continuous production. Application of Arduino based microcontroller system is one of current technology development in control system. Arduino has been widely utilized as a control system due to its simplicity and complete facility as well as its open source characteristic that made it convenience to be developed by developers across the globe. This tool has made control system becoming efficient, effective, and practically. Precision agriculture is one area that require application of this tool, specifically in order to provide sufficient water for the plant growth.
Generally, plant obtains water for its growth from the soil moisture that is distributed by the plant's root to stem, branches, and leaves. Therefore, moisture content of the soil as the plant's growth medium is necessary to be maintained, especially in the seeding period. Naturally, the occurrence of excess water causes less problem compare with drought. Drought is a condition when soil's moisture content is not sufficient to support transpiration and evaporation [2]. In order to prevent drought, routines watering is an urge.
Plant watering through irrigation commonly has been conducted manually by humans. However, the irrigation schedule may fail, mostly as problems related to time and condition appear. Hence, the existence of tool that could assist irrigation is necessary. This tool is a system that could work automatically with less continuous control by the operator. Utilization of this tool is expected could provide sufficient water for the plant through irrigation based on plant's water requirement.
Based on this condition, this experiment try to design a microcontroller based automatic irrigation on a prototype scale, that could help the operator to monitor and control their plant growth, especially in the seeding period that require sufficient water for its optimum growth. Therefore, optimum plant yield could be achieved better.

Time and Place
This experiment was conducted on November 2018 at greenhouse of Faculty of Food and Agroindustrial Technology, Universitas Mataram.

Equipment and Material
The required tools to construct the plant watering prototype consist of a set of carpentry tool, such as welding tool, electric drill, and grinder. Material used were hollow steel (20 cm x 20 cm x 0.8 cm and 25 cm x 25 cm x 0.8 cm), hex bolts (axles, 14 mm, 10 mm), bearing, nozzle (sprinkle), tube, water pump, and plywood. Plywood also used to build the seed container and the horseblock of the control system. A plastic bucket was used as a water container for watering the seed. As growth media for the seed, soil mixed with rise husk was used.
Whereas tools used to construct the designed irrigation control system were. Material used were breadboard, Arduino Uno R3 microcontroller, 20x4 LCD, I2C backpack module, sensors (soil moisture sensor and ultrasonic sensor), jumper cable, DC motor, 24 Volt adaptor, 4 channel relay. A plastic container was used as the control system box. Arduino software was used to write and compile the coding of language program.

Experimental Method
Method used in this research was experimental with direct observation in the field.

Solar Intensity (Lux)
Lux-meter was used to collect solar radiation intensity data. Measurement was conducted during the watering period, three times a day.

Ambient Temperature (°C) and Relative Humidity (%)
Measurement of ambient temperature and relative humidity was conducted using HTC-2 Thermohygrometer during the watering.

Axle rotation of DC motor (rpm)
Rotation of DC motor axle was measured using Tachometer that conducted every 2 minutes for 6 minutes observation.

AC and DC voltage
Voltage and power consumption during the operation of the irrigation system was measured using Power analyzer. The measured voltage consists of: 1) Input voltage a. PLN voltage (VAC)

Soil moisture content
Percentage of soil moisture content is presented in the LCD that obtained using a calibrated soil moisture sensor reading. The apparatus which is used for calibration is an analog soil PH-moisture meter.

Water discharge (Q)
Water discharge requirement for the automatic irrigation is obtained by measuring the of volume water used (V) then divide it by time of watering (t). The water used is obtained by subtracting initial water volume (Vo) and the remained water volume in the container (Vr). Watering is applied until soil moisture sensor read at least 80% moisture content, which is the setting point to turn off the system. Equation 1 is used to calculate water discharge. (2) Where: t = actual data in a t period t = forecasting value in a t period n = number of data

Design and Research Procedure
Flow diagram of the design and research procedure is shown in figure 1.

Preparation phase
Preparation consist of identification and compilation of the material and tools required for the experiment.

Design phase
This phase consists of two part, i.e. hardware design and arrangement of the programming language. Figure 2 show main hardware that is used in the designed control system (soil moisture sensor, Arduino board, 20x4 LCD, DC motor, and water pump).

Construction of the Automatic irrigation prototype and controlling system
The construction phase consists of two part, i.e. construction of the automatic irrigation prototype. The construction of the automatic irrigation prototype was conducted by cutting the material and connecting all of the components based on the determined design. Figure 3 shows the design of the prototype. This prototype is controlled using Arduino Uno board with soil moisture sensor and ultrasonic sensor as the mechanical movement component. The circuit is located in a box placed in the upper part of the prototype. Whereas the pump is placed inside the water container and connected to nozzle by a flexible plastic tube. Nozzle is preferable as it functions to break (atomization) the sprayed water into droplets [4], thus water will distribute evenly during the watering.

Arrangement of the programming language
The programming language is arranged in order to activate all of the component to work properly as the written instruction. The coding was conducted using Arduino IDE 8.1.3 software. The basic mechanism of the automatic irrigation system is as shown in figure 4. First, the soil moisture sensor will read the soil moisture content of the seedbed. If the soil moisture below the 70% setting point, then the water pump will be activated (turned on) to distribute the water into nozzle. DC motor will also be activated to move the nozzle on the rotating bolt axle. If the soil moisture achieve the 80% setting point, the water pump and the DC motor will be consecutively deactivated (turned off). The 80% setting point value is determined based on Hariadi (2007) Figure 5 shows the control system circuit of the automatic irrigation system. As the main component, the Arduino board function as the 'brain' in this designed system. The available pins in the board were connected using female jumper connector to the sensors (soil moisture sensor and ultrasonic sensor), LCD and I2C backpack module, 4 channel relay, DC motor, and water pump. The input voltage of this circuit is a 220 Volt provided by the National Electric Company (PLN). A proper design is required in order to result a successful automatic irrigation system as expected. The circuit then connected to the assembled prototype of the watering tool. Figure 6 show the prototype of the watering tool in this experiment. The nozzle which is connected to the water pump using flexible tube could move forward and backward on the railway, based on language program instructed by the Arduino.  Figure 6. Assembly of automatic watering prototype

Design and Assembly
The programming language which was written in order to activate the Arduino and all of the connected component used C language for the command procedures. This program functions to read and to process the data received by the input port. Furthermore, the processed data will then be send based on the arranged algorithm to the output port. Figure 6 shows some of the language program written that function to activate (turn on) and to deactivate (turn off) the watering system based on 70% setting point and 80% setting point respectively.  HIGH); lcd.setCursor(7,2); lcd.print("aktif"); lcd.setCursor(12,1); lcd.print("aktif"); else if(nilaisensor >= 80){ digitalWrite(pompa,LOW); lcd.setCursor(7,2); lcd.print("tdkAktif"); digitalWrite(relay2,HIGH); delay(500); digitalWrite(relay1,LOW); The display apparatus in this system is a 20x4 LCD that presented condition of the moisture content, DC motor movement and status condition of the water pump. Figure 6 show the LCD display of the control system when soil moisture sensor read soil moisture content of 69% (below the 70% setting point). This condition resulted in the activation of DC motor and water pump as displayed in the LCD on figure 7.   Figure 8 shows calibration data of soil moisture content sensor and ultrasonic sensor. Based on figure 8 (b), moisture sensor reading shows insignificant difference compare with the soil moisture meter value. The linier regression of the obtained data produced equation: y = 0.970x + 3.156, with correlation coefficient of R 2 = 0.944. Whereas, the ultrasonic sensor calibration, as could be seen in figure 8 (b), show linier regression equation: y = 0.9643x -0.5608, with R 2 = 0.9993. Both of these R 2 approaching 1, which indicates that the sensor used in this experiment have high validity in measuring soil moisture content and distance (of the DC motor movement).

Figure 8. Soil moisture meter and ultrasonic sensor calibration data
Average soil moisture content based on soil moisture sensor reading and soil moisture meter were respectively 65.4% and 66.63%. Mean Absolute Percentage Error (MAPE) of the soil moisture data was 1.85%. Whereas, average distance obtained from measurement of the ultrasonic sensor and meter gauge were respectively 27 cm and 28.58 cm. Mean Absolute Percentage Error (MAPE) of the distance data was 6.31%. Based on [5], the forecasting ability could be categorized as very good if MAPE value below 10%. Therefore, as MAPE value of the sensor used in this experiment were below 10%, it could be stated that both of the sensor have high validity.

Test performance of the control system
The performance of the control system could be determined by measuring the DC motor propeller rotation (rpm) using Tachometer. Table 1 and table 2 show DC motor propeller rotation without and with loading using 24 V DC input voltage. From both tables, it could be seen that DC motor was active when the soil moisture below 70% and the DC motor stop to rotate when it achieved 80%.    Average electricity voltage when the DC motor activated range from 24.2 -24.3 volt with average DC motor of 29.5-29.8 rpm ( Table 2). Table 3 shows that DC motor rotation decreased to 22.4 -21.8 rpm when loading was applied. This result is coherence with [1] which state that torque significantly related with motor ability to support the given load. Any change in load, will affect DC motor rotation velocity, thus change the torque of the DC motor that conform with the torque load. As the load is heavier, the resulted torque will increase. Thus, the motor velocity will slightly decrease as the motor could not provide proper torque coherence with the load condition.

Test performance of the microcontroller response
Based on table 3, the watering system automatically start every morning based on the moisture sensor reading (soil moisture below 70%). During the watering, the sensor continuously read the soil's moisture until the LCD shows value of 80%. This reading then successfully transferred to the microcontroller and instruction directly sent to turn off the pump and the DC motor. Light intensity, temperature, relative humidity are factors that affect evaporation [6]. These parameter siginificantly have effect on the watering frequency. High solar radiation intensity, will increase soil temperature, thus enhance evaporation of available water in the soil. From table 3, it could be seen that in the morning average solar intensity was 68,100 lux -83,600 lux with average temperature of 25.8°C -28.8°C. In the afternoon, average solar intensity increased to approximately 108,600 lux -127,800 lux with 36.2°C -36.6°C temperature. In the evening, solar intensity slightly decreased to 100,300 lux -114,300 lux with approximately 29.5°C -36.3°C ambient temperature. This result shows that the higher the solar intensity, the faster the evaporation of the soil moisture. Thus, affect the irrigation process using the control system.   Table 4 showed volume of water used during the plant watering in three days of observation. The irrigation was applied automatically three times a day (9 AM, 12 AM, and 3 AM) based on soil moisture content sensor reading. Average water volume used was 2.52 litre during 385.66 second watering period; obtained water discharge was approximately 0.00654 ml/second. After this period, soil's moisture content increased to 80%, thus the Arduino microcontroller successfully instructed the water pump and DC motor to shut down (turn off). Due to evaporation, approximately after three hours of the irrigation, soil moisture decrease below 70%, thus the Arduino microcontroller successfully instructed the water pump and DC motor to start the irrigation (turn on).  figure 9 (a), the electricity consumption for soil moisture sensor was relatively constant, with voltage range from 4.55 -4.58 Watt. Electricity power requirement for ultrasonic sensor also showed constant value around 4.61 -4.62 Watt ( figure 9 (b)). The founding also shows similar result for the DC motor power consumption that range from 24.2 -24.3 Watt (figure 9c). Figure 9. Electricity consumption of the automatic irrigation system's sensor and DC motor Based on the voltage measurement, the soil moisture sensor and the ultrasonic sensor require constant power to support continuous detection of observed parameter. These results were different with the DC motor condition that always deactivated at 6, 12, 18, 24 and 30 minutes with 0 Watt power. However, when the DC motor is activated, the electricity power consumption will vary depend on the given load. The higher the given load, the higher the required current [7]. Thus, enhance the electricity power requirement.

Conclusion
The microcontroller based watering system that designed in this study could perform a frequent watering of three times a day based on soil moisture condition of the seedbed. Approximately 0.009136 ml/s of water could be distributed evenly for 385.266 s. The calibration of the sensor shows average MAPE of 1.85% and 6.31% for soil moisture sensor and ultrasonic sensor, respectively. Therefore, it could be concluded that the designed control system has high validity to measure soil moisture content and to control the watering.