Next Article in Journal
Smart Matter-Enabled Air Vents for Trombe Wall Automation and Control
Previous Article in Journal
Performing-Arts-Based ICH-Driven Interaction Design Framework for Rehabilitation Game
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Design and Validation of an IoT-Integrated Fuzzy Logic Controller for High-Altitude NFT Hydroponic Systems: A Case Study in Cusco, Peru

by
Julio C. Escalante-Mamani
1,
Erwin J. Sacoto-Cabrera
2,
Roger Jesus Coaquira-Castillo
1,
L. Walter Utrilla Mego
3,
Julio Cesar Herrera-Levano
3,
Yesenia Concha-Ramos
4,* and
Edison Moreno-Cardenas
3
1
LIECAR Laboratory, Universidad Nacional de San Antonio Abad del Cusco (UNSAAC), Cusco 08003, Peru
2
GIHP4C, Universidad Politécnica Salesiana, Cuenca 010102, Ecuador
3
TESLA Laboratory, Universidad Nacional de San Antonio Abad del Cusco (UNSAAC), Cusco 08003, Peru
4
Professional Academic School of Systems and Computer Engineering, Universidad Continental, Cusco 08000, Peru
*
Author to whom correspondence should be addressed.
Electronics 2025, 14(18), 3740; https://doi.org/10.3390/electronics14183740
Submission received: 12 August 2025 / Revised: 15 September 2025 / Accepted: 19 September 2025 / Published: 22 September 2025

Abstract

Hydroponics in recirculation systems faces significant challenges in regulating critical parameters, such as pH and electrical conductivity (EC), especially in adverse environmental conditions, such as high altitudes. This paper presents the design and validation of a fuzzy controller integrated with IoT for NFT-type hydroponic systems, implemented on low-cost hardware and tested in the city of Cusco (3339 m.a.s.l.). Unlike previous studies that are limited to simulations or laboratory tests, the proposal was validated under real growing conditions, demonstrating its practical viability. The system incorporates a fuzzy controller based on simple rules, an IoT module with ESP32 for remote monitoring via Blynk, and an accessible and replicable architecture. The results demonstrate stable performance in pH and EC regulation, with adequate response times, minimal overshoot, and reduced errors, achieving levels comparable to those of higher-cost commercial solutions. The main contribution of this study is the demonstration that an intelligent, economical, and replicable system can be applied in agricultural environments with limited resources, offering a viable alternative for improving productivity in high-altitude hydroponic systems.

1. Introduction

Hydroponics is a soilless cultivation technique that has gained global relevance as a sustainable alternative to the challenges of traditional agriculture, such as intensive water use and soil degradation [1,2]. In recirculating systems, such as the nutrient film technique (NFT), controlling critical variables such as pH and electrical conductivity (EC) is essential to ensure nutrient availability and optimal crop growth [3]. Instability in these variables can lead to nutritional imbalances and significant productivity losses, especially in resource-limited environments.
In particular, hydroponics has established itself as a practice that can reduce water consumption by up to 90% [4,5]. In addition, this method offers other advantages, such as a controlled and optimized production process, lower space requirements, and higher-quality crops [6]. These advantages position hydroponics as a transformative tool for urban agriculture, vertical farming, and climate-resilient food production systems. Despite these benefits, the adoption of hydroponic systems, especially in a nutrient film technique (NFT) configuration [7], remains limited in developing countries. Studies on urban agriculture in countries such as Peru have suggested that barriers to its dissemination include the high cost of commercial equipment, dependence on closed platforms, and lack of adequate technical training [8]. Especially in the Andean region of Peru, particularly in Cusco, various agricultural areas face unfavorable conditions such as scarce water availability, acidic soils, and limited technology applied to the agricultural sector [9,10]. The limitations described above have hurt local production, creating a need for accessible and replicable technological solutions for small producers. In addition, in traditional Andean communities, technological innovation encounters difficulties in its integration with ancestral agricultural practices that still persist in the region [11].
On the other hand, in hydroponic systems, precise maintenance of pH and electrical conductivity (EC) in the nutrient solution (NS) is critical to avoid problems with nutrient absorption, root development, and crop yield [3,4]. In this regard, although automated commercial solutions exist, they are often inaccessible to producers with limited resources, and their implementation requires infrastructure and technical knowledge that is not always available in small agricultural workshops [6]. Regulating pH and EC is not trivial, as these parameters exhibit nonlinear dynamics influenced by nutrient composition, solution temperature, and crop uptake rates. Furthermore, these effects are amplified at high altitudes, where evaporation and oxygenation dynamics differ from sea-level environments. Likewise, traditional PID controllers often struggle to manage these coupled nonlinearities. Therefore, fuzzy logic control (FLC) is well suited in this context, as it does not require precise mathematical models and can handle uncertainty and dynamic variations.
Several studies have proposed fuzzy controllers for hydroponic systems [12,13,14], using Mamdani-type architectures. However, these implementations are limited to laboratory environments or simulations and lack validation under real growing conditions. Furthermore, important aspects such as field-calibrated rule bases, integration with low-cost hardware, and modularity for small-scale or resource-constrained producers remain under-explored, especially in the Andean region of developing countries. In response to this gap, this study presents the design and implementation of a low-cost fuzzy control system for pH and EC regulation in NFT-type hydroponic systems. In this system, a thin layer of NS continuously circulates through a channel, partially exposing the roots to water and air, which improves absorption and root development [15,16,17]. This work proposes and validates a fuzzy logic control system integrated with IoT for the regulation of pH and electrical conductivity in NFT hydroponic systems, implemented in Cusco, Peru, at 3339 m above sea level. The system combines a Mamdani-type fuzzy controller implemented on an ESP32 microcontroller with the Blynk platform for remote monitoring, resulting in a low-cost and replicable solution. The guiding hypothesis of this study is that a fuzzy controller integrated with IoT, implemented on low-cost hardware, can maintain the stability of pH and EC under real high-altitude cultivation conditions, thereby achieving performance comparable to that of commercial solutions. Based on this proposal, the main contributions of this study are as follows:
  • Novelty and validation under real conditions: The system was validated under real growing conditions at 3339 m above sea level in Cusco, Peru, using low-cost hardware and analogue sensors. This constitutes a novel contribution, as most previous work has been limited to laboratory setups or simulations.
  • Reproducibility and replicability: The design of the hardware, software, and fuzzy logic controller, as well as the calibration of the pH and EC sensors, is described in sufficient detail to ensure reproducibility. The description balances technical depth with clarity, allowing other researchers and practitioners to replicate the system while maintaining the conciseness of the main text.
  • Comparative analysis and robustness: The performance of the fuzzy controller is analyzed in comparison with conventional strategies such as PID, MPC, and adaptive fuzzy approaches. The results demonstrate that the proposed fuzzy system offers robustness against nonlinearities and environmental disturbances while maintaining a low implementation cost, making it particularly suitable for small producers in resource-constrained environments.
Es importante aclarar que la comparación con controladores convencionales, como PID y MPC, se realiza únicamente a nivel teórico, sustentada en la literatura revisada. La validación experimental directa de estos métodos no se implementó en este trabajo y se plantea como una línea de investigación futura. Ultimately, the type of research pursued in this study falls within the applied approach [18], as it provides a specific technological solution to a real problem in the field of hydroponic agriculture [15], specifically, the automatic control of the physicochemical parameters of the NS [12]. Likewise, this study is descriptive [18], as it focuses on characterizing and analyzing the behavior of the variables of pH and EC, as well as documenting in detail the process of design, implementation, and evaluation of the proposed control system. On the other hand, this research focuses on the design and implementation of a fuzzy control system to regulate the pH and EC levels of the NS, which are critical parameters for the proper development of hydroponic crops. Fuzzy logic [12] is selected for its ability to adapt to dynamic and uncertain environments, allowing flexible and robust management through heuristic rules. These rules are constructed based on the literature on fuzzy control for NSs [14]. On the other hand, acid and base solutions are used for pH regulation, dosed by peristaltic pumps [12]. The controlled addition of NS and water achieves EC control. The experimental tests were carried out in an environment located in the city of Cusco.

Related Work

Precision agriculture (AP) encompasses a wide range of technologies that seek to optimize the use of resources in agriculture through automation, data analysis, and sensor-based monitoring, as described in [19]. In recent years, various studies have explored integrating FLC strategies in hydroponic systems, particularly those using NFT, due to their simplicity, energy efficiency, and suitability for leafy green crops such as lettuce and spinach [20]. In this context, several studies have addressed the regulation of physicochemical parameters such as pH and EC using Mamdani-type fuzzy controllers, highlighting the system’s ability to manage uncertainty in nutrient dynamics [21]. Specifically, within the framework of the NFT technique, in [6], the authors describe successful applications of the NFT system that include the intensive production of leafy vegetables such as lettuce, arugula, and spinach, both in greenhouses and in urban environments [22]. Despite its high efficiency and scalability, there have been no reports of the implementation or evaluation of automated NFT systems based on fuzzy logic (FL) at high altitudes such as those in Cusco, Peru (3399 m above sea level (m a.s.l.)), where environmental factors can affect the dynamics of temperature, evaporation, and oxygenation of the solution [23]. Therefore, experimentally validating this type of technology in high-altitude contexts represents a relevant technical contribution to AP in Andean regions.
The framework FLCs have been widely adopted in agricultural systems due to their ability to manage nonlinear dynamics and uncertainties without requiring precise mathematical models [24]. This feature makes them suitable for environments where variables interact in complex and sometimes unpredictable ways, such as in hydroponic systems. Maintaining NS parameters, such as pH and EC, within optimal ranges in these systems is crucial for plant development, nutrient uptake, and root health. Traditional proportional integral derivative (PID) controllers often struggle to manage these variables simultaneously, mainly when the system exhibits nonlinear responses or time-varying behaviors. Several studies have explored the application of fuzzy control in this context, achieving satisfactory regulation of these parameters. For example, Safira et al. [25] implemented a fuzzy controller that dynamically adjusts nutrient concentrations based on real-time environmental input, improving stability under fluctuating growing conditions. Similarly, Chen et al. [12] evaluated a fuzzy system capable of jointly controlling pH and EC, achieving more robust operation compared to fixed-rule-based methods. These works confirm that fuzzy control is not only viable but also advantageous in systems with uncertain dynamics, such as hydroponics. However, its implementation is usually limited to simulation environments or high-cost laboratories.
Recent advances in microcontroller and embedded systems technologies have enabled the integration of low-cost hardware into smart agriculture. Devices such as the ESP32 and Arduino platforms provide sufficient processing power for fuzzy inference and support wireless communication using Wi-Fi, Bluetooth, and LoRaWAN, enabling real-time data acquisition, control, and cloud connectivity [15]. These microcontrollers are not only energy-efficient but are also compatible with a wide range of sensors and actuators, making them ideal for resource-limited environments. In parallel, mobile platforms such as Blynk have facilitated the development of intuitive interfaces that enable real-time monitoring and bidirectional control via smartphones [26]. This reduces the need for local human intervention and increases operational flexibility, especially for remote or automated farming applications [27]. The integration of these tools enables remote adjustments of dosing programs and immediate alerts in case of parameter deviations, improving user-level decision-making.
Furthermore, these platforms can support data logging and visualization, which is crucial for optimizing irrigation strategies and nutrient delivery. Despite these advantages, many existing systems using these components still lack robust control algorithms or rely on manual thresholding rather than dynamic, rule-based decision-making [28]. The potential synergy between embedded systems and FL remains underutilized in practical hydroponic applications, as described in [29].
However, most implementations lack real-time integration with IoT platforms or are limited by the use of industrial-grade sensors, which increases costs and reduces accessibility [30]. In many studies, the use of expensive EC and pH probes, as well as proprietary software platforms, represents a barrier to adoption by small producers, educational institutions, or developing regions [1]. Furthermore, few studies report detailed controller performance metrics, such as rise time, settling time, overshoot, or steady-state error, which are essential for assessing system stability and robustness under real-world operating conditions. These omissions limit the reproducibility and comparative evaluation of the proposed solutions. In some cases, the evaluation is only descriptive, without quantitative references or field-testing.
Table 1 summarizes representative studies in hydroponic control and IoT integration, highlighting their strategies, variables, environments, hardware, and limitations.
As shown in Table 1, despite promising results in simulation and laboratory environments, none of the reviewed studies reported validation under real high-altitude conditions using low-cost IoT-based fuzzy controllers.
On the other hand, when comparing the different methods concerning fuzzy logic, we have the following: ON–OFF and PID controllers generate oscillations and require constant adjustment in response to changing conditions, despite being economical and simple, limiting their accuracy in variable nutrient solutions [32]. While model-based predictive control (MPC) and adaptive methods outperform multivariable and nonlinear systems, these methods require accurate models and high computational resources, which makes their application in low-cost units difficult [33,34]. On the other hand, fuzzy control does not depend on an accurate mathematical model, it naturally manages the uncertainty and nonlinearities of the system, it reduces oscillations compared to ON–OFF, and it offers greater robustness than PID. Furthermore, it maintains simple implementation and low computational cost compared to MPC and adaptive control [32,33]. These characteristics make it an ideal alternative for applications in practical hydroponic systems.
This work addresses these shortcomings by implementing a Mamdani-type FLC using low-cost analog sensors and ESP32, fully integrating into an IoT dashboard through the Blynk platform. Sensor calibration is performed using standard solutions to improve measurement reliability, and a custom printed circuit board (PCB) is developed to minimize electrical noise and optimize component layout. Unlike previous studies, the proposed system is experimentally validated in a real-world hydroponic lettuce cultivation environment, with a thorough analysis of the system’s control behavior and responsiveness. This improves its potential scalability and practical applicability in precision agriculture contexts, where affordability and ease of implementation are essential.
As can be seen, the main difference in this work lies in the combination of the following:
  • Use of FL adjusted empirically and experimentally for the actual conditions of the prototype.
  • Modular, low-cost design (∼USD 100), validated in the field in Cusco, unlike existing solutions.
  • Full integration with the Blynk IoT platform, enabling real-time remote monitoring and control.
In summary, the main contribution lies in the integration of low-cost hardware with empirically adjusted fuzzy control strategies, validated in high-altitude hydroponic environments. This approach highlights methodological innovations for smart agriculture.
The remainder of this article is structured as follows. Section 2 describes the research methodology, which addresses the type of research, the research design, the techniques and instruments used, and the research’s limitations. Section 3 presents and describes the system model and its structure. Section 4 summarizes the main research results. Section 5 presents a discussion of our results in comparison with the results of previous studies. Section 6 describes the overall conclusions of the study. Finally, Section 7 describes the limitations and suggests future research that opens up this study.

2. Methodology

2.1. Research Design

This study follows the design science research (DSR) paradigm, which focuses on the creation and iterative refinement of technological artifacts to solve real-world problems in specific contexts [35,36]. According to this paradigm, the research process involves designing, developing, implementing, and validating a functional prototype, specifically a fuzzy-logic-based control system for regulating pH and EC in NFT hydroponics, which was tested under real operating conditions. Likewise, the study is exploratory-applied in nature, aimed at validating the system’s operation under real conditions, rather than performing inferential statistical tests. Explicitly, the research methodology followed a structured sequence of stages, summarized in Figure 1. This workflow begins with a review of the current state of the art in automated hydroponic systems [15,37,38], identifying key parameters and structural requirements. Then, a technical and economic evaluation of sensors, actuators, and microcontrollers was conducted. Based on this evaluation, the NFT hydroponic system was physically constructed, and an FL controller was designed. In addition, the embedded firmware and user interface were developed to enable real-time monitoring and control. Then, the system was integrated, tested, and validated, culminating in analyzing pH performance and EC regulation.

2.2. Techniques and Instruments

The controller was developed using the Mamdani method with the centroid defuzzification technique [39]. The accuracy of the measurements was verified through calibration processes with standard solutions (buffers) for both pH and EC. Specifically, three buffer solutions certified by Hanna Instruments [40] with pH values of 4.01, 7.00, and 10.01 were used for pH. For EC, buffer solutions of 1.413 mS/cm and 12.88 mS/cm of international origin were used. In addition, the control system used potassium hydroxide to increase the pH and phosphoric acid to reduce it. Thus, NS was added to increase the EC, and demineralized water was added to decrease it. Also, peristaltic pumps ensured accurate dosing, and the measured values were verified using certified instruments. Also, in this work, MATLAB/Simulink version R2022b was used as a prototyping environment for designing and validating fuzzy membership functions and rule bases prior to implementation. This step allowed the controller’s performance to be evaluated in different scenarios, the functions adjusted iteratively, and implementation errors minimized. After validation, the membership functions were transferred to the Arduino IDE for integration into the ESP32 microcontroller. This transfer ensured consistency between the simulation and the integrated operation. The instruments used are described below.
  • Actuators. Relay modules and peristaltic pumps were used due to their high precision, reliability, and compatibility with low-voltage microcontrollers. On the other hand, the relays allowed loads of up to 10 A and 250 V in alternating current to be switched, and there are also optocouplers to prevent interference in the control circuit.
  • Peristaltic pump. Peristaltic pumps used in research have a simple and reliable structure for handling corrosive and shear-sensitive fluids. The operation of these pumps ensures continuous, contamination-free dosing. The system uses a time-based dosing mechanism, which delivers 2.3 mL/s for acid and base solutions and 2.8 mL/s for NSs.
  • Ultrasonic level sensor. The HC-SR04 ultrasonic level sensor (Manufacturer: Multicomp Pro; Shenzhen, China) [41] was chosen for its low cost, reliability, and operation without physical contact with the fluid. This sensor works by emitting and receiving ultrasonic waves to avoid contamination of the NS.
  • RTC module. The RTC module DS3231 (Manufacturer: Maxim Integrated; Dallas, TX, USA) was implemented to ensure the temporal synchronization of the system, including scheduled events such as irrigation and recirculation [42]. In addition, this module is very accurate and tolerant to power interruptions thanks to its backup battery.
  • Temperature sensor. The DS18B20 digital sensor (Manufacturer: Maxim Integrated; Dallas, TX, USA) was used for temperature monitoring due to its high accuracy, moisture resistance, and ease of integration using the 1-Wire protocol.
  • LCD screen. A 20 × 4 character LCD screen with an I2C interface was implemented to simplify wiring and optimize the microcontroller’s input/output resources. The I2C interface was also compatible and facilitated the display of critical system parameters.
On the other hand, the research development followed these steps. First was the initial design and implementation, for which the system requirements were defined (variables to be controlled: pH and EC). Next, a fuzzy controller based on the Mamdani technique was designed, configuring the fuzzy sets and inference rules in MATLAB/Simulink. Afterwards, the prototype was implemented with an ESP32 microcontroller, (Manufacturer: Espressif Systems; Shanghai, China) inexpensive sensors, and peristaltic pumps. Second, validation was carried out in a laboratory, where controlled tests were performed to verify correct communication between sensors, actuators, and the Blynk IoT platform. Then, the membership function parameters were adjusted through iteration cycles, correcting deviations detected in the dynamic response of the system. Third, the experimental evaluation was carried out under real conditions, i.e., the system was installed in a hydroponic module in the city of Cusco (3399 m a.s.l.), subjecting it to real variations in temperature, pressure, and environmental conditions. Performance data (rise time, settling time, overshoot, steady-state error) were then collected. Finally, the results obtained were compared with reference values from commercial systems to validate the prototype’s efficiency.
Overall, the proposed NFT-type hydroponic system is based on the continuous flow of a thin film of NS through slightly inclined channels, where the plant roots are partially exposed to air [15]. Also, the proposed system was developed and validated in the city of Cusco, Peru (3399 m a.s.l.), in high-altitude conditions where, to date, no automated tests of NFT hydroponic systems have been reported [23]. The experimental study included the germination of lettuce seeds (Lactuca sativa) for 3–4 weeks until seedlings were obtained, which were then transplanted into the constructed hydroponic system and remained in cultivation for an additional 6 weeks under automated monitoring and diffuse control. Likewise, experimental work was carried out at temperatures between 10 and 19 degrees Celsius for 40 days with four lettuce seedlings in a container with 15 L of nutrient solution capacity. The system combines analogue sensors, an ESP32 microcontroller, peristaltic pumps, and the Blynk IoT platform. It was validated in situ to prioritize its accessibility, modularity, and educational applicability for small Andean producers.

3. System Model

The hydroponic system is structured around an integrated modular control architecture to regulate the pH, EC, and temperature of the NS [37]. The system consists of three main subsystems: (i) a detection unit composed of analog and digital sensors for monitoring the environment and nutrients, (ii) a processing and control unit based on a microcontroller that executes FL algorithms, and (iii) an actuation unit that includes peristaltic pumps and solenoid valves for dosing and flow regulation, as shown in Figure 2. The implementation of the hydroponic system begins when the program monitors the main parameters (pH level and EC). Then, it monitors the NS temperature, as temperature affects the measurement of both parameters. Also, the software considers the temperature value to determine the pH and EC correctly. Therefore, it is necessary to monitor the NS level using the HC-SR04 ultrasonic sensor, i.e., to check whether there is enough NS in the system to provide adequate irrigation at the time of recirculation throughout the system. If the NS level is low, the peristaltic pumps are activated to add NS and water to the system for the time necessary to determine that the NS level is adequate (the ultrasonic sensor also determines this). If the NS level is not low, then the level is adequate to perform the recirculation process defined by the RTC module. The module determines when to turn the NS recirculation pump on and off (it activates it for 5 min every hour between 06:00 and 18:00). The pH sensor checks the pH level. If the pH level is low, the pump is activated to add the basic solution to the NS, and if the pH level is high, the pump is activated to add the acid solution. If the pH level is within the appropriate range, the IoT platform continues to monitor the system. The EC sensor checks the EC level. If the EC level is low, the pump is activated to add NS; if the EC level is high, the pump is activated to add water. Finally, if the EC level is within the appropriate range, the system continues to be monitored through the IoT platform. A sampling time of 120,000 ms is applied to activate these pumps, i.e., if a level outside the appropriate ranges is detected and remains so during this time, only then is the pump activated. If, during this time, the measured level returns to the desired range, no pump is activated either for pH or for EC. This procedure was used to avoid unnecessary activation of the pumps, as incorrect readings can always be recorded. In addition, a human–machine interface facilitates data visualization and system configuration via serial communication.
Figure 3 shows the functional block diagram of the hydroponic system. Data from the sensors, including pH, EC, temperature, and NS level, is continuously acquired and transmitted to the ESP32 microcontroller. In addition, within the ESP32, an FLC algorithm processes the pH and EC measurements to determine the appropriate corrective actions. In parallel, on/off control logic manages the NS level, and temperature readings are used to monitor and compensate pH and EC regulation, ensuring accuracy. Based on the control outputs, the ESP32 activates the appropriate relays to operate the peristaltic pumps and solenoid valves to adjust the pH, EC, and NS level. Simultaneously, real-time sensor data is displayed on an LCD screen and transmitted via Wi-Fi to the Blynk IoT platform for remote monitoring.
The pH control subsystem consists of two peristaltic pumps: one that dispenses an acidic solution to lower the pH and another that dispenses a basic (alkaline) solution to raise it. The control logic is based on a fuzzy inference system that continuously evaluates the deviation of the current pH from a predefined optimal range. If the pH exceeds the upper threshold, i.e., the solution becomes too alkaline, the acid pump is activated to reduce the pH. Conversely, if the pH falls below the lower threshold, i.e., the solution becomes too acidic, the base pump is activated to increase the pH. This mechanism maintains pH stability within the optimal range for leafy vegetable growth, minimizing plant nutrient lockout and physiological stress.
Table 2 summarizes the optimal pH and EC values for hydroponic cultivation of leafy vegetables, such as lettuce, based on agronomic guidelines [3]. These parameters are fundamental for nutrient availability and efficient absorption by the roots. The pH range of 5.6 to 6.2 ensures balanced solubility of macro and micro nutrients. However, the EC range of 1.5 to 2.2 mS/cm indicates the total concentration of dissolved nutrients suitable for this type of crop. These values serve as reference and calibration points for the automated control system.
The hydroponic system model is divided into four parts: NS control system, control and monitoring interface, design and development of electronic cards, and, finally, construction of the hydroponic system. Each of these parts is addressed in Section 3.2, Section 3.3 and Section 3.4, which detail their functionality, implementation, and contributions to the overall operation of the system.

3.1. Mathematic Model

The pH modeling is approximated as a first-order system with delay, subject to natural drift due to nutrient absorption processes and chemical imbalance. Equation (1) describes pH modeling.
d d t p H ( t ) = k p H ( p H ( t ) p H e q ) + u p h ( t ) ,
where k p H is the decay constant towards equilibrium p H e q and u p h ( t ) is the control action through injection of corrective solution.
EC modeling is approximated as a first-order system, defined in Equation (2).
d d t E C ( t ) = k E C ( E C ( t ) E C e q ) + u E C ( t ) ,
where u E C ( t ) is the nutrient dosage.

3.2. NS Control System

This section describes aspects related to pH and EC control. The complete system was configured as a negative feedback loop consisting of sensors (pH and EC) to acquire current values, a diffuse controller for error processing and corrective action generation, actuators (peristaltic pumps) for solution injection, and an IoT platform (Blynk) for data monitoring and storage. Equation (3) defines the representation of the closed-loop system.
Y ( s ) = G p ( s ) G c ( s ) 1 + G p ( s ) G c ( s ) R ( s ) ,
where G p ( s ) represents the plant (dynamic model of the hydroponic system) and G c ( s ) represents the fuzzy controller. Figure 4 shows the control diagram of the hydroponic system for pH level control and EC, respectively.

3.2.1. pH Control

The fuzzy controller [43] used for pH control activates and deactivates the relays that control the operation of the peristaltic pumps: one to dispense a basic substance and increase the pH, and another to dispense an acidic substance and decrease it. The pH control is developed in three stages: pH sensor, pH sensor calibration, and fuzzy pH controller.
  • pH sensors. The selection of the pH-4502C sensor was based on a comparative analysis of cost, integration feasibility, and technical performance for use in low-cost embedded control systems. Table 3 compares three candidate pH sensors: the pH-4502C (Manufacturer: Shenzhen Robotlinking Technology Co.; Shenzhen, China), S-pH-01 Modbus (Manufacturer: Seeed Studio; Shenzhen, China), and Orbipac CPF81D (Manufacturer: Endress+Hauser; Reinach, Switzerland). The comparison includes key technical specifications such as measurement range, resolution, response time, output type, calibration method, and price. The pH-4502C was chosen due to its wide compatibility with 5 V microcontrollers (e.g., Arduino), analog output signal, low cost, and sufficient accuracy for real-time control in hydroponic systems. While its accuracy and long-term stability are lower than industrial-grade sensors like the Orbipac CPF81D, its performance-to-cost ratio aligns well with the objectives of this low-cost implementation [44].
  • Calibration of the pH sensor. The calibration of the pH sensor begins with an analysis of the pH level. To achieve an adequate pH level in the water, it is necessary to raise and lower the pH as required [45]. This process is carried out in two parts. First, we add water and acid solution to decrease the pH. Second, we add water and base solution to increase the pH of the water. Then, the sensors are calibrated using standard solutions of known pH, measuring the voltage generated by the sensor in each solution. On the other hand, the average voltage obtained with the pH 7.007 solution for calibrating the pH sensor using Arduino software version IDE 2.3.6 is 3.6 V. Table 4 shows the voltage values obtained for each solution (sample), which are used to calibrate the sensor. To ensure the reliability of the calibration process, a certified benchtop pH meter (Hanna Instruments HI2211 (Manufacturer: Hanna Instruments; Smithfield, RI, USA)) was used as a reference instrument to verify the pH values of the standard buffer solutions. The voltage readings from the pH-4502C sensor were recorded simultaneously and plotted against the reference pH values to construct a calibration curve. A linear regression analysis was then performed using Python version 3.11.9, yielding an R 2 value greater than 0.98. This value confirms the correlation between sensor voltage and pH in the test range.
Based on Table 4, we can determine the pH–voltage relationship of solutions with pH values of 4.01, 7.007, and 10.01 for pH sensor calibration.In addition, the data were adjusted using exponential regression to obtain a mathematical expression relating voltage to pH, which facilitated signal interpretation by the controller. Equation (4) defines the mathematical expression for sensor calibration.
y i = a e b x i ,
where y i is the dependent variable, x i is the independent variable, and a and b are parameters. Exponential regression starts with logarithmic transformation (Equation (5)), followed by linear regression (Equation (6)), then the determination of the coefficients (Equations (7) and (8)), and, finally, the parameters (Equation (9)).
Logarithmic transformation : ln y i = ln a + b x i ,
Linear regression : z i = ln y i z i = m x i + c ,
Coefficients : m = n x i z i x i z i n x i 2 ( x i ) 2 ,
c = z i x i 2 x i z i x i n x i 2 ( x i ) 2 ,
Parameters : b = m , a = e c
where m is the slope, c is the intersection, and n is the number of data points. Based on Equations (5)–(9) and our data, we obtained the values for x, y, and z shown in Table 5.
Based on Table 5, we determined m = 0.61172 and c = 4.14164 and the simplified expression of y in Equation (10).
y = 62.90527 e 0.61172 x .
  • Fuzzy pH controller. The proposed fuzzy controller was designed with membership functions based on previously established pH ranges (Table 6). The input and output membership functions were developed and adjusted in Matlab, where the fuzzy rules, as shown in Table 7, were also defined using the Mamdaniinference method.
Defuzzification was performed using the centroid method [39], obtaining results as shown in Figure 5. Then, the membership functions were transferred to the Arduino Integrated Development Environment (IDE) to develop the microcontroller code. The microcontroller output controls the activation time of the relays that activate the peristaltic pumps. These pumps adjust the pH by dosing potassium hydroxide (to raise pH) or phosphoric acid (to lower pH) [15].
Table 8 shows the operation of the implemented fuzzy controller. The fuzzy controller regulates the activation duration in proportion to the measured error, with a positive output to activate the alkaline pump and a negative output for the acid pump. The output is zero in the optimal pH range (5.6–6.2), so no pump is activated.

3.2.2. EC Control

Three relays control the EC of the hydroponic system: two activate peristaltic pumps that dose nutrient solutions A and B to increase the EC, and a third activates a solenoid valve that introduces pure water to reduce it. The system is managed by the ESP32 microcontroller, (Manufacturer: Espressif Systems; Shanghai, China)which is shared with pH control. EC control is developed in three stages: EC sensor, EC sensor calibration, and FLC of EC.
  • EC sensor. The selection of the EC sensor was guided by a technical and economic comparison of three commonly available models: the DFRobot Gravity EC sensor (Manufacturer: DFRobot; Shanghai, China), the S-EC-01 TDS sensor (Manufacturer: Seeed Studio; Shenzhen, China), and the SUP-TDS7001 industrial probe (Manufacturer: Supmea Automation Co.; Hangzhou, China). Table 9 presents a side-by-side comparison of key specifications, including measurement range, resolution, output signal, calibration method, and compatibility with microcontrollers. The DFRobot Gravity EC sensor was selected due to its analog output (0–2.3 V), wide measurement range, low power requirements, and native compatibility with 5 V microcontrollers such as Arduino. While the SUP-TDS7001 offers higher industrial precision and long-term durability, its digital output (Modbus RTU), higher voltage requirements, and cost make it less suitable for low-cost educational and prototype systems. The Gravity EC sensor provides an appropriate balance between accuracy and affordability for real-time control applications in hydroponics. Technical specifications were obtained from manufacturer datasheets [46,47,48].
  • EC sensor calibration. The EC control has a peristaltic water pump to decrease the EC, and a peristaltic pump for combined nutrients (nutrient A and nutrient B) to increase the EC (1.56 μ S/cm = 1 ppm or 2 μ S/cm = 1 ppm). The accuracy of the TDS sensor is verified by calibration with standard solutions of known conductivity (1413 μ S/cm). Table 10 shows the EC values of the known samples and the voltage value corresponding to each measurement.
Based on Table 10, Equation (11) defines the characteristic curve equation.
Y = β X + a ,
where Y are the EC values and X are the voltage values obtained with the sensor. The calculation of α and β is performed using the following system of equations:
1.41 = β ( 2.76 ) + α ,
12.88 = β ( 3.33 ) + α .
Based on Equations (11)–(13), Equation (14) defines the final expression for sensor calibration.
Y = 21.26 X 57.28
Equation (14) is incorporated into the microcontroller code to convert analog readings into actual EC values.
  • FLC of EC. The development of the EC controller using FL is carried out using membership functions for fusion in the fuzzy controller. Table 11 shows the ranges of EC used for fuzzy control.
The input and output membership functions were developed and adjusted in Matlab, where the fuzzy rules, as shown in Table 12, were also defined using the Mamdaniinference method.
Defuzzification was performed using the centroid method [39], obtaining the results shown in Figure 6.
The membership functions were then implemented in the Arduino IDE to develop the microcontroller code. This microcontroller activates the relays, which in turn control the peristaltic pumps responsible for increasing the EC (using A + B NS) or reducing it (with pure water). Similar to pH control, the fuzzy controller regulates the activation time of the relays based on the value read by the EC sensor. The controller output, proportional to the error, translates into specific times programmed in the code, as shown in Table 13.
Table 14. pH measurement error with statistical metrics.
Table 14. pH measurement error with statistical metrics.
MeasurementpH ValueInstrumentAbsolute ErrorPercentage Error (%)Mean ± SDRMSE95% CI
Morning6.06.10.11.646.0 ± 0.150.12[5.8–6.2]
Afternoon5.76.00.35.005.8 ± 0.200.18[5.5–6.1]
Evening5.96.10.23.286.0 ± 0.180.15[5.7–6.2]
Table 15. Fuzzy controller performance (pH and EC) with additional statistical metrics.
Table 15. Fuzzy controller performance (pH and EC) with additional statistical metrics.
VariableReference ValueMeasured ValueAbsolute ErrorPercentage Error (%)Mean ± SDRMSE/IC95%
pH (three runs: morning, afternoon, evening; ref.: 6.0, 5.7, 5.9; measured: 6.1, 6.0, 6.1)
Morning6.06.10.11.646.07 ± 0.060.216/[5.92–6.21]
Afternoon5.76.00.35.00
Evening5.96.10.23.28
EC (three controller scenarios; reference: 1.8 mS/cm; measured: 1.9, 1.4, 2.3 mS/cm)
Case 11.81.90.15.561.87 ± 0.450.374/[0.74–2.99]
Case 21.81.40.422.22
Case 31.82.30.527.78
Table 13 shows the behavior of the fuzzy controller for EC regulation, along with additional statistical metrics. The results display the average values along with their standard deviations (mean ± SD) and the root mean square error (RMSE) from repeated trials. These indicators demonstrate that the controller’s responses were consistent, showing low variability and minimal errors within acceptable agronomic ranges. The inclusion of these statistical measures enhances the reproducibility and robustness of the proposed control strategy.
On the other hand, the activation time of the NS and water pumps works in the same way as that of the diffuse pH controller. If the EC is within the optimal range (1.5–2.2 mS/cm), the output is 0.0, and no pump is activated. If the EC is lower, the controller generates a negative output that activates the NS pump; if it is higher, the output is positive and activates the water pump. In both cases, the activation time depends on the controller’s output value, expressed in seconds.

3.3. Control and Monitoring Interface

The Blynk platform is used as an IoT solution to design the proposed hydroponic prototype. This solution enables real-time data acquisition, control, and remote monitoring capabilities. Furthermore, this design is based on the methodology described in [49], where Blynk effectively integrated mobile device-based interaction with embedded systems in agricultural applications.

3.3.1. IoT Control and Monitoring with Blynk

The operation of the system using IoT is as follows. First, the sensors collect relevant information from the environment; this information is received and processed by the ESP32 microcontroller. Second, the ESP32 connects to the Internet via an access point, and all the information processed by the sensors is sent to the IoT platform. The Blynk IoT platform allows the data collected to be viewed and controlled manually via an Internet connection through its mobile app or web platform [49]. The diagram representing the control and monitoring process through Blynk is shown in Figure 7.

3.3.2. Hydroponic System Control Interface

The design and development of the hydroponic system control and monitoring interface focus on visualizing and managing key parameters such as pH, EC, and lighting, allowing setpoints to be established from the same platform. Blynk provides a variety of widgets, allowing us to expand the controlled parameters [49]. Monitoring through the interface focuses on activating valves to adjust pH and EC, NS temperature, and irrigation frequency and duration. The real-time control and monitoring interface results are shown in Section 4.5.

3.4. Design and Development of Electronic Cards

The electronic cards for the hydroponic system were created usingEasy Eda software version 6.5.51 [50] due to its ease of exporting designs to a professional development level. Likewise, the development of the circuits is based on [51], where the authors develop the circuit for their precision air conditioning systems. Figure 8 shows the schematic of the complete electronic cards. The power supply used supplies 5 V to the EPS32 module. Also, it serves as a power supply for the pH sensor, EC sensor, temperature sensor, ultrasonic level sensor, RTC module, LCD display, and relay module. Additionally, another 12 V power supply is required for activation of the peristaltic pumps and recirculation pump when necessary.
Figure 9 shows the different stages of the design: the routing of the tracks (Figure 9a), the three-dimensional modeling of the boards (Figure 9b,c), and, finally, the finished electronic boards (Figure 9d,e).

3.5. Construction of the Hydroponic System

The process of implementing the hydroponic system is shown in Figure 10. Implementation begins with the structure of the plants and ends with the visualization of the operation of the control and monitoring system. Figure 10a shows the structure for placing the plants developed with polyvinyl chloride (PVC) tubes, and Figure 10b shows the development of lettuce plants in the hydroponic system. Finally, Figure 10c shows the control and monitoring system. The structure where the hydroponic system is installed has the following dimensions: 150 cm high, 60 cm wide, and 50 cm deep. In addition, this structure has two levels. On the first level is the nutrient container, which has a capacity of up to 15 L where the nutrient is placed. On the second level, a structure built with PCB pipes can hold four plants.
Once the hydroponic system is implemented, different tests are carried out to verify the optimal functioning of the sensors, as they have limitations due to being low-cost sensors and need to be verified by the system to determine their viability. This verification allows us to check if they are suitable for this type of research.

4. Results

This section presents the main results obtained in developing the hydroponic system.
The hardware and software used are as follows: ESP32 microcontroller. Created by Espressif Systems (Espressif, 2023), it has 520 KiB of SRAM memory, 448 KiB of ROM memory, and an integrated Wi-Fi antenna. The pH 4502c sensor was used to measure pH. This is an analog sensor with a measurement range of 0 to 14 and an accuracy of ±0.1. The Dfrobot Gravity sensor was used to measure the EC, which is an analog sensor with a measurement range of 0 to 15.6 mS/cm and an accuracy of 10%. Other components that were also used are an RTC 3231 module for managing and controlling the recirculation of the NS over a given period of time, a DS18B20 temperature sensor for temperature compensation in the measurement of both pH and EC, an HC-SR04 ultrasonic sensor used to control the NS level of the system, and a 2004 I2C LCD screen for displaying the measured parameters, which are pH, EC, temperature, and NS level.
To implement the fuzzy controller for both pH and EC, Matlab’s FL Designer was used for the simulation and development of the fuzzy rules. These fuzzy rules were then transferred to the Arduino IDE for programming the ESP32.

4.1. Step Response of the pH Control System

Figure 11 shows the response to the unit step of the control system for the NS pH as a function of time. At the same time, it shows the values of the main parameters: rise time (Tr), peak time (Tp), overshoot (Mp), settling time (Ts), and steady-state error (Ess). We can see that initially, the pH value of the water was approximately 7, which is very high for the hydroponic system. Then, the pH value stabilizes within the range of 5.6 and 6.2 by means of the implemented fuzzy control system. This range of values is desirable for optimal operation of the hydroponic system. On the other hand, we can see that a Tr of 55 s means that the system’s performance can be considered relatively slow in response to the output signal when there is a change in the input; a Tp of 65 s, which is the time it takes for the system’s response to reach its maximum value (peak) before stabilizing; and an Mp of 0.17, which indicates how much the system output exceeds the desired or final value during the transient phase of the response (in this case, the value can be considered low, which makes the system stable); a Ts of 80 s, which indicates that the system takes a while to stabilize; and, finally, an Ess of 0.08, which shows us that the system is stable over time once it has reached the desired value range.

4.2. Response to the EC Control System Step

Figure 12 shows the response to the control system unit step for EC as a function of time. At the same time, it shows the values of the main parameters: Tr, Tp, Mp, Ts, and Ess. We can see that initially, the EC value is 1 mSiemens. Then, the EC value stabilizes within the range of 1.8 and 2.2 milliSiemens of EC by means of the fuzzy control system implemented. This range of values is desirable for optimal operation of the hydroponic system. On the other hand, we determine the values of the following parameters: a Tr of 35 s, which means that the performance of the system can be considered relatively faster compared to the pH system; a Tp of 48 s, which is the time it takes for the system response to reach its maximum value (peak) before stabilizing; an Mp of 0.03, which makes the system much more stable in its response to input changes, a Ts of 62 s, which means that the system takes a little longer to stabilize, relatively close to the pH control; and, finally, an Ess of 0.02, which makes the system very stable over time, much more stable than the pH control.

4.3. pH Measurement Error

Table 14 shows the results of the absolute and percentage error in pH measurement obtained during the day. We can see that the pH value fluctuates slightly throughout the day, between 5.7 and 6.0. Each of the values obtained in the measurements taken at different times of the day is compared with the measurements made with the pH measuring instrument. As a result, we have an average absolute error of 0.2 and an average percentage error of 3.31%. This means that the system has a low average deviation from the actual value. This absolute error of 0.2 can be considered small compared to other applications of this type, and the average percentage error indicates the average value of the relative deviation from the actual value, expressed as a percentage. Given the precision required in this work, this percentage can be considered acceptable or even very good.
To strengthen the statistical reliability of the evaluation, Table 14 presents additional indicators, including the mean with standard deviation (mean ± SD), the root mean square error (RMSE), and the 95% confidence interval (CI95). These metrics offer a clearer understanding of the variability and reliability of the pH control system during repeated trials, emphasizing that deviations stayed within acceptable agronomic ranges.

4.4. EC Measurement Error

Table 15 shows the results of the absolute and percentage errors in the EC measurement obtained during the day. We can see that throughout the day, the EC value fluctuates slightly, between 1.8 and 1.9 mS/cm. Each of the values obtained in the measurements taken at different times of the day is compared with the measurements made with the EC measuring instrument. As a result, we have an average absolute error of 0.1 and an average percentage error of 3.33%. This means that, as in the case of pH, the system has a low average deviation from the actual value. This absolute error of 0.1 can be considered small compared to other applications of this type, and the average percentage error indicates the average value of the relative deviation from the actual value, expressed as a percentage. Given the precision required in this work, this percentage can be considered acceptable or even very good.
Table 15 summarizes the statistical performance of the fuzzy controller for pH and EC regulation. For pH, the system achieved a mean of 6.07 ± 0.06 with an RMSE of 0.216 and a 95% confidence interval of [5.92–6.21]. For EC, the results show a mean of 1.87 ± 0.45 mS/cm, with an RMSE of 0.374 mS/cm and a 95% confidence interval of [0.74–2.99] mS/cm. These indicators complement the dynamic control metrics and confirm the stability of the fuzzy controller under real operating conditions.

4.5. Real-Time Control and Monitoring Interface

Figure 13 shows the interface implemented on the Blynk platform for real-time monitoring and controlling pH, EC, and temperature display on computers and mobile phones. Figure 13a shows the current pH value on the left side and the EC value on the right. In the center, the NS level is shown at the top, where the value 0 indicates the ideal NS level; below this is the NS temperature value; and, finally, below the temperature is an indicator that activates (lights up) with the operation of the recirculation pump every hour for the duration of the NS recirculation. These parameters are also accessible from the Blynk mobile app, shown in Figure 13b. We can see the pH value at the top of Figure 13b. Likewise, we can see the pH and EC values at the bottom, and in the bottom left, we can see the NS level. In addition, we can see the temperature value at the bottom right.
Finally, the system latency had an average delay ranging from 1 to 2 s under Wi-Fi conditions, thus demonstrating its operational dependence on the Internet connection. In other words, the Blynk platform does not support offline mode, highlighting the lack of user control when disconnected. Therefore, IoT systems face different problems, such as packet loss and bandwidth limitations. To resolve these issues, future work could address local backup control, disconnection, and buffered data handling to improve the reliability and scalability of the architecture proposed in this research.

5. Discussion

The results obtained in this research align with previous research related to hydroponic systems and the control of pH and EC of NS. During the development of the crop, a decreasing trend in pH was observed, which is characteristic of this type of system. The automated control system works by dosing acid (phosphoric acid) without adding a basic solution (potassium hydroxide) to raise the pH. This asymmetry reinforces the need to prioritize downward pH correction in the early stages of system design. On the other hand, the EC behavior shows a continuous decrease throughout the crop cycle, which implies an exclusive action of the control system to raise its value.
Table 16 compares recent work related to automated control in hydroponic systems. The comparison considers the type of controller used, the variables monitored, the hardware platform, the approximate cost of implementation, the RMSE, and the scope of application in the real world. In terms of control strategy, most studies, including [12,13,14], adopted Mamdani-type FL controllers due to their ability to handle nonlinearities and imprecise information. Our work follows this approach but extends it by incorporating IoT functionality through the Blynk platform, which enables remote monitoring and system scalability. This element was not addressed in previous systems. Regarding the monitored variables, all the studies reviewed consider pH and EC to be the main parameters. Furthermore, in [52], not only pH and EC (through TDS) are monitored, but also temperature and water level, which increases the environmental adaptability of the system. Although our implementation focuses on pH and EC, the proposed architecture supports modular expansion to other variables as needed. Regarding hardware, previous systems are based on Arduino [13,14] or Raspberry Pi [12], which provide sufficient control capabilities but can increase cost or complexity. While our system uses the ESP32 microcontroller, which offers an optimal balance between energy efficiency and native Wi-Fi capabilities, it maintains a compact format. The cost of implementation is another advantage of the proposed system, i.e., our design achieves a significant cost reduction, with an approximate implementation cost of USD 100, compared to USD 180–300 for other systems. This cost reduction improves the feasibility of its implementation in rural environments with few resources, where economic constraints are decisive. On the other hand, our system achieves RMSE values of 0.12 for pH and 0.15 for EC, indicating robust and stable regulation, while the work of [13] reports a slightly lower RMSE for pH (0.10), demonstrating that our system has better control performance. Likewise, our system performs superior EC control, with an absolute error of less than 0.1. These results validate the effectiveness of our fuzzy controller and highlight the potential for improving performance by optimizing the hybrid control parameters. In terms of implementation, previous studies were limited to restricted environments [12,13,14], while [52] achieved a pilot-scale IoT prototype focused on monitoring. Our work, however, offers a complete implementation in a real NFT hydroponic environment, validating both fuzzy control and IoT integration under practical growing conditions.
This study was conducted in an NFT hydroponic farming environment. In contrast, other studies have focused on laboratory-scale systems or prototypes, demonstrating their applicability in a real environment, their practical viability, and robustness under real farming conditions.
Finally, regarding the IoT interface, using Blynk proved effective for real-time monitoring and control of key hydroponic variables such as pH, EC, and temperature. The low latency measured between 1 and 2 s, combined with access via mobile app and desktop access, provided a practical solution for users. Therefore, the platform is suitable for operators with minimal technical knowledge. However, it relies on an active internet connection, which may limit its implementation in areas with unstable connectivity.
In summary, validation in this research was carried out in a controlled indoor hydroponic environment, which is in line with standard practice in the early stages of development of automated nutrient management systems. Furthermore, hydroponic systems are commonly implemented in closed environments such as greenhouses, where environmental variables are regulated to improve plant growth efficiency. The validation of the proposed FL controller under such conditions allowed for an evaluation focused on system performance, excluding confounding variables such as climatic fluctuations or pest pressure. However, we recognize the importance of testing the system under broader and more realistic conditions, and we have included this aspect in our roadmap for future work.

6. Conclusions

This study presents the design and implementation of a low-cost automated system for monitoring and regulating pH and EC in hydroponic nutrient solutions. The system employs a Mamdani-type FLC deployed on an ESP32 microcontroller and integrates low-cost sensors, peristaltic pumps, and a remote monitoring interface via the Blynk IoT platform. Experimental validation demonstrated a satisfactory dynamic response. For pH regulation, the system achieved Tr = 55 s, Tp = 65 s, Mp = 0.17, Ts = 80 s, and Ess = 0.08, with a mean absolute error of 0.2 and a mean percentage error of 3.31%. For EC control, the values were Tr = 35 s, Tp = 48 s, Mp = 0.03, Ts = 62 s, and Ess = 0.02, with a mean absolute error of 0.1 and a mean percentage error of 3.33%. These results confirm the effectiveness of the fuzzy control strategy. The system autonomously maintains pH and EC within the optimal ranges, using independent fuzzy inference mechanisms and centroid-based defuzzification. The controller was initially developed in MATLAB and later implemented in the Arduino environment. The Wi-Fi module integrated into the ESP32 allows real-time remote monitoring and control via the Blynk platform. The prototype consists of a two-level structure measuring 150 × 60 × 50 cm. The lower level houses a 15 L nutrient tank, while the upper level incorporates a PVC pipe system capable of supporting up to four plants. The complete assembly validated the effectiveness of the system in real conditions. Likewise, the performance of the proposed solution was evaluated considering the presence of noise in the sensors and possible limitations of low-cost hardware. For noise in sensors, digital filtering techniques using moving averages were applied to pH and EC readings to reduce the variability associated with instantaneous fluctuations. Likewise, the fuzzy controller, which is based on linguistic rules rather than a rigid mathematical model, showed greater tolerance to noise than conventional PID control. The system was tested in a greenhouse environment for external interference with minor temperature fluctuations and electrical variations, maintaining stability within the reference ranges. In terms of hardware limitations, using an ESP32 implies restrictions on the accuracy of its integrated ADCs. However, errors remained within acceptable margins for agricultural applications. Overall, the system exhibits stable behavior in the face of disturbances and limitations inherent to low-cost hardware, reinforcing its applicability in low-cost, high-altitude environments. In conclusion, beyond technical feasibility, the main innovation of this study lies in the experimental validation of a low-cost fuzzy control architecture under high-altitude hydroponic conditions. Based on the literature, no previous work has demonstrated fuzzy pH and EC regulation in NFT systems at altitudes above 3300 m. This unique contribution, combined with IoT integration and affordability, reinforces the importance of the proposed solution for small-scale agriculture in resource-constrained environments. This study also carries broader implications for sustainable agriculture in resource-constrained contexts. The primary focus was on validating the technological feasibility of a low-cost fuzzy IoT-based control system, rather than directly measuring crop growth responses. Nevertheless, by demonstrating stable regulation of pH and EC under real high-altitude cultivation conditions, the work provides a reliable foundation for future agronomic studies that can assess yield, biomass, and plant health more directly. Moreover, the replicable and affordable design enhances the scalability of the solution to diverse crops and climatic regions, particularly where environmental stressors such as altitude, temperature fluctuations, and limited connectivity restrict conventional hydroponic adoption. By lowering dependence on costly commercial equipment and proprietary platforms, the proposed system has the potential to empower smallholder farmers, facilitating more inclusive and sustainable adoption of precision agriculture practices in low-resource settings.

7. Limitations and Future Work

This study has certain limitations that should be acknowledged. The proposed system focuses on automatic pH and EC control, temperature monitoring, and time-based irrigation management. Although the sensors used were calibrated correctly, their measurements can still be affected by intrinsic inaccuracies associated with low-cost electronic components, which could impact system reliability under varying operating conditions. Furthermore, the current implementation does not integrate crop-specific agronomic, nutritional, or phytosanitary parameters. The absence of these contextual factors may limit the system’s generalization and scalability across different crop types or agricultural environments. Future work will consider incorporating these aspects to improve adaptability and performance in real-world agricultural scenarios. Furthermore, the Blynk interface, which enables intuitive and agile remote monitoring, requires continuous internet access, creating a dependency that limits its use in environments with limited connectivity. Future research could incorporate backup mechanisms, such as local dashboards and MQTT-based services, to ensure the interface’s availability offline. While the proposed system has been validated under controlled conditions using a small-scale hydroponic setup (a PVC structure with four plants), future work could include field-scale validation in more realistic environments, incorporating larger growing areas, seasonal variability, and trials with various species. These studies also seek to evaluate the system’s scalability, robustness, and adaptability to real-world agricultural conditions. Furthermore, this study has demonstrated the feasibility of a low-cost fuzzy control system for regulating pH and EC in hydroponic settings. However, future research areas have been identified to improve the robustness, scalability, and agronomic impact of the proposed solution. First, future work will include the addition of additional environmental parameters, such as temperature and light intensity, which affect plant growth and nutrient uptake in hydroponic systems. Second, a comparative study with alternative control strategies, such as PID, adaptive fuzzy control, and model predictive control (MPC), would provide a deeper understanding of the trade-offs between accuracy, stability, and computational cost. It is important to clarify that, in this work, the comparison with PID and MPC was conducted solely at a theoretical level, based on the reviewed literature. A direct experimental comparative evaluation with these control methods was not implemented, and is, therefore, proposed as a line of future research. Finally, technological integration with cloud platforms and edge computing environments can further optimize resource utilization and enable remote diagnostics and decision making. Ultimately, future work will investigate automated tuning methods to enhance control accuracy and system adaptability.

Author Contributions

Conceptualization and methodology, J.C.E.-M., E.M.-C. and R.J.C.-C.; software, J.C.E.-M.; validation and formal analysis, J.C.E.-M. and R.J.C.-C.; investigation, J.C.E.-M. and R.J.C.-C.; resources, L.W.U.M., J.C.H.-L. and R.J.C.-C.; data curation, J.C.E.-M., E.M.-C. and E.J.S.-C.; writing—original draft preparation, J.C.E.-M., Y.C.-R., E.M.-C. and E.J.S.-C.; writing—review and editing, all authors; visualization, L.W.U.M., Y.C.-R. and E.M.-C.; supervision, R.J.C.-C., E.M.-C. and E.J.S.-C.; project administration, L.W.U.M., R.J.C.-C. and E.M.-C.; funding acquisition, L.W.U.M., J.C.H.-L., R.J.C.-C. and E.J.S.-C. All authors have read and agreed to the published version of the manuscript.

Funding

This work was funded by the Universidad Nacional San Antonio Abad del Cusco (UNSAAC) through the projects of the Professional School of Electronic Engineering and partially by the Universidad Politécnica Salesiana under the Fog Computing Simulation project.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Acknowledgments

We thank the Institutional Laboratory for Research, Entrepreneurship and Innovation in Automatic Control Systems, Automation and Robotics (LIECAR) and the Laboratory of Renewable Energy, Optical Communications Engineering and Environmental Technology (TESLA) both from the Universidad Nacional de San Antonio Abad del Cusco (UNSAAC).

Conflicts of Interest

The authors declare no potential conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
pHPotential of hydrogen
ECElectrical conductivity
NSNutrient solution
FLFuzzy logic
FLCFuzzy logic control
NFTNutrient film technique

References

  1. Mansoor, S.; Iqbal, S.; Popescu, S.M.; Kim, S.L.; Chung, Y.S.; Baek, J.H. Integration of smart sensors and IOT in precision agriculture: Trends, challenges and future prospectives. Front. Plant Sci. 2025, 16, 1587869. [Google Scholar] [CrossRef]
  2. Rajaseger, G.; Chan, K.L.; Tan, K.Y.; Ramasamy, S.; Khin, M.C.; Amaladoss, A.; Haribhai, P.K. Hydroponics: Current trends in sustainable crop production. Bioinformation 2023, 19, 925. [Google Scholar] [CrossRef] [PubMed]
  3. Magwaza, S.T.; Magwaza, L.S.; Odindo, A.O.; Mditshwa, A. Hydroponic technology as decentralised system for domestic wastewater treatment and vegetable production in urban agriculture: A review. Sci. Total Environ. 2020, 698, 134154. [Google Scholar] [CrossRef]
  4. Tshering, U.; Barkha. Hydroponics for sustainable farming of future: A review. Pharma Innov. J. 2023, 21, 4762–4765. [Google Scholar]
  5. Schreiber, P. Hydroponic innovations: Cutting-edge technologies shaping the industry. J. Agric. Sci. Bot. 2023, 8, 230. [Google Scholar]
  6. Son, J.E.; Kim, H.J.; Ahn, T.I. Hydroponic systems. In Plant Factory; Elsevier: Amsterdam, The Netherlands, 2020; pp. 273–283. [Google Scholar]
  7. Anjali; Singh, K.; Thomas, R.R.; Shubhashish, S.; Kumar, S.; Kaushal, S. Hydroponics: An Innovative Approach to Sustainable High-Value Crop Cultivation. J. Sci. Res. Rep. 2025, 31, 410–419. [Google Scholar] [CrossRef]
  8. World Food Programme. How to Grow Food in the Desert Slums of Lima, 2023. Proyecto Hidroponía Urbano Entregando Kits a Comunidades Vulnerables, Reducción de Agua en 90%, Cuarto Espacio. Available online: https://innovation.wfp.org/project/h2grow-hydroponics/how-grow-food-desert-slums-lima (accessed on 1 October 2024).
  9. Ministerio de Desarrollo Agrario y Riego (MINAGRI). Informe Técnico Sobre Suelos Agrícolas y Disponibilidad Hídrica en Cusco, 2020. Available online: https://www.gob.pe/minagri (accessed on 1 October 2024).
  10. Llacta, V.; Choque, M. Aplicación de tecnologías de riego en comunidades campesinas de Cusco. Rev. Agrar. Andin. 2021, 14. [Google Scholar]
  11. FAO. Andean Agriculture, Cusco–Puno Corridor, Peru; Technical Report; FAO: Rome, Italy, 2022; Descripción de prácticas agrícolas tradicionales y retos para introducir innovaciones tecnológicas. [Google Scholar]
  12. Chen, C.H.; Jeng, S.Y.; Lin, C.J. Fuzzy logic controller for automating electrical conductivity and pH in hydroponic cultivation. Appl. Sci. 2022, 12, 405. [Google Scholar] [CrossRef]
  13. Nasution, I.; Satriyo, P.; Dhafir, M.; Iswanda, A.; Rani, S.; Fitria, S.; Munawar, A. Embedded fuzzy logic for controlling pH and nutrition in hydroponic cultivation. IOP Conf. Ser. Earth Environ. Sci. 2023, 1183, 012113. [Google Scholar] [CrossRef]
  14. Puno, J.C.V.; Haban, J.J.I.; Alejandrino, J.D.; Bandala, A.A.; Dadios, E.P. Design of a nutrient film technique hydroponics system with fuzzy logic control. In Proceedings of the 2020 IEEE Region 10 Conference (TENCON), Osaka, Japan, 16–19 November 2020; pp. 403–408. [Google Scholar]
  15. Resh, H.M. Hydroponic Food Production: A Definitive Guidebook for the Advanced Home Gardener and the Commercial Hydroponic Grower, 8th ed.; CRC Press: Boca Raton, FL, USA, 2022. [Google Scholar]
  16. Jensen, M. Hydroponics worldwide. Acta Hortic. 1997, 481, 719–730. [Google Scholar] [CrossRef]
  17. Dorais, M.; Gosselin, A. Greenhouse tomato fruit quality. HortTechnology 2001, 11, 362–375. [Google Scholar]
  18. Creswell, J.W.; Creswell, J.D. Research Design: Qualitative, Quantitative, and Mixed Methods Approaches; Sage Publications: Thousand Oaks, CA, USA, 2017. [Google Scholar]
  19. Mehedi, I.M.; Hanif, M.S.; Bilal, M.; Vellingiri, M.T.; Palaniswamy, T. Remote sensing and decision support system applications in precision agriculture: Challenges and possibilities. IEEE Access 2024, 12, 44786–44798. [Google Scholar] [CrossRef]
  20. Ibrahim, M.N.R.; Solahudin, M.; Widodo, S. Control system for nutrient solution of nutrient film technique using fuzzy logic. TELKOMNIKA (Telecommun. Comput. Electron. Control) 2015, 13, 1281–1288. [Google Scholar] [CrossRef]
  21. Vega, J.D.; Gonzaga, J.; Lim, L.G. Fuzzy-based automated nutrient solution control for a hydroponic tower system. IOP Conf. Ser. Mater. Sci. Eng. 2021, 1109, 012064. [Google Scholar] [CrossRef]
  22. Sardare, M.; Admane, S. A review on plant without soil—Hydroponics. Int. J. Res. Eng. Technol. 2013, 2, 299–304. [Google Scholar]
  23. Zanabria Pacheco, P. Invernaderos Sostenibles para la Producción de Hortalizas en Zonas Alto Andinas del Cusco. Master’s Thesis, Universidad de Piura, Piura, Peru, 2015. [Google Scholar]
  24. Rodriguez Alvarado, D.P.; Sacoto-Cabrera, E.J. Implementation and analysis of the results of the application of the methodology for hybrid multi-cloud replication systems. In Proceedings of the International Conference on Advances in Emerging Trends and Technologies, Riobamba, Ecuador, 10–12 November 2021; Springer: Berlin/Heidelberg, Germany, 2021; pp. 273–286. [Google Scholar]
  25. Safira, M.; Lim, M.; Chua, W. Design of control system for water quality monitoring system for hydroponics application. Iop Conf. Ser. Mater. Sci. Eng. 2022, 1257, 012027. [Google Scholar] [CrossRef]
  26. Zadeh, L.A. Fuzzy sets as a basis for a theory of possibility. Fuzzy Sets Syst. 1978, 1, 3–28. [Google Scholar] [CrossRef]
  27. Sassenrath, G.F.; Heilman, P.; Luschei, E.; Bennett, G.L.; Fitzgerald, G.; Klesius, P.; Tracy, W.; Williford, J.R.; Zimba, P.V. Technology, complexity and change in agricultural production systems. Renew. Agric. Food Syst. 2008, 23, 285–295. [Google Scholar] [CrossRef]
  28. Liu, Y.N.; Wu, S.Y. A rule-based approach for dynamic analytic hierarchy process decision-making. Int. J. Inf. Decis. Sci. 2020, 12, 36–74. [Google Scholar] [CrossRef]
  29. Widayat, I.W.; Arsyad, A.A.; Mantau, A.J.; Adhitya, Y.; Köppen, M. Fuzzy Methods in Smart Farming: A Systematic Review. Informatica 2024, 36, 453–489. [Google Scholar] [CrossRef]
  30. Zhang, W.; Tan, H. Integrating 5G and machine learning technologies for advanced PDM in smart farming. J. Intell. Fuzzy Syst. 2024, 46, 9709–9726. [Google Scholar] [CrossRef]
  31. Sotelo López, C.; Mamani Machaca, W.; Bastidas Cerazo, L.; Utrilla Salazar, D.; Benites Saravia, N. IoT-based Smart Hydroponics Experimental Module in Lima, Peru. Nanotechnol. Perceptions 2024, 20, 1222–1234. [Google Scholar]
  32. Sulaiman, H.; Yusof, A.A.; Mohamed Nor, M.K. Automated Hydroponic Nutrient Dosing System: A Scoping Review of pH and Electrical Conductivity Dosing Frameworks. AgriEngineering 2025, 7, 43. [Google Scholar] [CrossRef]
  33. Wang, Y.; Zhang, N.; Chen, C.; Jiang, Y.; Liu, T. Nonlinear Adaptive Generalized Predictive Control for PH Model of Nutrient Solution in Plant Factory Based on ANFIS. Processes 2023, 11, 2317. [Google Scholar] [CrossRef]
  34. Soussi, A.; Zero, E.; Ouammi, A.; Zejli, D.; Zahmoun, S.; Sacile, R. Smart greenhouse farming: A review towards near zero energy consumption. Discov. Cities 2025, 2, 55. [Google Scholar] [CrossRef]
  35. Hevner, A.R.; March, S.T.; Park, J.; Ram, S. Design science in information systems research. MIS Q. 2004, 28, 75–105. [Google Scholar] [CrossRef]
  36. Peffers, K.; Tuunanen, T.; Rothenberger, M.A.; Chatterjee, S. A design science research methodology for information systems research. J. Manag. Inf. Syst. 2007, 24, 45–77. [Google Scholar] [CrossRef]
  37. Palande, V.; Zaheer, A.; George, K. Fully automated hydroponic system for indoor plant growth. Procedia Comput. Sci. 2018, 129, 482–488. [Google Scholar] [CrossRef]
  38. Lakshmanan, R.; Djama, M.; Selvaperumal, S.K.; Abdulla, R. Automated smart hydroponics system using internet of things. Int. J. Electr. Comput. Eng. 2020, 10, 6389–6398. [Google Scholar] [CrossRef]
  39. Ross, T. Fuzzy Logic with Engineering Applications; John Wiley & Sons: Hoboken, NJ, USA, 2005. [Google Scholar]
  40. Hanna Instruments. Instruction Manual—pH and EC Calibration Solutions. 2024. Available online: https://www.hannainst.com (accessed on 16 June 2025).
  41. Morgan, E.J. HC-SR04 Ultrasonic Sensor. Online Resource. 2014. Available online: https://www.bitmi.ro/domains/bitmi.ro/files/files/bitmi-datasheet-senzor-ultrasonic-hc-sr04-2702.pdf (accessed on 1 October 2024).
  42. Mnati, M.J.; Chisab, R.F.; Al-Rawi, A.M.; Ali, A.H.; Van den Bossche, A. An open-source non-contact thermometer using low-cost electronic components. HardwareX 2021, 9, e00183. [Google Scholar] [CrossRef]
  43. Sugeno, M. An introductory survey of fuzzy control. Inf. Sci. 1985, 36, 59–83. [Google Scholar] [CrossRef]
  44. De Camargo, E.T.; Spanhol, F.A.; Slongo, J.S.; da Silva, M.V.R.; Pazinato, J.; de Lima Lobo, A.V.; Coutinho, F.R.; Pfrimer, F.W.D.; Lindino, C.A.; Oyamada, M.S.; et al. Low-cost water quality sensors for IoT: A systematic review. Sensors 2023, 23, 4424. [Google Scholar] [CrossRef] [PubMed]
  45. Jones, C.; Williams, D.R.; Marsicano, F. Surface water pH measurements—Theory and practice. Sci. Total Environ. 1987, 64, 211–230. [Google Scholar] [CrossRef]
  46. DFRobot. Gravity: Analog pH Sensor/Meter Kit V2 SKU:SEN0161-V2. 2024. Available online: https://wiki.dfrobot.com/Gravity__Analog_pH_Sensor_Meter_Kit_V2_SKU_SEN0161_V2 (accessed on 16 June 2025).
  47. DFRobot. Gravity: Analog Electrical Conductivity Sensor SKU:SEN0244 (S-EC-01). 2024. Available online: https://wiki.dfrobot.com/Gravity__Analog_Electrical_Conductivity_Sensor___Meter__K=1__SKU_SEN0244_ (accessed on 16 June 2025).
  48. Supmea Instruments. SUP-TDS7001 Conductivity Sensor—User Manual; Supmea Instruments: Hangzhou, China, 2024; Available online: https://www.supmeaauto.com/ec-sensor-and-meter/tds7001-conductivity-sensor (accessed on 16 June 2025).
  49. Karuppusamy, P. A sensor based IoT monitoring system for electrical devices using Blynk framework. J. Electron. Inform. 2020, 2, 182–187. [Google Scholar]
  50. Asadi, F. Electric Circuit Analysis with EasyEDA; Springer: Berlin/Heidelberg, Germany, 2022. [Google Scholar]
  51. Quispe-Astorga, A.; Coaquira-Castillo, R.J.; Utrilla Mego, L.W.; Herrera-Levano, J.C.; Concha-Ramos, Y.; Sacoto-Cabrera, E.J.; Moreno-Cardenas, E. Data-Driven Fault Detection and Diagnosis in Cooling Units Using Sensor-Based Machine Learning Classification. Sensors 2025, 25, 3647. [Google Scholar] [CrossRef]
  52. Sneineh, A.A.; Shabaneh, A.A. Design of a smart hydroponics monitoring system using an ESP32 microcontroller and the Internet of Things. MethodsX 2023, 11, 102401. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Methodological workflow of the research.
Figure 1. Methodological workflow of the research.
Electronics 14 03740 g001
Figure 2. Model of the hydroponic system. The red arrow indicates the direction of water flow driven by the pump. The blue arrow represents the communication between the control and feeding systems with the user interface, accessible through a computer or mobile application. The pH control system includes a peristaltic pump for the alkaline solution to increase the pH, and another for the acidic solution to decrease the pH.
Figure 2. Model of the hydroponic system. The red arrow indicates the direction of water flow driven by the pump. The blue arrow represents the communication between the control and feeding systems with the user interface, accessible through a computer or mobile application. The pH control system includes a peristaltic pump for the alkaline solution to increase the pH, and another for the acidic solution to decrease the pH.
Electronics 14 03740 g002
Figure 3. Functional block diagram of the hydroponic system.
Figure 3. Functional block diagram of the hydroponic system.
Electronics 14 03740 g003
Figure 4. Hydroponic system control diagram.
Figure 4. Hydroponic system control diagram.
Electronics 14 03740 g004
Figure 5. Defuzzification results using Matlab. (a) Response of the fuzzy controller for a pH value below the optimum range. (b) Response of the fuzzy controller for a pH value within the optimum range. (c) Response of the fuzzy controller for a pH value greater than the optimum range.
Figure 5. Defuzzification results using Matlab. (a) Response of the fuzzy controller for a pH value below the optimum range. (b) Response of the fuzzy controller for a pH value within the optimum range. (c) Response of the fuzzy controller for a pH value greater than the optimum range.
Electronics 14 03740 g005
Figure 6. Defuzzification results using Matlab for EC control. (a) Response of the fuzzy controller for an EC value below the optimum range. (b) Response of the fuzzy controller for an EC value in the optimum range. (c) Response of the fuzzy controller for an EC value higher than the optimum range.
Figure 6. Defuzzification results using Matlab for EC control. (a) Response of the fuzzy controller for an EC value below the optimum range. (b) Response of the fuzzy controller for an EC value in the optimum range. (c) Response of the fuzzy controller for an EC value higher than the optimum range.
Electronics 14 03740 g006
Figure 7. Control and monitoring scheme using the Blynk platform.
Figure 7. Control and monitoring scheme using the Blynk platform.
Electronics 14 03740 g007
Figure 8. Schematic of the electronic boards.
Figure 8. Schematic of the electronic boards.
Electronics 14 03740 g008
Figure 9. Stages of electronic card design. (a) Track routing and PCB board design. (b) 3D top view of the PCB board. (c) 3D rear view of the PCB board. (d) Top view of the finished PCB board. (e) Rear view of the finished PCB board.
Figure 9. Stages of electronic card design. (a) Track routing and PCB board design. (b) 3D top view of the PCB board. (c) 3D rear view of the PCB board. (d) Top view of the finished PCB board. (e) Rear view of the finished PCB board.
Electronics 14 03740 g009
Figure 10. Hydroponic system implementation process. (a) The structure for placing the plants was developed with PVC pipes. (b) Development of lettuce plants in the hydroponic system. (c) Control and monitoring system.
Figure 10. Hydroponic system implementation process. (a) The structure for placing the plants was developed with PVC pipes. (b) Development of lettuce plants in the hydroponic system. (c) Control and monitoring system.
Electronics 14 03740 g010
Figure 11. Response to the pH control system step. Rise time (Tr). Peak time (Tp). Settling time (Ts). Overshoot (Mp).
Figure 11. Response to the pH control system step. Rise time (Tr). Peak time (Tp). Settling time (Ts). Overshoot (Mp).
Electronics 14 03740 g011
Figure 12. Control and monitoring schematic.
Figure 12. Control and monitoring schematic.
Electronics 14 03740 g012
Figure 13. EC control interface. (a) Computer. (b) Mobile phone.
Figure 13. EC control interface. (a) Computer. (b) Mobile phone.
Electronics 14 03740 g013
Table 1. Comparative analysis of related works in hydroponic control and IoT integration.
Table 1. Comparative analysis of related works in hydroponic control and IoT integration.
Ref.YearControl StrategyVariablesEnvironmentHardwareLimitations
[12](2022)FuzzypH, ECLaboratoryArduino/PCNo field validation
[14](2020)FuzzyNutrient flow (NFT)LaboratoryArduinoLimited to lab conditions
[13](2023)Embedded FuzzypH, nutrientsGreenhouseMCUNo high-altitude validation
[31](2024)IoT monitoringEC, temp.Field (Lima)ESP32 + IoTMonitoring only, no fuzzy
[29](2024)ReviewMultiple--Most studies at lab scale
[1](2025)IoT + sensorsMulti-sensorsPrecision agri.Smart sensorsNo control integration
Table 2. pH and EC ranges for lettuce cultivation in hydroponic systems.
Table 2. pH and EC ranges for lettuce cultivation in hydroponic systems.
ParameterOptimal Range
pH5.6–6.2
EC1.5–2.2 mS/cm
Table 3. Comparison of selected pH sensors.
Table 3. Comparison of selected pH sensors.
SensorRange (pH)ResolutionResponse Time (s)Output TypeCalibrationApprox. Price (USD)
pH-4502C0–14±0.01<60Analog (0–5 V)Manual (2-point)Low (∼10)
S-pH-01 Modbus0–14±0.01<30Digital (RS485 Modbus)Digital auto/manualMedium (∼50)
Orbipac CPF81D2–12±0.002<10Digital (4–20 mA/
Profibus)
Automatic (w/transmitter)High (>200)
Table 4. Voltage values obtained for each pH solution.
Table 4. Voltage values obtained for each pH solution.
pH Solution (Sample)pH ValueVoltage Value (V)
4.0144.5 V
7.00773.6 V
10.01103.0 V
Table 5. Variable values.
Table 5. Variable values.
x (Voltage)y (pH)z ( ln y ) x · z x 2
4.541.3862946.23832520.25
3.671.9459107.00527712.96
3.0102.3025856.9077559.00
Σ 11.1215.63479020.1513642.21
Table 6. pH ranges.
Table 6. pH ranges.
pH LevelRange
Very low0.00–4.50
Low4.25–5.75
Normal5.60–6.20
High6.25–7.75
Very high7.50–14.00
Table 7. Fuzzy rules for pH control.
Table 7. Fuzzy rules for pH control.
RulepH Control Action
1If input1 is pH_very_LOW then output1 is Add_BASE
2If input1 is pH_LOW then output1 is Add_little_BASE
3If input1 is pH_NORMAL then output1 is NEUTRAL
4If input1 is pH_HIGH then output1 is Add_little_ACID
5If input1 is pH_very_HIGH then output1 is Add_ACID
Table 8. Behavior of the fuzzy controller.
Table 8. Behavior of the fuzzy controller.
pH (Measured by the Sensor)Fuzzy Controller OutputAcid PumpAlkaline PumpActivation Time (s)
6.00.00DeactivatedDeactivated0.0
5.3−1.03ActivatedDeactivated10.3
7.03.00DeactivatedActivated30.0
Table 9. Comparison of selected EC sensors.
Table 9. Comparison of selected EC sensors.
SensorRange (mS/cm)ResolutionOutput TypeCalibrationMCU CompatibilityApprox. Price (USD)
DFRobot Gravity EC0–20±0.01Analog (0–2.3 V)Manual (2-point)Native (5 V Arduino)Low (∼15)
S-EC-01 TDS0–10±0.02Analog (0–3.3 V)ManualCompatible (ESP32/Arduino)Medium (∼25)
SUP-TDS70010–100±0.001Digital (RS485 Modbus)Auto/manualNo direct (Needs transmitter)High (>120)
Table 10. TDS values measured with the EC meter and the respective voltage values.
Table 10. TDS values measured with the EC meter and the respective voltage values.
SamplesEC Meter Value (mS/cm)Voltage Value (V)
Void0.000.02
Buffer 11.412.76
Buffer 212.883.33
Table 11. EC ranges.
Table 11. EC ranges.
EC levelRange (mS)
Very low0.0–1.1
Low1.1–1.6
Normal1.7–2.0
High2.1–2.8
Very high>3
Table 12. Fuzzy rules for EC control.
Table 12. Fuzzy rules for EC control.
RuleEC Control Action
1If input1 is EC_very_LOW then output1 is Add_a_lot_of_NS
2If input1 is EC_LOW then output1 is Add_NS
3If input1 is EC_NORMAL then output1 is NEUTRAL
4If input1 is EC_HIGH then output1 is Add_little_WATER
5If input1 is EC_very_HIGH then output1 is Add_WATER
Table 13. EC controller behavior with statistical metrics.
Table 13. EC controller behavior with statistical metrics.
EC (mS/cm)Fuzzy Controller OutputSN PumpWater PumpActivation Time (s)Mean ± SDRMSE
1.90.0DeactivatedDeactivated0.01.9 ± 0.050.04
1.4−2.0ActivatedDeactivated20.01.4 ± 0.070.06
2.31.8DeactivatedActivated18.02.3 ± 0.080.07
Statistical metrics. For pH and EC, mean, standard deviation (SD), root mean square error (RMSE) with respect to the reference, and 95% confidence intervals (CI95%) of the mean were computed using Student’s t distribution ( t 0.975 , d f = n 1 ). Formulas: R M S E = 1 n i = 1 n ( x i r i ) 2 , S D = 1 n 1 i = 1 n ( x i x ¯ ) 2 , C I 95 % = x ¯ ± t S D n . This note also applies to Table 14 and Table 15.
Table 16. Comparison of control systems in hydroponics.
Table 16. Comparison of control systems in hydroponics.
Ref.ControllerVariablesPlatformCost (USD)RMSEApplicationImplementation Type
[12]Fuzzy MamdanipH, ECRaspberry Pi≈300 0.14 (pH)LaboratoryFull
[14]Fuzzy + GUIpH, ECArduino≈200n/aNFT PrototypeLimited
[13]Fuzzy MamdanipH, ECArduino≈3000.10 (pH)DWC PrototypeLimited
[52]Threshold-based ControlpH, EC (TDS)ESP32 + Blynk≈180n/aIoT PrototypeFull (pilot-scale)
Our workFuzzy Mamdani + IoTpH, ECESP32 + Blynk≈1000.12 (pH), 0.15 (EC)Real NFT PrototypeFull
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

Escalante-Mamani, J.C.; Sacoto-Cabrera, E.J.; Coaquira-Castillo, R.J.; Mego, L.W.U.; Herrera-Levano, J.C.; Concha-Ramos, Y.; Moreno-Cardenas, E. Design and Validation of an IoT-Integrated Fuzzy Logic Controller for High-Altitude NFT Hydroponic Systems: A Case Study in Cusco, Peru. Electronics 2025, 14, 3740. https://doi.org/10.3390/electronics14183740

AMA Style

Escalante-Mamani JC, Sacoto-Cabrera EJ, Coaquira-Castillo RJ, Mego LWU, Herrera-Levano JC, Concha-Ramos Y, Moreno-Cardenas E. Design and Validation of an IoT-Integrated Fuzzy Logic Controller for High-Altitude NFT Hydroponic Systems: A Case Study in Cusco, Peru. Electronics. 2025; 14(18):3740. https://doi.org/10.3390/electronics14183740

Chicago/Turabian Style

Escalante-Mamani, Julio C., Erwin J. Sacoto-Cabrera, Roger Jesus Coaquira-Castillo, L. Walter Utrilla Mego, Julio Cesar Herrera-Levano, Yesenia Concha-Ramos, and Edison Moreno-Cardenas. 2025. "Design and Validation of an IoT-Integrated Fuzzy Logic Controller for High-Altitude NFT Hydroponic Systems: A Case Study in Cusco, Peru" Electronics 14, no. 18: 3740. https://doi.org/10.3390/electronics14183740

APA Style

Escalante-Mamani, J. C., Sacoto-Cabrera, E. J., Coaquira-Castillo, R. J., Mego, L. W. U., Herrera-Levano, J. C., Concha-Ramos, Y., & Moreno-Cardenas, E. (2025). Design and Validation of an IoT-Integrated Fuzzy Logic Controller for High-Altitude NFT Hydroponic Systems: A Case Study in Cusco, Peru. Electronics, 14(18), 3740. https://doi.org/10.3390/electronics14183740

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