Next Article in Journal
Pine Wilt Disease Segmentation with Deep Metric Learning Species Classification for Early-Stage Disease and Potential False Positive Identification
Previous Article in Journal
A Cost-Effective Current-Limiting Hybrid DC Circuit Breaker Based on Hybrid Semiconductors
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Smart IoT Irrigation System Based on Fuzzy Logic, LoRa, and Cloud Integration

System Engineering and Automation Department, Faculty of Engineering of Vitoria-Gasteiz, Basque Country University (UPV/EHU), 01006 Vitoria-Gasteiz, Spain
*
Authors to whom correspondence should be addressed.
Electronics 2024, 13(10), 1949; https://doi.org/10.3390/electronics13101949
Submission received: 12 April 2024 / Revised: 23 April 2024 / Accepted: 14 May 2024 / Published: 16 May 2024

Abstract

:
Natural resources must be administered efficiently to reduce the human footprint and ensure the sustainability of the planet. Water is one of the most essential resources in agriculture. Modern information technologies are being introduced in agriculture to improve the performance of agricultural processes while optimizing water usage. In this scenario, artificial intelligence techniques may become a very powerful tool to improve efficiency. The introduction of the edge/fog/cloud paradigms, already adopted in other domains, may help to organize the services involved in complex agricultural applications. This article proposes the combination of several modern technologies to improve the management of hydrological resources and reduce water waste. The selected technologies are (1) fuzzy logic, used for control tasks since it adapts very well to the nonlinear nature of the agricultural processes, and (2) long range (LoRa) technology, suitable for establishing large distance links among the field devices (sensors and actuators) and the process controllers, executed in a centralized way. The presented approach has been validated in the laboratory by means of a control scheme aimed at achieving an adequate moisture level in the soil. The control algorithm, based on fuzzy logic, can use the weather forecast, obtained as a cloud service, to reduce water consumption. For testing purposes, the dynamics of the water balance model of the soil were implemented as hardware in the loop, executed in a dSPACE DS1104. Experiments proved the viability of the presented approach since the continuous space state output controller achieved a water loss reduction of 23.1% over a 4-day experiment length compared to a traditional on/off controller. The introduction of cloud services for weather forecasting improved the water reduction by achieving an additional reduction of 4.07% in water usage.

1. Introduction

In the context of constant change and demographic increase, the efficient usage of natural resources is key to improving the planet’s sustainability. Water is a critical resource, essential for life, agriculture, and industry [1]. The growing pressure to use water supplies efficiently demands innovative approaches based on modern technologies. A special focus must be applied to agriculture since it is the main water consumer. Actually, 70% of the world’s water usage is dedicated to this sector [2]. Some studies suggest that water resources are unreasonably overused [3]. In a scenario of continuous demographic expansion, the efficient use of water in agriculture may have a considerable impact on sustainability.
The use of modern technologies in different domains introduces new possibilities and challenges [4]. In the case of agriculture, some authors have coined the term Agriculture 4.0 in a similar way to Industry 4.0 [5]. Agriculture 4.0 benefits from using several technologies already mature in other domains, such as the Internet of Things (IoT), big data, or artificial intelligence (AI), to optimize the agricultural processes [6]. For example, in [7], the authors’ novel monitoring architecture approaches were required to detect viticulture diseases early, combining IoT and cloud computing. Among other issues, those technologies can help reduce water usage and increase its efficiency. Another example can be found in [8], where a fuzzy logic control technique was used to cope with the nonlinearity and complexity of the system in the control of temperature and relative humidity. The results showed the effectiveness of a wireless intelligent automation system in the monitoring of the different set points of the parameters. Traditional irrigation methods can be improved to optimize water usage by combining different domain technologies, as this article aims to demonstrate with the implementation of LoRa, fuzzy logic, and cloud services to reduce water usage in crop irrigation systems.
The evolution of information and communication technologies has led to the development of new concepts such as IoT and cloud computing. In particular, IoT enables the distribution of a large number of sensors and actuators in wide areas using wireless technologies. Typically, IoT devices are used to acquire large sets of data that may optimize production. Cloud computing centralizes computation resources, especially data storage and computing power, on border devices. This approach provides high-performance computing that may be used to execute complex algorithms by combining a range of advanced services. Modern networking technologies are also being introduced for communication tasks between IoT nodes and cloud services. One incipient low-power wide-area network (LPWAN) technology is LoRa. This is a low-cost, low-consumption technology suitable for covering large distances. LoRa is starting to be adopted in smart agricultural applications, which involve monitoring and data integration tasks. For example, the authors of [9] deployed a network of sensors to obtain environmental data and use AI techniques to find patterns, correlations, and anomalies. This information was used to determine the irrigation schedule with an on/off control. In [10], a five-layer architecture was proposed for smart farming based on LoRa. The proposed architecture, integrating intelligent edge technology with LoRa and IoT, demonstrated promising outcomes for smart farming and automated irrigation. In [11], a LoRa long-range data acquisition system was proposed. This system uses a fuzzy logic controller that calculates the irrigation time needed. However, their approach performs an open-loop control, which lacks robustness under uncertainties. Consequently, it can fail to stabilize the values of the parameters, e.g., the soil humidity. The authors of [12] developed an IoT architecture for automated irrigation control for marigold flowers using LoRa. Their work demonstrated that the yield increased by 66.78% when compared with manual irrigation.
Fuzzy logic (FL) allows making decisions based on imprecise and non-numerical information, being closer to human language than other technologies [13]. In addition, FL eases the calculus of an output variable considering multiple inputs. It uses linguistic terms to contextualize the input values by defining the degree of membership in some defined fuzzy sets. These characteristics make FL a suitable tool for nonlinear systems because of its flexibility and decision-making capacities [14]. FL controllers have been used in multiple fields, proving their operation capabilities [15,16,17]. For example, the authors of [18] used a two-factor second-order fuzzy trend to forecast the Taiwan Stock Exchange Capitalization Weighted Stock Index (TAIEX). Although it uses a language closer to human reasoning, the controller operation requires three stages (fuzzification, inference, and defuzzification) to determine the output based on the imposed rules. There are two main types of fuzzy systems: Mamdani and Sugeno [19,20]. The difference between them is the way they approach the last stage, defuzzification. While Mamdani creates a set of membership functions for the outputs, Sugeno selects among different values. Therefore, in the case of Mamdani, an algorithm is needed to calculate the output value based on the geometry inferred from the FL rules. In the case of Sugeno, however, this step is achieved by a polynomial function that is inferred from the activated rules. The primary benefit of employing Sugeno over Mamdani lies in its computational efficiency and easier integration with other algorithms. Additionally, Sugeno can ensure the continuity of the output surface. On the other hand, Mamdani is characterized by its intuitive nature and ease of use for humans [21].
Some authors applied FL in agriculture with the objective of reducing water consumption. For example, the authors of [22] proposed a WiFi-based, low-cost system for environmental temperature, soil moisture, relative humidity, lighting monitoring, and remote on/off control. In [7], a fuzzy-stranded-neural network model detected downy mildew in viticulture early and successfully. In [23], the FL technique was used to monitor and set the duration for which the water pump would be turned on. Another example can be found in [24], where the authors proposed an FL controller and compared its performance with manual and drip irrigation methods. Their approach achieved a reduction in water consumption of 18% and 7%, respectively. This controller type works as an on/off controller. In [25], a five-state discrete output controller based on FL was designed. The results of the FL algorithm were used to select the resulting state. Their approach increases the number of output variables, offering more flexibility than traditional on/off controllers, and achieves more precise water handling, reducing water loss.
Real-time digital simulators are used in diverse fields and industries to reduce the validation time for control schemes and to avoid possible damages in real plants [26]. Hardware-in-the-loop (HiL) testing stands out as a popular technique for developing and commissioning embedded systems in real time, introducing all the complexities of the controlled plants [27]. By doing so, the effectiveness of the control scheme on a simulated plant can be assessed in real time before its implementation on an actual physical plant.
The inefficient use of water in agriculture is a global problem that threatens water supply and sustainability. Our approach has the potential to significantly reduce water consumption in agriculture, with broader implications for environmental sustainability. In this work, we present an approach that reduces water consumption in crop irrigation. The main contributions of this paper are the following:
  • An architecture that integrates different technologies for optimizing water usage in crop irrigation. Namely, it combines LoRa wireless communication and a fuzzy logic controller with weather forecast cloud services.
  • Design of a continuous state output fuzzy logic controller that achieves a smoother and more precise water flow control when compared to traditional controllers, i.e., on/off and discrete state output controllers.
  • Integration of cloud services to feed the control algorithm with the precipitation data forecast to further reduce water waste.
The use of LoRa communication technology allows the covering of a wide range of distances while providing low-cost and low-power usage. Actually, this technology is very suitable for agricultural applications [9]. Fog and cloud computing concepts are included to better scale the control scheme in order to incorporate several plants.
The contributions of this work were validated by means of hardware in the loop. The water balance model of the soil was implemented on the dSPACE DS1104 platform. Two MKR WAN 1300 were used to perform the communication between the DS1104 platform and the computer where the control is implemented. Several experiments were carried out to assess the performance of the proposed approach in various scenarios.
The rest of the paper is arranged as follows: Section 2 describes the materials and methods used, such as the hardware implementation, fuzzy logic control algorithm, soil model, and LoRa communication used. Section 3 provides and discusses the validation results obtained from the hardware-in-the-loop implementation. Finally, a summary, conclusion remarks, and future work are presented in Section 4.

2. Materials and Methods

2.1. Architecture and Layout

The validation of the wireless irrigation controller was performed using HiL. The controller was implemented in a Matlab script using the FL toolbox on a PC. The model was designed using Simulink 2022B by MathWorks and integrated into the embedded hardware dSPACE DS1104 through the dSPACE real-time interface. For communication between these two elements, there were LoRa devices at both ends. On the computing node, the Arduino MKRWAN 1300 receiving the measurements and sending the control actions to the actuators was connected to the PC by serial communication. On the other hand, on the system dynamics simulation side, the Arduino would communicate with the DS1104 using the analog and digital inputs and outputs to send the measurements to the computing node and execute the control commands. Data acquisition and supervision were conducted using the graphical user interface Control Desk 2022B, a component of the dSPACE software package. Subsequent data processing and analysis were carried out using Matlab. Figure 1 shows a diagram of the proposed HiL implementation.

2.2. Soil Model

The HiL requires a model for the analysis of soil moisture and temporal evolution in diverse conditions. For this purpose, a water balance formulation was used for the upper soil layer. Not all of the water that falls because of atmospheric conditions and irrigation is completely absorbed, as shown in Figure 2. In addition, losses in water content are due to, on the one hand, water drainage with the deeper layers (deep percolation) and the adjacent soil volumes (interflow) and, on the other hand, direct evaporation at the surface and transpiration of the vegetation. Equation (1) models this dynamic for a soil layer of thickness L as follows:
d W ( t ) d t = f ( t ) e ( t ) g ( t ) W ( t ) < W m a x
where W ( t ) is the amount of water in the soil layer, also known as volumetric water content (VWC), f ( t ) is the fraction of water precipitated that infiltrates in the soil, e ( t ) represents the water loss due to evapotranspiration, g ( t ) the water loss from deep percolation and interflow, and W m a x is the maximum water capacity.
The infiltration can be estimated with different equations. Some of them are Richards’ equation [28], Georgakakos and Baumer formula [29], Green and Ampt formula [30], Horton’s equation [31], and Kostiakov equation [32]. For the drainage, there are formulas such as the one proposed by Georgakakos and Baumer in [29], Hooghoudts equation [33], and a nonlinear relation proposed in [34]. The analysis by [34] compared models realized with different combinations of infiltration, drainage, and evapotranspiration formulas. They demonstrated that for infiltration, both the Georgakakos and Baumer empirical formulas and the Green and Ampt formulas synthesized the dynamics well. They also demonstrated that the nonlinear relation proposed in [34] achieves good results for drainage. Additionally, the Doorenboss and Pruitt equation was used to get the evapotranspiration rate. So, the Georgakakos and Baumer empirical formula, the nonlinear relation for drainage, and the Doorenboss and Pruitt equation have been chosen for this work. The model combining these equations achieves an error between 0.008 and 0.030 cm3cm−3 and Nash–Sutcliffe coefficients (NS) of 0.74 and 0.81 [34], proving to be valid for simulating the soil moisture level with sufficient accuracy.
The selected infiltration formula uses a nonlinear parameter with the relative water content relative to the soil’s maximum capacity. Equation (2) condenses the nonlinearities of water infiltration f ( t ) into the soil:
f ( t ) = p ( t ) 1 W ( t ) W m a x m
where p ( t ) is the precipitation, W ( t ) is the soil water content, W m a x is the maximum water capacity of the soil, and m is the nonlinear parameter that depends on the soil properties. For the drainage g ( t ) formula, Equation (3) applies also a nonlinear relation of W ( t ) :
g ( t ) = K s W ( t ) W m a x 3 + 2 λ
where K s is the saturated hydraulic conductivity in mm h−1 and λ is the pore size distribution index linked to the structure of the soil layer.
Evapotranspiration affects the water content that evaporates to the atmosphere on the surface and the transpiration of the crops, which is the main cause of the loss of water content in the soil. It is represented in Equation (4) by a linear relation of the potential evapotranspiration E T p ( t ) , a factor K c depending on the crop type and size, and the soil saturation:
e ( t ) = K c E T p ( t ) W ( t ) W m a x
The potential evapotranspiration is computed through the empirical relation of Blaney and Criddle as modified by Doorenbos and Pruitt [35], as shown in Equation (5):
E T p ( t ) = a + b [ ξ ( 0.46 T a ( t ) + 8.13 ) ]
where T a ( t ) is the air temperature in °C and ξ , a, and b are constants that need calibration depending on various factors like the minimum of the air-specific humidity, the diurnal wind velocity (nearly two times the velocity in the nocturnal hours), and the ratio between the actual and theoretical sunshine hours. These parameters can be estimated from tables in [35], through explicit equations [36,37], or from experimentally obtained values. This formula can be extended with wind velocity and air humidity if more accuracy is needed, but it adds complexity both for calculation and for collecting variables that are difficult to measure and require specific equipment. For this model, the simplest representation with air temperature was selected. The model parameters were selected, matching the cloud data used with the model response. Table 1 shows the usual range of values for the parameters of the model, as shown in [34], and the selected values for the model:
There are three main values attached to the VWC, as shown in Figure 3 [38]. The first one corresponds to saturation, characterized by the absence of air in the soil and substantial surface runoff. The second value is field capacity, indicating the cessation of free drainage and preventing the movement of water from shallow to deeper soil layers. The limit between saturation and field capacity marks the optimal soil water content for conducive plant growth since the plant has to use minimal energy to extract the nutrients. The third value is the wilting point, where the water content is insufficient for plant roots to extract water from the soil; therefore, this value and below should be avoided.

2.3. LoRa 868 MHz-Based Wireless Communication

Since the introduction of Industry 4.0, different wireless technologies have been adopted, such as ZigBee, Bluetooth, LoRa and LoRaWAN, ISA 100.11a, WirelessHART, and WIA-PA. Most of them are based on the IEEE 802.15.4 standard [39], which is a widely established standard that features a low bit rate and low power consumption. It defines the lower levels focused on enabling low-cost communication between ubiquitous devices. The standard can use several nonregulated frequency bands, like 868 MHz (Europe), 900 MHz (North America), and 2.4 GHz (worldwide). Both WiFi and most wireless technologies rely on the 2.4 GHz network, which is why this frequency band is more susceptible to interference. LoRa technology has similar objectives compared with other IEEE 802.15.4 standard technologies, such as low-power communication and IoT-oriented applications, but it has key differences, such as its modulation technique or frequency bands. LoRa achieves a longer range, immunity to interference, and lower power consumption at the cost of lower data rates [40].
In this project, we opted for LoRa modules for several compelling reasons: (1) they have a solid track record of reliability, durability, and affordability; (2) LoRa modules can operate at 868 MHz, a frequency outside the crowded 2.4 GHz band, minimizing interference with other technologies; (3) this technology offers exceptional flexibility, allowing configuration for various topologies and scenarios; and (4) when paired with high-gain antennas, they are capable of extending coverage to cover substantial distances, spanning several kilometers.
LoRa is an RF proprietary modulation technology for low-power, wide-area networks (LPWANs). It claims a 5 km range in urban areas and 15 km or more in rural areas. It is designed for applications that require long-range or deep in-building communication among a large number of devices that have low power requirements and that collect small numbers of data. Although the concepts are often mixed up, LoRa defines only the physical layer of communications, while LoRaWAN defines layers 2 and 3. In this project, only the LoRa physical layer capabilities are used to reduce latency and jitter in communications. LoRa uses a proprietary spread-spectrum modulation technique derived from existing chirp spread spectrum (CSS) technology. This offers a trade-off between sensitivity and data rate, depending on the configured parameters. LoRa uses a variation of direct sequence spread spectrum (DSSS) [41]. One of the downsides of a DSSS system is the fact that it requires a highly accurate reference clock. With LoRa CSS technology, the spreading of the signal’s spectrum is achieved by generating a chirp signal that continuously varies in frequency. This method means that the timing and frequency offsets between the transmitter and receiver are equivalent, greatly reducing the complexity of the receiver design. The amount of spreading code applied to the original data signal is called the spreading factor (SF). LoRa modulation has a total of six spreading factors (SF7 to SF12). The larger the spreading factor used, the farther the signal is able to travel and still be received without errors by the RF receiver, but it also takes a longer time on air; thus, the data rate decreases.

2.4. Fuzzy Logic Control Algorithm

As discussed in Section 1, FL controllers are composed of three steps: (1) fuzzification, (2) inference engine, and (3) defuzzification. The goal of the controller is to maintain the moisture level given by a reference. This reference can change based on meteorological predictions to anticipate when rain events will occur and, therefore, adjust the reference in advance to avoid providing water that will later be supplied by the rain. Weather forecasting is one of the most complex physical models humans have ever created, requiring overwhelming computational power. It is, therefore, impossible to implement these models in a hardware solution. However, thanks to the Internet, anyone can access the results through public APIs. In this case, using the API [42] provided by OpenMeteo, every hour, the controller can access the weather forecast for the next 24 h in 15 min intervals to see the rainfall forecast. If there is rain in the forecast, the reference is adjusted so that instead of the optimum point, its value is adjusted to the amount of rain predicted, always without going below the wilting value.
The inputs of the controller are the error between the VWC and the reference and the rate of change of this error. In this way, we can easily cope with the change in the baseline caused by the rain forecast. In order to make the first step, fuzzification, a definition of the membership functions for each input of the controller is needed. For the error input, three functions are defined: two linear Z-shaped functions and one triangular function. The two Z-shaped functions are at the two extremes of the error, positive and negative, and the triangular function is centered on the zero error. Similarly, the error rate membership functions are defined with two functions for the positive and negative changes and a triangular function centered at zero. Therefore, the objective of the controller is to bring the inputs to a state where [error, error rate] = [0, 0], as this indicates the tracking of the reference. Figure 4 and Figure 5 show the membership functions used for error and error rate, respectively.
The third step, defuzzification, varies depending on the FL controller type. In this case, the Sugeno-type FL controller was selected. The Sugeno type suits the continuous output state better since it guarantees the continuity of the output surface. In addition, it is able to better handle situations where very low water input is required compared to Mamdani’s defuzzification methods. The output values must, therefore, be defined. Three possible values have been chosen for this application based on the dynamics of the system. These correspond to zero, medium, and maximum input to the irrigation system. As the controller runs every minute, the value of the maximum input is selected so that it does not overshoot the VWC in that minute in order to avoid water waste. Table 2 shows the used output values.
Among these steps, there is the inference between the inputs and the set of rules to calculate the output. The set of if–then rules has been formulated to avoid overshoot in the reference tracking to avoid water waste. Table 3 summarizes the set of rules implemented on the controller. Figure 6 shows the 3D graphical representation surface of the set of rules.
Finally, Figure 7 shows the control algorithm flowchart for the integration of fuzzy logic and weather forecast cloud services. The algorithm starts when the computing node receives a new message from a sensor and actuator node. First, the algorithm checks if the data for the next 24 h are already stored. If the data are not stored, it connects to the cloud weather forecast service to retrieve and store them. Once the data are available, the algorithm calculates the sum of the expected precipitation over the next 24 h and calculates the adjustment in the reference input. The adjusted reference is then fed to the fuzzy logic controller. After the fuzzification, inference, and defuzzification processes, the control output is sent to the sensor and actuator nodes.

3. Results

This section presents the results obtained using the HiL technique during the various tests carried out. These results seek to demonstrate the feasibility and effectiveness of the proposed control scheme. In addition, this section is intended to highlight the significant advantages compared to more traditional control schemes. A detailed analysis of the data collected reveals not only the response of the new control system but also its superior performance in terms of efficiency and adaptability. These findings are critical to supporting the adoption and implementation of the proposed control scheme in real-world applications, thus supporting its position as a more advanced and efficient alternative to conventional methodologies.
For the validation of the FL controller, in the first experiment, a controlled benchmark monitoring scenario was performed. During this evaluation, the ability of the controller to track the reference without error and without generating unwanted overshoots was analyzed. The test was performed at a constant temperature and without precipitation. While this scenario might not replicate real environmental conditions, it allowed us to focus on specific aspects of controller functionality. It is important to note that during the design phase of the controller, the output values were carefully selected to prevent overshoot, which contributed to avoiding water wastage. This proactive approach to controller configuration aimed not only to optimize performance but also to promote efficient water resource management. Figure 8 shows the environmental conditions imposed. As mentioned above, a constant temperature of 20 °C and no rainfall events were imposed. Figure 9 shows the response of VWC at a step change from the initial 0.25 cm3/cm3 to the 0.4 cm3/cm3 of the reference.
In Figure 9, it can be observed that the controller was able to reach the reference with a minimal stationary error. In 5 min, the controller reached a VWC of 0.39 cm3/cm3. It is not advisable to reduce this time by much more because of the delay in the assimilation of water by the soil. Increasing the irrigation input per unit of time can lead to poor assimilation of water. In the steady-state regime, it was possible to completely eliminate the error, ensuring that the set reference was not exceeded. This achievement is crucial to fulfilling the goal of preventing water wastage by the control system. To attain this objective, the controller must, during the transient period, compensate for the water deficiency in the soil between the initial point and the established reference. Once this balance is achieved, in the steady-state condition, the controller must consistently balance the water loss due to evapotranspiration and deep percolation. Figure 10 graphically illustrates the contribution of irrigation and losses due to evapotranspiration and deep percolation, demonstrating how irrigation first compensates for the lack of water during the transient phase and then continuously balances the input and losses in the steady state. This behavior highlights the effectiveness of the control system in maintaining the desired water balance and preventing both water shortages and excess irrigation.
In the next experiment, the FL controller was compared with an on/off controller with hysteresis. The experiment was carried out for four days with real temperature and precipitation data. In this way, the behavior of the controllers under real conditions was analyzed to validate the results observed previously. The comparison was performed by contrasting the tracking behavior of the reference set at a VWC of 0.4 and the amount of water wasted. To define the amount of wasted water, the quantity of irrigation water supplied was measured when the VWC was above 0.4 (the desired reference) since this amount of water does not improve the feeding conditions of the plant and, therefore, this water expenditure does not increase the productivity of the crop. Figure 11 shows the temperature and precipitation profile during the experiment time, and Figure 12 shows the comparison between these two controllers. For the temperature and precipitation, 4 days of historical data were used. The temperature profile shows an overall descent in the temperature from a really hot day to more warm ones. The day and night cycles in the profile throughout a day can also be observed. For the precipitation profile, Figure 11 shows some intermittent light rains on days two and three, with no rain on days one and four.
In Figure 12, it can be observed that the FL controller did not overshoot the reference because it only surpassed the reference during precipitation. On the other hand, the on/off controller, because of its nature, constantly exceeded the reference, thus generating a waste of water. Furthermore, in terms of tracking the reference, this controller oscillated around the reference point, so the system was never at the point of maximum production. However, the FL controller managed to follow the reference exactly except in rainy events. The total irrigation water input in the two cases is 9.481 and 9.562 mm for the FL and on/off controller, respectively. However, this comparison is not very fair because the on/off controller maintained the VWC below the reference during some time frames, so less water was used in these time frames. Therefore, it is convenient to analyze the water waste as defined above. The FL controller did not waste water, as it never overshot the reference other than by rainfall. The on/off controller, however, had a wastage of 2.209 mm, a 23.1% of water input when it was above the reference. It should be noted that the VWC above the reference is not better for plant growth, so this water is wasted. Therefore, the FL controller performs better both in total water expenditure as well as in tracking reference and water waste.
For the last experiment, the focus was on observing the benefits of introducing cloud services for acquiring precipitation forecast data. To achieve this, a controller was deployed that, based on the forecast for the next 24 h, analyzed the expected rainfall during that period and adjusted the system’s reference to compensate for the additional water input anticipated during those 24 h. However, there were limits to how much the reference could be reduced, as entering the wilting point zone should be avoided to prevent potential damage to the plant due to dehydration.
The controller received precipitation forecasts every hour through the OpenMeteo API, which is publicly accessible. Once the forecast was obtained, the controller approximated the change in reference, as mentioned earlier. This adjustment allowed for water savings since the control system did not provide the amount of water predicted to fall. However, this approach also had some negative aspects because, for a certain period, the system could be below the maximum growth point. Nevertheless, this drawback could be diminished by reducing the change in the reference, but obviously, this would also reduce the water savings. These changes in the reference only occur if a precipitation event is forecasted in the next 24 h; therefore, for the rest of the time, the system behaved identically to the controller without this addition. Since these data are part of the OpenMeteo database and it was not possible to access the forecast for those days, to reproduce the error between forecast and actual precipitation, an uncertainty in the forecast precipitation value used by the controller was introduced. The test was conducted under the same conditions as the previous experiment, namely, in a 4-day simulation using the environmental data presented in Figure 11. Figure 13 shows the response of the evolution of VWC through the experiment.
In this graph, we can observe how the controller with a reference change based on the prediction adjusts the reference every hour. However, because of the slow dynamics of the system, some changes do not have an immediate impact on the system, as it needs more time to evolve. While it may be tempting to extend the prediction further into the future, this poses challenges since it would increase the likelihood of reducing the reference to a point where we are constantly at the wilting point.
The graph also indicates that the controller has performed well in anticipating the necessary reduction in irrigation due to rainfall, as the reference is never surpassed because of precipitation. Although there is a small calculation error due to the nonlinearity of the plant and the underestimation of water losses compared to the rainfall term, the proposed control system presents a good performance. These nonlinearities of the plant can also be modeled in the prediction model to improve precision. However, the introduction of such terms would complicate the calculations because of the nonlinearities involved and is considered unnecessary since other terms, such as the error between prediction and actual precipitation, are more predominant and make the water losses negligible.
In addition to the behavior of the VWC, it is also interesting to analyze the irrigation effort being made. Figure 14 displays the accumulation of irrigation during the experiment. Here, it can be observed how both controllers exhibit identical behavior initially until the rainfall forecast comes into play. Upon detecting the rainfall event, the VWC reference is proportionally changed in anticipation of the rain. As the forecast progresses and the accumulation of the next 24 h increases or decreases, the reference decreases or increases accordingly, causing the controller to act accordingly. Eventually, the VWC can reach the estimated reference, and the contribution resumes to balance the losses.
After the conclusion of the last rainfall event, the controller closes the gap with the reference, having overestimated the effect of the rain. Consequently, it returns to a transient state, balancing the losses. Meanwhile, the unmodified controller attempts to maintain its reference constant at 0.4 cm3/cm3, and each rainfall event surpasses this reference, forcing it to cease water contribution until reaching it again. In total, the modified controller used 9.481 mm of water, compared to 9.095 mm from the unmodified controller. That is, the reduction is 4.07% throughout the 4 days, demonstrating the controller’s ability to keep the crop at field capacity by leveraging rainfall to reduce water consumption, making the control much more efficient in water resource utilization. This percentage can vary depending on the experiment’s weather conditions and length; the longer the experiment and the more rainfall, the higher the percentage of water waste savings.

4. Conclusions

Modern information technologies are being introduced in agriculture to improve the performance of agricultural processes while optimizing water usage. In particular, the combination of artificial intelligence techniques with IoT technologies may help to improve the efficiency of agricultural applications by optimizing the use of resources. This paper proposes a control scheme aimed at agricultural applications to reduce water consumption in crop irrigation. It uses edge/fog/cloud concepts that may help scale the presented approach to applications of different sizes. The presented approach involves a fuzzy logic controller with continuous control output that achieves a more precise water flow. In order to improve the performance of the fuzzy controller, the presented approach allows integration with cloud services that provide weather forecasting information. LoRa communication is used since this is a low-cost and low-power consumption technology able to cover a wide range of distances.
The presented control scheme was validated in the laboratory by means of a hardware-in-the-loop plant, which executed the dynamics of the water balance model of the soil in a dSPACE DS1104. LoRa communications were used between the fuzzy controller and the hardware-in-the-loop. Additionally, a connection with cloud services, offering the weather forecast, was implemented to improve water usage efficiency. The integration with cloud services, particularly for precipitation forecast data, was a key feature that enhanced the controller’s predictive capabilities. Thus, after analyzing upcoming weather conditions, the controller might adjust irrigation references proactively, preventing the overuse of water for irrigation and reducing water waste. Laboratory results proved that the presented approach achieved better management of water resources, reducing water consumption.
A notable achievement of the proposed controller is the ability to maintain a maximum growth point for the crops, as observed in the experimental validation. Through careful consideration of reference adjustments and the avoidance of entering the wilting value zone, the controller strikes a balance between water conservation and optimal plant hydration. The continuous state controller provides a smooth control. The comparison between the proposed fuzzy logic and traditional on/off controllers showed a reduction in water consumption of 23.1%. Moreover, the introduction of cloud services for weather forecasts enhances the ability of the controller to reduce water usage. This reduction in water usage, demonstrated by the comparative analysis of the modified and unmodified controllers, highlighted the efficiency of the presented control scheme. Experimental results showed a reduction of 4.07% in water usage during a four-day experiment when weather forecast cloud services were added to the controller. In summary, the designed irrigation system controller represents an advancement in precision agriculture. The presented approach combines a fuzzy logic controller, fog computing, cloud services for precipitation forecasting, and a focus on water conservation while maintaining crop growth. The system demonstrated its potential to contribute to sustainable and resource-efficient agricultural practices. Furthermore, the introduction of fog-computing structures may help to build scalable systems capable of managing several agricultural plants simultaneously.
In the future, the authors are going to implement the system in a real crop to check the promising results of the presented approach. The authors also intend to define a multilayer IoT architecture to manage several crops by combining cloud and fog services.

Author Contributions

Conceptualization, O.B., E.A. and I.C.; methodology, O.B. and E.A.; investigation, E.A.; writing—original draft preparation, E.A.; writing—review and editing, E.A., J.U., O.B. and I.C.; visualization, J.U., A.d.R. and I.M.T.; supervision, O.B. and I.C.; project administration, O.B. and I.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Dataset available on request from the authors.

Acknowledgments

The authors wish to express their gratitude to the Basque Government through the project EKOHEGAZ II; to the Diputación Foral de Álava (DFA) through the project CONAVANTER; to the UPV/EHU, through the project GIU20/063; and to the MobilityLab Foundation (CONV23/14. Proy. 16) for supporting this work.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Rockström, J.; Falkenmark, M.; Lannerstad, M.; Karlberg, L. The planetary water drama: Dual task of feeding humanity and curbing climate change. Geophys. Res. Lett. 2012, 39. [Google Scholar] [CrossRef]
  2. Gleick, P.H.; Heberger, M. Water and conflict. In The World’s Water, 2008–2009: The Biennial Report on Freshwater Resources; Island Press: Washington, DC, USA, 2014; pp. 159–171. [Google Scholar]
  3. Dong, C.; Huang, G.; Cheng, G.; Zhao, S. Water resources and farmland management in the Songhua River watershed under interval and fuzzy uncertainties. Water Resour. Manag. 2018, 32, 4177–4200. [Google Scholar] [CrossRef]
  4. Liu, J.; Shu, L.; Lu, X.; Liu, Y. Survey of Intelligent Agricultural IoT Based on 5G. Electronics 2023, 12, 2336. [Google Scholar] [CrossRef]
  5. Zhai, Z.; Martínez, J.F.; Beltran, V.; Martínez, N.L. Decision support systems for agriculture 4.0: Survey and challenges. Comput. Electron. Agric. 2020, 170, 105256. [Google Scholar] [CrossRef]
  6. Araújo, S.O.; Peres, R.S.; Barata, J.; Lidon, F.; Ramalho, J.C. Characterising the agriculture 4.0 landscape—Emerging trends, challenges and opportunities. Agronomy 2021, 11, 667. [Google Scholar] [CrossRef]
  7. Kontogiannis, S.; Koundouras, S.; Pikridas, C. Proposed Fuzzy-Stranded-Neural Network Model That Utilizes IoT Plant-Level Sensory Monitoring and Distributed Services for the Early Detection of Downy Mildew in Viticulture. Computers 2024, 13, 63. [Google Scholar] [CrossRef]
  8. Azaza, M.; Tanougast, C.; Fabrizio, E.; Mami, A. Smart greenhouse fuzzy logic based control system enhanced with wireless data monitoring. ISA Trans. 2016, 61, 297–307. [Google Scholar] [CrossRef] [PubMed]
  9. Indira, P.; Arafat, I.S.; Karthikeyan, R.; Selvarajan, S.; Balachandran, P.K. Fabrication and investigation of agricultural monitoring system with IoT & AI. SN Appl. Sci. 2023, 5, 322. [Google Scholar]
  10. Raja Gopal, S.; Prabhakar, V. Intelligent edge based smart farming with LoRa and IoT. Int. J. Syst. Assur. Eng. Manag. 2024, 15, 21–27. [Google Scholar] [CrossRef]
  11. Benzaouia, M.; Hajji, B.; Mellit, A.; Rabhi, A. Fuzzy-IoT smart irrigation system for precision scheduling and monitoring. Comput. Electron. Agric. 2023, 215, 108407. [Google Scholar] [CrossRef]
  12. Bunpalwong, M.; Rukhiran, M.; Netinant, P. Improving marigold agriculture with an IoT-driven greenhouse irrigation management control system. Bull. Electr. Eng. Inform. 2023, 12, 3817–3825. [Google Scholar] [CrossRef]
  13. Zadeh, L.A. Fuzzy logic. Computer 1988, 21, 83–93. [Google Scholar] [CrossRef]
  14. Sala, A. On the conservativeness of fuzzy and fuzzy-polynomial control of nonlinear systems. Annu. Rev. Control. 2009, 33, 48–58. [Google Scholar] [CrossRef]
  15. Jia, X.; Zhao, M. A Hierarchical Energy Control Strategy for Hybrid Electric Vehicle with Fuel Cell/Battery/Ultracapacitor Combining Fuzzy Controller and Status Regulator. Electronics 2023, 12, 3428. [Google Scholar] [CrossRef]
  16. Schouten, N.J.; Salman, M.A.; Kheir, N.A. Fuzzy logic control for parallel hybrid vehicles. IEEE Trans. Control. Syst. Technol. 2002, 10, 460–468. [Google Scholar] [CrossRef]
  17. Ochoa, D.; Martinez, S.; Arévalo, P. A Novel Fuzzy-Logic-Based Control Strategy for Power Smoothing in High-Wind Penetrated Power Systems and Its Validation in a Microgrid Lab. Electronics 2023, 12, 1721. [Google Scholar] [CrossRef]
  18. Chen, S.M.; Jian, W.S. Fuzzy forecasting based on two-factors second-order fuzzy-trend logical relationship groups, similarity measures and PSO techniques. Inf. Sci. 2017, 391, 65–79. [Google Scholar] [CrossRef]
  19. Zadeh, L.A. The concept of a linguistic variable and its application to approximate reasoning—I. Inf. Sci. 1975, 8, 199–249. [Google Scholar] [CrossRef]
  20. Tsay, D.L.; Chung, H.Y.; Lee, C.J. The adaptive control of nonlinear systems using the Sugeno-type of fuzzy logic. IEEE Trans. Fuzzy Syst. 1999, 7, 225–229. [Google Scholar] [CrossRef]
  21. Nguyen, A.T.; Taniguchi, T.; Eciolaza, L.; Campos, V.; Palhares, R.; Sugeno, M. Fuzzy control systems: Past, present and future. IEEE Comput. Intell. Mag. 2019, 14, 56–68. [Google Scholar] [CrossRef]
  22. Robles Algarín, C.; Callejas Cabarcas, J.; Polo Llanos, A. Low-cost fuzzy logic control for greenhouse environments with web monitoring. Electronics 2017, 6, 71. [Google Scholar] [CrossRef]
  23. Abdullah, N.; Durani, N.A.B.; Shari, M.F.B.; Siong, K.S.; Hau, V.K.W.; Siong, W.N.; Ahmad, I.K.A. Towards smart agriculture monitoring using fuzzy systems. IEEE Access 2020, 9, 4097–4111. [Google Scholar] [CrossRef]
  24. Krishnan, R.S.; Julie, E.G.; Robinson, Y.H.; Raja, S.; Kumar, R.; Thong, P.H.; Son, L.H. Fuzzy logic based smart irrigation system using internet of things. J. Clean. Prod. 2020, 252, 119902. [Google Scholar] [CrossRef]
  25. Rahim, S.; Hussain, M.; Rahim, S.; Hashim, N.; Halim, H. An automatic irrigation system for plants using fuzzy logic controller considering volumetric water content. In Journal of Physics: Conference Series; IOP Publishing: Bristol, UK, 2020; Volume 1432, p. 012011. [Google Scholar]
  26. Myaing, A.; Dinavahi, V. FPGA-based real-time emulation of power electronic systems with detailed representation of device characteristics. In Proceedings of the 2011 IEEE Power and Energy Society General Meeting, Detroit, MI, USA, 24–28 July 2011; pp. 1–11. [Google Scholar]
  27. Saleem, A.; Issa, R.; Tutunji, T. Hardware-in-the-loop for on-line identification and control of three-phase squirrel cage induction motors. Simul. Model. Pract. Theory 2010, 18, 277–290. [Google Scholar] [CrossRef]
  28. Richards, L.A. Capillary conduction of liquids through porous mediums. Physics 1931, 1, 318–333. [Google Scholar] [CrossRef]
  29. Georgakakos, K.P.; Baumer, O.W. Measurement and utilization of on-site soil moisture data. J. Hydrol. 1996, 184, 131–152. [Google Scholar] [CrossRef]
  30. Rawls, W.J.; Brakensiek, D.L.; Miller, N. Green-Ampt infiltration parameters from soils data. J. Hydraul. Eng. 1983, 109, 62–70. [Google Scholar] [CrossRef]
  31. Horton, R.E. An approach toward a physical interpretation of infiltration capacity. Soil Sci. Soc. Am. J. 1940, 5, 339–417. [Google Scholar] [CrossRef]
  32. Kostiakov, A. On the dynamics of the coefficient of water. percolation in soils and on the necessity of studying it from a dynamic point of view for purposes of amelioration. Sixth Comm. Int. Soil Sci. SocMoscow 1932, 14, 17–21. [Google Scholar]
  33. Smedema, L.; Poelman, A.; De Haan, W. Use of the Hooghoudt formula for drain spacing calculations in homogeneous-anisotropic soils. Agric. Water Manag. 1985, 10, 283–291. [Google Scholar] [CrossRef]
  34. Brocca, L.; Melone, F.; Moramarco, T. On the estimation of antecedent wetness conditions in rainfall–runoff modelling. Hydrol. Process. Int. J. 2008, 22, 629–642. [Google Scholar] [CrossRef]
  35. Doorenbos, J.; Pruitt, W. Crop Water Requirements. FAO Irrigation and Drainage Paper 24; Food and Agriculture Organization of the United Nations, Viale delle Terme di Caracalla: Rome, Italy, 1977; pp. 108–119. [Google Scholar]
  36. Jensen, M.E. Evapotranspiration and irrigation water requirements. In Manuals and Reports on Engineering Practice; American Society of Civil Engineers: New York, NY, USA, 1990; Volume 70, pp. 25–41. [Google Scholar]
  37. Allen, R.G.; Pruitt, W.O. FAO-24 reference evapotranspiration factors. J. Irrig. Drain. Eng. 1991, 117, 758–773. [Google Scholar] [CrossRef]
  38. Saleem, S.K.; Delgoda, D.; Ooi, S.; Dassanayake, K.; Liu, L.; Halgamuge, M.; Malano, H. Model predictive control for real-time irrigation scheduling. IFAC Proc. Vol. 2013, 46, 299–304. [Google Scholar] [CrossRef]
  39. IEEE Std 802.15.4-2020 (Revision of IEEE Std 802.15.4-2015); IEEE Standard for Low-Rate Wireless Networks. IEEE: Piscataway, NJ, USA, 2020; pp. 1–800.
  40. Almuhaya, M.A.; Jabbar, W.A.; Sulaiman, N.; Abdulmalek, S. A survey on Lorawan technology: Recent trends, opportunities, simulation tools and future directions. Electronics 2022, 11, 164. [Google Scholar] [CrossRef]
  41. Al mojamed, M. LTM-LoRaWAN: A Multi-Hop Communication System for LoRaWAN. Electronics 2023, 12, 4225. [Google Scholar] [CrossRef]
  42. Open-Meteo. Open Meteo Weather Forecast API. Available online: https://open-meteo.com/en/docs (accessed on 19 March 2024).
Figure 1. Ambient conditions for the experiment.
Figure 1. Ambient conditions for the experiment.
Electronics 13 01949 g001
Figure 2. Water balance diagram.
Figure 2. Water balance diagram.
Electronics 13 01949 g002
Figure 3. VWC saturation, wilting point, and field capacity values.
Figure 3. VWC saturation, wilting point, and field capacity values.
Electronics 13 01949 g003
Figure 4. Error input membership functions.
Figure 4. Error input membership functions.
Electronics 13 01949 g004
Figure 5. Error rate input membership functions.
Figure 5. Error rate input membership functions.
Electronics 13 01949 g005
Figure 6. Control surface for the set of rules.
Figure 6. Control surface for the set of rules.
Electronics 13 01949 g006
Figure 7. Control algorithm flow chart.
Figure 7. Control algorithm flow chart.
Electronics 13 01949 g007
Figure 8. Ambient conditions for the first experiment.
Figure 8. Ambient conditions for the first experiment.
Electronics 13 01949 g008
Figure 9. Step change from initial conditions to reference in the first experiment.
Figure 9. Step change from initial conditions to reference in the first experiment.
Electronics 13 01949 g009
Figure 10. Irrigation contribution and losses due to evapotranspiration and deep percolation.
Figure 10. Irrigation contribution and losses due to evapotranspiration and deep percolation.
Electronics 13 01949 g010
Figure 11. Ambient conditions for the second experiment.
Figure 11. Ambient conditions for the second experiment.
Electronics 13 01949 g011
Figure 12. Controller performance comparison: FL and on/off with hysteresis.
Figure 12. Controller performance comparison: FL and on/off with hysteresis.
Electronics 13 01949 g012
Figure 13. VWC evolution comparison: modified FL controller and FL controller.
Figure 13. VWC evolution comparison: modified FL controller and FL controller.
Electronics 13 01949 g013
Figure 14. Added irrigation comparison: modified FL controller and FL controller.
Figure 14. Added irrigation comparison: modified FL controller and FL controller.
Electronics 13 01949 g014
Table 1. Model parameters range and used value.
Table 1. Model parameters range and used value.
m K s λ ab ξ
Range3–160.3–200.09–0.5−20.8–20–1
Value8100.35−220.3
Table 2. Values for irrigation output.
Table 2. Values for irrigation output.
ZeroMediumHigh
Values0 mm0.1 mm0.25 mm
Table 3. Table of FL rules.
Table 3. Table of FL rules.
PositiveError
Zero
Negative
Error ratePositiveHighMediumZero
ZeroHighZeroZero
NegativeHighZeroZero
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Artetxe, E.; Barambones, O.; Martín Toral, I.; Uralde, J.; Calvo, I.; del Rio, A. Smart IoT Irrigation System Based on Fuzzy Logic, LoRa, and Cloud Integration. Electronics 2024, 13, 1949. https://doi.org/10.3390/electronics13101949

AMA Style

Artetxe E, Barambones O, Martín Toral I, Uralde J, Calvo I, del Rio A. Smart IoT Irrigation System Based on Fuzzy Logic, LoRa, and Cloud Integration. Electronics. 2024; 13(10):1949. https://doi.org/10.3390/electronics13101949

Chicago/Turabian Style

Artetxe, Eneko, Oscar Barambones, Imanol Martín Toral, Jokin Uralde, Isidro Calvo, and Asier del Rio. 2024. "Smart IoT Irrigation System Based on Fuzzy Logic, LoRa, and Cloud Integration" Electronics 13, no. 10: 1949. https://doi.org/10.3390/electronics13101949

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop