Automatic waste water treatment, aeration, and retrieval for a hybrid aquarium/plant system

Because of the greenhouse effect, global climate changes will adversely influence the water supply in the future. As can be seen in traditional reservoirs, the crisis will be exacerbated due to the reservoir’s sedimentation. From a global view, 70 % of freshwater resources are used for agricultural purposes. Thus, water management and infrastructure changes are needed to improve the situation if current climate conditions continue into the future. In order to save water resources, an attempt to reuse a pond’s wastewater for agricultural irrigation is proposed. Utilizing waste water treatment via nitrification (with nitrifying bacteria) and aeration processes, the plant will receive enough fertilizer extracted from fish dung. Additionally, to assure a safe environment, the temperature, dissolved oxygen, and pH (potential of hydrogen) value of the aquarium will be monitored online and shown on the interface of the server device. Various automatic functions such as an aquarium filtering system, a waste water treatment system, a plant irrigation system, a waste water aeration system, and a water retrieval system are also designed in the hybrid aquarium/plant system. Consequently, a prototype of a PC-based automatic plant/aquarium hybrid system is established.


Introduction
Rosegrant's research indicates that the effects of climate change on hydrology and water resources are tremendous [1,2]. This change will lead to decreasing precipitation rates and increasing drought events [3]. Based on FAO's report, 70 % of the freshwater resources are used for agricultural purposes [4]. Ostrom's investigation also indicates that there has been a threefold increase in the total area of irrigated agriculture during the past century [5]. Research from Perry's study [6] reveals that 20 % of the total cropland (irrigated agriculture) produced more than 40 % of the world's total agricultural output. Therefore, water is closely related to the crop's production. Thus, water management and recycling are needed to improve the situation if the current climate conditions continue into the future [7].
For aquaculture farmers, the over-load pumping of underground water on an island results in sinkholes which may destroy the aquaculture farm [8]. Temperatures also tremendously affect aquarium animals [9,10,11,12]. To overcome this drawback, Chiu [13] proposed an alternative method using an inner water circulation system in conjunction with an automatic water treatment process and a thermal control for a pool.
Regarding feeding and water irrigation/recycling of an aquarium and plants, a hybrid system having a filter, waste water treatment, waste water aeration, water irrigation, and a water retrieving function is presented. Because a plant cannot absorb the components of NH4+ and NH 3 from fish dung, the waste water pumped from the aquarium will be treated in the waste water treatment tank via nitrifying bacteria. Here, the nitrifying bacteria will convert NH 4 + and NH 3 into NO 3 −. With this, the plant will receive fertilizer from the hybrid system. An advanced waste water treatment using an aeration process is also adopted. Furthermore, to assure a safe aquarium environment, several environmental factors such as temperature, dissolved oxygen, and pH values will be monitored online.
Consequently, to facilitate an operational process, a PC-based interface connected to the PLC is established.
2 Automatic waste water treatment, aeration, and retrieval system for a hybrid aquarium/plant system The structure of an automatic waste water treatment, aeration, and retrieval monitoring/controlling system for a hybrid aquarium/plant system is depicted in Fig. 1. As indicated in Fig. 1, three kinds of sensors (a pH detecting sensor, a dissolved oxygen detecting sensor, and a temperature detecting sensor) used in the aquarium is adopted and fed back to the server device. To automatically manipulate a waste water treatment and a water recycling process, five sub-functions (an aquarium filter, waste water treatment, waste water aeration, plant irrigation, and water retrieval) connected to the PLC are designed into the system. In order to improve the pH value of aquarium water, a waste water treatment system is designed. Here, waste water treatment will be initiated when the solenoid valve#1 is actuated. The water of the aquarium will be conveyed to the waste water tank via the solenoid valve#1. A water level gauge installed in the tank will be actuated and send back a signal to the PLC to close solenoid valve#1 when the water reaches the top of the water's level gauge. Because plants cannot directly absorb the NH 4 + and NH 3 from fish dung, the process of nitrification from NH 4 + and NH 3 into NO 3 − via nitrifying bacteria within the tank is required. Furthermore, because aeration can help prevent low dissolved oxygen levels from negatively impacting pond fish populations [14], an aeration motor used for the waste water aeration process is designed. In addition, the nitrified water can be conveyed to the plants for irrigation via solenoid valve#2. Subsequently, the water filtered through the soil will be conducted into the recycling tank. The filtered water can also be conveyed to the aquarium via the water pump. The related input/output diagram of the PLC connection is shown in Fig. 2. In order to remotely manipulate waste water treatment, aeration, and the retrieval monitoring/controlling system via the server PC, the auxiliary relays defined in Table 1 have been added into the PLC's ladder program shown in Fig. 3. As indicated in Fig. 3, the auxiliary relays are marked in red in place of the button functions. The server pc can then submit the command to actuate the related function for the waste water treatment, aeration, and retrieval monitoring/controlling system. Moreover, the interface of the server PC programmed by the VB(Visual Basic) is also illustrated in Fig. 4. (a) Abstracted ladder diagram #1 using auxiliary relay marked in red.
(b) Abstracted ladder diagram #2 using an auxiliary relay marked in red.

System established and communication formated automatic
As indicated in Fig. 1 and Table 1, a level gauge installed inside a waste water treatment tank and connected to a PLC is used to detect the status of the water level. The PLC is used as a controller to actuate the actuators (two water pumps, two solenoid valves, and an aerating motor) of the automatic waste water treatment, aeration, and retrieval monitoring/controlling system. Also, three kinds of aquarium sensors used to detect the pH value, the dissolved oxygen, and the temperature of the aquarium that are installed and connected to the server PC will feedback the pH value, the dissolved oxygen value, and the thermal data to the server PC. The related wiring diagram of the system is shown in Fig. 5. An interface at the server PC is programmed by the VB and is used to implement the system by sending a command to the PLC controller. The abstract of the related interface program built into the server PC is depicted in Fig. 6. To facilitate communication between the PLC and the PC via a RS232/RS422, the picket format for the MISTISUE FX2n-PLC's primary port communication is shown in Table 2. Also, the definition of the picket format is shown in Table 3. The MISTISUE FX2n-PLC's extended port communication is shown in Table 4. In addition, the communication parameter used in the extended port is illustrated in Table 5. Consequently, the command description of the MISTISUE FX2n-PLC's extended port communication protocol type 1 is indicated in Table 6.

The program design for serial communication between the server PC and the client PC
The TCP/IP communication between the server pc and the client PC is performed using the WINSOCK object [15,16,17,18,19]. The host (server PC) can also be connected simultaneously by the client's PCs. The interface of the client PC is depicted in Fig. 7. The related communication diagram is shown in Fig. 8. The communication process for the server port and the client port is described below.

The communication process (server port)
Four steps performed in the communication process are (1) Listen: Because the server port will establish a connection platform for the client port, a condition of "Listen" for the server PC is required. The server port waits for the connection from the client port when "Listen" is ready. (2) Accept: The server port will receive an event ConnectionRequest from the client port when the client port submits a "Connect" for an internet connection. The server port also accepts the connection request from client port using "Accept" via another WINSOCK. (3) GetData: The server port receives an event "DataArrival" from the client port when the client port sends data back to the server port. The server port will also receive data by using "GetData." (4) SendData: The server port sends data to the client port by using "SendData."

The communication process (client port)
Four steps performed in the communication process are (1) Connect: A connection request will be submitted from the WINSOCK of the client port by using "Connect." The WINSOCK will assign the server port's "Port Number" (at "Listen") to be the value of its "Remote Port." (2) SendData: The client port will send a data set to the server port using "SendData" when the internet connection between the server port and the client port is established. (3) GetData: An event "DataArrival" will be generated from the client port when the server port sends a data set to the client port. The client port can receive the data using "GetData." (4) Close: The end connection using "Close" is required when the communication is finished.

Results
As indicated in Fig. 1, a prototype of an automatic waste water treatment, aeration, and retrieval monitoring/controlling system is established and shown in Fig. 9. A PLC serves as a controller to control various actuators (two water pumps, two solenoid valves, and one aerating motor). Water pump#1 is used to filter the aquarium water. To avoid the overflow of the waste water tank, a water level gauge installed inside the waste water tank will detect the water level when the aquarium water is conveyed to the tank via the opened solenoid valve #1. In addition, in order to nitrify the waste water for further plant irrigation, nitrifying bacteria will be added inside the waste water tank. Also, to purify the waste water, an aeration process using an aerating motor inside the tank is adopted. To monitor the status of the aquarium online, three kinds of sensors (a pH value detector, a dissolved oxygen detector, and a thermal detector) connected to the server device are used. The nitrified water will be conveyed to the plant by opening solenoid valve #2. After the irrigation process, the water filtered by the soil will be conducted to the water recycling tank and repumped up to the aquarium via water pump #2. To realize the current status of the system, a remote distributing, monitoring, and controlling network in conjunction with an IP CAM via the TCP/IP network is built and shown in Fig. 7. To assure the operation of the automatic waste water treatment, aeration, and retrieval monitoring/controlling system, a visual monitoring system using the IP CAM is adopted. Fig. 9. A prototype of the automatic waste water treatment, aeration, and retrieval monitoring/controlling system.

Discussions
The main issues concerning a PC-based automatic waste water treatment, aeration, and retrieval monitoring/controlling system follow: (1) Aquarium filtering, waste water treatment, waste water aeration, plant irrigation, and water retrieval.
(2) Automation for processing the aquarium water to be used for plants and to be reused in the aquarium.
(3) Online monitoring of the status of the aquarium's pH value, the dissolved oxygen, and the temperature. (4) Establishing the client-server control system between the server port and the client port.
(5) Saving manpower on site by using an interface between the server port and the system. (6) Establishing system's hardware and setting up a communication format between the PLC and the server PC. (7) Assuring the operation of the automatic waste water treatment, aeration, and retrieval monitoring/controlling system using the visual monitoring system of IP CAM.

Conclusions
It has been shown that to reduce manpower and to nitrify/aerate and retrieve aquarium water, a PC-based automatic waste water treatment, aeration, and retrieval monitoring/controlling system is necessary. This network is utilized using an inquiry between the server PC and the client PC via the TCP/IP network. To monitor the quality of aquarium water online, three kinds of sensors (a pH detector, a dissolved oxygen detector, and a thermal detector) are adopted and connected to the server device. Moreover, to realize the current status of the system, a remote distributing, monitoring, and controlling network