Artificial intelligence for small hydroponics farms employing fuzzy logic systems and economic analysis

HIGHLIGHTS: Artificial intelligence is used to build an economical nutrient mixing machine for hydroponic farms. An automated nutrient mixing system enhanced work capacity more than manual mixing. Fuzzy logic-based nutrient mixing machine on a small-medium scale in hydroponics proved both efficient and cost-effective. ABSTRACT The application of artificial intelligence (AI) in modern agriculture has attracted increasing attention since its automation has the potential to accelerate food production with efficiency in resource use. Fuzzy logic, as one AI method, can be applied in hydroponics as an automation function of a nutrient mixing machine. There have been some inventions of nutrient mixing machines in commercial-scale agribusiness but not yet at the level of the small and medium farms that are mostly found in developing countries. This study constructed a hydroponics nutrient mixing machine employing a fuzzy logic method, calculated the machine’s efficiency, and evaluated its economic application. The automated nutrient mixing machine using fuzzy logic was efficient, and both theoretical field capacity and actual field capacity indicators were higher with the use of the nutrient mixing machine compared to manual nutrient mixing. This machine saves 78% of the labor normally used for mixing nutrients, with a saving of up to 42.86% in the nutrients used compared with mixing manually.


Introduction
Smart farming has gained increasing recognition nowadays since it has produced more advances in agriculture, in both process and product quality (Alipio et al., 2017;Zhao, 2020).Modern agriculture is expected to satisfy the food requirements and supply an efficient agricultural labor force, as this has decreased over time.Due to the current issues, the agricultural industries are looking for innovations that can improve the crop yield to keep up with the population growth, and are also therefore concerned with efficiency (Pathan et al., 2020).
Among modern methods, Artificial Intelligence (AI) has entered many sectors, including agriculture.Many methods have been developed for problem-solving to simplify tasks or work.AI methods include fuzzy logic, artificial neural networks, neuro-fuzzy logic, and expert systems (Jha et al., 2019).Automatic hydroponics are expected to control important environmental factors which affect plant growth, including temperature, humidity, and water (Kularbphettong et al., 2019).Furthermore, the automatic system is applicable for general agricultural processes, namely nutrition management, harvest and post-harvest, and also weed and disease management (Eli-Chukwu, 2019;Liu, 2020).
In developed countries where most agricultural farms are on a commercial scale, automatic control such as AI is already widely used.In contrast, the horticultural business, especially hydroponics, operates at small and medium levels in developing countries.AI has generally not been used at those levels by reason of the high cost of the machinery.Thus, it is a challenge to develop an advanced technology that can support them to upgrade their works but also to remain cost-efficient.The study constructed and calculated the performance of a nutrient mixing machine for use in hydroponics using the fuzzy logic method, then assessed the economic aspects to see if it could be used successfully by small and medium-scale agribusinesses.

Material and Methods
The machine construction was carried out in the Workshop Laboratory, Agricultural Engineering Study Program, Agricultural Technology Department, Faculty of Agriculture, Hasanuddin University, Makassar, Indonesia (5.1342° S, 119.4881°E).It was first constructed in 2016 and then reconstructed in 2021 for further development of its function.Performance testing of the machine was conducted in the Central Sulawesi Assessment Institute for Agricultural Technology office in Central Sulawesi Indonesia in 2021.
The nutrient mixing machine consists of a deep flow technique (DFT) hydroponic system, a nutrient control device, a water level control device, a solenoid, a nutrient reservoir, and a submersible pump.This nutrient mixing machine is controlled by a programmed microcontroller.The machine's structure is shown in Figure 1.
The specifications of the nutrient mixing machine are as follows: a. Planting media dimensions (W×W×H) = 391 cm × 14 cm × 11 cm; e. Planting distance in hydroponic system = 15 cm; f.Hydroponic system installation = elbow iron; g.Solenoid valve = 7 pieces, to regulate nutrients and water; h.Submersible pump = 1200 L h -1 , as a source of nutrient irrigation; i. Using electricity for submersible pumps, solenoid valves, and control systems; j.Control tool = multivariable fuzzy logic (2 inputs and 2 outputs).
Testing of the control system aims to determine the performance of the control system implementation during the hydroponic nutrient distribution process; the parameters observed are water height (cm), nutrient content (mg L -1 ), water discharge (mL min -1 ), nutrient discharge (mL min -1 ), and sensitivity to disturbance.In the hydroponic nutrient reservoir, three solenoids are used, namely one for water discharge, one for nutrient discharge, and one ON/OFF solenoid for incoming water.The magnitude of the nutrient discharge flow affects the control performance; if the nutrient discharge is large it will respond too quickly or the nutrient content will be excessive as a result of excess nutrients in the reservoir at the beginning of the process (overshoot) and tend to be unstable in the performance of the solenoid and shorten its life.However, if the response is slow, there will be an unstable mixing of nutrients and water in the reservoir (offset).
The first activity carried out in this study was designing a hydroponic system.The hydroponic installation system consists of several main parts, namely the hydroponic installation and the nutrient mixing tank.This tank consists of a mixing machine, a nutrient mixing machine, and a water level control.The furnace system consists of a combustion chamber, blower, and limiting plate.This hydroponic installation system can be seen in Figure 2.
To control the nutrients in the mixing tank, there are six solenoids that regulate the amount of nutrients that come out of the mixing tank.This solenoid is directly connected to the microcontroller, which uses a fuzzy program that functions as a command to adjust the valve opening on the actuator.
The materials needed to design the hydroponic system are gutters, PVC pipes, lateral pipes, electric pumps or submersible pumps, mixing tanks, and solenoid valves.The gutters serve as the hydroponic growing medium.The gutters are made of PVC material and have dimensions of 391 cm × 14 cm × 11 cm.The PVC pipe serves as a reservoir of nutrients and water and measures 7.62 cm with a length of 1 m and a width of 0.5 m.This PVC pipe is of class D, which has the ability to withstand pressure on 5 kgf cm -2 .The lateral pipe serves as a branch of the main pipe.The pipe diameter ranges from 8-20 mm and the low pressure ranges from 35-175 kPa.
The electric pump or submersible pump functions in hydroponic irrigation systems as a nutrient stirrer.The size of the pump is 1200 L h -1 , the maximum suction height is 0.75 m, and the maximum suction power is 600 L h -1 .The mixing tub is for mixing the nutrients and water.The solenoid valve serves as a control tool that functions as a water and nutrient dropper in the hydroponic system.The solenoid valve size is 1 inch with a voltage of 220 V and the valve type is normally closed.
The hydroponic system used in this research is the Deep Flow Technique (DFT) system.The DFT system is a hydroponic method that uses water as a medium to supply nutrients to plants through ponds.Plants are cultivated in hydroponic installations with a nutrient solution that is about 4-6 cm deep and flows continuously, such that the plant roots are always submerged in the nutrient mixture.
The software in the fuzzy logic machine was built by the flowchart shown in Figure 3.
As mentioned earlier, the study uses AI in the form of a fuzzy logic control system, which is based on its membership, which can be considered as the input range, and the fuzzy logic control is a range-to-point or range-to-range control.The output of the fuzzy controller is derived from the fuzzification of the input and output using the associated membership function.There are several methods for developing fuzzy logic control systems, one of which is multivariable fuzzy logic, which is designed with fuzzy control methods, namely 2 inputs and 2 outputs.The 2-input system consists of the water level and nutrients.The input water level is labeled as t (cm) and the nutrients are labeled as n (mg L -1 ).
Figure 4 shows Input 1 (height) and Input 2 (nutrients).Input 1 has a range of 8-12 cm in use; a set of fuzzy triangles and a set of firm ones were used, and Input 2 (nutrients), having a range of 500-800 mg L -1 , with a set of fuzzy triangles and a set of crisp ones, was used.This range is considered as the input value given.For output, it has a 2-output system, which comprises a high water discharge labeled Qh, and a nutrient discharge labeled Qn.The water discharge output (Qh) ranges from 0-50 mL min -1 , and the nutrient discharge (Qn) ranges from 0-21 mL min -1 , as needed by the plants.The fuzzy set used is the fuzzy singleton.
In Figure 5, the results of the preparation of the fuzzy control rules are shown.The arrangement of control rules is based on a heuristic approach, namely an approach based on quantitative knowledge of the behavior of a hydroponic system that is controlled based on the operator's knowledge.In this study, the rules are arranged based on a loop system that is in accordance with the desired conditions.
The aim of tool testing is to determine the results of the hardware design and fuzzy rules that can run the hydroponic system control device according to the expected function and produce good performance.To measure the success rate, the following indicators are used: a.There is no offset and the stability in the hydroponic system is about 1% of the water height setting point, which is 12 cm.b.There is no overshoot in the hydroponic system from the water height setting point, which is 12 cm.c.There is no offset and the stability in the hydroponic system is about 1% of the set point for the nutrient content of 500 mg L -1 .
d.There is no overshoots since the difference value of 1% from the points in the the nutrient content of 500 mg L -1 .
e.The hydroponic system is resistant to disturbance in the event of a power outage.The thing that must be considered is the water level in the nutrient reservoir; this is because a water return cycle occurs when there is no pump flow that supplies nutrients entering the planting medium.
The performance of the Nutrient Mixing Machine was analyzed using the Agrotechnology test (Purwantoro et al., 2018).The observation of the agrotechnical aspect includes the ability of a tool to complete a job on a land area per unit of time as the theoretical work capacity.The theoretical field capacity of the machinery can be formulated as in Eq. ( 1  where: Kt -theoretical field capacity (ha h -1 ); (1) Wt -theoretical working width (m); and Vt -theoretical working speed (km h -1 ).
The actual field capacity is the ability to work machinery based on the total area for the total time used.The actual working capacity of the machinery can be formulated as in Eq. ( 2):

Results and Discussion
In this test, two control systems were implemented, namely the expert system and fuzzy control.Expert systems can be categorized based on specific subject areas and the purpose of the application, such as the type of diagnosis, prediction, design, and planning, simulation, knowledge base, reasoning, expressing, and problem identification, as well as storing knowledge (Tan, 2017).The development of expert system programming will apply different rules, codes, algorithm sequences, and interactive methods between users and other programs (Tan et al., 2016).It is different from compiling fuzzy rules for a fuzzy knowledge base because in that it is mandatory to include study by knowledgeable experts.A fuzzy logic-based system imitates human behavior in managing and solving problems that cannot be fully formalized by using mathematical models, and is treated using a systems theory approach (Sharma et al., 2018).In fuzzy control, encapsulated skills are translated into linguistic descriptions and knowledge of process states and input-output relationships.The control measures are coded via fuzzy inference rules and require some numerical parameters to operate, such as what is considered a significant error and a significant error rate of change, but the exact values of these numbers are usually not important, unless highly responsive performance is required, in which case empirical tuning will determine it (Honda et al., 2004).
The initial water output is considerable because the system is trying to quickly catch up with the target set point as the water level drops.However, the output discharge starts to drop as it approaches the preset point (10 cm), as predicted by the fuzzy computation.The amount of water that enters the mixing tank is reduced when the running pump reaches its preset point.This occurs because the mechanism cycles back to control once the pumping of water to the planting media has been completed.
Figure 6A describes the results of observing the water level in the mixing tank and Figure 6B demonstrates the results of observing the water discharge.By looking at the time it takes to achieve stability at a fairly fast water level, namely 1-5 min, it can be seen in Figure 6A that the sensor response for both systems of the control is quite stable.In addition, Figure 6B also shows that the height reaches the setting point within 5 min.For water level control, there is no overshoot or offset.This is where: Ka -actual field capacity (ha h -1 ); A -area of land worked (ha); and, T -time spent (hours) The economic evaluation is based on five indicators, namely: 1) labor-saving, 2) cost-labor-saving, 3) investment determination, 4) saving of the nutrients used, and 5) economies of scale.The economic analysis compared the use of the Nutrient Mixing Machine and manual nutrient mixing.
Labor-saving is the situation of requiring much less labor per unit of production than alternative farms, while cost-laborsaving is determined by multiplying the labor-saving with the current wage.This is called cost-saving whenever the labor cost is less than the alternative cost.The investment determination uses a feasible investment level calculated by multiplying the cost-saving per year with the assumption of the economic life of the machine.
The saving of the nutrients used is calculated based on the result of the performance test of the nutrient mixing machine as compared to manual mixing.The result of this performance test becomes the basis of the calculation in the economic analysis including the nutrients used.The plants that have been used in the calibration are lettuce in a small-scale hydroponic installation that contains 200 plants per installation.
The final indicator, the economy of scale, is calculated to show the effectiveness of automation using artificial intelligence.It is measured by comparing the total cost of the nutrient mixing divided by the total population that can be served either by the machine or manually.because the sensors used in the water level control system are very sensitive to receiving the signal given, so that the system runs as expected.
Figure 6A shows the results of observations of the nutrient content and Figure 6B shows the results of observations of the nutrient discharge.Looking at the time required to achieve stability at a fairly fast water level, which is 1-7 min, it can be seen in Figure 6 that the sensor response for both control systems is quite stable.At the beginning of filling, the water discharge that comes out is large and therefore overshoots.This is because the sensor has not been able to cope with the very large nutrient output or it is not sensitive enough yet during the initial filling.However, this does not affect the plant growth because the conditions are fast and the mg L -1 value is quite small (35 mg L -1 ).
The results of the observations showed that the nutrient discharge entering the mixing tank decreased when it reached the setting point.This is due to the control command to provide nutrients to the growing media, and the system returns to control until the final set point where the system has cycled.In addition, it can be seen in Figure 7 that the nutrients reach the setting point in 7 min and that the control is not stable enough after being disturbed.In the nutrient control, overshoot also occurs above the set point, which is for an overshoot of 35 mg L -1 .This is still tolerable considering the large amount of nutrient content used, however.
The testing of the nutrient mixing machines and manual mixing of nutrients in hydroponic installations aim to identify which work processes are more effective and efficient in the process of providing hydroponic nutrients.The efficiency of the working process of manual nutrient mixing and the nutrient mixing machine can be seen from the theoretical field capacity (Kt) and actual field capacity (Ka) values which are presented in Table 1.
The work capacity of the nutrient mixing machine in hydroponic installations is faster than the manual mixing of nutrients.The nutrient mixing machine uses the Arduino fuzzy logic control system to measure water and nutrients in hydroponic installations to a high level of accuracy.According to Sihombing et al. (2018), the implementation of the Arduino control system for water level sensors in hydroponic installations shows a high level of accuracy and the sensors can detect them well.Nutrient measurement is needed in real time because the concentration of ions in the nutrient solution changes over time (Ahn & Son, 2011).
Table 1 also shows significantly different results based on the performance test of the nutrient mixing machine, compared to manual nutrient mixing.The mixing process in a hydroponic installation is influenced by several factors, such as the skills of the workforce, the level of accuracy of the nutrient-measuring device, and the transfer of nutrients to the hydroponic installation.The nutrient solution in the hydroponic installation mixing tank must have a good system for containing optimal levels of oxygenation, salinity, pH, and the conductivity of nutrient solutions (Modu et al., 2020).Several previous studies conducted research related to automation systems in hydroponic installations (Daud et al., 2018;Chowdhury et al., 2020) with the aim of improving the working system in hydroponic cultivation.According to Sambo et al. (2019), hydroponic systems with artificial intelligence technology can be used to improve the system performance in hydroponic installations, compared to manual work systems.The level of accuracy of the sensor greatly affects the relationship between the electrical conductivity (EC), nutrient solution (mg L -1 ), and pH of a hydroponic nutrient mixing system.
Investment in the hydroponic installation is the most costly part of all the expenses involved.As the prime requirement of the hydroponics system is well-monitored conditions, the automation system streamlines the work of the system.However, to achieve this effectiveness, the installation will need greater investment, which may be a drawback in terms of cost.It is a challenge to know whether an automation machine on a small-medium scale is economical compared to manual work.The feasibility of using automation machines for small-and medium-scale hydroponics is based on a number of indicators given below.B.
This research used ten installations that included 200 plants per installation (the dimensions of the installation are shown in Figure 1), so the total population is 2000 plants.Based on the result of the performance test in Table 1, the time spent in one installation was 1079 s with manual work and 605 s using the nutrient mixing machine.This means that the number of plants per hour that could be handled in manual work was 667, while the use of the nutrient mixing machine increased this to 1192 plants per hour.Thus, there is a potential labor-saving of about 78%.As concerns the potential labor-saving indicators, a comparison of the labor use between manual work and the use of a nutrient mixing machine is shown in Table 2.
The economic benefits of AI are mostly seen in terms of lowering the labor costs (Sharma &Tripathi, 2021).The labor costs with and without the nutrient mixing machine are shown in Table 2, in which, in terms of labor cost saving, the number of hours is multiplied by the hourly cost per person, which is generally $0.994 in Indonesia.The nutrient mixing machine could work optimally up to 10 installations or cover 2000 plants.The total hours per planting season based on manual work is 60.03 hours while the use of the nutrient mixing machine took only 24.95 hours, so the total labor saving per planting season is 35.08 hours, making the total cost saving per planting season $34.87 and finally, a cost-saving for labor per year of $418.43.This was counted per year regarding the calculation of the investment level of the machine and including depreciation.
Nutrient mixing machines have now been released on the market, but these are selling at a high price and are large in size, being intended for the commercial farm level.In this study a smaller nutrient mixing machine was constructed, targeted at small-to-medium scale farms.However, the feasibility of this machine needs to be proved with regard to determining the investment level, shown in Table 2.The investment level should be less than the price of the machine in order to get the benefit of the machine used.In this study, the feasible amount of investment is $4,184.30,which means that the price of the machine should be lower than this.
The automated use of nutrient mixing machines minimizes human work, including human supervision based on its setting point.As well as saving labor costs, another particular benefit of this machine is in reducing the use of material due to its accuracy (Danaher, 2022).Manual nutrient mixing has greater material losses compared to automatic nutrient mixing.This finding is supported by other researchers who found that automation helps farmers to be more accurate with inputs such as seed, fertilizer, water, and pesticides (Rotz et al., 2019).
Once investments in advanced technology are being made, the effect of this automation is that a larger target consumer can be served with limited marginal costs and on a larger economic scale compared to the traditional system (Ernst et al., 2019).The cost of nutrient mixing per unit which reflects economies of scale is shown in Table 3.
However, the government should introduce supporting regulation to lower the cost, otherwise the economic benefit for small and medium farms will be lost and automation will only increase the economies of scale on larger farms (Lowenberg DeBoer et al., 2022).Research has shown that advanced technology in automation generated more sales of horticultural products, an effect of which was to enable better salaries for the workers (Posadas, 2012).

Conclusions
1.The automatic nutrient mixing machine was efficient, and both its theoretical working capacity and actual working capacity indicators were higher compared to the manual work.
2. In line with AI benefits in terms of saving on labor and enabling efficient use of resources, the nutrient mixing machine reduces the labor needed for nutrient mixing by up to 78% and allows a saving of up to 42.86% on the nutrients used.

Figure 1 .
Figure 1.Hydroponic installation with fuzzy logic control system

Figure 2 .
Figure 2. Making a hydroponic system based on fuzzy logic control Figure 3.Control software flowchart

Figure 5 .
Figure 5. Fuzzy control matrix for hydroponic system

Figure 4 .
Figure 4. Fuzzy control input (water and nutrients) -output (Qh and Qn) for hydroponic system

Figure 6 .
Figure 6.(A) Water level (cm) in mixing tub and (B) incoming water (mL min -1 ) discharge results of fuzzy logic calculation

Table 1 .
Hydroponic nutrient mixing machine performance test A.

Table 2 .
Potential labor cost savings from using nutrient mixing machine

Table 3 .
Comparison and saving of nutrient use with and without automation