Application of the Internet of Things Technology (Iot) in Designing an Automatic Water Quality Monitoring System for Aquaculture Ponds

The current paper aims to apply the Internet of Things technology (IoT) in designing an automatic system for measuring and monitoring important parameters of aquaculture ponds such as temperature, pH, and dissolved oxygen (DO). The system includes the Arduino Nano main microcontroller (the device that transmits and pushes data to the Raspberry Pi 3 Web server), the DS18B20 temperature sensor module, the pH sensor module V1.1, and the DO Sensor SKU SEN0237. The system is capable of continuously measuring the above parameters of aquaculture ponds. The measurement results are stored and transmitted wirelessly to smart devices such as computers and mobile phones. Farmers can continuously monitor water quality parameters of aquaculture ponds (pH, DO, temperature) through these smart devices. In addition, a warning message will be sent to the farmer's phone when the DO index of the aquaculture pond falls below the prescribed level. The results of the test evaluation also show the high accuracy of the system when compared with the sample measuring device. All relative errors are satisfied less than the limit value of 5%.


Introduction
Vietnam is a country with a dense system of rivers and long seaways, which is very convenient for developing fishing and aquaculture activities. According to data from the Vietnam Association of Seafood Exporters and Producers (2020), Vietnam's seafood production has maintained continuous growth over the past 17 years with an average increase of 9.07% per year. With the Vietnamese government's policy of promoting the development of the aquaculture, aquaculture activities have made strong development steps, the output from aquaculture activities has continuously increased over the years with an average of 12.77% increase per year, making a significant contribution to the growth of the country's total fishery output. According to a report by the General Department of Fisheries (2020), the value of fishery production in 2018 reached about VND 228,139.8 billion, an increase of 7.7% as compared to 2017. The total output reached about 7.74 million tons, an increase of 7.2%, of which fishing output reached 3.59 million tons, up 6.0%, aquaculture reached 4.15 million tons, up 8.3%, respectively.
Water quality in aquaculture ponds plays a crucial role in the growth and development of aquatic animals. Indicators that directly influence water quality in aquaculture ponds are DO concentration, temperature, pH, NH3, Nitrite, H2S, alkalinity, salinity, mineral concentration, nitrate concentration, phosphorus concentration, bacterial density, and algae density, etc. All of these indicators must be within the threshold limits. As long as one of the above indicators exceeds the threshold limits, aquatic animals will be affected. For example, low DO in the water will lead to difficulty in breathing for aquatic organisms which may threaten their lives. Therefore, it is imperative to control all water quality indicators and have timely treatments to ensure they are within the threshold limits.
Among the above water quality indicators, there are some fast-changing indicators (continuously changing during the day) such as DO, pond temperature, and pH. These indicators need to be tracked and monitored all the time of the day. The remaining indicators, due to the low speed of change, can be monitored by test kits (KIT) or hand-held meters to reduce the investment cost for the monitoring system. Table  1 presents the limit of DO thresholds for some aquatic animals.
Recently, in Vietnam, the indicators of water quality of aquaculture ponds are mainly measured by hand-held meters as shown in Figure 1. These methods are not very effective since they must use manpower and can only be conducted manually a few times a day.
Therefore, the water quality parameters of the pond are not monitored continuously and may have brought inaccurate information.  Currently, the strong development of science and technology, especially the Internet of Things (IoT) and computer science, has led to the introduction of wireless measuring devices and sensor networks (Wireless sensor networks). IoT is a highly promising technology that is offering many innovative solutions to modernize the agriculture sector. Throughout the world, IoT and wireless technologies have been studied and applied in many different fields of agriculture such as farms and growers, fisheries, animal husbandry, and agribusiness supply chains. Existing research in this field has usually focused on measurement and monitoring of production environment parameters (Akhmetov & Aitimov, 2015;Ran, 2014), precision agriculture (Lin, 2015), improving product quality (Athanasios & Charalampos, 2010), and building a data management system forensuring food safety (Liu, 2015).
In Vietnam, the application of IoT technology in agricultural production has been initially researched and sporadically conducted. Binh & Tri (2016) presented the simulation of measuring environment temperature in ponds using Matlab programming language. In their work, they build a virtual pond combining DS18B20 temperature sensor with Arduino microcontroller circuit and MATLAB software, and then create a tool to collect, store, and retrieve temperature data in a 3D environment of the virtual pond. In the study by Duy et al. (2015), the authors have initially applied sensors and controllers to monitor the parameters of the pond environment; however, the results are limited in monitoring some parameters such as temperature, pH, and light intensity. The very important DO concentration was missing in their work. Moreover, the results have not been recorded and there have been no timely warnings to farmers when pond water quality indicators fall below threshold limits.
The above limitations motivated us to conduct our study. The aim of our work was to apply Internet of Things in measuring important indicators of the pond environment automatically and continuously. More specifically, in our system, DO, pH, and pond temperature are stored and transmitted wirelessly to smart devices (smartphones) or computers. Moreover, the system is also able to send warning messages to farmers immediately when the water quality indicators of the ponds are below the threshold limits.

Materials and Methods
Overall structure of the system The ovarall structure of the automatic measurement and monitoring system of the parameters in aquaculture ponds is illustrated in Figure 2.
The indicators of the aquaculture ponds such as temperature, pH, and DO are measured by sensors and then converted into voltage signals that are sent to the Arduino Nano central microcontroller. The microcontroller processes signals according to the installation algorithm, the data is then transferred to the Raspberry Pi3 block where the data is processed and pushed to the Web server. Users can use computers or smartphones with a network connection to track and monitor the parameters of aquaculture ponds, such as temperature, pH, and DO concentration, through the ThingSpeak interface. Besides, when the DO level in the pond falls below the threshold limit, the system will send a warning message to the farmer's phone via a SIM 900 A module and turn on the aerator to timely supply additional DO to the pond.

Sensors used to measure parameters in aquaculture ponds
DS18B20 temperature sensor To measure water temperature in aquaculture ponds, we used the DS18B20 sensor as shown in Figure 3. This is a MAXIM high resolution (12bit) temperature sensor, capable of Water resistant, with stainless compact design. The construction consists of a transducer immersed in water and an output consisting of 3 pins directly connected to the central control board.

Specifications
Power input: 3.0 to 5.5V Usable temperature range: -55 to 125°C (-67 to +257°F) Accuracy: ±0.5°C accuracy from -10 to +85°C Selectable resolution: 9-12 bits Query time: less than 750ms Diameter of the tube: 6mm Communication: 1-Wire interface-requires only one digital pin Output: 3 wires -Red connects to 3-5V, Black connects to ground, and Yellow is for data pH sensor To measure the pH level of the water in the ponds, we used the pH sensor module V1.1 of Gizmo Mechatronix central as presented in Figure 4. The main construction of the sensor consists of a pH probe and a signal conditioning board which gives an output that is proportional to the pH value and can be interfaced directly with any Micro-controller.

Dissolved Oxygen (DO) sensor
The DO indicator in water plays a vital role in the development of aquatic animals. To measure this indicator, we used DO sensor module SKU SEN0237 developed by DFRobot as shown in Figure 5.
There are two main components of this sensor. The first one is a galvanic probe, no need for polarization time, and stays available at any time. The filling solution and membrane cap are replaceable, meaning low maintenance costs. The DO measuring range is 0-20 mg L -1 , the response time is 90s, the working pressure range is 0-50Psi, and the connecting cable length is 2m. The second one is a 42x32mm signal converter board which is plug and play and has good compatibility. It can be easily integrated into any control or detecting system, the operating voltage is 3.3-5V, an the output signal is 0-3V.

Central control board
The central control board receives data from the sensors, implements control algorithms, and communicates with modules such as Raspberry and sim module. In our work, we use the Arduino Nano board. It is a small, complete, and breadboard-friendly board based on the microcontroller ATmega328P (Arduino Nano 3.x). It offers similar connectivity and specifications to the Arduino Uno Rev3 and works with a Mini-B USB cable instead of a

Raspberry Pi 3 Model B+ module
The data of temperature, pH, and DO were processed according to the programming algorithm at the central control board and then sent to the Raspberry Pi 3 B + module. Here the data continued to be processed and sent to the cloud where it was stored in either a private or a public channel, from which they would be stored and observed via computers and smartphones using the ThingSpeak platform. Figure  6, is the latest product in the Raspberry Pi 3 range, boasting a 64-bit quad-core processor running at 1.4GHz, dual-band 2.4GHz and 5GHz wireless LAN, Bluetooth 4.2/BLE, faster Ethernet, and PoE capability via a separate PoE HAT.

SIM 900 A module
The process of sending a warning message to the farmer when the DO level in the pond fell below the threshold limits was carried out via SIM 900A module. It has basic features like a cell phone including calling, sending SMS, and accessing GPRS. Due to its high stability, simplicity of use, and 5VDC standard operating voltage. Figure 7 illustrates Sim 900 A module with the diagram of pins connected to the Arduino Nano central board.

Dissolved Oxygen aerator
To provide DO for a 0.45-m 3 tank, we used the Mini Pump with 5-12V MB385, the capacity of 12W, the flow of 4-5 L/Minute. This pump was controlled via an intermediate relay.

Algorithm flowchart of the automatic control system for measuring and monitoring aquaculture pond parameters
The Algorithm flowchart of the system of automatically measuring and monitoring the parameters of aquaculture ponds is presented in Figure 8. The water quality indicators of the ponds, including temperature, pH, and DO levels, were measured by the sensors, and then sent to the processor by the Arduino Nano controller chip. Here, we set the DO threshold limits at 2.0 mg L -1 , if the DO level of the pond fell below 2.0 mg L -1 , it would turn on the oxygen aerator to provide in-time with the amount of DO for the pond, and through the SIM 900A module, a warning message would be immediately sent to the farmer's phone. The temperature, pH, and DO data were stored and pushed to the Cloud via the Raspberry Pi module. Farmers could use Thingspeak software installed on phones or computers to track and monitor these indicators continuously.

Measurement results of temperature, pH, and DO concentration
To show the effectiveness of our system, we compared our measurement results and reference samples by the following standard machines:  The water temperature meter: DYS HDT-10 type made by EMIN, Korea. It measurres temperature range from -50 o C to +300 o C with ±1 o C accuracy. This temperature meter meets the EC No. E8 04 08 53916 001 quality certification.  The DO meter: DO Hanna HI9142 type made by Hanna Romania. The meter provides a full range DO readings from 0 to 19.9 mg L -1 with ±1.5% accuracy.  The pH meter: HI8314 type made by Hanna.
It provides a full range of pH measurement from 0 to 14 with ±0.01pH accuracy.
The results are presented in Tables 2, 3, and 4. To achieve these results, we operated the system and conducted measurements 5 times per hour. The system can perform the measurement of parameters, viz. temperature, pH, and DO of the ponds, continuously in a long time.

Tracking and monitoring parameters in aquaculture ponds via computer or Smartphone
By using the open-source ThingSpeak data transfer platform, we were able to track and monitor the parameters in aquaculture ponds including temperature, pH, and DO indicators through computers or Smartphones. The users need a smart device (either smartphone or computer) that is connected to the internet. Then, one can access the ThingSpeak website and use the previously registered account and password to track the parameters of aquaculture ponds. During the process, if the DO level in the pond falls below the threshold level, the system will send a warning message to the farmer and turn on the aerator to provide oxygen to the pond. Figures 9 and 10 below illustrate the process of tracking and monitoring parameters on a computer and sending warning messages to farmers. To receive the warning messages, the phone number of the user needs to be added into the coding for SIM 900 A Module. Then, the user needs to maintain monthly payments to keep the SIM 900 A active. It can be seen that the system operated according to the requirements. The temperature, pH, and DO indicators of the ponds were continuously measured, stored, and transmitted to the network. The maximum relative error of the result when compared to the sample measuring devices was 3.57%, which was still lower than the limit value of 5%. The measurement of DO was quite accurate with the maximum relative error of 2.88%.
From the discussions above, we can see that by using this sytem, the users could actively track and monitor the parameters of the aquaculture ponds such as temperature, pH, and DO concentration through smartphones or computers with internet access. All these parameters were stored in the system, and when the important index of DO in the pond fell below the specified level, there would be a warning message sent to the farmer so that a method could be applied to Sending data of temperature, pH, and dissolved oxygen to Raspberry Pi 3 and transferring data to a Web server End S Đ increase the DO level. In this case, the dissolved aerator machine would be turned on to timely provide DO to the pond. This is the main advantage of our system in comparison with the works of Duy et al. (2015) or Binh & Tri (2016).

Conclusions
In this work, we presented the design of an automatic system for measuring and monitoring water quality indicators of aquaculture ponds, including temperature, pH, and DO. The test results showed that the system achieved accuracy in measuring temperature, pH, and DO, and was reliable and easy to use. The autonomic system is an important application of IoT technology in the field of aquaculture. It not only helps to reduce the time and effort of the farmers significantly but also helps to improve aquaculture's productivity. In the near future, more research is needed to develop the system to measure more water quality parameters such as turbidity, ammonia (NH3), and hydrogen sulfide (H2S) and to employ solar energy for the operation of the system.