IoT based system for monitoring dissolved oxygen and temperature in fish larviculture

: Aquaculture is carried out in controlled environments to guarantee the health, growth, and survival of aquatic species, so it is essential to monitor water quality parameters. We designed and implemented a system based on the Internet of Things for monitoring dissolved oxygen and temperature in Amazonian fish larviculture. We based the design of the architecture on four layers: data acquisition, communication, cloud server and application. We carried out the experimental tests with the data collected by the system during seven days of culture of larvae of the species Piaractus brachypomus (paco) in the aquaculture center “La Cachuela”. The values obtained for dissolved oxygen varied between 7.43 ± 0.04 and 7.83 ± 0.02 mg L -1 ; regarding the water temperature, it fluctuated between 19.59 ± 0.45 and 25.45 ± 0.11 °C. We concluded that the system developed for monitoring dissolved oxygen and water temperature displays data obtained in real time, in both cases the values are within the tolerable ranges for the cultivation of this species.


Introduction
The demographic explosion and food scarcity are the main challenges to global sustainable development (Said Mohamed et al., 2021), this forces the prioritization of strategies that address food security (Tripathi et al., 2019). Aquaculture is an innovative alternative to guarantee food availability through the supply of animal protein for human consumption (FAO, 2020).
Aquaculture activity increased in recent years in Peru, production was 161,279 tons in 2019, representing an increase of 12% compared to 2018 and 44% compared to 2015. The department of Madre de Dios had a production of 329 tons in 2019, Piaractus brachypomus (paco) is the main native fish species with 318 tons produced, representing 97% of the regional total, P. brachypomus production was 37% higher than in 2018 (Produce, 2021).
Aquaculture is developed in controlled environments where several factors must be taken into account to ensure optimal production performance, among them, water quality control, so its monitoring becomes increasingly important (Li & Liu, 2019). In aquaculture culture systems, water quality has a great impact on the health, growth, and survival of aquatic species, and also affects the yield of the harvest, which is why it is vital to continuously monitor its main parameters such as dissolved oxygen, temperature, and pH (Abdullah et al., 2021).
Dissolved oxygen (DO) is the most critical index, the optimum concentration is essential for the growth and evolution of organisms in water (Zhou et al., 2022). When the DO level drops, which occurs in the evening hours, fish may show delayed growth and even mortality (Moyo & Rapatsa, 2021). While high DO contents predispose fish to gas bubble disease that would cause high mortality in a short time (Liu et al., 2019;Huan et al., 2020a).
Another important parameter to consider is temperature, as its variation can alter the physiological processes of fish that are related to feeding, health, and growth (Shapawi et al., 2019), tropical species mostly live in environmental temperatures close to their tolerable upper limit, so, exceeding this threshold would be at risk their survival (Ehrlén & Morris, 2015).
The traditional method of water quality monitoring involves manual sample collection and laboratory testing, which is a time-consuming and inefficient process. Current techniques cover physical, chemical, and biological analysis; however, they have several disadvantages such as limited coverage, intensive use of labor, and high cost of equipment, in addition, it is not possible to obtain continuous and real time information (Vijayakumar & Ramya, 2015).
Currently, smart systems including Internet of Things (IoT) are applied in the implementation of technological solutions in various sectors, such as aquaculture, in order to improve production through remote and accurate monitoring of pond water quality (Huan et al., 2020b;Idoje et al., 2021). Several systems have been designed for continuous monitoring of critical parameters in fish farming; thus Defe & Antonio (2019) designed a prototype to monitor water quality parameters in real time for grouper production, data storage was in local mode. Meanwhile, Bokingkito & Llantos (2017) designed and implemented a Raspberry Pi-based continuous water temperature monitoring system, which makes it possible for users to access the collected data in real time via a mobile application. Also, Jamroen et al. (2023) designed and implemented a photovoltaic-powered remote monitoring system for water quality parameters, used 3G NB-IoT wireless technology to send the data to the cloud server and its deployment using an application developed with Grafana.
According to the referred problems, in the research we designed and implemented an IoT-based system to monitor dissolved oxygen and temperature in Amazonian fish larviculture in the breeding laboratory of the aquaculture center "La Cachuela" located in the department of Madre de Dios, Peru.

Study area
The study was carried out at the "La Cachuela" aquaculture center located on the left bank of the Madre de Dios River (latitude -12.557270°, longitude -69.182914 and altitude 182 m) in the town of La Cachuela, district and province of Tambopata, department of Madre de Dios, Peru. Figure 1 shows the geographic location and extent of the land.
The total area is 2.5 hectares, where they develop the reproduction and mass production of native fish, mainly P. Figure 1. Location of the aquaculture center "La Cachuela".

3/8
brachypomus, an Amazonian species in high demand in the regional market according to a report from the Ministry of Production (Produce, 2021). The center has 17 earthen ponds for the fry raising, broodstock preparation and fattening stages, as well as an artificial reproduction laboratory where the larviculture stage is also carried out.

System design and implementation
We designed the architecture of the IoT-based dissolved oxygen (DO) and temperature monitoring system in four layers: data acquisition, communication, cloud server, and mobile application to visualize the information of each parameter in real time, as we show in Figure 2.

Temperature sensor
To measure water temperature we use the DS18B20 sensor, with a measuring range of -55 to 125 °C, accuracy of ± 0.5 °C, programmable resolution of 9 to 12 bits, response time of less than 750 ms and requires a 3 to 5 V power supply. This device uses the 1-wire communication protocol, so we only need one line for data exchange. The sensor is protected by a stainless steel probe to enable it to be submersible in water. For reading temperature data on the Arduino Uno board we use two libraries: OneWire to implement the data communication protocol over a single bus and DallasTemperature which contains the functions to configure and perform the temperature reading in degrees Celsius.

Data acquisition card
We use as data acquisition board an Arduino Uno Rev3 board to process the signals sent by the two sensors; we use the libraries provided by the manufacturer for conversion to units of dissolved oxygen (mg L -1 ) and temperature (°C). The Arduino board uses the ATmega328 microcontroller working at 16 MHz, has 14 digital input/output pins (6 of them provide PWM output), 6 analog input pins, 5 V power connector and a cross-platform development environment for programming (Kondaveeti et al., 2021). We collected data every minute, averaged and transferred the records to the ESP8266 NodeMCU (version 2) using the UART (universal asynchronous transceiver) communication protocol.

Communication
In the communication layer we use the Espressif Systems NodeMCU ESP8266 model (version 2) mainly for its communication features, wireless wifi compatible with the IEEE 802.11 b/g/n standard in the 2.4 GHz band for internet connectivity and serial for programming and communication with the computer through the USB-Serial TTL CP2102 converter. This device, has input and output pins (GPIO) for interconnection to other peripherals (Mesquita et al., 2018). The transmission of DO and temperature records is carried out as described in the flow diagram in Figure 4.

Data acquisition
In this layer we collect information through the DO and temperature sensors installed in the central part of one of the troughs. The DO and temperature sensors send analog signals to the data acquisition card, which are then transformed through libraries into mg L -1 and °C units, respectively.

Dissolved oxygen (DO) sensor
We measured dissolved oxygen in water using a DFRobot model Dissolved Oxygen Meter measurement kit consisting of a galvanic probe that does not require polarization time and a signal conditioning card, as shown in Figure 3. It has a measurement range of 0 to 20 mg L -1 , full response time (at 98%) of 90 seconds and operates in a pressure range of 0 to 50 PSI.

Cloud server
We used the NoSQL database in Google Firebase Realtime Database for storing the information in the cloud, transmitted the data in JSON format, and automatic real-time updates were received by the clients (Moroney, 2017). We selected this technology because of its simplicity for mobile application development and lower response time when executing CRUD (Create, Read, Update, Delete, Update, Delete) operations compared to other storage alternatives such as MySQL (Ohyver et al., 2019).

Mobile application
We developed an application for smartphones with Android operating system (version 8 or higher) in order to receive the information recorded in Firebase Realtime Database through a friendly interface. We use the Kotlin programming language applying the Model-View-ViewModel (MVVM) architectural pattern that offers better performance and throughput over other patterns (Arcos- Medina et al., 2018).
The developed mobile application has a user interface to visualize in real time and ubiquitously the levels of dissolved oxygen (mg L -1 ) and temperature (°C) collected by the sensors, as shown in Figure 5. Among other options, the application allows the user to add a new sensor node by means of its unique identification code, view the last data stored, access the geographical location of the monitoring system and graph historical data.
The graphical interface of historical data shown in Figure 6 facilitates the visualization of the trend of the trough water temperature and DO variables updated every minute.
In addition, a scatter plot of the data recorded every minute makes it possible to visualize in greater detail the variability of the trough water temperature and DO parameters, as shown in Figure 7.  A.

B.
A. B.

Results and Discussion
We collected data for seven days in the artificial propagation laboratory, from March 31 to April 6, 2022, during the larviculture phase of the species P. brachypomus. To improve data collection, we installed the dissolved oxygen and temperature sensors in the central part of trough No. 3, whose dimensions are 2.5 m long, 0.9 m wide, and 0.35 m deep, as shown in Figure 8. The sampling frequency was 5/8 at one-minute intervals between each measurement, which were transmitted to the Firebase database in the cloud. Table 1 shows the average and dispersion of DO and temperature levels collected by the IoT-based monitoring system during the seven days of larviculture.
in the trough during the seven days of monitoring, the data present an incremental trend ranging from 19.59 ± 0.45 °C on March 31 to 25.45 ± 0.11 °C on April 6, 2022.
The incremental trend is explained by the increase in ambient temperature reported by the National Service of Meteorology and Hydrology of Peru (Servicio Nacional de Meteorología e Hidrología del Perú -SENAMHI) for the Tambopata province. Between March 31 and April 6, 2022, the average ambient temperature recorded was 24.75 ± 2.5 °C, with an increase of 5.25 °C during the same period. Figure 10A shows the heat map of trough water DO data collected from March 31 to April 6, 2022; red color represents the maximum recorded DO level (7.8 mg L -1 ) and blue color indicates the minimum recorded level (7.4 mg L -1 ). The graph shows the 24 hours incremental trend over the seven days monitoring period, ranging from 7.43 ± 0.04 mg L -1 at 00:00 hours to 7.83 ± 0.02 mg L -1 at 23:00 hours. Figure 10B shows the box plot of the variability of water DO data in the trough over the seven days of monitoring, we observe an incremental trend ranging from 7.63 ± 0.45 mg L -1 on March 31 to 7.70 ± 0.14 mg L -1 on April 6, 2022.

Dissolved oxygen variation
The graphs show a minimum increase of 0.07 for the DO parameter during the seven days of monitoring. This small variability is due to the fact that during the entire larval stage a Blower pump injected compressed air into the water A.
B.   Figure 9A shows the behavior of the water temperature in the trough during the 24 hours of the day over the course of the seven days of monitoring. The graph shows an increasing trend from 22.59 ± 2.15 °C at 00:00 hours to 23.48 ± 1.82 °C at 23:00 hours. Figure 9B presents the behavior of water temperature  Dissolved oxygen levels and water temperature in the trough vary throughout the day due to the incidence of sunlight on water quality parameters, mainly dissolved oxygen levels. During the day, phytoplankton photosynthesis is favored by sunlight, producing abundant oxygen that will dissolve in the water; while at night, in the absence of oxygen production, its level will be rapidly reduced by fish respiration (Danh Luong et al., 2020).

Temperature variation
Ríos Isern (2021) argues that the species P. brachypomus is a very resistant species to the conditions of the crop, its tolerance range to temperature varies from 22.6 to 34.3 °C and with respect to oxygen, from 2.0 to 8.5 mg L -1 . During the experimental trials, we recorded on average an DO concentration of 7.67 ± 0.14 mg L -1 and a water temperature of 23.05 ± 1.93 °C in the trough; i.e., both parameters were maintained within acceptable ranges.
Our findings support the idea that the implementation of technologies in the monitoring and control of parameters such as temperature and dissolved oxygen in fish larval troughs of the species P. brachypomus leads to better performance compared to the manual methods currently used. These manual practices require the availability of laboratories and specialized personnel, which implies a significant demand.
In support of our results, several studies have reported on the effectiveness of the technologies implemented in this area. For example, Alselek et al. (2022) presented an IoT-based water monitoring system for aquaponics, health, and fisheries, demonstrating the benefits of this technology in optimizing aquaculture systems. In addition, the study by Medina et al. (2022) proposed an open source and low-cost design for remote monitoring of water quality in fish farming, which further reinforces the feasibility of technological solutions in this area. Likewise, Veeralakshmi et al. (2022) proposed an integrated IoT-based system for automatic monitoring and control of fish farming, offering additional insight into the advantages of technological implementation in this field.
Finally, we can affirm that these studies support and strengthen our conclusions by providing additional evidence of the benefits of monitoring and control technologies in the larviculture of P. brachypomus fish. Our work contributes to the growing literature in this field by providing results consistent with previous research and highlighting the relevance and applicability of these technological solutions in the optimization of aquaculture production.

Conclusions
We implemented a system based on an IoT architecture for monitoring dissolved oxygen and water temperature in the larval culture of Piaractus brachypomus (paco) developed in the aquaculture center "La Cachuela". We collected the data of the water contained in the trough through sensors, which we then transmitted with wifi technology for cloud storage and the mobile application through a user interface allowed us to visualize the data collected in real time and also historical information. The DO and temperature values collected did not exceed the tolerable ranges for the rearing of this species.