AquaStat: An Arduino-based Water Quality Monitoring Device for Fish Kill Prevention in Tilapia Aquaculture using Fuzzy Logic

In the Philippines, Tilapia fish farming sector is vital to the economy in providing substantial employment, income and meeting local demand for protein sources of the Filipinos. However, the possible benefits that can be derived from this industry are at stake because of the sudden occurrences of fish kill events. This can be attributed to a wide variety of natural and unnatural causes such as old age, starvation, body injury, stress, suffocation, water pollution, diseases, parasites, predation, toxic algae, severe weather, and other reasons. With the identified severe effects of fish kill events to the fish farmers, consumers and the fisheries industry, advanced measures and methods must be established to alleviate the adverse effects of this phenomenon. To solve the underlying problem on water quality monitoring system to improve freshwater aquaculture, various studies were already conducted. However, these studies merely focused on the reading and gathering of water parameters. In this paper, fuzzy logic was used to come up with a model that can analyze and generate result regarding the overall quality of the water being used in Tilapia aquaculture. The water parameters considered in this paper were temperature, dissolved oxygen, and pH level. The results of the water parameter readings using the conventional method were compared to the data that were gathered by AquaStat to test its accuracy and showed no significant difference. Also, the overall water quality obtained using the conventional method was compared to the overall water quality generated by AquaStat and obtained an accurate result. Keywords—Fuzzy logic; fuzzy sets; fish kill; freshwater aquaculture; Tilapia


I. INTRODUCTION
The Philippines is positioned as the 8th top fish producing country in the world. It has a total inland resource of 749,917 ha as reported by the Bureau of Fisheries and Aquatic Resources employing a combined total of 1,614, 368 fishing operators nationwide. Moreover, aquaculture got the highest percentage of total fish production from 2018 -2020 with 52.8% share to overall total fish produced [1]. This sector produces tons of fish, crustaceans, mollusk, and aquatic plants which contribute to the national economy of the country having the largest share next to agricultural crops at current and constant prices [2].
Tilapia (Oreochromis niloticus) ranked second among the fish species that are being produced in aquaculture in the Philippines [3]. Moreover, it is identified as the most consumed aquaculture fish in the Philippines for its taste and affordability [4], [5].
However, there is an indicative fall of the potential benefits of the aquaculture industry in the Philippines because of the occurrences of fish kill incidents directly harming fishing operators. The fish kill is a sudden mass death of the fish in any given body of water [6]. Also, it is defined as any unusual and noticeable increase in mortality due to infectious or noninfectious causes like oxygen depletion, pollutants, natural toxins and diseases in aquatic organisms [7]. It is characterized by large numbers of aquatic animals dying over a short time in any bodies of water where fish cultivation was being pursued [8].
Fish kills can be attributed to a wide variety of natural and unnatural causes such as old age, starvation, body injury, stress, suffocation, water pollution, diseases, parasites, predation, toxic algae, severe weather, human-induced activities, and other reasons. However, most fish kills result from natural events [9]. The authority attributed the Lake Sebu fish kill event in South Cotabato last January 2021 to the sudden change of weather in the area [10]. Also, extremely high temperature has been identified as a potential agent that could cause fish kill events.
With the identified severe effects of fish kills to the fish farmers, consumers and the fisheries industry, advanced measures and methods must be established to alleviate the adverse effects of fish kill events.
To solve the underlying problem on water quality monitoring, various studies were conducted. The studies presented in [11], [12], [13], [14], and [15] used water sensors and IoT technology to conduct real-time water quality monitoring. However, these studies focused only on the reading and gathering of water parameters.
To solve this, various researchers presented studies that used fuzzy logic to automatically analyze the water quality without the human intervention.
In the study of Caldo and Dedios [16], they categorized the inputs as physical, chemical, and micro biological in the fuzzy inference system to analyze the water quality in Taal Lake. Rana and Rani [17] conducted a MATLAB simulation of a fuzzy logic system to determine the percentage of fish health in freshwater using temperature, dissolved oxygen, and www.ijacsa.thesai.org conductivity. In the study of Ichsan, Kurniawan and Huda [18], they designed a fuzzy logic control based on graphical programming to monitor the water quality in shrimp pond by considering the salinity and turbidity. Hiyunissa, Alam and Salim [19] designed fuzzy logic control system to control microbubble aeration to maintain a desirable value of dissolved oxygen. They only considered the DO and the water temperature. Bokingkito and caparida [20] implemented an IoT-based real -time water quality assessment monitoring system for freshwater aquaculture they considered temperature, pH and turbidity.
Despite the notable results of the studies presented above, their scopes were focused mainly on the assessment of the water used in freshwater aquaculture in general. However, diverse freshwater species have their own tolerance to various water parameters [21] and the desirable ranges of water parameters vary in every freshwater specie.
Hence, this study developed a fuzzy logic-based water quality assessment, specifically focused on Tilapia aquaculture. This study considered pH, DO and temperature as inputs to the fuzzy inference system.

A. Water Parameters
With the significant profit gained from the aquaculture industry, measures must be taken into consideration to ensure aquaculture's production growth to continuously contribute to the different pattern of supply and demand for fish and fish products. Poor water yields to poor product quality thus this becomes a potential risk to human safety. Also, production is reduced when the water contains contaminants that can impair development, growth, reproduction, or even cause mortality to the cultured species [22].
Massive fish kill events are mostly associated with a sudden change in water composition due to natural causes. Fish kills occur most frequently during the summer when water temperature is high and dissolved oxygen levels are low [23]. Although there is a wide variety of natural and unnatural causes of fish kill incidents, the following are just the identified water parameters that mostly caused sudden massive Tilapia fish kill incidents in the Philippines that need to be monitored in a regular basis.
The first parameter is the water temperature. Water temperature can adversely affect the water condition. Both low and high heat can directly influence other important components that are beneficial in ensuring the health of the marine species [24].
Second is the pH level. The pH concentration of the water can affect the aquatic organisms' health. In freshwaters, inadequate pH levels can hasten the release of metals from rocks and sediments. These eventually affect the metabolism of the fish and its ability to take up water through the gills. Furthermore, low pH can condense the amount of dissolved inorganic phosphorus and carbon dioxide available for phytoplankton during photosynthesis. In contrast, high pH levels can turn the toxic form of ammonia, become more predominant, and the phosphate can rapidly precipitate [22].
And the most important water parameter is the Dissolved Oxygen (DO). Fish needs dissolved oxygen to breathe and perform metabolic activities. Thus, an inadequate level of dissolved oxygen is often associated with fish kill events. Alternatively, precise levels can result in good growth leading to high production yield [22].

B. Desirable Ranges of Water Parameters
The tolerance of diverse aquamarine species to several water parameters varies. Table I shows the water quality standards for Tilapia Freshwater Aquaculture in the Philippines [21]. It contains the three (3) identified parameters that are crucial in fish kill incidents together with their desirable ranges.

C. Development of the Fuzzy Inference System
There are numerous water parameters that can cause fish kill incidents, however, with the recommendation of an expert 1 in the field of freshwater aquaculture, this paper only focused on the three (3) identified water parameters that caused most of the sudden Tilapia fish kill occurrences. Also, the said expert helped in defining the linguistic values and universe of discourse for each input parameter. Matlab R2018b was used in designing the fuzzy inference system.
In designing the fuzzy inference system of the three (3) inputs, the Membership Function (MF) type used was trapezoidal (1) because there are ranges from a single linguistic value that are equal regarding the degree of membership.
where x is the input value while parameters b and c define the shoulders of the membership function, and a and d define its feet.
In designing the fuzzy inference system of the output, the triangular membership function (2) was used.
where x is the input value while parameters a and c define the feet of the membership function, and b defines its peak.
The Mamdani Fuzzy Inference System model was used in this paper because of its ability to synthesize a set of linguistic control rules obtained from a human expert and because it has more intuitive and easier to understand rule bases suited to expert system applications [25]. www.ijacsa.thesai.org In creating the rules, the logical AND operator was used. The AND operator was used to combine the different antecedents because the value of each input has a significant impact on each other.
And finally, the Center of Area (3) was used for the defuzzification process.
where ( ) is the membership value for point in the universe of discourse. Table II shows the inputs, their linguistic values, Membership Function types and universe of discourse of each water parameter and the structure of the output of this fuzzy inference model.  Fig. 1 shows the concept of the fuzzy inference model of this study.      With the assistance and guidance of the expert in Tilapia aquaculture, eighteen rules were generated for the model.

D. Development of the AquaStat Device
Arduino Uno was mainly used as the microcontroller of the device. The device is equipped with three (3) ATLAS sensors, namely: pH Sensor, dissolved oxygen (DO) sensor, and temperature sensor. Also, this device has a data logger and LCD to display the sensor readings and the overall water quality.
Arduino IDE was used to write the code and the fuzzy logic implementation of this paper.

A. Accuracy in Gathering Water Parameter Values
The testing of AquaStat was done in five (5)  To determine the extent of the accuracy of AquaStat in terms of reading the water parameters, comparison was made against the obtained readings of LaMotte Fresh Water Aquaculture Test Kit which is currently being used in the said laboratory. Table III shows the obtained pH level of the water in five (5) fish cages.
The obtained pH values from the sample fish cages showed differences having a mean of 0.14. However, since the LaMotte Fresh Water Aquaculture Test Kit is a manual device and only capable of reading pH values with limited and exact decimal values, such differences in decimal values are considered insignificant.    Table V shows the obtained water temperature in the five (5) fish cages. The obtained water temperature values from the sample fish cages showed differences having a mean of 0.07. However, since the LaMotte Fresh Water Aquaculture Test Kit is a manual device and only capable of reading water temperature values with limited and exact decimal values, such differences are considered insignificant.

B. Accuracy in Assessing the Overall Quality of the Water
To further evaluate the accuracy of AquaStat in identifying the overall quality of the water, actual historical data of the water parameters during the regular monitoring activities of the concerned agency were used as inputs for each respective water parameter in the simulation process, Fig. 8.   Table VI shows the results of identifying the overall water quality of the water using the historical data by the Fish Health Specialist and AquaStat. Using the given historical data, the researcher asked Dr. Centeno to evaluate and identify the overall water quality based on his own assessment. The researcher then used the given historical data and inputted them to AquaStat, and the following results were drawn. Table VI presents the overall analysis of the water quality by the Fish Health Specialist and AquaStat using the actual historical data. The historical data are consisted of values per water parameter. The results of the overall water quality evaluation generated by AquaStat using the collected actual historical data were found to be in consonance with the overall water quality given by the Fish Health Specialist.

IV. CONCLUSION
Fish kill events in Tilapia aquaculture in the Philippines are undeniably bringing negative impacts in the lives of the Filipino Tilapia fish farmers and the consumers. Undeniably, it is difficult to accurately predict as to when fish kill events will occur, however, having preemptive measures can lessen its devastating effect.
Based on the results, readings of the important water parameters such as pH, dissolved oxygen and temperature using AquaStat showed promising accuracy compared to the device that is currently being used by the subject agency having mean difference of 0.14, 0.13 and 0.07, respectively. Also, AquaStat can accurately determine the overall quality of the water by using the human reasoning applied to it using Fuzzy Logic obtaining a 100% accuracy.
Hence, the results and the concept of this study can be used in another study on specific freshwater specie.

ACKNOWLEDGMENT
The researcher would like to acknowledge the assistance and help extended by Dr. John Henry R. Centeno III, Fish Health Specialist at the Fish Health Laboratory, Bureau of Fisheries and Aquatic Resources, San Mateo, Isabela, Philippines, johnhenrycenteno@gmail.com.