Prediction of Water Quality Temperature in the Growth Pattern of Fish (Nile Tilapia) and Plant (Lettuce) in a Prototype-Safe, Automated Aquaponics Environment Using Deep Learning ()
1. Introduction
Since the 1970s, several fish farmers have experimented with the use of aquatic and terrestrial plants to see if their inherent ability to absorb nutrient-rich compounds from the water (which is essential for their growth) was also capable of effectively cleansing it. As a result, it was no longer necessary to periodically remove a portion of the tank’s water to control the continuously rising concentration of dissolved waste materials, which tend to become poisonous for animals above a certain threshold. Individual entrepreneurs and sustainability enthusiasts started various experiments in private aquatic farming systems to uncover a potential solution. These trials yielded significant results that were successfully integrated into universities and public research institutions. These experiences over the past few decades have given rise to commercial aquaponics farms that can produce enormous quantities of organic vegetables and aquatic animals (particularly fish) all year round. Today, commercial aquaponics systems are implemented, for instance, in the United States, Australia, the United Arab Emirates, Singapore, Mexico, Canada, Vietnam, Great Britain, Germany, and Switzerland. The first commercial systems for producing high-value ornamental fish species (like Koi carp), edible fish, and crustaceans (like Tilapia and freshwater crayfish species), and the growth of hot peppers and saffron with intriguing commercial value have been established in Italy.
One of the world’s greatest difficulties is meeting the nutritional needs of a growing human population, which is expected to reach 10 billion by 2050. Global food production may need to expand by as much as 50% to fulfill the additional food demands imposed by the almost 30% population increase [1]. Climate change, pollution, and the destruction of arable lands, on the other hand, will pose a threat to food production [2] [3]. According to [4], current food production trends will not fulfill anticipated global food demand by 2050, despite the introduction of high-yielding crop varieties and improved food production methods. Aquaponics is a low-input, low-waste food production method that employs circular economy principles and a biomimetic natural system. A mechanism that perfectly integrates with intensive agriculture’s long-term growth [5] [6]. Recirculating aquaculture systems (RAS) and hydroponic cultivation are the two most productive systems in aquaponics. The farming of fish and crustaceans in a tank is recirculating aquaculture, while hydroponic cultivation is the production of crops in a medium other than soil. In the context of climate change, aquaponics is emerging as a crucial technology with the potential to transform agriculture and improve food security, particularly in dry places [7].
Aquaponics systems have evolved from a water-reuse breakthrough to an efficient energy and wastewater recycling system as design and functionality have improved [3]. Typically, the method promotes a way for effective use of marginal lands in metropolitan settings for food production. Even though the technology has recommendations as a means of alleviating some of Africa’s food insecurity and nutrition-related issues, adoption is still quite low across the continent.
Aquaponics systems are being implemented slowly in Ghana, and reports on aquaponics are limited. The most well-known aquaponics project in Ghana was a collaboration between a Ghanaian and a Brazilian research institute aimed at increasing smallholder food production by implementing water-saving aquaponics-based food systems that ensured all-year-round food production for improved nutrition to smallholder farmers [8]. Fully recirculating or decoupled aquaponics systems are available, although, in the case of the Ghana project, it was a decoupled system.
In addition, a new scientific subject known as “smart fish farming” aims to maximize resource efficiency and advance sustainable aquaculture growth by tightly integrating the Internet of Things (IoT), big data, cloud computing, artificial intelligence, and other contemporary information technologies. Computer science, the discipline of automatically and rationally processing information, plays an important role in modern human existence [9]. Additionally, a new fishery production mode has finally been formed thanks to real-time data collecting, quantitative decision-making, intelligent control, accurate investment, and individualized service. Information and data are the foundational components of smart fish farming. The ability to make decisions with a scientific foundation will result from the aggregation and advanced analytics of all or some of the data.
The vast amount of data generated by smart fish farming, however, presents several difficulties, including different sources, multiple formats, and complex data. Information on the tools, the fish, the environment, the breeding process, and the people is gathered from a variety of sources. Nowadays, fish farming pays more attention than ever to data and intelligence. Big data and artificial intelligence have started to translate these data into usable information for smart fish farming as of late [10]. The future of fishery data systems is artificial intelligence, particularly machine learning and computer vision applications [11]. Traditional machine learning techniques, including the support vector machine (SVM) [12], artificial neural networks (ANN) [13] decision trees [14], and principal component analysis [15], have demonstrated satisfactory results in several applications. However, typical machine learning algorithms still struggle with choosing the features that are most suited for a given task since they rely so largely on attributes that human engineers manually develop [16] [17].
Furthermore, numerous academics have used neural networks and other machine learning algorithms for forecast tasks such as water quality in recent years, with good prediction outcomes. Emerging machine learning, together with smart technologies, is filling a gap in water applications that was previously unmet by old methods and thinking. Through their generalization, robustness, and relative ease of design in ML and smart technologies are projected to model and solve complex and challenging difficulties in water applications, resulting in cost savings and process optimization [18].
Recent studies show deep learning models like recurrent neural networks and LSTM outperform traditional machine learning [19].
Deep learning is a subset of machine learning that aims to increase accuracy without human assistance in performing tasks. It is a layered structure of connected neurons inspired by biological neural networks, primarily consisting of a three-layer neural network. These networks simulate human brain behavior by learning from massive amounts of data. While single-layer neural networks can make approximations, additional hidden layers can aid in optimization and refinement for accuracy. The principle is the same as traditional models, except that the model creates n which is not a single function like
, but with a network of functions connected. The deeper the network, the better the machine can learn to perform complex tasks like object recognition, identifying people in photos, driving cars automatically, text summarizing, and language translation.
Figure 1. Architecture of an ANN [20].
A network has one input and output layer, with hidden layers based on the recognition model problem according to [21]. ANN architecture identifies weights w for desired output, allowing multiple mechanisms such as Multilayer Perceptron or the cost function [22].
Assume a
square neuron layer that is followed by a convolutional layer. “If the filter ω on
is used, the convolutional layer output will be of size
”. To calculate the pre-nonlinearity input to some unit
, the sum of the contributions from the preceding layer cells is required in the layer:
(1)
The nonlinearity of the convolutional layer is then applied:
Deep learning-based algorithms, such as “Long Short-Term Memory (LSTM),” are superior to traditional algorithms for forecasting time series data. In their research, Sima Siami-Namini et al. demonstrated that traditional-based algorithms, such as the ARIMA model, are outperformed by LSTM. More specifically, when compared to ARIMA, the average reduction in error rates obtained by LSTM was between 84 and 87 percent, indicating LSTM’s superiority [24].
The LSTM layer extracts spatial structural features from data, capturing temporal dependencies. It overcomes the vanishing and expanding gradient difficulties of classic RNNs [25]. LSTM controls information flow through gate units like forget, input, and output gates as shown in the Figure 3 [26].
Figure 2. Example of an artificial neuron computes a nonlinear function of weighted sum its inputs [23].
Figure 3. Principle diagram of LSTM.
LSTM is a recurrent neural network designed for dealing with time-varying data. RNNs are feedforward neural networks with edges that span adjacent time steps, providing a sense of time [27]. They can form cycles, including one-cycle self-connections. RNNs are trained in natural language processing machine learning approaches, such as movie criticisms, and are trained using positive and negative evaluations [28]. They process input based on their internal state using neural network loops. Equations can be used to compute at each time step on the forward pass in a simple recurrent neural network [29]:
(2)
Nodes with recurrent edges receive input data from the current data point
, as well as hidden node values,
, at time t in the preceding network state. The hidden node values
, are given in the output,
at each t of time computed. at t time. Input
of the recurrent connections at time
can influence the output,
at time t and later.
(3)
where,
is the conventional weights matrix between the input and the hidden layer, and
is the recurrent weights matrix between the hidden layer and itself at adjacent time steps. The bias parameters
and
allow each node to learn an offset.
Figure 4. A simple recurrent network [29].
LSTM is a recurrent neural network with four layers that interact to learn long-term data dependencies. It uses stochastic gradient descent optimization and has two key vectors: short-term (keeping output at the current time step) and long-term (storing, reading, and rejecting items) [30]. The learning rate, batch size, and learning rate are key parameters for efficient performance. The decision between reading, storing, and writing is based on activation functions, resulting in a value between 0 and 1 [31]. LSTM, a component of feedback neural networks, outperforms standard RNNs due to long-term reliance issues, such as exploding gradient and vanishing gradient, when information distances are vast.
The LSTM has proven effective in identifying rear-end collisions in IoV and developing stock market predictions [32]-[34]. In addition, a miniature model was developed in [35] paper, different sensors and mask R-CNN instance segmentation algorithm was used as promised approach to automatic control of the aquaponics system using an autoML algorithm to improve plant and fish growth and help monitor the system. Although the testing findings have been good, as the event’s automatic triggering has improved using machine learning prediction over the previous way, resulting in increased plant and fish development, the aspect of temperature monitoring remind an important aspect for a suitable system.
2. Materials and Method
2.1. System Design
2.1.1. Automated Aquaponics Predefined Model Tools
The fish tank has dimensions of Length 600 mm, Width 300 mm and Height 360 mm. Below is the pictorial drawing of the water Tank with water measurement
Figure 5. Aquaponic model.
New Dimensions after Water is filled into tank.
(4)
The water level of full container = 44 liters (11.623 gallons).
Water level of the semi-filled container = 40 liters (10.566 gallons).
Height of water
(5)
2.1.2. System Prototype
A miniature representation of our Aquaponics system displaying measurements of the Water Tank, Grow Bed, and Stand. It also displays all elevated sides for an accurate prototype.
2.1.3. Components Used for Building Temperature and Heating Power Chamber a Thermocouple
This sensor is made up of two different types of metal wires, one of which is a data logger for a thermocouple or an extension lead for a thermocouple, etc. It is linked to other pieces of equipment or accessories. Thermocouples can measure a wide range of temperatures if the thermocouple and system configuration are both appropriate. However, thermocouples, like all sensors, will not function
Figure 6. System prototype with varied dimensions that represents a miniature representation of our aquaponics system.
properly if the correct type and application method are not chosen for the application environment. Understanding a thermocouple’s basic structure, method of operation, and scope is critical for determining which type and material is best for the application. There are several metal pair calibration combinations available for thermocouples. The most common types of basic metal thermocouples are J, K, T, E, and N. Furthermore, the R, S, B, G(W), C(W5), and D(W3) thermocouples are precious metal and alloy thermocouples designed for high-temperature measurement. Because temperature standard is not established, U and V types are made of uncompensated copper and are not used as thermocouple temperature sensors. Because they can measure a wide temperature range and are relatively robust, thermocouples are widely used in industry. When choosing a thermocouple, the following basic criteria should be considered.
2.2. DAQ (Data Acquisition)
The process of measuring electrical or physical phenomena such as voltage, current, temperature, pressure, or sound is known as data acquisition. A DAQ system is made up of a computer that can be attached to sensors, DAQ measurement hardware, and programmable software.
With the advancement of technology, this type of process has become more accurate, universal, and reliable. These devices range from simple recorders to sophisticated computer systems, and smartphones can even be converted into portable DAQ devices.
Nickel-Chrome Wire
It is a wire made up of an alloy primarily composed of nickel, chromium, and other elements. Because of its chemical composition, it has high resistivity and oxidation resistance. Nickel-chrome 80/20 wire is used in heaters, furnaces, home appliances, and a variety of other heating applications. It is available in round wires, stripes, sheets, and round bars. Nickel-chrome is the electrical trade’s global standard for metallic resistance wire. An alloy of 60% nickel and 16% chromium is used in heating devices that operate at temperatures of up to 1000˚C.
2.3. Sample System Experiment for Temperature and Heating Power with a Beaker
To obtain data for water temperature and its corresponding heat power from the aquaponics, Nickel wire was wrapped around a beaker of 0.5 ml volume to obtain the positive and negative ends. A thermocouple (K-type) was connected to DAQ (Data Acquisition) on one side and the other was connected to a beaker filled with water. A power supply of 5 watts, 10 watts, and 15 watts power is applied intermittently and concurrently. After every 30 minutes, the power supply is cut off to measure the rising and declining rate in the water temperature. Data is stored in the DAQ, the diagram; Figure 6 is a pictorial description of how water temperature changes with varied heat power over time.
Figure 7. Temperature and heat power experiment.
2.4. Dataset Building
The dataset used in this study was obtained from sample water in our aquaponics system; water quality parameter like temperature was the focus. This included the preparation and cleaning of this data.
Three datasets were collected, each of them containing the Six predictors. Starting with the results of our experiment on temperature and heating power beaker testing, a dataset was created for model training and machine learning models were built to predict water temperature relative to time, heating power relative to time, and temperature relative to heating power, all to provide an automatic forecasting system. The machine learning model determines the effectiveness of the validation process and the model’s correctness in the suggested solution implementation.
Below are graphical representations of data collected, denoting the temperature rise and decline over time with heating power.
2.4.1. Comparison of Water Temperature versus Heating Power
Figure 8. Temperature against 5W heating power.
Figure 9. Temperature against 10W heating power.
Figure 10. Temperature against 15W heating power.
2.4.2. Configuration of the Model
In all forecasting models, the Adam optimizer was used to minimize cost functions and update weights and biases. It is well suited for deep learning tasks and consists of using the gradients’ moving averages and squared gradients. In the LSTM, the rectified linear unit (ReLU) was chosen as the activation function. Starting with the Exploratory Data Analysis (EDA) step, we examined each variable in the dataset and its relationship to the target variable using the libraries NumPy, Pandas, Matplotlib, and Seaborn. When dealing with data for a machine learning process, it is preferable to understand the dataset; thus, numerous details about the dataset were provided, including the first six columns, information about the dataset, and its description, as shown below.
Figure 11. Dataset pieces of information.
The data that constituted the dataset comes after a thorough examination made for fish and plant development, and chemical measures over a six-month period during which the aquaponics prototype was built for this research, from April 2022 to September 2022, was in operation. During the initial setup, we can measure water temperature daily and after for a while when the aquaponics system is stable.
This was followed by the features extraction stage as a Data Preprocessing stage, which transformed the dataset into the proper machine learning format, reformatting the Date Time Columns for a more accurate analysis, because the data presented has three columns: Data time, Temperature, and Power. The date and time are processed to display the Year, Month, and Time in hours, minutes, and seconds, with temperature as the target variable to be forecasted.
A simple model created to solve our prediction problem bears the following characteristics:
Layer 1 has 75 cells in the hidden layer, with a dropout rate of 20%. Layer 2 has 50 cells with a 20% dropout rate.
Only one feature as an output on the Dense layer level was used in this research.
“Adam” was used as an optimizer and “mean squared error” to calculate the loss.
With a batch size of 64, the model has a validation split of 20% on the total data produced.
Train model for 200 epochs.
The “Low” column of the dataset was used as input and trained to predict the “Open” column of the dataset.
2.5. Validation Process
Model validation is the most important aspect of developing a Machine Learning model. Building a model with good generalization performance, which is critical for model validation, requires a good data-splitting strategy.
2.5.1. Validation Scenario
For this purpose, the dataset was divided into two parts: one for training (training set) and one for testing (Test Data) the system’s performance in real life. Using the model selection function from the sklearn library, 75% of the dataset was assigned to the train set and 25% to the test set. Validating a model train set and test set, on the other hand, is insufficient. As a third section, a validation set that is derived from the train set is required. Neither model training nor model evaluation uses the test set. The primary goal of the testing set is to determine how a machine-learning model is trained and how well it generalizes. The training set, as illustrated in the figure below, generally verifies the model’s accuracy. As a result, model validation is the process of comparing a trained model to test data points in machine learning or deep learning (dataset). The testing data is simply a subset of the training data.
Figure 12. Validation process.
2.5.2. Model Evaluation
The LSTM Model’s predictive ability was assessed using four metrics: Coefficient of determination (R2), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Root-Mean-Square Error (RMSE). The following are the formulas:
(6)
(7)
(8)
(9)
3. Result and Discussion
3.1. Result
This experiment shows the result of the original values and what the model predicted after being trained four times with different batch sizes and epoch values. The selecting of an appropriate network configuration affects the models’ forecasting performance. The diagram shows the training and validation accuracy and training and validation losses obtained with LSTMs. The purpose of displaying these losses is to demonstrate that (1) the models’ training reaches convergence, that is, there is a minor decrease in training loss or it remains stable near the end of the training, and (2) the trained model is a good fit, that is, the training and validation losses are nearly identical at the end of the training, show similar decreasing trends and the validation loss does not increase after reaching a minimum value.
Understanding rising water temperature is critical for developing a machine-learning model for predicting Temperature. The diagram below shows an increase in temperature concerning a given time (30 minutes) over a constant heating power of 15 watts, 10 watts, and 5 watts supply respectively. This displays a rising
Figure 13. Accuracy curve after 200 epochs for 15 watts.
Figure 14. Accuracy curve after 200 epochs for 10 watts power.
Figure 15. Accuracy curve after 200 epochs for 5 watts power.
Figure 16. Temperature vs time with 15 watts.
graph to a peak level and drops slightly after heating power is returned to zero power supply.
The results depict the machine trained on the training dataset and the prediction made using new data deemed to be the test dataset. The machine learning model is excellent and denotes the blue line representing the machine’s prediction, and the red line representing the original data. The LSTM model predicts accurately.
Deep learning-LSTM with enabled data analysis, visualization and forecasting future water temperature is by reliably predicting the future possibilities. With
Figure 17. Temperature vs time with 10 watts.
Figure 18. Temperature vs time with 5 watts.
Figure 19. Prediction for 15 watts power supply.
Figure 20. Prediction for 10 watts power supply.
Figure 21. Prediction for 5 watts power supply.
the same testing data and conditions, the LSTM model predicted a score of 96% with 15 watts power, 98% with 10 watts power and 99% with 5 watts power after 200 epochs and a batch size of 64. R-squared metric, like accuracy, provides a quick indication of how well the model is performing, with a value closer to 1.0 indicating that the model is performing well. However, the metric does not provide a clear picture of how inaccurate the model is in terms of how far off each prediction can go. Comparing with other models, such as MAE and MSE, used, particularly MAE provided a better indication of how far off each prediction can reach. Based on the prediction results, the model produces good results but requires more training to reduce prediction error (See Table 1).
Table 1. Comparison between MAE, MAPE, RMSE and R2.
|
Indicators (Power) |
Optimizer |
15 watts |
10 watts |
5 watts |
MAE |
0.8130 |
0.3071 |
0.0841 |
MAPE |
2.5399 |
1.3554 |
0.3447 |
RMSE |
0.9079 |
0.4664 |
0.1003 |
R2 |
0.9694 |
0.9860 |
0.9970 |
3.2. Discussions
A cost-effective solution, the proposed machine learning methodology can decrease false positives and accurately trigger the event to increase production and conserve water. The suggested semantic segmentation approach accurately detects fish in water quality and can be expanded to analyze the growth of fish and plants. Nevertheless, the technology has shown encouraging results that may support precision farming more broadly in the future.
In order to show the necessity for and the feasibility of significantly increasing investment in further research, development and education in the aquaponics industry, challenges underlying sustainable socio-ecological, technological and economic variables relevant to aquaponics are examined in this study. These elements must be considered because a purely financial approach has many limitations, particularly in terms of natural resource scarcity and the long-term economic effects. There are a number of technological issues that need to be resolved before commercial aquaponics systems can be developed that are socially, ecologically, and environmentally sustainable. Improved nutrient solubilization and recovery for a better use of the nutrient input and reducing extra-mineral addition, such as phosphorus recycling; adapted pest management; high reduction in water use by reducing the need for water exchange; use of alternative energy sources for hot/cold and arid areas (such as CHP waste heat, geothermal heat, etc.); and innovative pH stabilization techniques by utilizing fluidized lime-bed reactors [36].
All of the aforementioned elements need additional consideration. Some production parameters still need to be established and optimized to get aquaponics ready for commercial use because some of the components and how they interact with one another are still being developed technically. Without putting more effort into synthesizing already-existing information from the various relevant sectors within a scientific and global framework, this cannot be sufficiently accomplished. These factors are crucial because commercially relevant technology should be controlled by specific environmental factors. Instead, universal applicability necessitates the development of resource-economic (i.e., resource-saving) production methods that can function in arid, hot, cold, urban, or any combination of these environments.
At the controlled environment level, the ML models performed well. For estimating water dynamics, our methodology is scalable, simple, and low-cost. It was discovered that the prediction accuracy of the models varied and was dependent on the scenario input variables. Water temperature and heating power prediction is extremely difficult due to their reliance on multiple factors, such as environmental factors, cold and hot seasons, and how they interact with one another. Many studies have been conducted on water quality, but our research focuses on the effects of heat exchanges on water temperature and vice versa, where we predicted water quality based on input variables such as water temperature and heating power all relative to time.
We can develop a combined learning model approach where multiple clients train on the edge device and also send the results to a server, helping in data privacy and improving communication bandwidth, to reduce hardware resources and improve communication when deployed on large aquaponics farms in real-time.
Let’s notice that the experiment was based on a specific type of fish and plant that fits in the aquaponics system. Related to the fish, the experiment shows that Catfish and Salmon adapted well in this system as well Spinach, Cabbage, Kontonmire, and Cauliflower are the plants that fit well in the system.
4. Conclusions
Aquaponics requires water temperatures ranging from 20 to 30 degrees Celsius. In this range, bacteria, plants, and fish thrive. To avoid problems and lower maintenance costs, it is critical to select a combination of fish and plants that are appropriate for a specific location and environmental conditions. When the temperature of the water is too high, the solubility of dissolved oxygen decreases, causing fish stress. When water temperature is too low, bacteria cease to function and plant growth slows. To maintain a healthy aquaponics system, we must ensure the right plant for the aquaponics system. For outdoors systems, plant and fish can be exposed to cold in colder climates or too much sun in warmer climates, choose plants and fish carefully to meet their optimal water temperature ranges to avoid water temperature issues, and select plants and fish that are good to survive in a particular habitat. However, some techniques can be used to reduce water temperature fluctuations and extend their growing season.
This study presented a machine learning approach for predicting water temperature in systems that interacted with three different types of heating power where (5, 10, 15 watts’ power were used concurrently to determine water temperature changes over time).
The successfully installed prototype aquaponics system can continuously check the water quality, fish and plant growth. The prototype can significantly reduce labor and operating costs when used on a wide scale, increase productivity, and increase profitability, all of which help create more livable and sustainable communities.
Acknowledgments
The authors acknowledge the Mechanical and Control Engineering Lab, Handong Global University Green Science CO., the University of Science and Technology (USCITECH), Optimall Research Lab, the Department of Business IT and English of the University of Kinshasa, and the University of Kikwit for their support of this research work.
Conflicts of Interest
The authors declare no conflicts of interest.