Automatic Drain System in Seawater Aquarium with Fuzzy Logic Method

−In seawater aquariums, seawater quality plays a very important role for the survival of the biota in it. There are measurement parameters that determine the quality of the seawater fit to be inhabited by seawater ornamental fish such as clown fish. Measurement parameters are such as temperature, salinity, dissolved oxygen content (DO), pH, ammonia, nitrite, and nitrate. Current technological developments make it possible to create a system that automatically conducts seawater drainage in a seawater aquarium so that the quality of the seawater remains in accordance with its measurement parameters and is fit for habitation by seawater ornamental fish such as clown fish. In this study the measurement parameters that become the reference are the temperature, pH (acidity) values obtained from the temperature sensor and the pH sensor. For normal temperatures, if the temperature is in the range of 24°C to 28°C, while for the ideal temperature is in the range of 25-27°C. For an appropriate pH in a saltwater aquarium is 7.5-8.5 with an ideal pH of 8.2. From the results of measurements made by these sensors, the value will be processed using the fuzzy logic method, then the condition of sea water quality in the aquarium can be seen from the smartphone, and when the measurement results show an inappropriate value, the system will automatically drain the water.


INTRODUCTION
Based on data from the Director General of Aquaculture of the Ministry of Maritime Affairs and Fisheries (KKP), Indonesia has more than 450 species of fish from 1,100 species of freshwater ornamental fish and more than 700 species of marine ornamental fish that are scattered in Indonesian waters [1]. Approximately 75% of the world's supply of ornamental sea water comes from Indonesia [2]. Therefore maintaining sea water ornamental fish in Indonesia is very possible to do because of the many species of sea water ornamental fish that are scattered in Indonesian waters.
In maintaining sea water ornamental fish there are things that need to be considered, for example is the quality of water that will be a fish habitat. Water quality plays a very important role in the development and growth of sea water ornamental fish that are vulnerable to dirty environmental conditions [3]. Based on research conducted by K.Raghu Sita Rama Raju and his colleagues [4]. Sea water quality management is very dependent on the parameters used such as temperature, salinity, pH (acidity), dissolved oxygen (DO), turbidity, ammonia, nitrate, and carbonate [3], [4]. Sea water that is not in accordance with the assessment parameters should not be suitable for use in aquariums, so there needs to be a change of water according to quality based on the specified parameters. Not many people know the standard of good water quality values for maintaining sea-water ornamental fish, most sea-water ornamental fish keepers do water draining based on when the water turns turbid without looking at measurement parameters such as temperature and pH (acidity). Because when the temperature and pH are too low or too high it will have a bad impact on ornamental fish in the sea water in the aquarium.
According to research conducted by R.M Bima Gentayu [5] regarding the implementation and analysis of smart aquarium systems, one of the applications of current technological developments is like the internet of things that can be made of a smart aquarium system by utilizing the internet network. Based on the above it is proposed a system that can perform automatic draining of water aquariums based on water quality by looking at the measurement parameters such as temperature and pH. In the aquarium there are sensors that function as a means of measuring the temperature and pH values that will be used as input for the process in the system using the fuzzy logic method. The use of fuzzy logic method in this study is because the fuzzy logic method can make decisions by entering and sorting data into several groups. In addition, because it can perform difficult calculations, to distinguish certain conditions in a parameter [6,7]. Besides the fuzzy logic method can also be used in the field of artificial intelligence (Artificial Intelligence) that allows a system to do work like humans can. If the system shows that the water quality does not match the specified parameters, the system will send an order to automatically change the water in the aquarium.

Research Stages
There are several stages in this study, Figure 1 shows from the beginning of the study to the end of the study. The stages consist of problem identification, literature study, system design, system implementation to system testing and analysis.

Water Quality
Water quality is an important parameter in maintaining ornamental fish, because ornamental fish require certain water quality to live [8,9]. Some determinants of water quality such as pH, temperature, turbidity, dissolved oxygen, ammonia content and other chemicals The several explanations related to the above factors are as follows: a. pH The acidity of water is measured by the pH which has a range of values between 1-14. The more acidic the water makes the pH value smaller. Conversely, the more alkaline water makes the pH value is greater. For neutral conditions indicated by a pH value of seven [8]. According to research conducted by Martin A. Moe, the optimum pH range for aquariums in sea water is between 7-8.5 and the ideal pH is 8.2 [10]. b. Temperature Temperature is one of the important factors that must be considered when breeding aquatic organisms [4]. For temperatures less than equal to 20°C fish will tend to be passive, metabolism decreases so that it becomes thin and in advanced conditions can die. Conversely, if the temperature is too hot or more than 33°C will result in fish breathing will be faster and can cause death [8]. Martin A. Moe stated that the optimal water temperature for sea water aquariums is between 24-28°C, while the ideal temperature is in the range of 25-27°C [10]. The temperature should not be more than 28°C [11,12].

Internet Of Things
Internet of Thing has become a separate research since the development of internet technology and other communication media. The growing development of human needs about technology makes more and more research present, the internet of things is one of the thoughts of researchers who optimize several tools such as media sensors, wireless sensor networks and other smart objects that allow humans to easily interact with all equipment connected to Internet Network [13].

Arduino
Arduino is an open-source platform prototyping made based on the ease of use of hardware and software. Arduino boards can be used to read input in the form of sensors or pressures on buttons and turn it into an output that can be distributed online. Users can create an arduino board to do something by sending a set of commands to the microcontroller on the board [14].

Fuzzy Logic
Fuzzy Logic is a branch of Artificial Intelligence which is a knowledge that can emulate human intelligence so it is expected that computers can do things that if done by humans requires intelligence. In other words fuzzy logic method has a function to imitate the intelligence possessed by humans to do something and implement it to a device, such as robots, vehicles, and other equipment [15,16]. In general, in the fuzzy logic method there are three main processes [17]. a. Fuzzyfication Fuzzyfication is a process to change an input from a strict form (crisp) to fuzzy (linguistic variable) which is presented in the form of a fuzzy set with a function of each member [17]. In the fuzzyfication process the determination of membership functions by making a curve that shows the mapping of each input value into degrees of membership that has a value interval between 0 and 1.
Fuzzy Inference System is a system that evaluates all rules to produce conclusions. All rules or rules are defined first before building a fuzzy inference system that will be used to interpret a rule. c. Defuzzyfication Defuzzyfication is a stage of changing the amount of fuzzy that is presented in the form of a fuzzy set with the membership function to get back its strict form (crisp). This is necessary because in real applications what is needed is a firm value (crisp) * = ∫ (yi)y dy ∫ ( ) Where y* is the defuzzification output. y is the value of crisp and uf (yi) is a function of the degree of membership of y. The integration function can be replaced by the sum function if y is discrete. Thus becomes * = ∑ ( )

General Description Of The System
In the design of this automatic drainage system consisting of several tools such as aquariums, Arduino uno, water pumps, relays, ultrasonic sensors, pH sensors, temperature sensors, nodeMCU.The general description of the system is depicted in Figure 3. In Figure 3. It is explained that the temperature sensor and ph sensor detect the temperature and ph value, where the value will be processed using the fuzzy logic method. When the results of the fuzzy calculation match the parameters, water pump 1 will stop and will detect the temperature and ph value again periodically. However, when the fuzzy calculation does not match the parameters, water pump 1 will turn on and drain the water. Aquarium water will be drained according to the water level that has been set. If the water level is appropriate, water pump 1 will stop draining and water pump 2 will fill water into the aquarium. And when the water level is appropriate, water pump 2 will stop filling water.

System Architecture
The following is an overview of the system architecture that has been built : In Figure 4. It can be seen that the temperature and pH sensor reads the temperature and pH values of water. The value read by the sensor is processed by arduino using fuzzy logic. NodeMCU sends sensor reading data and sends data to firebase. The monitoring application retrieves data from firebase. Relays and water pumps receive data from fuzzy logic to take action or not drain water.

Implementation Fuzzy Logic
The implementation of fuzzy logic in the system uses two input parameters namely water temperature and water pH with the output in the form of an action on or stopping the water pump.

Fuzzyfication
Fuzzification is the process of mapping inputs into fuzzy sets by determining their membership functions. The membership function for temperature parameters is divided into three such as cold, normal and hot. Temperature data used as parameters is the ideal value of water temperature for aquatic habitat life, which is between 24ºC to 28ºC.

Figure 6. Water temperature membership function
The membership function for the pH parameter of water is divided into three such as acidic, neutral and alkali. Temperature data used as parameters is the ideal value of water pH for aquatic habitat life, which is between 7 to 8.5.

Inference
Inference is a system that can evaluate all rules to produce a conclusion or decision. In the inference process occurs the processing of input data from fuzzyfication into fuzzy output in the form of rules. Then this rule will be the parameter of the automatic drain system that is built. The conditions of the rules are attached in Table 1 and Table  2. IF pH (alkali) AND temperature (cold) THEN drained 8.
IF pH (alkali) AND temperature (hot) THEN drained

Defuzzyfication
Defuzzification is the process of converting fuzzy output to crisp value based on a predetermined membership function. Defuzzification to determine whether the water pump is active or inactive (active = drained, non active = not drained). The membership function is as illustrated in figure 3.3.3

Evaluation Of Results
Testing is done to determine the level of success of the system being built. The test is repeated by changing the values of the test parameters which include the pH value and water temperature. Testing is divided into three scenarios such as sensor testing, fuzzy logic testing and monitoring system testing.

a. Tools/Sensor Testing Results
The test aims to determine whether the results of the detection of temperature sensors and pH sensors are accurate and appropriate. The test is done by comparing the results of the same water temperature measurement between the temperature sensor with the results of a manual temperature thermometer measurement, while the results of the pH sensor measurement are compared with the measurement of the pH value of water using litmus paper. The results of testing the tools can be seen in table 3. From Table 3, it can be seen and concluded that the sensors installed in the system are functioning properly.
Because of the results of the comparison between temperature and pH readings with the sensor does not differ greatly with temperature and pH readings with a manual temperature thermometer and litmus paper.
b. Fuzzy Logic Testing Results At this stage, testing of fuzzy logic has been applied to the system. Testing is done by comparing the results of the system with the fuzzy rules listed in Table 1, Table 2 and with manual calculations using formulas. Tests carried out 5 times by changing the water temperature and water pH intentionally or manually, such as by entering ice to get cold temperatures, hot water to get hot temperatures, vinegar to get acidic conditions, soapy water to get alkaline conditions, and by doing manual calculations by using a formula. The results of this manual calculation are then compared with the results of the system that has been made. The fuzzy logic test results can be seen in Table 4.  Then from the previous table, it will be changed as below  This test is conducted to determine whether the monitoring system that has been built in a mobile device is functioning properly. The results of the reading of the tool as in Figure 3 In Figure 9. The system is running well. The system can display the pH value and the temperature of the water read by the sensor.
Readers can use the programs used in this paper on the following webpage https://github.com/hilalnuha/FL_for_drainsystem.

CONCLUSION
Based on the results of research conducted, several conclusions can be drawn including, Fuzzy logic can be applied in a system to measure water quality by comparing the pH value of water and water temperature with the fuzzy rule from the results of fuzzy logic that refers to the ideal parameters of water pH and water temperature that is good for the survival of aquatic habitats and automatic drainage can be done when the water pH and water temperature do not match the specified parameters.