Fog Computing Enabled Hydroponic Farming Systems

Quang Tran Minh1, 2,*, Vy Nguyen Tran Gia1, 2, Sang Nguyen Tan1, 2, Phat Nguyen Huu3 and Takeshi Tsuchiya4

1Faculty of Computer Science and Engineering, Ho Chi Minh City University of Technology (HCMUT), 268 Ly Thuong Kiet, District 10, Ho Chi Minh City, Vietnam
2Vietnam National University Ho Chi Minh City (VNU-HCM), Linh Trung Ward, Thu Duc District, Ho Chi Minh City, Vietnam
3School of Electrical and Electronic Engineering, Hanoi University of Science Technology, 1 Dai Co Viet Rd., Hanoi – Vietnam
4Suwa University of Science, Japan
E-mail: quangtran@hcmut.edu.vn; 1552446@hcmut.edu.vn; 1552314@hcmut.edu.vn; phat.nguyenhuu@hust.edu.vn; tsuchiya@rs.sus.ac.jp
*Corresponding Author

Received 09 August 2021; Accepted 18 December 2021; Publication 05 March 2022

Abstract

Intelligent hydroponic farming that leverages IoT advantages is a pattern of modern farming technology as it not only increases crop productions but also reduces negative impacts from traditional methods. This paper proposed a fog computing enabled hydroponic farming framework that devises low-cost data collection and novel data analysis mechanisms to deliver intelligent farming systems. In this framework, the data from multiple IoT sensors at the garden are collected, filtered and analyzed by artificial neural network (ANN) models deployed at the fog landscapes, while the ANN models are trained in the cloud with a large amount of historical farming data. This approach allows the intelligent models being updated, reducing the communication cost and response time, while utilizing computing resources available on the network edge. The evaluation results on the developed prototype depict the effectiveness and the performance of the proposed approach revealing that it is feasible and ready to be applied in real-world applications.

Keywords: Fog computing, smart farming, IoT, data mining, ANN.

1 Introduction

People are living in the world where billions of things are connected in an emerging environment of internet of things (IoT) [1]. The industry 4.0 has encouraged technological revolutions to develop intelligent systems for improving the quality and productivity of productions and services in various fields such as in production lines, automatic control, healthcare, transportation, smart city, community eco-systems, and so on. Smart agriculture has a positive impact on society which attracts researches from academic and industry recently. The technologies that are applied in this sector are not only possible to collect a colossal volume of data to extract useful information but also cost effective for real-world applications.

For example, microprocessors for controlling various equipments or tiny sensors can track the environmental factors [2] to provide useful information for automation systems. The IoT-based data collection combining with data analytic technologies such as data mining, machine learning, AI, etc., provide suitable approaches for developing smart farming techniques. However, farmers are still working with equipments and techniques that come from the third industrial revolution [3]. It is still a long path to archive the benefit of the industry 4.0.

To help farmers move to the next step of modern cultivation, IoT based smart farming systems have been introduced, specifically with the support of fog computing paradigm. In the early state of modern agriculture, cloud computing had done a successful job of helping to store, process the data efficiently [4]. However, cloud computing has revealed drawbacks in system deployment flexibility, response time, scalability and so on. Fog computing allows moving computation and storage resources closer to the IoT devices at the smart farms where the data are directly generated and used. Fog computing devices such as routers, local PCs, gateways, or even smartphones with computation and storage capabilities [5] can store data and compute the local or regional data to quickly provide necessary information for the system monitoring and control (e.g., to control corresponding actuators at the farms). This approach helps archiving lower latency, reducing data traffic and saving more network bandwidth compared to the cloud computing approaches as not everything is transmitted to cloud computing devices [6].

In order to maximize the fog computing potential and apply it to the farming sector, this paper proposes a novel approach to data collection and machine learning based computation at the fog/edge nodes which leads to the reduction of the end-to-end response time and improvement of the computation effectiveness. In this paper, artificial neural network (ANN) with multilayer perceptron (MLP) is considered the primary model to analyze the data collected by the IoT devices installed at the farm. The proposed fog-based computing mechanism pre-processes the data collected from various IoT devices and then the MLP models on the fog nodes analyze and evaluate the appropriate results to return the best actions/instructions on controlling the actuators (e.g., light, pumps at different locations) at the farm.

Beside the enormous benefits of fog computing, this technology still remains several kinds of new lands requiring research efforts to explore. Our work focuses on the speed of fog computing in transmitting, pre-processing, and analyzing of the data by the fog-based machine learning models. The main contributions of this paper are summarized as follows:

(i) We analyze and propose an appropriate fog computing approach for smart farming considering the speed of sending and receiving data in a typical smart farming environment, the system flexibility and scalability.

(ii) We propose a fog-based machine learning approach where ANN models can be deployed at the fog/edge nodes to efficiently process the IoT data providing appropriate instructions for optimizing the farming processes.

(iii) We build a prototype system that applies the proposed fog computing approaches to hydroponic farming that is able to help users to track and control the states of their garden effectively. The experimental results from this system have confirm the effectiveness and the efficiency of our proposed approaches.

2 Related Work

Due to the sky-rocketed rising of human population over the world [7] that reached 7.7 billion in the middle of 2019 [8], the area of arable land is going to decrease. Besides, there are several threats to soil in cultivate areas including the natural process of erosion and temperature rising due to the global warming (inefficient management of land and water resources), soil and river pollution causing by the rise of urbanization and industrialization. All of these reveal significantly negative impacts to the food production under soil-based farming method [9]. Under the circumstances, hydroponics and soilless cultivation have become one of the most suitable solutions that can handle the problem of food security all over the world without expanding the cultivate land system. Growing plants under hydroponic culture brings a lot of advantages compared to traditional soil-based planting cultures [10]. However, hydroponics still has its disadvantages such as it requires great cares to provide healthiest crops, which are difficult to be implemented. For commercial purposes, the system requires technical knowledge and high investment. Energy for operating the system is also a problem [11].

Academic and industrial sectors are active in the recent years in developing smart farming solutions and starting business models based on their key technologies of smart hydroponic farming augmented by IoT technologies. Viscon Fresh has designed and deployed a unique system for leafy vegetables named Viscon hydroponics system [12]. This system focuses strongly on short life cycle vegetables such as lettuce, herb, cabbage, leeks, parsley, and spinach. This system can operate automatically in different tasks including potting, boxing, floating, and end packaging. Another company is La Grangette which produces a household hydroponics system where customers can grow vegetables in their kitchen [13]. This system applies IoT technology for monitoring essential factors such as temperature, humidity, light intensity, and water usage. Besides, customers can track and control their gardens though a mobile application also provided by the company.

Researchers from Taiwan had developed an intelligent plant care hydroponics box named the IPCH-Box [14] that uses a scalable and configurable software called IoTalk to interact with the sensors and actuators. This research introduced environment driven control methods including light, water spray, and water pump. The authors claimed that IPCH-Box can help to decrease temperature and CO2 emission while increasing the efficiency of water usage. Specifically, the time of CO2 concentration in the IPCH-Box reduces 38.54% compared to the other systems.

For low cost and affordable technologies on managing and controlling hydroponic gardens, another research group from Thailand had developed a DIY sensor-based on automatic control mobile application [15]. The application makes the system controls itself automatically via different types of sensors including water temperature, atmosphere temperature, humidity, and light intensity sensors. The application also supports several functions for planning, managing, and recording harvest data to adapt requirements during the planting progress. The collected data from gardens are used to design decision schemes for the next grows. In addition, users can track the growing progress globally. Another approach for IoT-based indoor hydroponic farming that leverages wireless sensor networks was introduced in [16]. The network contains temperature, humidity, and water level sensors to monitor the garden’s condition. The sensor network is connected with a micro-controller kit that controls the humidity adjusting and watering systems. Growing data can be monitored from remote locations with IoT devices in a real-time plan.

Conventionally, IoT-based smart farms are designed based on cloud computing architectures. However, most of these systems are inadequate to handle the load of traffic data on the network, the response time, the flexibility on utilizing local/regional knowledge, and the system scalability [17]. Therefore, a system with low energy consumption but fast processing and being available to access, update, and upgrade of knowledge management for the data processing and actuator controlling that leverages modern data analytic technologies such as artificial intelligence (AI), machine learning (ML), and deep learning (DL), etc., is essential. These requirements lead to the design of a fog/edge-based IoT smart farming system which is also proposed in our current work. Potentials of fog computing are discussed in [18] with several benefits such as providing IoT systems with faster data communication, better security, and lower latency when comparing to cloud computing models. An IoT-Fog based smart farm system called AgriFog [19] had been designed to optimize the bandwidth usage and reduce the latency for making decision in real-time.

In order to make hydroponic farming more efficient, several intelligent farming models have been investigated. In [20], the researchers had developed a smart hydroponic system that can automatically control the growing process of plant using Bayesian Network (BN). The system includes sensors and actuators for monitoring and controlling physical events such as light intensity, acidity, electrical conductivity (EC), solution temperature, and relative humidity. Data is collected from sensors for building the BN which helps to provide the best value for each variable so that the actuator control system can work appropriately. The experimental results have shown that the automatic control system using BN increases 66.67% of the yielded crop compared to the manual control system. Besides, a web interface is provided for users to monitor and control their farms remotely. Research in [21] showed another approach of proposing an ANN model for predicting environmental parameters (e.g., pH, EC) providing a deep response through the hydroponic system. The model has nine inputs including pH, EC, solution temperature, air temperature, humidity, light intensity, plant age, amount of adding acid, and amount of adding base. The outputs are the predicted pH and EC values in the next twenty minutes.

A project from Europe called DrainUse [22] proposed an approach of combining edge and cloud computing into a single platform that supports a precise agriculture presented by a real hydroponic system. The platform was built based on low-cost hardware and supported by a 3-tier software schema deployed at local, edge, and cloud layers. At the local layer, Cyber-Physical systems (CPS) collect data and perform real-time control decisions. The edge layer takes the responsibility of monitoring and managing tasks near the access network to increase system reliability against network access failures. Finally, the cloud platform hosts data analytic modules and collects past and current records for analyzing and tracking the system. In [23], a fog-to-cloud enabling animal farming system was proposed for animal welfare with low-cost technologies for data collection and analysis. The system contains multi-master replications of SQL Server databases between Microsoft Azure Cloud and multiple fog nodes on the farms. Researchers had shown a reliable system with improving performance, thanks to fog computing capabilities on collection, storage and computation of a large amount of data with the aid of machine learning techniques. Combinations of animal welfare, cloud-based computing, and fog-based farming models along with mobile applications become closer to farmers and customers alike in the future.

Our work in the current paper is different from the existing works discussed above as it focuses on hydroponic smart farming system leveraging the advantages of fog/edge enabled IoT technologies. The proposed approach and the developed system explore not only the potential of fog computing but also the benefits of applying ANN into fog nodes where the local/regional data can be quickly and efficiently analyzed to provided appropriate controls to the actuators. Therefore, it helps the farms automatically to act through real-time physical events with a significant reduction of latency compared to the cloud-based approaches.

3 Fog-based IoT Farming System

This section presents the overall architecture of the proposed framework where a fog-based IoT farming system and the communication mechanisms between different components in the system are designed. The architecture focuses on a fog/edge computing scheme where the environmental data collected at the farms can be processed effectively and efficiently leveraging the advantages of fog computing and machine learning techniques deployed at the fog landscape.

3.1 Overall Architecture

The overall architecture of the proposed solution is illustrated in Figure 1 consisting of three main components, namely the garden node, the fog layer, and the cloud service platform.

The garden node is the IoT layer consisting of sensors and actuators to track and control the environment status and the hydroponic solution states. The sensor component consists of air temperature, humidity, EC, pH measurement, and the solution temperature sensors to sense corresponding hydroponic farming environment conditions and send to the data analysis component (deployed on the fog landscape). There are intermediary objects that transmit data to the fog layer and receive the control signals. Many actuators are used to control the plant condition which operate under instructions from the control units. The appropriate instructions are provided by the data analysis component implementing machine learning models such as ANN models to analyze the data collected from the sensor component and map with the environmental conditions to make the plants mature healthily. The Fog layer is composed of many edge network devices such as routers (F1), access points (F2), and microcomputers like Raspberry Pi3 (RP3) that connect to the data collection units in the Garden node for collecting, processing and analyzing the sensed data. In addition, the fog node (e.g., the one implemented by RP3) plays as a gateway that listens to the signals from the cloud server or releases the signals by itself to control the lower layer actuators. It should be noted that in some cases the machine learning based data analysis approaches need global knowledge/data such as the shared data between different regions in a garden or between different gardens, different crop seasons and so on, the machine learning components at the cloud server will be invoked to provide appropriate instructions to the fog nodes.

images

Figure 1 The overall architecture of the proposed fog/edge enabled IoT smart hydroponic farming system.

In this work, the machine learning approach is implemented based on ANN with multilayer perceptron (MLP) model trained on the cloud leveraging its strong computation and storage resources. The trained models are then downloaded to the fog nodes for execution. In addition, the system also triggers the fog nodes to download the retrained models (on the cloud) when applicable if new data may affect the accuracy or the machine learning models. It should be noted that, to avoid heavy traffic load, data received from the garden layer will be examined at the fog nodes to filter only the significant change sensed data, before being submitted to the cloud server. These data are used to retrain the ANN model and to display on the user interface (UI). The cloud server has its tasks as storing data sent from the Fog layer, sending the data to the web server to provide users with a clear view of the garden state, retraining ANN models when the update data are relevant. In this work, MongoDB [24] is utilized as the primary database for the developed system.

In this proposed framework, a smart farm system can be deployed in a hierarchical scheme where one fog nodes serves for a particular region of a garden (namely a fog colony) which consists of several sensors for environment sensing and multiple actuators for adjusting environmental parameters such as temperature, humidity, EC. In addition, multiple fog colonies can share their data to the cloud for further analysis (i.e., retrain ANN models) to improve the performance of each fog node. For the simplicity in experiments while keeping the generality of the proposed framework, we have deployed a prototype for a garden region where multiple sensors are connected to a fog node. In further improvement, depending on the size of the farm, it may require a larger number of distinct fog nodes to connect and control different garden regions. This requirements can be satisfied by our proposed framework as discussed above.

In order to develop a smart hydroponic farming system based on the aforementioned architecture, we need to propose suitable solutions for communication protocols between different components in the fog landscape. Moreover, we design and evaluate appropriate ANN models to control the actuators on the gardens, and then we develop a prototype system including hardware clusters like sensors, actuators deployed at the gardens to evaluate and confirm the effectiveness of the proposed approaches. Last but not least, we develop a website to allow users easily access and control the system remotely. The system communication will be presented in the following subsection followed by other technical issues and corresponding proposed solutions.

3.2 System Communication

The communication between different components in the Fog-based IoT system is one of the most important issues that need to be thoroughly investigated to maximize the fog computing potential by elegantly utilize heterogeneous devices available in the network edges. Since the flexibility and openness are essential requirements for any fog-based computing systems, the communication protocols in our proposed framework should be flexible and open to accept various types of communication technologies including wired and wireless methods. As a result, the communication component in our proposed approach is divided into three main areas as shown in Figure 2 described as follows.

images

Figure 2 The communication model for the proposed fog-based IoT smart farm system.

The first area is for the end-user application where mobile or web-based applications are provided to connect users with the system via the Internet. The next area is the cloud computing server that conducts a web server and MQTT broker to direct the requests from users and other components at the fog landscape or from the farms to the right cloud-based services (e.g., to display the real-time status of the farm for the users, to trigger a new deployment of the updated ANN model to the corresponding fog nodes). The third area is the farming area where sensors and IoT devices (actuators) are deployed to communicate with other components in the whole system.

In this designed architecture, data collected from sensors are routed to the web-server in the cloud, via fog nodes, by using the hypertext transfer protocol secure (HTTPS). Therefore, any nodes in the network such as those in farm, network edges, etc., can smoothly communicate and exchange data with the web server when needed as the web-server always listens to the requests from clients via pre-described public IP addresses and ports. However, the IoT kits are inaccessible from the web-server since the IoT devices do not have their public IP addresses. Consequently, the controls/instructions flows from the web-server to the actuators could not be automatically conducted without any request from the IoT devices. This problem hinders users to control the farm manually and remotely via a mobile or a web-based application. To overcome this issue, the MQTT protocol is utilized where the MQTT brokers conduct the handshakes between the IoT devices and the web-server. Therefore, when needed, the web-server can initiate the communication (e.g., to transfer a control signal) to the IoT devices.

4 Data Analytic With ANN Model on the Fog

Obviously, the local or regional data collected at particular farms are specific to those farms and they can be used directly to monitor and control actuators on the corresponding farms without interference from other farms. Therefore, the data analytic model should be developed specifically to each farm and it should be deployed close to the farm, rather than being deployed in the cloud, to make the garden become self-control, work more efficiently by exploring the potentials of fog computing scheme combining with the benefits of machine learning techniques deployed on the fog. This designed features in our proposed framework are presented in detail as follows.

4.1 ANN based Model for Data Analysis and Controlling the Farm

Hydroponic farming methods can be applied to many vegetables each of which requires different caring conditions. These conditions include either environment factors such as air temperature, light intensity, humidity, water-based solution variables like EC, acidity measured in pH unit, and the solution temperature. Besides, several factors in one period can be different to that in another period in the same season crop during growing progress because of the differences in the plant nutrient uptake and chemical reactions in the nutrient solution. All of them significantly affect the productivity of plants. Therefore, it is essential to propose a method that can analyze the planting conditions and then provides the best decisions on controlling actuators (such as lights, fans, pumps,…) at the farm to keep good planting conditions in accordance with different periods. ANN has been considered as one of the most appropriate, accurate, and reliable methods to handle the problem. ANN has the ability to learn from the data and provide appropriate outputs/decisions. All the essential input factors are stored in its network, thus the loss of data does not affect the working process. Each neural of the network can perform in parallel without affecting the performance of fog nodes. The ANN model in this approach will focus firmly on the nutrient solution. Therefore, the model will process solution factors as inputs and provide suitable control signals to manage physical actuators that relate to the nutrient solution (e.g., turn on or turn of a pump).

images

Figure 3 ANN network designed for actions on the gardens based on the solution sensor data.

4.2 Model Design

In order to provide a concrete example on designing an appropriate ANN model for the smart hydroponic farming system, we describe a system that is used to culture lettuce plants. Similar to other plants, the nutrient solution for lettuce is an important problem. Therefore, EC, acidity, and solution temperature need to be managed appropriately. An ANN model will be applied to help the system perform based on those three variables. These nutrient parameters become the inputs of the model and output is a small list of actions on controlling corresponding actuators that directly affect the nutrient solution. As a result, lettuce plants fed from the controlled solution can grow healthily.

More concretely, the outputs of the ANN model are divided into five class labels presenting actions that the system should conduct, namely “add nutrient”, “add water”, “increase solution temperature”, “decrease solution temperature”, and “do nothing”. Therefore, the architecture of the ANN model consists of a total of three inputs and five decision outputs. In this work, an ANN model of one hidden layer network which contains ten nodes will be trained as shown in (Figure 3). The activation functions are the rectifier linear unit (ReLU) at the hidden layer and the SOFTMAX function at the output layer since both of them were considered as the most using functions [25] and they are suitable for the designed purposes in our proposed framework. As for ReLU, it is simpler in computation when the function only retains positive input values and the other inputs will become 0. Therefore, the computation cost in the training process substantially reduces leading to the higher capacity of the model. On the other hand, the SOFTMAX function is usually used at the output layer since it returns probabilities of each label as the target class. Here, the label with the highest probability is selected as the target class, i.e., the output, of the model in accordance with a given input vector.

Obtaining an appropriate ANN model is a significant step in developing autonomous gardens in the future when their physical sensor data can be analyzed at the fog nodes. Actuators are then controlled based on the ANN model’s decisions. The model can learn from historical data and performs appropriately with similar events arise at fog nodes. This approach provides the ability to work through real-time events to automate the garden quickly and effectively.

4.3 Deploy Model

As presented, the proposed framework provides computation capabilities at the fog nodes and in the cloud where the ANN model can be trained and deployed to analyze the real-time sensed data from the farms. As for the ANN approach, the training phase requires relevant resources while the trained model can operate in a limited resource nodes. Therefore, in this work we suggest to train the ANN model in the cloud with relevant historical data collected from the farms. Besides the local/regional data collected from particular farms, global data related to the general features, growing periods combining with optimal conditions for the considering plant (e.g., lettuce), and so on can be used to optimize the training processes. The trained model will then be tested with an adequate sample dataset to evaluate its performance. When the model has satisfied all requirements in terms of effectiveness and efficiency, it will be transferred to fog nodes (Raspberry Pi) to analyze the real-time data collected by the sensors deployed on the farms.

In the beginning phase of this research, the global datasets used for training and testing were collected from La Grangette Inc [27]. The planting data had been recorded for two months started on April 26th, 2019. This dataset contains more than 230,000 records of lettuce raised in a hydroponics environment. From the beginning to the end of a seasoned crop, each record of data including solution parameters (EC, acidity …) and environmental parameters (light intensity, air temperature, humidity …) which was logged every 15 minutes and stored in the database. The dataset was separated into two subsets include the training set and the testing set with the ratio of 75:25 respectively.

At the working phase, the sensor data are gathered and transferred continuously to fog nodes which work as small and local computing centers to analyze these real-time events, thank to the downloaded ANN model which has been trained in the cloud. The real-time nutrient variables (pH, EC, solution temperature) will become the new inputs of the model. The fog nodes will then use the model to compute these three parameters to produce the output results of five probabilities that represent for the five actions as mentioned before. The label with the highest probability will be chosen as the final output action. The system will immediately control actuators in the garden based on that output. For example, if the output “add water” has the highest probability among all five defined labels, then the fog node will instantly send a signal to the garden to turn on corresponding water pumps. By applying the ANN model, the system can control the actuators in the farms in accordance with the changes of the growing conditions to optimize the conditions for a given growing period (of the considering plant). This approach provides several benefits as it not only helps to reduce the latency and the traffic load of data transferring from the farms to the cloud but it also explores the computing potentials of available computing resources at network edges.

5 Implementation

This section describes the implementation of the prototyping system for the proposed framework to confirm its effectiveness and efficiency. This implementation can also be deployed in real-world applications of hydroponic farming systems.

5.1 IoT System Deployed on the Garden – The Garden Nodes

IoT system is essential to handle the data collection and transfer to the computing nodes at the fogs or in the cloud. Figure 4 illustrates the IoT system with necessary IoT devices and connection types. These devices connect to the fog nodes via wireless communication protocols such as zigbee or Bluetooth, or the can be wired cables to minimize the latency and data loss. We group IoT sensors and actuators at the same part of a garden into a cluster controlled by an Arduino micro-control unit, each connects to a Raspberry Pi which plays as a fog node to process the collected data and control the actuators. For example, Figure 4 shows a fog colony with a Raspberry Pi connecting to two Arduino units through an USB-A port. The first Arduino node’s role is to collect data from sensors and the second one is to control the actuators in the garden. Sensors connect through its analog or digital PWM pins depending on the type of sensors with the collecting Arduino unit. At the same time, the controlling Arduino unit connects with actuators in the garden and control (turn on/off) them in accordance with instructions from the upper layers, namely from the fog landscape. In turn, the appropriate instructions from the fog nodes are provided by the ANN model which has been trained in the cloud and deployed on the fog nodes.

images

Figure 4 IoT components in a smart farm system.

5.2 Web Application

As presented before, the proposed framework consists of a web-based application to allows farmers visualizing the growing data and interacting with the garden in real-time. In addition, users can also be able to examine and analyze the historical growing data, if needed, through functionalities implemented in this web application. Here, Node.js was chosen for developing the web application [26] while MongoDB [24] was utilized as the database system. Data stored in the database which is deployed in the cloud will be used for further data analysis in the future. The web application’s functions are designed following a software design pattern called model–view–controller (MVC). In the front-end, ChartJS is used to represent data through dynamic charts. The web application is also used as an interface to manage all the physical devices/actuators in the garden. In order to deploy the web-server to the cloud, a cloud platform as a service (PaaS), namely Heroku had been utilized.

Figure 5 shows that a user is allowed to manage one or many gardens at the same time. When a particular garden is selected, the web application will redirect the user to the corresponding garden’s dashboard as shown in Figure 6. Here, all the critical information of that garden which is updated in real-time can be visualized. All the critical factors of either environment or nutrient solution are also illustrated in different charts, such as charts for EC, Solution Temperature, Acidity (pH), Light intensity, Air Temperature and Humidity. The dashboard contains not only garden parameters but also control signals that can trigger all the physical devices/actuators at the garden layer. These signals are represented as switch buttons, and each switch controls (turn on/off) one kind of actuator, namely Light bulb, cooling fan for atmosphere, water pump and solution pump, cooling and heating solution devices. User can remotely control those devices by clicking on the corresponding button the web interface.

images

Figure 5 The first page allows user to select a particular garden among various ones to manage.

images

Figure 6 The Dashboard for a particular garden containing main features for users to view and control the garden.

5.3 Fog Layer

Different from cloud computing, Fog node processes the data at every end device which is mostly the physical real-time data (e.g., collected and processed at the Raspberry pi nodes presented in the proposed scheme). The fog node also acts as a computing center where every incoming data can be analyzed and acted as input vector of the ANN model for processing to return control signals on controlling the gardens (activate/deactivate actuators). In this work TensorFlow API is used to design the ANN model. The model will is trained and tested on Google Colab. Once the model is ready, it is be transferred to the Amazon S3, a service provided by Amazon Web Service (AWS) which offers a library named Boto3 containing many friendly APIs to upload and download objects.

The fog node downloads the trained model from S3 mentioned above and uses that model to analyze the sensed data from garden’s sensors. The decision will be delivered based on real-time data analysis at the fog node, thanks to the trained ANN model. Then, the decision is immediately transmitted to Arduino nodes in the Garden landscape to control actuators. In another flow, the collected from sensors will be filtered (keep only the changed data) at the fog node before being sent in bag (to mitigate the communication cost) to the database in the cloud. These data are used to update the ANN model to improve its effectiveness.

The ANN model can be deployed on any operating system which has installed python and required python libraries: Tensorflow, Numpy, and Boto3. The ANN model was trained by using Tensorflow framework and then conducted into one single “.h5” file format. All sensors for data collection will be firmed in an array of inputs by Numpy. Tensorflow will use the combination of that array of inputs and the trained model file to produce an array of probability outcomes, and Numpy was used once again for getting the outcome with the highest probability from the result array. The model was trained in Google Colab platform and stored in AWS S3 storage. In order to download the model to local machine, Boto3 was chosen for handling this task.

5.4 Update the Knowledge Base

As presented, the ANN models deployed on the fog nodes will control the actuators on the garden. The issue here is that the ANN models might be out of date since the environment changes dynamically, hence the control must also change accordingly. In this sense, the ANN models should be retrained to adapt such kinds of changes. In order to retrain the ANN models, we need to update the knowledge base used as the input data for the retraining process. To build and update this knowledge base we logged both the “bot decisions” (i.e., decisions made automatically by the ANN models at the fog nodes) and the “human decisions” along with sensed data from sensors at the corresponding gardens as shown in Figure 7. Concretely, in human decisions, the user conducts manual controls on actuators based on their farming experiences in accordance with the input data of the environment factors reported by the web dashboard mentioned above. For the bot decisions, the fog nodes automatically control the actuators based on the changes from the environment and the decision rules provided by the ANN models. It should be noted that the human decisions and the bot decisions may not always be the same. In this work, we assume that the human decisions could be the “real knowledge” hence the bots (i.e., the ANN models) need to be retrained to keep the knowledge updated from human knowledge if their decisions are too far apart from the human being ones.

images

Figure 7 Data Log Web interface.

Table 1 Examples of the rate score

Temp Acidity EC Bot Decision Human Decision
24.03 5.89 1.1 Add nutrient Do nothing
29.03 6.01 1.0 Decrease temp Decrease temp
24.03 5.89 1.1 Add nutrient Add nutrient
25.03 5.89 0.8 Add nutrient Add nutrient
22.03 6.05 1.1 Do nothing Increase temp
Rate ratio 3/5 Rate score 3

We propose the “rate score” to identify the difference between the bot decisions and the human being ones. This score is ranged in five levels, namely from 1 to 3 which is low and the values of 4 and 5 are acceptable (i.e., correct enough). This “rate score” is calculated as the rounded value of the portion between the number of the same decisions provided by the bots and by the human being, and the total number of decisions logged. Table 1 shows an example of the rate score. When the decisions made by an ANN model do not meet the user demands revealing a low rate score (i.e., less than 3) then the model need to be retrained using the knowledge updated by the sensed data and the human decisions which are logged during a farming season as mentioned above. On the other hand, if the rate score is marked as 4 or 5, the model still correctly executes as expected (i.e., similar to the human being), hence it will keep unchanged and the system works as designed.

It should be noted that the process of ANN model retraining is conducted in the cloud where an analytic service is deployed to analyze the rate score as presented above and decide where the ANN models should be retrained or not. If an ANN model is required to be retrained, it will be retrained in the cloud without effect to the functionalities at the fog nodes. When the retrained process is completed, a signal is transmitted to the corresponding fog node to trigger the task of updating the ANN model. At that time, the newly trained ANN model will be downloaded to replace the existing one at the considering fog node. From then the ANN model at the fog node is called to be updated with the real-world knowledge and ready for its garden controlling tasks, for instance to apply in the next farming season.

6 Evaluation

This section evaluates the effectiveness of the proposed framework in terms of response time in different system deployment platforms and the data analytic time in comparison with the conventional cloud model. In order to conduct these evaluations, we have built a farming system which is deployed in both the fog and the cloud schemes and collect the data for analysis. In this experiment, he have deployed a web-server on Heroku cloud platform, we also installed it at a local computer, and at three Raspberry pi units connecting equipped with Wi-Fi 802.11n connections to represent fog nodes. We evaluated the response times of these two platforms by simulating continuous accesses from multiple users to the web-page through the JMeter application. The specification of these servers is showed in Tables 2 and 3.

Table 2 The localhost specification

CPU Ryzen 5 2600 (3.4/3.9 GHz)
Mainboard Asus Prime B450 Plus
Ram 16GB DDR4 bus 2666 MHz
VGA MSI GTX1060 6gb

Table 3 The Heroku platform

Country United State
Locate Virginia
Provider Amazon Web Service
Free Slug size 500MB

Firstly, we evaluated the performance of the proposed IoT based smart farm on two different platforms, namely in the cloud and on the local computer to show the feasibility and the benefit of the fog computing scheme. Table 4 shows the detailed comparison between two platforms of Web-server: Heroku and localhost platforms. It is clear to state that the performance of the local server is out-weight the cloud server due to the difference in latency and response time with the same number of concurrent requested threads. This result reveals that, the local deployment of web services for controlling IoT smart gardens could be more appropriate than the cloud based deployment.

Table 4 Performance of the Web server deployed in a local computer

Source User Threads Average Throughput Latency (ms) Response Time (ms)
Localhost 300 50 15.20 54.33 55.8
Heroku 300 50 8.69 595.45 670.21

Secondly, we evaluated the response time of the fog computing scheme compared to the cloud based methods. The system was deployed in two modes, namely cloud and fog modes for this evaluation. In the cloud mode, it works like every other cloud computing system where the data is sensed from the sensors, passed through the fog nodes (without any further processing here) and then stored and processed at the cloud server. In the fog mode, Raspberry pi nodes or local computers take the role of data processing nodes where the data are filtered and then applied to the ANN models deployed on these fog nodes to control the actuators in the garden. Figure 8 depicts the evaluation results where the response times of 10 different tests have been drawn out. As shown the proposed fog computing scheme, even deployed in Raspberry pi or in local computers, is significantly outperformed the cloud based approach. In the fog computing scheme the response time is around 300 ms while the response time in the cloud based counterpart is around 1300 ms.

images

Figure 8 Response time of the fog computing scheme compared with the cloud counterpart.

Next, we evaluated the capacity of fog nodes on deploying an ANN model for data analysis and make decisions on actuator controls. Figure 9 illustrates the resource (CPU and RAM) utilization on the Raspberry Pi playing as a fog node in two cases: with and without the deployment of an ANN model on it. As shown in the figure, the ANN model affects significantly on the CPU of the Raspberry Pi node as it consumed around 28% of the CPU compared to only 1.5% when it does not host an ANN model. An interesting point here is that the memory (RAM) utilization on both the cases (with and without deployment of an ANN model) is mostly the same which is around 34%. It is worth to be noted that, this CPU and RAM utilization is still much lower than the capacity of a commodity Raspberry Pi device. Therefore, it is possible to be used for implementing a fog node.

images

Figure 9 Raspberry Pi CPU and Memory usage (%).

Finally, we evaluated the appropriate of the proposed fog enable IoT smart farm by evaluating the time to train an ANN model on the fog and in the cloud. If we use a fog node implemented by a Raspberry Pi to train an ANN model with 260,000 rows of input data then it takes 2,206,684 ms (approximately 36 minutes). Meanwhile, if we train the same model in the cloud (Google Colab), it takes only 324,271ms (over 5 minutes) as shown in Table 5. Obviously, due to the lack of resources in microcomputers such as Raspberry Pi, it takes much longer time than a cloud service to train an ANN model. However, there is an interesting point in Table 5 is that it requires only 7 ms to download a trained ANN model from the cloud to the fog node as the trained model is as small as 24 kb as shown in Table 6. This download time can be extended if the trained model goes larger. However, the size of the trained model must be much smaller than that of the size of the training data (see Table 6) resulting in a relevant time saving (comparing the time for training and downloading the model). After download the ANN model to the fog node, it is quite adequate to execute the model to analyze the real-time IoT data for making decision on controlling the garden’s actuators as presented in the previous evaluation points discussed above.

Table 5 Times for training and downloading an ANN model to the fog node

Trained on the Fog Node Trained in the Cloud Service
Training the model 36 min 5.6 min
Downloading the model 0 7.113 ms

Table 6 Specification of the training data and the trained ANN model

The size of the training data sample 260,000 rows
The size of trained ANN model 24 kb

These experimental results and analysis confirm the effectiveness and the robustness of our proposed fog-enable IoT approach compared with the traditional approaches in the cloud.

7 Conclusion

This paper proposed a novel approach to hydroponic farming systems based on fog-enable IoT mechanisms. Applying IoT with a fog computing framework, the proposed approach enables the farming system to automatically and efficiently adapt to the changes of environmental conditions. Furthermore, the proposed hydroponic system could be suitable for many kinds of herbs and vegetables which share the common attribute of lightweight root system such as pepper mint, basil, spinach.

The evaluation results on our prototype reveal that the proposed approach provides a better IoT solution compared to the conventional approach based on the cloud computing scheme. Concretely, the proposed approach provides significant advantages in saving the data communication cost, reducing the response time of IoT services, and more importantly it can be deployed on existing devices on the network edges serving as fog nodes, hence it reduces the overall implementation cost of a large scale IoT system. As a result, the proposed approach is applicable in not only smart farming applications but also in any fog-enable IoT system in real world applications.

In addition, the system was developed based on hydroponics cultivating methods. Therefore, environmental factors are fundamental elements that must be always considered. There are many kinds of herbs (tarragon, peppermint, green mint, basil…) and vegetables (lettuce, spinach, bok choy, tomatoes …) that are suitable for the hydroponics system since these plants share the same common characteristic which is the lightweight root system. Currently, the proposed system is able to collect environmental and solution data. There is no plant attributes that could be recorded during the whole growing progress. This could be frustrated for users to know whether or not the caring decisions are suitable for the plan development. For further improvements, to determine the growing process and health status of plants, computer vision can be applied to track the leaf area, leaf size and color, and the plant height. These data are then used to train ANN models which help fog nodes to control the garden accordingly.

Acknowledgement

We would like to thank Ho Chi Minh City University of Technology (HCMUT), VNU-HCM for the support of time and facilities for this study.

References

[1] S. Ranger, “What is the iot? everything you need to know about the internet of things right now,” 2020.

[2] Y. Rivas-Sańchez, M. Moreno-Pérez, and J. Roldań-Canãs, “Environment control with low-cost microcontrollers and microprocessors: Application for green walls,” 2019.

[3] N. Huong, “Vbf 2018: Investment opportunities in smart agriculture,” Vietnam Investment Review, 2018, https://vir.com.vn, accessed Aug. 2021.

[4] M. Chan, “Big data in the cloud: Why cloud computing is the answer to your big data initiatives,” 2018.

[5] Cisco, “Fog computing and the internet of things: Extend the cloud to where the things are,” 2015.

[6] M. Firdhous, O. Ghazali, and S. Hassan, “Fog computing: Will it be the future of cloud computing?” 2014.

[7] J. Cleland, “World population growth; past, present and futures,” Environmental and Resource Economics, vol. 55, no. 4, pp. 543—554, 2013.

[8] D. o. E. United Nations and P. D. Social Affairs, “World population prospects 2019: Highlights (st/esa/ser.a/423),” Technical report, 2019.

[9] D. Pimentel and M. Burgess, “Soil erosion threatens food production,” Agriculture, vol. 3, pp. 543–554, 2013.

[10] M. D. Sadare and S. Admane, “A review on plant without soil hydroponics,” IJRET: International Journal of Research in Engineering and Technology, vol. 2, no. 3, pp. 299–304, 2013.

[11] A. Van, H. Gieling, and A. Ruijs, “Equipment for hydroponics installations,” IJRET: International Journal of Research in Engineering and Technology, pp. 102–141, 2002.

[12] “Leafy vegetables,” https://www.visconfreshproduce.com/leafy-vegetables/. accessed Aug. 2021.

[13] “The best vegetables in the world grow in your kitchen,” https://lagrangette.tech/. accessed Aug. 2021.

[14] T.-H. Wu, C.-H. Chang, Y.-W. Lin, L.-D. Van, and Y.-B. Lin, “Intelligent plant care hydroponic box using iottalk.” IEEE International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), 2016.

[15] C. Peuchpanngarm, P. Srinitiworawong, W. Samerjai, and T. Sunetnanta, “Diy sensor-based automatic control mobile application for hydroponics.” Fifth ICT International Student Project Conference (ICT-ISPC), 2016.

[16] R. Rajkumar and R. Dharmaraj, “A novel approach for smart hydroponic farming using iot,” International Journal of Engineering Research in Computer Science and Engineering (IJERCSE), vol. 5, no. 5, 2018.

[17] S. Nandhini, S. Bhrathi, D. D. Goud, and K. P. Krishna, “Smart agriculture iot with cloud computing, fog computing and edge computing,” International Journal of Engineering and Advanced Technology (IJEAT), vol. 9, no. 2, 2019.

[18] S. Yi, C. Li, and Q. Li, “A survey of fog computing: Concepts, applications and issues.” Proceedings of the 2015 Workshop on Mobile Big Data (Mobidata ’15), 2015.

[19] V. Sucharith, P. Prakash, and G. N. Iyer, “Agrifog – a fog computing based iot for smart agriculture,” International Journal of Recent Technology and Engineering (IJRTE), vol. 7, no. 6, 2019.

[20] M. I. Alipio, A. E. M. D. Cruz, J. D. A. Doria, and R. M. S. Fruto, “A smart hydroponics farming system using exact inference in bayesian network.” IEEE 6th Global Conference on Consumer Electronics (GCCE), Nagoya, 2017, pp. 1–5.

[21] K. P. Ferentinos, L. D. Albright, and N. R. Scott, “Modeling ph and electrical conductivity in hydroponics using artificial neural networks,” IFAC Proceedings Volumnes, vol. 33, no. 19, pp. 172–178, 2000.

[22] M. A. Zamora-Izquierdo, J. Santa, J. A. Martinez, V. Martinez, and A. F. Skarmeta, “Smart farming iot platform based on edge and cloud computing,” Biosystems Engineering, Intelligent Systems for Environmental Applications, 2018.

[23] A. Jukan, F. Carpio, X. Masip, A. J. Ferrer, N. Kemper, and B. U. Stetina, “Fog- to-cloud computing for farming: Low-cost technologies, data exchange, and animal welfare,” Computer, vol. 52, no. 10, pp. 41–51, 2019.

[24] “What is mongodb,” https://www.mongodb.com/what-is-mongodb, accessed Aug. 2021.

[25] C. Nwankpa, W. Ijomah, A. Gachagan, and S. Marshall, “Activation functions: Comparison of trends in practice and research for deep learning,” ArXiv, vol. abs/1811.03378, 2018.

[26] “About node.js,” https://nodejs.org/en/about/, accessed Aug. 2021.

[27] https://github.com/la-grangette/plantings-datasets, accessed Nov. 2021.

Biographies

images

Quang Tran Minh is an associate professor at Faculty of Computer Science and Engineering, Ho Chi Minh City University of Technology, Vietnam and a visiting researcher at Shibaura Institute of Technology, Tokyo, Japan. He has been a researcher at Network Design Department, KDDI Research Inc., Japan (2014–2015) and a researcher at Principles of Informatics Research Division, National Institute of Informatics (NII), Japan (2012–2014). His research interests include mobile and ubiquitous computing, IoT, network design and traffic analysis, disaster recovery systems, data mining, and ITS systems. Prof. Quang received his Ph.D. in Functional Control Systems from Shibaura Institute of Technology. He is a member of IEEE, ACM.

images

Vy Nguyen Tran Gia graduated from Ho Chi Minh City University of Technology, VNU-HCM, Vietnam in computer science. In his academy years, he showed interest in IoT designs and machine learning. He had worked on data migration and big data before becoming a professional web-backend developer for a foreign company.

images

Sang Nguyen Tan is a graduate student at Ho Chi Minh City University of Technology, VNU-HCM, Vietnam, where he received a bachelor’s degree in computer science. During his studies, Sang was focusing on researching and solving problems of web design, IoT, computer vision, and system architecture designs. He had spent over a year contributing to a social network platform (named phpFox) and some CMS systems.

images

Phat Nguyen Huu received his B.E. (2003), M.S. (2005) degrees in Electronics and Telecommunications at Hanoi University of Science and Technology (HUST), Vietnam, and Ph.D. degree (2012) in Computer Science at Shibaura Institute of Technology, Japan. Currently, he lecturer at School of Electronics and Telecommunications, HUST Vietnam. His research interests include digital image and video processing, wireless networks, ad hoc and sensor network, and intelligent traffic system (ITS) and internet of things (IoT). He received the best conference paper award in SoftCOM (2011), best student grant award in APNOMS (2011), hisayoshi yanai honorary award by Shibaura Institute of Technology, Japan in 2012.

images

Takeshi Tsuchiya received his Ph.D degree (2009) in Engineering at Waseda University, Japan. Currently, he is an Associate Professor of Department of Applied Information Engineering at Suwa University of Science. His recent interests include distributed collaborate system, distributed machine learning platform, and web marketing prediction system. He is member of IEICE, IPSJ, and IEEE.

Abstract

1 Introduction

2 Related Work

3 Fog-based IoT Farming System

3.1 Overall Architecture

images

3.2 System Communication

images

4 Data Analytic With ANN Model on the Fog

4.1 ANN based Model for Data Analysis and Controlling the Farm

images

4.2 Model Design

4.3 Deploy Model

5 Implementation

5.1 IoT System Deployed on the Garden – The Garden Nodes

images

5.2 Web Application

images

images

5.3 Fog Layer

5.4 Update the Knowledge Base

images

6 Evaluation

images

images

7 Conclusion

Acknowledgement

References

Biographies