IoT-based intelligent irrigation management and monitoring system using arduino

,


Introduction
Industry 4.0 has spread nowadays and Internet-of-Things (IoT) is very familiar to be heard with its specialize in automation system. IoT can communicate between human and things by sending and receiving the information signals. IoT can be defined as interaction that not require physically touch either human-to-human or human-to-computer and it has many unique identifiers and the abilities to send or receive data over a network due to its interrelated with any devices, machines, objects, animals or peoples. IoT is widen in many creativities and assure that can upgrade the quality of life and reduce the gaps between elderly and modern technology [1]. In order to live in the world with wirelessly connected, Wireless Sensor Network (WSN) also had been studied to focus on features that easily movable object and wire-cost-efficiency. Studied had carried on applications such as civilian, military, visual sense models where they only consume less power that formed by the sensor nodes [2]. Thus, future work will be more advanced with the exist of IoT and WSN technologies with varieties lifestyle and works.
IoT has also been very aggressively applied in agricultural to improve the agricultural system [3][4][5][6][7]. In [8], Controller Area Network (CAN) communication has been proposed in order to handle communication between distributed nodes for irrigation system. A solar powered remote management and automation system for agricultural activities through wireless sensors and IOTs has been proposed by Navulur [9]. It comprises a hardware platform based on Raspberry-Pi micro controller which configured to connect with a user device and accessed through the internet network. Other project [10] uses a Simple Link WI-Fi module (CC3200) which connects the hardware system to internet and it monitors PV system, controls the motor and solenoid valve for pumping water to the field on the statistics obtained from the water level sensor and soil moisture sensor. Another works on irrigation systems are also focused on utilizing solar power [11][12][13][14][15]. Precision Agriculture (PA) with cloud computing has been discussed in [16] that will optimize the usage of water fertilizers in smart agricultural. It manages to maximize the yield of the crops and also help in analyzing the weather conditions of the field. There is also a paper which proposed an intelligent irrigation control system that combined fuzzy system and neural network to aim for water-saving [17]. Irrigation system optimization with limited water supplies efficiency of water application is proposed in [18] by applying the elitist non-dominated sorting genetic algorithm (NSGA-II). Different plants will need their different own necessities such as water, light and nutrition to ensure that they will grow well and healthy. However, there are several cases that make them difficult to grow such as during hot day which will make them too dry or during a heavy rain which will make them too wet [19]. The home owner who care about their garden might face a watering problem when they left their home for a long time of period [20]. So, people need long distance controller such as using a smart phone to manage the watering system of their plants and obtain their plants' data conditions such as soil moisture and visible of light. Thus, this proposed work will ensure them to be unworried about their plants although leaving their garden for a long time of periods. Normally, irrigation system in agriculture used the largest amount of water compared to other systems in the world [21]. Mostly, irrigation system in agriculture used timer in order to implement the period of time of their system to perform the watering [22]. Thus, there will be the wastage of water during rainy day where the soil is already in the wet condition. In the market, there are a lot of garden monitoring systems with a very high price thus unaffordable for a people who only have a small area of garden such as home garden. Additionally, most of the products with wire connection which will limits the distance if the users want to remove their vase freely or plants' container to other places. Moreover, other market products also do not smart enough to control their garden and lack of function. Therefore, this paper focuses on IoT-based intelligent irrigation management and monitoring system where user can monitor and manage the growth of their plants although from location elsewhere. This work develops an IoT, WSN and Android Application which fulfil costumers need with a low-cost and power efficient. The proposed irrigation system can be performed both manually and automatically. The proposed manual system utilizes a smart phone as a platform where the user can manually perform the watering from long range distance, while the proposed automatic system depends on either the timer setting or the condition of the soil either it is still wet or dry.

Proposed System Design 2.1. Hardware Development
The proposed IoT-based irrigation management and monitoring system consists of an integrations work between hardware, software and IoT parts which fulfil the objectives of this research. The hardware parts contain of two main microcontrollers; Arduino UNO that works as sensor node and base station. For the sensor node, both soil moisture sensor and NRF24L01 are connected to the Arduino UNO. Soil moisture sensor is connected to analogue pin A0 of the Arduino UNO. The sensor is operating at 5V DC voltage supply. The NRF24L01 is connected through SPI pin where it uses MISO, MOSI, SCN, SCK, CE, VCC (3.3 VDC) and GND (0). Thus, soil moisture sensor will collect the data from soil humidity and send to the base station through NRF24L01.
For the base station part, light-dependent resistor (LDR), mini water pump, NRF24L01 and Wi-Fi module (Node MCU-ESP8266) are connected to the Arduino UNO. The LDR with 12 kΩ is connected to analogue pin of Node MCU. The NRF24L01 for the base station also use SPI pin similar to the connection at the sensor node. The Wi-Fi module uses serial pin connection with Arduino UNO by using digital pin 1 and 2 which are Tx and Rx. The mini water pump is connected to digital pin of Node MCU (ESP8266) through transistor which act as an amplifier and switch for triggering the water pump. The base station will receive the data from the sensor node and send to the cloud server. This project used Thingspeak as cloud server to record all the data in the database and link with android application. Once the irrigation system is enabled, the mini water pump will pump the water from the water tank and perform the watering process. Figures 1 and 2 show the proposed smart irrigation system and the schematic diagram, respectively.

Software Development
There are two parts of the software development in this work. The first part is the software development for the Android Application, whereas the second part is the software programming for the Arduino boards. In order to write the programming, Ardunio IDE must be installed first where the board manager and library must be downloaded from internet. Board manager is depending on the selected device board, i.e. Arduino UNO, Arduino Mega and Node MCU, while library is the internal programming for the kit's pin. This project used Arduino UNO as board manager and several libraries such as ESP8266, SPI, nRF24L01 and RF24. The developed Android application is used to obtain the data from the hardware system and monitor the function of watering system [23]. The developed application is started with user's log-in first before it can be functional. The proposed system also can be monitored in a very long distance through cloud server. Other than that, user also can set an alarm for the soil moisture level threshold to remind them that their plants are in critical situation. Thus, they will know that the watering system had a problem due to a failure of pump, tank or absence of water.
In order to develop an IoT in this project, the cloud is created to perform the database and act as medium to save and transfer the data between hardware and gadget [24]. The data from the cloud server can be downloaded as an excel file to analyze the condition of plants based on the graph. Other than that, the Android application will read the data from the cloud and remind user for any problem about their plants. User also can give manual command from Android application to monitor their plants. The selected action will be then operated at the hardware parts.

Implementation of the Proposed Irrigation System
The implementation of the IoT and WSN in the proposed irrigation system consists of several parts as shown in Figures 3 and 4. The sensor node starts by reading the soil moisture level data in order to identify the level of soil dryness. The node then sends the information by using radio transceiver to the base station. After that, the light exposed data from the light sensor is also read by the base station. The base station then sends both data, i.e. moisture level and light exposed to the storage server which is a cloud server. This proposed smart irrigation system can operate in two different scenarios, automatic and manual operation with and without internet connection.
User also can manage and monitor both data on soil moisture and light exposed by browsing the cloud web server. In addition, the developed android application with user-friendly interface can be another platform to monitor the watering progress. In this android application, user can choose their own setting on the selected moisture threshold values at the sensor node. User can choose to manually perform the watering process by clicking the watering button on the android application. Once the watering process is finished, a display of moisture meter shows an increment level in real time. Figure 5 shows the flow chart of the whole process. Three new methods have been proposed and implemented in this work:  sensor node packaging;  monitoring and manually watering process using Virtuino;  Wi-Fi routine checker using timer interrupt; these three newly methods will be discussed in the next subsections.

Method 1: Sensor Node Packaging
Sensor nodes packaging is implemented in this work to identify the different data that is received from different sensor nodes. The most significant bit (MSB) of every sensor node is given with different single-bit-number so that the system can recognize different sensor nodes in each related plant. These data then will be upload to the cloud. Figures 6 and 7 show

Method 2: Monitoring and Manually Watering Process using Virtuino
Virtuino android application has been developed to monitor the data of real-time soil moisture and sunlight exposed as shown in Figure 8. In this apps, user can set an alarm system as a warning for any critical level of soil moisture. Additionally, the user can choose to manually give a watering command to the irrigation system. This developed system is used as a remote to manually watering and monitoring the real-time soil moisture and sunlight exposed. The watering system is set up so that the switch will trigger the mini water pump for 3 seconds, i.e. similar to 15 ml of water. User must connect the application with the internet in order to download the real-time data from the cloud server into the android application. This is shown in Figure 9. Other than that, user also can set the alarm for the critical level of soil moisture in case if their plants are facing problem of receiving water as shown in Figure 10. This application can be operated at any place as long as the place has an internet coverage in order to communicate with cloud storage.  Figure 9. GUI for connect the application with internet Figure 10. GUI for setting the alarm

Method 3: Wi-Fi Routine Checker using Timer Interrupt
Internet is the important things for IoT. Therefore, the development of Wi-Fi routine checker is implemented in this system to avoid internet disconnection maybe due to heavy rain or others disturbance. Figure 11 shows the programming of Wi-Fi routine checker. The interrupt timer will start count while the main loop is executing. When the timer for Wi-Fi routine checker is executed, then the interrupt will occur and check the internet connection. After performing the interrupt, the timer of Wi-Fi routine checker will be reset to zero. Figure 12 shows the programming code for setting the initial timer to zero. The specification of water volume versus soil moisture is shown in Figure 13. The data is recorded every 5ml of water which used for watering the soil. The soil will start to dry when the value of soil moisture is below 375. The critical condition is when the soil moisture is below 200 where the soil is too dry. The soil moisture has specification value that react with water. The value of soil moisture is increased after adding every 5 ml of water. The soil is lack of water when below 400 and very dry when below 200. Most soil moisture value used percentage level equation as: (1) The value of 1023 is the maximum value of analog reading which 10 bit because of ADC. Thus, by using (1), the percentage of soil moisture is 20% when the soil is too dry, 36% when lack of water and 71% when excessively of water where it can reduce the soil nutrition.

Experiment of Soil Moisture Level in 4 days
Experiment was performed in 4 successive days, i.e. Day 1, Day 2, Day 3 and Day 4. At Day 1, the initial condition of soil is measured. It showed that at Day 1, the value is 977 and 416 for light exposed and soil moisture, respectively. Figure 14 shows sunlight exposure and soil moisture of plants in one graph. Both data have been taken every hour and plotted in real-time. These results were tabulated for four successive days for soil and weather monitoring. At 9.00 am on Day 2, the plants were experimented by first watering with 30 ml of water. The value of soil moisture increased until 700 for a short period of time and then it decreased slowly from 10.30 am until 1.00 pm on the next day. Day 4 is the last day of the data recorded where the soil is dry because the soil moisture sensor value is below 300.

Automatic Watering Action System
The experiment was then tested to perform automation system on Day 5. The initial condition of soil moisture level is 676. This system then automatically performed the irrigation when the threshold value of soil moisture is below 500 which is 48.8% as highlighted in Figure 15. The smart automatic irrigation system manages to prevent the soil from dry and ensure the constant level of soil moisture.

Manual Watering System
In Day 6, the automation system was tested with user manual watering by using android application. The initial condition of soil moisture level is 455 and slowly dry until perfoming an automation irrigation at soil moisture level 300. Then the user interrupted the system by watering the plant at 4.00 pm. It shows that the value of soil moisture increases drastically until 711 as in Figure 16.  Figure 17 shows the first, second and third page of the android application. First page of the android application shows that the initial condition of the soil moisture is constantly at 19.5%. After the manual watering was applied at the green line in page 2, the value of soil moisture increased until 48.88%. Thus, the user can monitor their plants by using this application and manage to save the data tabulated in document file such as Microsoft Excel.

Conclusion
This work has successfully implemented water irrigation system that meet the objective of water-saving purposes since it is equipped with self-intelligent capability. The results showed that the condition of soil moisture is under good supervision as it is proved that the proposed irrigation system did not perform the watering process when the soil is above unrequired watering purposes level or during rainy day. Therefore, the system manages to save the usage of water and prevent the plants from being overwater or flood. The system also successfully implemented several methods, i.e. sensor nodes packaging that can differentiate each of user's plants; wireless communication between sensor nodes, base station and android application for controlling system in an unlimited range; and Wi-Fi routine checker to overcome the disconnection of an internet. This proposed work helps to reduce a manpower requirement in agriculture system. Future works will consider LoRa [25] as one of the communication systems.