Design of Automatic Watering System Based on Arduino

Food self-sufficiency is a government program that has been being actively promoted so that Indonesia to reach food independence. Indonesia is a maritime and agricultural country with rainy and dry seasons. In the rainy season, food plants usually do not need to be watered, while in the dry season, the plants must be watered regularly according to the soil moisture conditions. Farmers usually do not grow food plants in the dry season for fear that it will not grow well. The farmer’s dependence on the season causes the production to decline and becomes an obstacle in the success of the food self-sufficiency program. An information and communication technology-based agricultural device is needed to overcome the problem. The research aimed to design a programmed microcontroller chip to control watering automatically based on soil moisture detected using a domestic soil moisture sensor. This device detected whether the soil was dry or not. The farmers did not need to do watering manually. In addition to helping farmers, the device could also be installed on plantations, seedbed nurseries, urban parks, hotels, offices, and homes. Keywords— Soil moisture, microcontroller, arduino.


INTRODUCTION
Some farmers in Indonesia still depend on the rainy season for farming. It makes the production of agricultural products unstable. In the dry season, the prices of agricultural products increase significantly due to their small production, while in the rainy season, the production is abundant that decreases the price. It causes loss and disappointment for many farmers. During the dry season, farmers who want to do farming must spend extra energy and costs to do watering manually.
Hence, an automatic watering plant that works both in the rainy season and the dry season is necessary to design. The device used a microcontroller chip programmed based on the detection of agricultural soil moisture sensors. When the soil was dry, the device automatically watered the plants. Conversely, if the soil was wet, the device would not water them. It led to healthy plants because the need for water had been fulfilled all the time.
Several researchers have conducted research in agriculture such as Qingmei, Zhili, and Mingzhu who designed communication nodes in tractor control networks based on the ISO11783 Protocol. The tractor was equipped with a GPS module that can be controlled remotely with the CAN2.0B module with the ISO11783 protocol [1]. Ahmed and Ladhake designed a very low mobile-based embedded system for irrigation. The system consisted of an ATMEGA32 microcontroller, an RTC DS1307, a Nokia 6610 Mobile, and a pump motor [2]. Ma Yuquan, Han Shufen, and Wang Qingzhu investigated a new environmental parameter monitoring and control system for greenhouses based on the distributed master-slave. The system consisted of a soil moisture sensor, an air humidity sensor, a temperature sensor, and an AT89C51 microcontroller [3].
Ganesh and Girisha examined the embedded controller in the farmer's Solari's water pump automation. The system consisted of solar panels, pump motors, current sensors, and a PIC 16F877 microcontroller [4]. While Pradeep et al examined a PV pump farmer automation. The system consisted of a PIC 16F877 microcontroller, a water level sensor, and a pump [6]. Li and Yu investigated a high accuracy temperature control system based on ARM9 using a microcontroller type S3C2440A, a temperature sensor, and control using a Fuzzy algorithm [5].
Prema studied online control of remote agricultural robots operated using fuzzy controllers and virtual instrumentation. The system in the robot consisted of a microcontroller, a DC motor, and a Fuzzy logic controller algorithm [7]. Polpitiya et. al. researched wireless agricultural sensor networks consisting of a temperature sensor, a humidity sensor, a pH level sensor, a light sensor, a microcontroller, and a WSN [8]. Idris and Muhammad Ikhsan Sani monitored and controlled the aeroponic growth system for potato production. The system consisted of a microcontroller, a temperature sensor and pH, humidity, and fogging sensors [9].
Martin implemented a Wireless Accelerometer Mems to detect red palm beetles using MEMS sensors, microcontrollers, and Bluetooth [10]. Patel et. al. investigated a microcontroller-based drip irrigation system using smart sensors. The system consisted of agricultural sensors such as temperature, air humidity, and soil moisture sensors, a microcontroller, and a wireless module [11]. Sathish Kannan and Thilagavathi studied online farming based on embedded systems and wireless sensor networks. The system consisted of a temperature sensor, a soil moisture sensor, a water level Journal of Robotics and Control (JRC) ISSN: 2715-5072 56 Ipin Prasojo, Design of Automatic Watering System Based on Arduino sensor, a PIC type microcontroller, a water pump, and a Zigbee communication [12].
The paper aimed to design an automatic watering system for plants. Several references were used. Rosinski researched an unattended flower watering system using a soil moisture sensor and a comparator to replace the function of the microcontroller [13]. Tapak and Csiba investigated the watering of IoT plants using an Ethernet, a light sensor, a soil moisture sensor, a temperature sensor, a humidity sensor, a water level sensor, and a solenoid valve [14]. Selmani et. Al. investigated the multithreading design for irrigation systems using solar power. The system consisted of a temperature sensor, a soil moisture sensor, a water level sensor, a Raspberry PI, and a solar panel water pump [15].
Divani, Patil, and Punjabi examined an automatic watering system using a soil moisture sensor to detect the soil requiring water, a microcontroller, and a water pump [16]. Azam examined a hybrid water pumping system for hilly farm locations using a microcontroller, a water pressure sensor, a flow rate sensor, and a pump motor [17]. Padalalu et. al. investigated the smart water droplet system for agriculture. The system consisted of a PH sensor, a temperature sensor, a soil moisture sensor, a microcontroller, and a water pump motor [18].
A context-aware wireless irrigation system was investigated by P et al. The system consisted of a temperature sensor, a humidity sensor, a PH sensor, a chemical sensor, a microcontroller, and a Zigbee [19], while a web-based automatic irrigation system using wireless sensor networks and embedded Linux boards was investigated by Tarange, Mevekari, and Shinde [20]. The system consisted of a temperature sensor, a soil moisture sensor, a Raspberry PI, and a Zigbee. Ishak et al. investigated the prototype of an activated GSM watering using a humidity sensor, an Arduino microcontroller, and a GSM module [21].
The difference between the previous study and this study is that it aims to design an automatic plant watering device utilizing a soil moisture sensor. This device is expected to be developed and help farmers overcome problems in watering their crops.

II. METHOD
This research investigated the use of a soil moisture sensor as a determinant of the time when the plants need water to water them automatically. A soil moisture sensor by utilizing a voltage divider circuit was used. By measuring the resistance of the soil, the value of soil moisture can be obtained.
Microchip technology has developed since the discovery of semiconductor material as an electronic component. This discovery reduced the size of computers. The semiconductor as an IC (Integrated Circuit) material makes microchip and microcomputer technology advance rapidly. In this study, the researcher used an Arduino microchip or microcontroller [22]- [25] that had been specifically designed to make it easier for prototype designers to test the device.
The sensor used in the research was a resistive metal plate sensor to measure soil moisture converted to an analog voltage, which then was read by the microcontroller in the embedded system so that the device worked following the results of the research. Figure 1 illustrates the phases of the research, namely, to design the hardware and software for Arduino boards [26]- [30].

III. IMPLEMENTATION
The automatic plant watering device used a soil moisture sensor designed based on the specially programmed Arduino board technology. The moisture sensor detected the level of the drought of agricultural land. When the soil was dry, the microcontroller commanded a solenoid valve to open and water the plants, but when the soil was wet, the solenoid valve closed, and water stopped flowing.
The specifications of the automatic sprinklers designed were a 220V AC, a single sensor, a 12V output Relay, a 220V solenoid valve AC, an AT Mega Processor, a 16x2 LCD, and a 20x40x15cm dimension. Figure 2 displays the working principle of the automatic plant watering device.  Pin_Analog is read at pin 0, the Pin_Digital is read at pin 13, and the relay is at Pin 8. Junk and String variables are for characters, and the humidity variable is for hum. The soil moisture sensor will detect the level of soil moisture. If the soil is dry, the microcontroller will activate the relay driver so that the solenoid valve gets an electric current to open the tap so that water from the pipe can flow to water the plants.
Conversely, if the ground is wet, the microcontroller will deactivate the relay driver and the solenoid valve closes and the water stops flowing. This device uses a 220-volt power supply unit (PSU) to activate the solenoid valve and a 5-volt voltage regulator IC 7805 to provide a 5-volt voltage to the microcontroller and LCD.

IV. RESULT AND DISCUSSION
A test on the hardware was carried out to make sure each part of the device works properly. The parts tested were the soil moisture sensor, the driver relay, and the solenoid valve.

a. Soil moisture sensor test
The sensor consisted of copper plates as electrodes to measure soil moisture. Measured soil moisture is the conversion of electrical voltage converted into digital data. The result is shown in Table 1.

b. Driver relay and Solenoid valve test
The solenoid valve is a pipe component that can open and close automatically with the working principle of electric magnets. If the electricity gets an electric current, the solenoid will open and vice-versa. It gets electric current from a relay connected to the relay driver circuit. The relay will get high logic to activate the solenoid valve. Meanwhile, if it gets low logic, the valve will not be active. The result is shown in Table 2. The designed automatic plant watering device uses a copper plate sensor working as an electrode to measure soil resistance that is converted into analog voltage and then into digital data so that it can be processed by the Arduino Uno processor. The determination of the upper limit for the watering process is carried out by trials on different soil conditions. The use of solenoid valves to reduce the use of electrical energy is more effective compared to pumps that require greater electrical energy.