1. Introduction
The shrinking of agricultural land, along with the increasing population and the rise of urbanization in cities, has resulted in less and less available land for farming. This, along with other factors, has caused a decline in agricultural productivity. These challenges have sparked breakthroughs in the field of agriculture, particularly in household self-sustaining agriculture [
1]. Hydroponic growing media is one such innovation, offering a solution to the scarcity of available land. This system uses water and mineral nutrient solutions without using soil as its primary medium. Hydroponic planting methods generally include several techniques for supplying the necessary nutrient solutions, two of which are the Nutrient Film Technique (NFT) and the Deep Flow Technique (DFT) [
2].
The DFT system is a technique where nutrients are supplied by submerging the roots in nutrient-rich water. One advantage of the DFT system is that it does not rely on a water pump, as it utilizes the standing nutrient water in the pipes [
2]. However, the more commonly used hydroponic method is the NFT system. This system involves irrigation with well-circulated nutrient water, which requires a water pump. The principle of NFT is that plant roots rest in a shallow layer of nutrient water, absorbing nutrients from it. The water must be continuously circulated to keep the roots wet, preventing root damage [
3].
Despite its advantages, the hydroponic system has some drawbacks, such as the need for more advanced knowledge of the production system, especially in monitoring water quality and pH in real-time to ensure the plants receive adequate nutrition. Additionally, experience and technical skills in hydroponic methods are essential. Another downside is the relatively high initial investment cost [
4,
5].
To achieve better efficiency than manually monitoring nutrients, there is a need for a way to automatically maintain water quality. The research in [
6] presents a concept for automatic monitoring and control of pH levels and nutrients in hydroponic water using a control device. The study in [
7] adds an IoT-based automatic control module to gather data from sensors that can be monitored in real-time.
In general, hydroponic plant cultivation has existed for a long time [
5], and training and empowerment programs for communities have frequently been carried out [
8,
9]. The addition of IoT—and thus real-time monitoring—to hydroponic systems has been a research trend in recent years [
10].
The difference between previous research and the study conducted by the authors lies in the sensor and actuator devices, with a more comprehensive set of tests. These tests include response-time testing for the sensors and disturbance response testing. As far as the author knows from the literature review, these aspects are rarely explored.
This research broadly focuses on automation that can be monitored in real-time using IoT (Internet of Things), aiming to measure parameters efficiently, ensure effective monitoring, and reduce human error. The Internet of Things, in essence, creates an intelligent system environment by connecting devices to the internet, providing more comprehensive capabilities for exchanging and collecting data [
11].
2. Methods
This section will present an overview of the device’s operation, the design of the hydroponic system, and the electronic design. The overview will cover the general working principles of the device. The system design will discuss the overall functional design of the device. The electronic design will cover the hardware and software design, along with their workflows.
2.1. Overview
A control system generally consists of a control center, sensors, and actuators. The main control module in this hydroponic system uses the Arduino Mega Pro Mini 2560, which functions as the system’s central hub, responsible for processing data received from sensors and triggering actuators (motors via an automatic ON/OFF relay).
Figure 1 shows the block diagram of the IoT-based hydroponic automation system design, with the NodeMCU device used to implement the IoT features. This device is an open-source microcontroller like Arduino, which serves as a data receiver and processor connected to the internet. NodeMCU also has a built-in WiFi chip equipped with the TCP/IP protocol [
12].
This design incorporates four sensors: a water level (WL) float sensor, an acidity (pH) sensor, a TDS (Total Dissolved Solids) sensor, and a temperature sensor. There are five actuators used in the system: nutrient dosing pumps (A and B mix), acidity up/down dosing pumps, main DC circulation pumps, mixing DC pumps, and AC well pumps.
2.2. System Design
Hydroponics includes several planting techniques, one of which is the Nutrient Film Technique (NFT). This method uses well-circulated and recirculated water, making it efficient in conserving water and effective in providing constant nutrients to the roots [
13]. In NFT, constant irrigation and fertilization are key, which is why the hydroponic automation system applied focuses on the automatic control of irrigation, nutrient levels, and pH balance [
5].
Figure 2 illustrates the automation design of this hydroponic system. The primary concept of this automated method is to maintain correct circulation of water and nutrients. This process requires sensors to read environmental conditions and actuators that can be controlled to intervene in various system variables. The operating principle of the automatic hydroponic nutrient controller can be explained as follows.
First, the water level (WL) sensor monitors the water level in the hydroponic irrigation tank. If the water level drops and the WL sensor reaches its lower limit, the data sent to the microcontroller will be processed, and the microcontroller will activate the actuator (in this case, the AC motor pump in the well). Once the tank is filled (when the water reaches the upper limit), the pump will automatically shut off.
Next, the water will flow through all the hydroponic channels. The TDS sensor will then read the nutrient conditions and send data to the microcontroller indicating that the nutrient levels are not within the desired range. The microcontroller will instruct the activation of the A and B mix dosing pumps. When the nutrient concentration reaches the set PPM (Parts Per Million) level, the dosing pumps will turn off. Once the A and B mix dosing pumps are off, the stirring motor will turn on.
When the irrigation tank has been mixed with the AB mix solution, this condition will affect the pH level of the water. The pH sensor will detect any deviation in pH and send data to the microcontroller to activate the pH up–down dosing pumps. If the water’s pH level is adjusted to the desired range, the microcontroller will then command the dosing pumps to turn off. Along with the cessation of the pH dosing pumps, the DC stirring motor in the irrigation tank will also stop.
2.3. Control Flow Strategy
The control strategy for this system, it is essential for the microcontroller to receive signals from sensors, compare them to set points, and then intervene in the environment.
Figure 3 illustrates the execution flow of the control program.
The program starts with the declaration of data types for the variables used. In the loop, the microcontroller receives data from the sensors, which are then displayed on the monitor via serial communication, followed by communication between Arduino and NodeMCU. Data input from Blynk, such as the setpoint PPM, follows.
Next, the microcontroller checks the water level status and activates or deactivates the well pump as needed. The turbidity sensor, or TDS, will measure the nutrient solution concentration in the tank. If the concentration is low, the actuator will turn on the AB mix pump as necessary; if it is high, the well water pump actuator will be activated. After these actions, the microcontroller will command all actuators to turn off for a period of time.
Then, the pH sensor will measure the acidity level in the tank and activate the pH up and pH down pumps as required. At the end of the loop, the microcontroller will turn off all actuators, leaving only the main pump running. The program will then repeat, starting with reading the water level.
3. Results and Analysis
After the initial assembly and startup process, the system is tested in parts and as a whole. Sensor testing includes basic testing and response-time testing. Overall testing encompasses disturbance testing and field testing.
3.1. Sensor Testing
The first test is the pH sensor calibration test, conducted to determine the sensor’s accuracy by testing various liquid samples. This includes nutrient water, pH buffer solutions at 4.0 and 6.87, AB mix solution, distilled water, well water, and soapy water. A calibrated pH meter is then used for comparison with the pH sensor’s readings, allowing for the assessment of the sensor’s accuracy.
The readings from the pH sensor are listed in
Table 1. The installed pH sensor shows a small error margin, with a deviation of 0.026 for measurements around 7.0.
The samples used for testing the TDS sensor are of a hydroponic nutrient solution A and B mix, which have different PPM levels, as shown in
Table 2. The data obtained show a comparison between the TDS meter and the TDS sensor, with an average error of 1.079. Compared to measurements in the hundreds, this indicates that the TDS sensor has good accuracy. The sensor also responds quickly, making it effective and accurate for readings.
Temperature measurements and calibration were performed using the DS18B20 temperature sensor, with the results displayed in
Table 3. The sensor yielded an average deviation of 0.42 °C for measurements around 30 °C, indicating relatively small variation.
Each sensor has a non-zero response time and varies from other sensors. The sensor testing in this study also involved measuring response times. A good sensor should exhibit a quick and consistent response time.
Figure 4 shows the response-time graph for the pH sensor model 4502C. Initially, the pH of the water was set to 4.07, and the sensor stabilized readings between 3.84 and 3.98. When the sensor was suddenly moved to water with a pH of 9.09, it was able to read the new pH value between 8.68 and 8.70. The pH sensor took approximately 12 s to stabilize its readings.
The next response-time test is for the TDS sensor, as shown in
Figure 5. Initially, the water sample in the tank had a TDS value of 311 ppm. When the TDS meter sensor was first placed in this tank, it displayed a reading around 310 ppm. The sensor was then abruptly moved to water with a TDS value of 830 ppm, and it measured approximately 834 ppm. The TDS sensor took about 4 s to stabilize.
Figure 6 displays the response-time graph for the DS18B20 temperature sensor. The initial water sample tested was at room temperature, 27.3 °C. The sensor was then quickly moved to a hot water sample with a temperature of 47.3 °C. As seen, the DS18B20 sensor responded well and stabilized its readings after about 10 s.
3.2. System Testing with Disturbance
The goal of system testing is to determine how well the device responds to disturbances in the environment. The first test of the hydroponic automation system involves disturbance testing on the water’s pH. For a set PPM range of 400–550 on Blynk, the TDS sensor detected a value of 521 ppm, which did not trigger any actuator intervention.
The pH level of the water was then deliberately raised to 8.34 to observe the sensor and actuator responses to sudden changes. The results, shown in
Figure 7, demonstrate that the pH down pump effectively worked to correct the pH imbalance in the solution.
The second disturbance test involved changing the nutrient levels in the water by adding well water to the tank. This action lowered the water’s PPM, as shown in
Figure 8. When the sensor detected a PPM value of 444, the A and B mix pumps were activated. When the sensor detected a PPM of 589, the A and B mix pumps turned off, because the Blynk setpoint was set between 400 and 550 ppm. This condition indicated excess nutrients in the water, so the well pump was turned on when the PPM was 568 and turned off when the sensor measured 537 ppm. All pumps then turned off, and the TDS sensor stabilized at 521 ppm.
In the first disturbance test, the TDS values showed slight oscillations in actuator automation. Therefore, a second TDS disturbance test was conducted with an extended setpoint range of 550–740 ppm and a slower duration for the A and B mix dosing pumps. The results, depicted in
Figure 9, showed improved system performance. However, the process of adding nutrients was somewhat slower because the pump worked for a shorter duration.
3.3. Field Testing
Field testing of the system was conducted over a period of seven days with one-week-old plants, which required low nutrient levels (540–650 ppm). Data were collected continuously for 24 h, with samples taken twice daily, in the morning and evening. The results are summarized in
Table 4.
The initial data review indicated no significant changes in actuator conditions due to stable sensor readings aligning with the setpoints. To gain a more detailed understanding of sensor and actuator behavior, a more granular data collection method was needed.
Subsequent field data collection focused on detailed changes over approximately 2 h and 30 min, with sensor values for TDS and pH recorded every 15 min. The data presented in
Figure 10 showed that the TDS sensor values experienced fluctuations. At 21:13, the TDS value decreased, triggering the AB mix pumps to activate until 21:28. Following this, at 21:28, the pH level increased, causing the pH down pump to activate. The pH down pump then turned off at 21:43 but was reactivated 15 min later due to another rise in pH levels. The pH down pump finally turned off at 22:13. These actuator changes are illustrated in
Figure 10.
From this field test, it was concluded that the pH sensor exhibited less stability compared to the TDS sensor. Although the TDS sensor was generally stable, it occasionally showed drops in readings every minute, but this did not significantly impact the activation of the AB mix pumps.
4. Discussion and Concluding Remarks
Based on the experiments and observations, we will discuss a number of issues and then present concluding remarks and recommendations for further development.
4.1. Discussion
Comparison with manual methods suggests that the automated one lessens the need for human attendance. The downside is that the automated method increases the number of failure points that must be taken care of. To improve this situation, one needs a more robust design and engineering execution.
There is also a concern regarding sensor stability in varying environmental conditions. The sensors used in this work are capable of withstanding a wide range of temperatures, acidities, and other environmental elements.
The sensors used in the system respond relatively quickly to the dynamics of the overall system. This is a good foundation for effective control. The sensors perform like other physical measurement devices, exhibiting statistical discrepancies but generally providing expected average values. With regard to operational continuity, the system is designed to continue functioning even if the Wi-Fi network is disconnected. In such cases, the control system will refer to the last input values.
4.2. Recommendations for Further Development
Sequential Control Process Improvement: The current system’s sequential control process among variables needs enhancement. If there is a reading error for one variable, the program will repeatedly process that variable without advancing to other processes. Future developments should focus on designing a system capable of concurrently managing all desired variables in real-time.
Real-Time Concurrent Control: Implement a system that can handle multiple variables simultaneously and adjust them in real-time. This would improve the overall efficiency and response to changing conditions.
Notification Feature: Adding a notification feature to alert the hydroponic garden owner of any issues requiring attention would significantly enhance the system’s usability and maintenance.
These improvements would contribute to a more robust and user-friendly hydroponic automation system.