Controlling the Nutrition Water Level in the Non-Circulating Hydroponics based on the Top Projected Canopy Area

Hydroponics non-kontak menggunakan untuk mendapatkan Top Projected Canopy Area (TPCA). digunakan Abstract Deep Water Culture Hydroponics is suitable for a large-scale plantation as it does not require turn-on the electric pump constantly. Nevertheless, this method needs an electric aerator to give Oxygen to the roots. Kratky’s and Dry Hydroponics are the two methods that suggest an air gap between the raft and the nutrient water level. The gap gives Oxygen to the roots without an aeration pump. Controlling the nutrient water level is required to give a good distance of air gap for Precision Agriculture. The root length estimation used to be done manually by opening the raft, but this research promotes automatic and non-contact estimation using the camera. The images are used to predict the root length based on the Top Projected Canopy Area (TPCA) using various Regression Methods. The test shows that the TPCA gives a high correlation toward the Root Length ( 𝑅 2 >0.9). To control the nutrient water level, this research compares If-Else and the Linear Regression. The error between the actual level that is measured using an Ultrasonic sensor and the setpoint is fed to an Arduino Uno to control the duration of an inlet pump and the outlet pump. The If-Else and the Linear Regression method show good results.


INTRODUCTION
A Hydroponics is an emerging method to grow plants. It uses water instead of soil as a base. The land for plantations is getting scarce, hence this method is getting more popular. Hydroponics can be used to grow vegetables, fruits, or even flowers. There are several methods to do the Hydroponics, such as the Wick system, Floating Raft or Deep Water Culture (DWC) Nutrient Film Technique (NFT), Flood-and-Drain, and Drip Irrigation [1]. The Wick and DWC are categorized as the non-circulating Hydroponics as the water stays in the reservoirs. The NFT, Flood-and-Drain, and Drip irrigation are categorized as circulating Hydroponics as the water should be pumped to reach the plant's roots. The latter type consumes a high amount of electric bills to power the pump.
The non-circulating type is preferable for a lower-cost plantation. The DWC is, even more, cheaper than the Wick system as it does not requires a capillary medium. The Wick system require cotton or nylon to be inserted into the net pod for the roots to gain nutrient from the nutrient water [2]. This wick requirement is impractical, especially for a large-scale plantation. Inserting the wick into each net pod and harvesting the plants from the tangled wicks are surely time-consuming and intensive labor. The DWC is more efficient as the roots directly touch the nutrient water as it floats using the rafts.
Although the non-circulating type does not require electricity, it needs an aerator pump to supply oxygens to the roots. The roots, especially in the DWC system constantly submerged in the nutrient water, thus there are no gaps for the roots to catch the oxygen. The element is very important for the plants' growth. A study by [3] shows that a sufficient amount of the aerator pressure and duration increase the fresh and dry weight of the lettuce plant. It also cut down the harvesting time from 35 to 21 days. The 24-hours duration of aeration also shows not only the higher fresh and dry weight of lettuce but also the root volume and leaf area as well [4]. The lack of dissolved oxygen in the DWC system can wither the plants. The use of aerators will still cause a higher electric bill.
There is a method for non-circulating and non-aerator Hydroponics named Kratky's Hydroponics [5]. It stated that the method is a one-time set-up, meaning that monitoring or control of the nutrient water during the growing stage is unnecessary. The nutrient water gradually drops its volume but as the plants grow, the roots are also expanding to reach the descending water. A gap between the lowering nutrient water and the top of the roots creates a moist air space to replace the function of aeration [6]. In this condition, the roots can catch the oxygen without an aeration machine. Kratky's method is suitable for plants that have short-growth periods such as lettuce. A similar method named Dry Hydroponics is also an option. The method uses the floating raft system at the beginning of planting, and graduareducesduce the nutrient water level as the roots get longer [7]. The roots are still touching the nutrient water but have an open-air gap that allows oxygen intake. In the experiment, the Dry Hydroponics system grows similar result of green lettuce harvest compared to the Wick system and the Floating Raft system in terms of stem diameter, leaf width, number of leaves, leaf thickness, canopy area, and fresh weight. Dry hydroponics has an advantage which is a cleaner raft with no moss as it does not touch the water constantly.
Both the Kratky's and the Dry Hydroponics are efficient to be implemented in a largescale plantation. Those methods require no electricity on the water pump and aeration. The raft system also allows better handling during the planting and harvesting stage. Although Kratky's Hydroponics stated no control on the nutrient water, monitoring the root's condition is necessary since the plants could wither if the roots do not touch the water. An automation control on the lowering process of the water level in the Dry Hydroponics system is also beneficial for largescale growth. This research aims to control the level of the nutrient water based on the length of the roots. Generally, the length of the root can be predicted by the planting time but the different conditions of the water base, nutrient's Total Dissolved Solids (TDS), nutrient's Electrical Conductivity (EC), light, pH, media, temperature, carbon dioxide, and relative humidity affect the plant's growth differently [8].
The length could be measured manually by lifting the raft and inspecting the roots, but this research offers an automatic and non-contact measurement using computer vision. The various method in image processing is utilized to gain information about the plants including the morphological, spectral, and temporal data. Computer vision is widely used in agriculture such as in plant classification [9]. Computer vision can also detect plant disease. Research by [9] used a Gray Level Co-occurrence Matrix (GLCM) of the segmented RGB images combined with Near Infrared (NIR) images of the Top Projected Canopy Area (TPCA) of the plants to detect the disease. For commercial and real-time use, the research suggests the feature based on the condition of the plant's canopy is preferred. The detection or measurement using computer vision will be non-contact and non-destructive as the plants are not removed from their location. To our knowledge, no research predicts the length of roots based on the leaves' canopy image. In this research, the prediction uses a Learning method that trains the collected data-pair to find the Prediction Mathematical Model.
The predicted root's length is used as the information on the nutrient water level. There are researches to control the water level of the hydroponics system. Research by [10] used an onoff system that turns on the water pump until it reaches the desired level then it is turned off. Other research by [11] used an If-Else conditional statement in the ARDUINO IDE software to control the nutrient water level. Whilst the research by [12] used a Linear Regression to predict the duration of turning on the pump to reach the desired level. This research compares the if-else and the Linear Regression method.

METHODS
The System of Controlling the nutrient water level based on the Top Projected canopy Area (TPCA) consists of three parts, which are: (1) Estimating the TPCA, (2) Predicting the Root Length Based on TPCA, and (3) Controlling the nutrient water level based on the Root Length. The first part uses Image Processing methods to segment the top projected canopy from the background and count how many pixels of it as the area. The second part uses several Regression Analysis and determine which model gives the best fit based on a Coefficient of Determinant (R 2 ). The third stage uses the If-Else and Linear Regression method to control the level of nutrient water and compare the accuracy between the two methods. The system is built and tested on the Brazilian Spinach (Alternanthera sissoo) plant. The spinach is easy to grow in the Hydroponics system and is famous for its crunchy texture [13].

Estimating the TPCA using Image Processing
A visible light camera is used to capture the top-view of the plants. The camera is placed on a tripod, down-faced at 90 degrees, and kept at a specific position. The plants are placed in a DWC hydroponics kit. In this research, only one plant is placed in the kit to simulate a simple prototype. The camera-to-ground distance is fixed at 50 cm. All the fixed setting is crucial in the TPCA estimation as the area pixel-to-cm ratio must be the same for all images. The setting is shown in Figure 1. The image size is set to 240x360 pixels.
The camera is connected to a laptop using a USB connection. The images are acquired using Python program code. The image processing steps to estimate the TPCA are coded on the Python which utilizes the OpenCV library. The image processing consists of four steps, which are: (1) Converting the BGR to HSV color space, (2) Segmenting the top projected canopy using a Thresholding method, (3) Applying the Morphological Filters to eliminate the segmentation errors, and (4) Determining the TPCA.
The images acquired are in the BGR (Blue-Green-Red) color space where the leaves are hard to segment. The BGR color space mixed the color and brightness information. Hence, the first step in Image Processing is converting the BGR image into the HSV (Hue-Saturation-Value). The greenish color of the leaves is easy to be segmented especially by the Hue. The HSV separates color information from the brightness information, hence an object is easy to be detected based on a single color.

Figure 1. Image Acquisition Setup
The second step is the Leaves Segmentation. The leaves of the Brazilian Spinach is ranging from the yellowish light green of the young leaves to the dark green of the old leaves. The Hue of yellow-greenish color is around 50°-120° in the 360° Hue Color Wheel. As the leaves' colors fall within a specific threshold, hence a simple Thresholding method is chosen for the Segmentation process. The OpenCV library uses a 0-255 range value, hence the Hue Color value is set to 35-85 as the threshold. The saturation and the Value threshold are both set to 45-255 to accommodate a wider range of green color impurity and lighting conditions. The value of the HSV that falls into those ranges will be set to 1 and else to 0. This Thresholding process results in a Binary Image where the leaves pixels are set to 1 or white color and the non-leaves pixels are set to 0 or black color.
The third step is the Filtering process. It is common in binary images to have many segmentation errors. The first type of error is a false-positive error where pixels of the background is segmented as the leaves. The second type of error is false-negative where pixels of the leaves are segmented as the background. A Morphological Filter is powerful to eliminate those errors. The basic filter in the Morphological Filter is the Erosion and Dilation Filter. The Opening filter used the Erosion followed by the Dilation to eliminate the false-positive errors. The Closing filter used the Dilation followed by the Erosion to eliminate the false-negative errors. The combination used the same size and shape as Structuring Elements (SE). In this research, the size of the SE is 7x7 which is determined by manual experiments.
An example of the Image segmentation steps to find the TPCA of an acquired image is shown in Figure 2. The acquired image in the BGR color space is shown in Figure 2(a), the HSV conversion is shown in Figure 2(b), the segmentation result is shown in Figure 2(c), the result after applying the Opening filter is shown in Figure 2(d), and the result after applying the Closing Filter is shown in Figure 2(e). The final result showing the segmented TPAC of the plants' leaves is shown in Figure 2(f).
The fourth step is determining the TPCA. The Top Projected Canopy Area of plants is determined by counting the non-zero pixels. The TPCA of the plant in Figure 2(f) is 13,685 pixels from a total of 86,400 pixels in an image. The pixels unit is not converted to cm since the aim of the system is to find the root length and not the area of the Top Projected canopy. The Flowchart of the Program using the Python and the OpenCV library is shown in Figure 3.

2 Estimating the Root Length based on TPCA
Prediction is part of Machine Learning where collected data are trained to find the prediction model. The basic method of prediction is Regression. The learning process of the Regression is to find a mathematical model that best-fit the data training. The fitting process aims to find the model that gives a minimum error between the model and the data. Several Regression equations can be used to fit the data, which are Linear, Exponential, Logarithmic, Polynomial, and Power. The Equation of each Regression type is shown in Table 1.
In this research, the TPCA is the and the root length is the . Data pairs between TPCA and root length of several plants are collected and used to calculate the parameters in the Regression Models. The performance of Regression is calculated using a Coefficient of Determination ( 2 ). This value shows how fit the models are using Sum-Squared Regression (SSR) and Sum-squared Total variation (SST). The SSR is the Variance of the predicted value (̂) towards the Mean of observed value (̅). The SST is the Variance of the observed value ( ) toward its Mean (̅). The is the total number of data. The Equation to find the ( 2 ) is shown in Equation (1). The value of 2 is between 0 and 1. A good model has a value close to 1, whilst a bad model has a value close to 0. (1)

3 Controlling the Level of Nutrient Water
The estimated TPCA is used to control the level of nutrient water. Kratky's method mentions the root should be submerged for around 1 to 2 inches. In this research, the system setti that if the root is longer than 2 inches (around 5 cm), hence the level of nutrient water is lowered to create air, gap. The Hardware of the system consists of 2 inputs, which are a general camera to capture the top projected canopy of the plants and an ultrasonic sensor to measure the distance from the water to the top of the floating raft. The camera is connected to a computer using a USB connection, whilst the ultrasonic sensor is connected to an Arduino Uno. The TPCA estimation is performed on the computer using Python programming and the OpenCV library. The TPCA value is sent to the Arduino manually. This value and the distance are compared in the Arduino to determine the set point level. Two submerged water pump is the output of the system which are connected to the Arduino. The pumps are used to control the level of nutrient water to reach this set point. The block diagram of the system is shown in Figure 4. The schematic diagram of the sensors, the Arduino Uno, and the two pumps are shown in Figure 5. The ultrasonic sensor URM09 is connected to the Digital Pin 11 (PWM) of the Arduino. The inlet pump that adds nutrient water to the reservoir to increase the water level is connected to Digital Pin 2. The outlet pump that take-out nutrient water from the reservoir to reduce the water level is connected to Digital Pin 3. Both pumps are operated by the Arduino via Relays. The prototype of the system which is based on the designed Schematic Diagram is shown in Figure 6. The code of the water level control is programmed using Arduino IDE. The first step in the code is an initialization step which includes the Pin Number, Variables, and Pin Mode declaration. The TPCA is also stated in this first step and it is subtracted with the 5 cm submerged root limit. If the subtraction result is negative, the setpoint distance is set to 2 cm which is the minimum distance that can be measured by the sensor. The setpoint distance is the distance between the water level and the floating raft. The root can grow longer than the height of the reservoir, hence a maximum value is set which is a few cm above the reservoir base. In the experiment, a reservoir that has a height of 13 cm is used. The maximum value is set to 9 cm distance, leaving the water to be 4 cm in height. Once the set point distance is determined, the controlling begins to operate. The Actual Distance is measured using the Ultrasonic sensor. The two pumps will manage the level of nutrient water to reach this set point. An If-Else conditional statement is used to add or take out the water. If the Actual Distance is larger than the Set Point Distance, then the inlet pump will be turned on and the outlet pump will be turned off. If the Actual Distance is smaller than the Set Point Distance, then the inlet pump will be turned off and the outlet pump will be turned on. If the Actual Distance reaches the set point, then both pumps will be turned off. A delay of 2 seconds is implemented in each iteration since the water surface oscillates during the water addition and subtraction process. The flowchart of the controlling program is shown in Figure 7.  Table 2. The root length is measured using a ruler from the beginning of the root hairs until the tip of the root. Figure 8. Sample of the Brazilian Spinach plants Table 2. Result of TPCA and its Root Length

Analysis of Regression Models
Five different Regression Models are determined from the 21 TPAC-Root length data pairs. The result is shown in Figure 9 whilst the list of Equation and its Coefficient of Determination( 2 ) is listed in Table 3. The Result in Table 3 shows that the Coefficient of Determination

Analysis of Control System
The root length of the Brazilian spinach in Table 2 ranges from 8 to 41. The setpoint is the root lengthof 5 cm and capped to a maximum of 9 cm as mentioned in the Flowchart of Nutrient Water Level Control program. Hence the set point for plant 1 is 3 cm, plant 2 is 4 cm, and plants 3 to 7 are 9 cm. The result of controlling the nutrient water level based on the flowchart program in Figure 7 is shown in Table 4. The experiment results in Table 4 show that the if-else method gives good performance to control the level of nutrient water. This method is simple and low-computation in the Arduino. The control of nutrient water level is also tested for the Linear Regression method. The input is the error between the actual level and the set point. The is the duration of the ump. The input-output pairs are then used to find the parameters and in the Linear Regression equation = + . The data in Table 4 are shown in graphic Figure 10. It is found that the Linear equation between the water level error and the duration of the pump is = 38.909 − 36.039. The Coefficient of Determination ( 2 ) is 0.9632 which shows a very good relation between the input-output. Hence the Linear Regression method also can be used to control the level of nutrient water. The computation of the Linear Regression is also low since it only uses multiplication and addition. The disadvantage of the Linear Regression method to predict the duration of the pump is that it is unique to each size and volume of the reservoir. The equation above is only applicable to the box used in this experiment. The equation will be different if it is tested in a different box of reservoirs.