Smart irrigation system: an IoT based approach prototype

Agriculture, especially crop cultivation, is one of the most important economic activities that contributes to the growth of most developing countries. Mostly practiced in African countries crop cultivation depends on irrigation and improvements in irrigation methods can improve yields. The use of IoT, cloud technologies and microprocessors like Raspberry Pi can be used to create better irrigation solutions. This research takes advantage of these technologies to create a smart irrigation system prototype that would improve irrigation methods for farmers. This system uses a Raspberry Pi, sensors for soil moisture, pH, temperature and humidity, a web application, and a cloud-based database. The smart irrigation system assesses environmental conditions by analyzing data from the sensors and comparing it to the values stored in the database which determine the conditions needed to cultivate the crop. Results from testing the system show that irrigation actions were successful after analyzing soil moisture; when moisture is low, pH range; higher or lower and temperature; higher than required, while no irrigation was triggered when all conditions were in required bounds according to the values saved in the database for the maize crop. Unfortunately, humidity sensor yielded erroneous readings that could not be used to decide whether irrigating the field was required.


Introduction
Agriculture has proven to be essential for human survival and development over the years.In 17 th century England population growth of an estimated value of 16.6 million encouraged the growth of the agricultural sector to fulfill food needs in the country [1].Improved yields were achieved by improving agricultural practices and implementing new methods like crop rotation and land reclamation [1].Agriculture has consistently improved over the centuries as industries progress from the 1 st industrial revolution to the current 4 th industrial revolution that is backed by the improvement of Information Communication Technologies (ICTs) [2].The agricultural and industrial revolution have paved way for developments which has derived humans to the 21 st century.
Since agriculture contributes a lot to most countries' economies, there is always a need to improve how crops are cultivated to produce higher yields.In most southern African countries, agriculture is the main economic activity which contributes to the GDP, source of food and income for most rural communities.A survey conducted by Statista in 2022 showed that agriculture was one of the three major contributors of GDP in Sub-Saharan Africa contributing 18.48% and 17.17% to the GDP in 2020 and 2021 respectively [3].In Zimbabwe agriculture is practiced at a communal level in the rural areas and in a commercially formal setting [4].Because agriculture 1324 (2024) 012126 IOP Publishing doi:10.1088/1755-1315/1324/1/012126 2 is an important economic activity, if there is a poor agricultural season the GDP is affected.The World Bank in 2022 highlighted how the Zimbabwean economy grew by 5.8% in 2021 due to many factors among them a good agricultural season [5].
In a research paper by Rahman [6], he stated that agriculture depends on rainfall and atmospheric temperature; rainfall is influenced by the changes in temperatures in the atmosphere.Reduced rainfall affects those areas that did not receive enough rainfall therefore making agricultural activities impossible.Mwadzingeni et al [7] noted that climate change has affected the rainy season in Zimbabwe which resulted in rain season starting late in some regions, while in other regions the rain season ends earlier.Global warming plays major role in changes to the interannual variability of the mean temperatures and precipitation which in turn affects human activities that are based on water, agriculture, and food security [8].Irrigation is the major factor considered in the agricultural industry; a good rainfall season is likely to result in higher crop yields.Mutiro & Lautze [9] noted that irrigation is critical to the growth and development of Southern Africa's economy, which means there is need to invest in irrigation development.
The 21 st century offers technological advancements in all fields.The agricultural industry has an opportunity to incorporate smart technology like Internet of Things (IoT) to help address the irrigation problem which is faced by famers.21 st century technology can modernize agricultural methods for commercial and subsistence farmers to improve their yields significantly [10].IoT technologies can be used to create adaptive systems that asses the environmental conditions of a given piece of land and irrigate crops efficiently and suitably with minimum human intervention.
The goal of this research project is to develop a prototype scaled model of Smart Irrigation System which can be used to irrigate crops after assessing environmental elements like soil moisture, humidity, temperature, and soil pH which will allow the farmers to be efficient and sustainable, giving the farmer the flexibility of monitoring the system using a web portal.
By completing this project, the authors seek to meet the following: design a smart irrigation system, develop a prototype (scaled model) of the irrigation system designed, use IOT (microprocessors, sensors cloud technologies), monitor conditions for different crops, analyze conditions for crops like maize, soyabean, Irish potato, and groundnuts, web application to monitor system, pre-saved conditions values for each crop for analysis with an option to add more and edit, and monitor multiple farms from the same web application.
In line with the sustainable development goals, this research aligns with SDG goal 2 which seeks to eradicate hunger.The smart irrigation prototype contributes by optimizing irrigation methods which is crucial to enhancing crop yields and food production.In addition to goal 2 the research also contributes to goal 6 by promoting sustainable management of water.

Related Works
In an article by Kansara et al. [11], the researchers develop an irrigation system that is based on the use of sensors to provide a timid irrigation schedule.By employing the use of a soil moisture sensor and temperature sensor, they were able to control a valve from the water reservoir.The system in question relies largely on data from the moisture sensor, which determines when irrigation is required according to the pre-set value of soil moisture.
This system was also designed to use GSM and a MAX232 integrated circuit.Using a pipe connected to a water store, with a solenoid valve which is controlled by the MAX232 IC, the valve opens when the moisture drops below the required level, and water drips to the plant roots drop wise using a rain gun.The moisture sensor continues to collect data on the soil moisture levels, when the required level of moisture is reached the microcontroller will close the valve.The irrigation system uses a rain gun which limits water spillage and runoff, a good way to manage water loss.
In another related article [12], the researchers developed a more advanced irrigation system that would incorporate the use of sensors and a much more powerful microprocessor computer.Rao & Sridhar [12] used the Raspberry Pi 3 minicomputer as the main controlling component of their IoT based irrigation system.Using an IC chip MCP3208 to interface the Raspberry Pi and the two sensors they used (moisture & temperature) to collect data required to trigger irrigation processes.Using both temperature and moisture levels, the system can irrigate the crops if certain thresholds are exceeded according to the set values in the system.To accommodate the IoT nature of the system they added a web portal which allows the user to monitor the measured values.To trigger the irrigation Rao & Sridhar implemented a simple logic that would assess the level of moisture and temperature in the field.
Rajkumar et al. [13] also developed a smart irrigation system that can be implemented at household level.The smart irrigation system uses an Arduino Mega 2560 microcontroller board, also using temperature and soil moisture sensors like the previously observed articles.This system allows mobile control by use of mobile texts and Bluetooth when in range with the components which gives the farmer better control of the system even when far away.The system also provides a way to view the real-time data display using the Arduino OS which is not as good hence it does not allow remote monitoring, however the system designed is low cost and allows for easy setup and implementation.

Proposed System 3.1 Proposed Solution
The authors of this project propose a system that would be used for irrigation of crops after analysis of environmental factors within the field.As highlighted by articles in the previous section, the most common metrics considered for irrigation are soil moisture, humidity, and temperature.The authors plan to capture temperature, humidity, soil moisture, and soil pH values, however, the irrigation system to be developed will use soil moisture, pH, and humidity as the main conditions.Table 1 shown below summarizes the values the authors plan to use as thresholds when deciding to irrigate a certain crop.When fully developed, the farmer can alter the values as they please however these will come pre-installed with the system as they cover some of the most common crops cultivated in Zimbabwe.The proposed system will use sensors to collect temperature, humidity, moisture, and pH through a Raspberry Pi and save these values in a database.Figure 1 shows the process by with the Smart irrigation system would work.When operational, the Raspberry Pi triggers the sensors to collect data from field and saves these values in the database, at the same time the system would check if the conditions set for irrigation are met by comparing the values captured by the sensors to the values stored in the database.As shown in Figure 1, the system starts by checking against the moisture values and proceeds to pH then temperature and finally humidity.If all the conditions are false the system loops back to sensor value collection after an hour, else an irrigation event is triggered if any of the condition is true.

Benefits of the proposed system
When implemented, the smart irrigation system would be beneficial to famers by providing crops irrigated only, when necessary, soil analysis, irrigation analytical data, and flexibility from remote control of the system.Table 2 summarizes the aspects of the related works that were analyzed in this project.Comparing the existing solutions to the proposed solution, the authors' solution is better because it provides for extra features than the ones provided by the existing solutions.The proposed solution has remote system control through a web application and access to the Raspberry Pi server, 4 sensors are included (temperature, humidity, pH, and soil moisture) as compared to the 2 (temperature and soil moisture) that the rest have.
The proposed solution takes advantage of IoT by integrating cloud, Raspberry Pi 4 and the sensors.In terms of connectivity, it has the widest range given that it utilizes cloud technology, and it has a cloud database.

System Architecture
As discussed in the previous section the smart irrigation system to be developed considers values from 4 sensors and a Raspberry Pi system would analyze to check if there is need for irrigation.The Raspberry Pi 4 which is the brain of the smart irrigation system controls the sensors as well as a pump that will run water to the crops.The sensor data recorded is stored in an online database which can be accessed by the web application and farmers can generate daily graphs that show the conditions of temperature, humidity, pH, and soil moisture recorded that day.
As shown in the Figure 2, users have access to both the web application and the Raspberry Pi using remote access i.e., web application for checking and controlling some aspects of the system 1324 (2024) 012126 IOP Publishing doi:10.1088/1755-1315/1324/1/0121265 which provides features like setting values for irrigation comparisons, checking graphs, adding farms and crops, and managing users.The other user access applies to the Raspberry Pi which will run and control sensors and the pump.Access to this will be through remote access apps like VNC viewer.

Implementation 5.1 Raspberry Pi & Sensors
Figure 4 shows the components of the smart irrigation system prototype put together in a small box.The Raspberry Pi provides power to most of the components with its 4 power pins.However, the 9V battery is used to power the water pump.

Web Application
The dashboard page displays the farms that are saved in the system that can be monitored and controlled by the web application.It also displays the sidebar menu which is used to navigate between pages.Figure 5 and Figure 6 show the pages that is used to display graphs that represent the conditions of certain farm as recorded by the sensors.Through this pages, farmers can see the outlook of their farm and check values for temperature, humidity, pH, and moisture.

Testing and Results
Testing of the smart irrigation system was conducted against 4 major tests: moisture (when the measured value is below and above the required threshold value), pH (when the measured value is below or above the required threshold range), temperature (when it's above the required threshold value), and humidity (when the measured value is lower that the required threshold value).The tests were conducted using the maize crop as a benchmark for threshold values.

Moisture Testing.
Crop maize must maintain a moisture level of at least 75 %.The authors used a dry soil sample, and the system assessed the conditions.After inserting the soil moisture sensor in the dry sample, the irrigation system on the Raspberry Pi is started.According to the Figure 7, the value of moisture in the soil recorded is 0% and the system indicates it as low, and an irrigation event is triggered.1 with the threshold values, Maize requires pH within the range 5.5 -7.8.This test scenario used a solution that simulates a pH lower than 5.5 and to achieve that the authors used vinegar as previously mentioned.Since pH is given in a range it is possible to have a value over the required range.Figure 8 shows what happens when the pH value is above the required range.While testing for temperature increase in scenario 3, the authors noticed that blowing dry air onto the temperature and humidity sensor would raise the humidity levels to almost 100% even though the air was dry given that it was from a hair dryer (Figure 10).

Conclusion & Recommendations
Upon completion of this thesis project the authors were able to design a smart irrigation system and develop a prototype (scaled model) based on the designs.The developed prototype system was able to implement IoT concepts by using a Raspberry Pi, multiple sensors and electronic components, online database and a web application that can be used to monitor and control aspects of the system.Using the entire system farmers can monitor irrigation for their crops.The results of this project show that it is possible to have an automated smart irrigation system that can minimize the need for humans to regularly man farms.Considering the conditions of soil moisture, pH and temperature can create a well-advised decision on whether to add more water or not.However, since moisture is the most important condition considered when making an irrigation decision, the values for temperature and pH are mostly not used for analysis.

Figure 1 .
Figure 1.Proposed System Flow Diagram

Figure 4 .
Figure 4. Prototype System Construction with pH, Temperature & Humidity, and Moisture Sensors.

Figure 8 .
Figure 8. pH higher than threshold range

Table 1 .
Proposed Threshold values for System.

Table 2 .
Comparison of Proposed system to Existing solutions