Next Article in Journal
Weaponized IoT: A Comprehensive Comparative Forensic Analysis of Hacker Raspberry Pi and PC Kali Linux Machine
Previous Article in Journal
Fog-Enabled IoT Robotic System for Efficient Date Palm Monitoring in Moroccan Oases
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Network Architecture of a Fog–Cloud-Based Smart Farming System

by
Alain Biheng
1,
Chunling Tu
1,*,
Pius Adewale Owolawi
1,
Deon Du Plessis
2 and
Shengzhi Du
3
1
Department of Computer Systems Engineering, Tshwane University of Technology, Soshanguve, Pretoria 0152, South Africa
2
Department of Information Technology, Tshwane University of Technology, Soshanguve, Pretoria 0152, South Africa
3
Department of Electrical Engineering, Tshwane University of Technology, Soshanguve, Pretoria 0152, South Africa
*
Author to whom correspondence should be addressed.
Submission received: 10 June 2024 / Revised: 8 January 2025 / Accepted: 23 January 2025 / Published: 20 February 2025

Abstract

:
With the rapid increase in the human population and urbanization worldwide, the demand for food production has played a significant role in driving the integration of technology into agriculture. Various Cloud-based systems, such as livestock tracking systems, have been proposed. In those systems, data were collected by the sensors and sent to the Cloud for processing. However, significant issues with those systems were noted, such as high bandwidth utilization and security concerns, such as a high volume of row data traveling from the data collection devices (such as sensors) to the Cloud through the Internet. Additionally, the long distance between the Cloud and the data collection devices makes it unsuitable for latency-sensitive livestock disease monitoring and tracking systems. Therefore, this paper proposes a Fog–Cloud-based approach, where the processing is conducted at the Fog layer, closer to the data collection devices, and only the result is sent to the Cloud for remote viewing. The proposed method aims to reduce power consumption and latency in communication. To validate the proposed method, both the Cloud-based and Fog–Cloud-based scenarios are simulated using iFogSim (a novel simulation tool for IoT and Cloud computing), and the result shows that there is less than twice the power consumption in some scenarios and that the time consumed in the proposed Fog–Cloud-based system, depending on the number of sensors, is five to ten times lower. This study further supports the point that the Fog–Cloud-based is suitable for latency-dependent farming systems such as livestock tracking systems.

1. Introduction

The recent enhancements in Information and Communication Technology (ICT), such as IoT, Cloud computing, Fog computing, and Machine Learning, have significantly impacted the reshaping of livestock farming [1], paved the way for precision agricultural practices, and improved efficiency in livestock management. These advancements have led to increased productivity, reduced waste, and improved animal welfare.
Applications that monitor and control animals’ welfare and accurately detect reproductive cycles for increased production and reproduction are no longer futuristic; they are now achievable with ICT innovations. Various Cloud-based IoT farming techniques involve collecting data using sensors and sending it to the Cloud for analysis and processing. Then, based on the results, instructions are sent to the actuators to complete specific tasks [2,3]. In these systems, the powerful computing capability of the Cloud unit can always easily meet the processing requirements of the system. In addition, a notable issue is that Cloud units are typically geographically distant from the data collection devices. Large volumes of data travel a long distance to the Cloud after being collected on the site. This creates an enormous bandwidth utilization and some security risks when raw data travel on the Internet. The negative effects of the high latency and energy consumption also need to be considered.
With the rise of Fog computing, first developed by CISCO in 2012 [4], new Fog–Cloud-based applications provide computational processing closer to the data collection devices. These systems are more secure as the raw data no longer need to be sent to the Cloud directly, and more importantly, the communication latency is reduced. A lower communication cost is observed as more data are processed locally.
Livestock farms are usually located far from urban areas, with communication issues of power consumption, latency sensitivity, limited bandwidth, etc. This paper, therefore, proposes a Fog–Cloud-based IoT network architecture to satisfy the requirements of an IoT livestock farming system. In this architecture, data collected from the sensors mounted on animals are processed on the Fog device, and only the results are sent to the Cloud for storage and remote viewing. Based on the results of the processing performed in the Fog device, actions are triggered on the actuators to complete specific tasks. Reduced communication latency occurs as data are processed closer to the data collection devices and actuators. The overall system efficiency and response time are greatly improved, leading to faster and more efficient operations.
The system is simulated and evaluated using iFogSim, a novel Java-based Fog–Cloud simulator that models Fog–Cloud-based IoT environments and measures their parameters, simulating the interactions between Fog, Cloud, and sensor technologies. This novel simulation tool is not yet widely used in such applications, but it has the potential to have more contributions to research in IoT-based livestock farming systems.
The simulation results validate the proposed method’s main advantages over Cloud-based IoT systems, particularly in reduced latency and energy consumption. This study shows two times higher power consumption and five to ten times higher latency in the Cloud-based system compared to the proposed Fog–Cloud-based system depending on the number of sensors used in the simulation. Therefore, the proposed Fog–Cloud-based system offers significant efficiency improvements compared to the traditional Cloud-based IoT systems.
This paper is structured as follows: Related works are presented in Section 2, the proposed system’s components are outlined in Section 3, the methodology is shown in Section 4, and the simulation and results are depicted in Section 5.

2. Related Works

Various systems have been developed over the years for smart farming. Many of them are based on Cloud-based architecture, but more recently, a Fog–Cloud-based architecture has attracted attention in the agricultural field. In particular, in intelligent livestock management systems, these systems gathered data and processed them via a Fog–Cloud-based system [5], including body temperature, heartbeat rate, location, movement (lying down, standing, or sleeping), and environmental data such as temperature and humidity. Using technology to gather information on animal health, behavior, and productivity is a key aspect of data collection in smart livestock farming systems. To increase productivity and animal welfare, farmers can use technology to track their livestock in real time and make well-informed decisions. This innovative approach to data collection is revolutionizing the way livestock farming is managed and has the potential to greatly benefit both farmers and animals [6,7]. Additionally, the data collected can be analyzed to identify patterns and trends that can help farmers improve their processes. By using this technology, farmers can also detect early signs of illness or distress in their animals, leading to better care and potentially higher yields. This can ultimately result in improved animal welfare and overall farm efficiency [7].
Data collection devices in smart livestock farming systems perform various tasks, including animal identification via RFID tags, delivering advisories through teleservices and SMS, facilitating connections among farmers through social media and mobile telephony, and employing sensor-based systems for monitoring. Furthermore, artificial intelligence technologies such as Machine Learning, Cloud computing, and the Internet of Things are used to change the livestock business into a more efficient and data-driven industry [8]. This technological integration allows for improved monitoring of livestock health and behavior, ultimately leading to better decision-making processes within the industry. As a result, farmers and ranchers can optimize their operations and maximize productivity. In smart livestock farming, accelerometers are used to measure animal movement and activity levels, heart rate sensors are used to track cardiovascular function and stress levels, and GPS is used to study cattle grazing behavior and energy expenditure [7]. Accelerometers have been used in [9] to measure the walking, resting, and eating behaviors of animals as well as to calculate energy expenditure. They have also been attached to animals’ legs, necks, ears, or tails to track movement trajectories. Leg-mounted accelerometers are commonly used in dairy cows to measure lying time and walking behavior. Accelerometers can help monitor animal activity and behavior in real time. In [10], GPS was used for animal tracking to determine the location and movement patterns. The system integrates GNSS technology with cellular communication to provide accurate and continuous monitoring of animal behavior and movement. These data can then be analyzed to better understand animal habits and interactions. Other sensors, such as heart rate monitors and temperature monitors, were used in [11,12] to provide a more comprehensive understanding of the animals’ well-being in addition to the behavioral data. In [8], cameras were used to monitor and count livestock animals like pigs. The system involves fitting animals with Bluetooth Low Energy tags and using wireless broadband antennas to track their movements. Additionally, image processing and deep learning methods are employed to identify animals based on camera data. The data collected are then analyzed to provide insights into animal health, behavior, and overall well-being.
Livestock smart farming relies on effective communication protocols to facilitate data exchange and monitoring within the system. These protocols help ensure a seamless integration of various sensors, devices, and systems to manage livestock health and productivity. Understanding the communication protocols used in livestock smart farming is crucial for optimizing efficiency and ensuring the well-being of the animals. A variety of protocols have been used in livestock smart farming, including LoRaWAN, Zigbee, and NB-IoT. Each protocol has its unique advantages and disadvantages; so, it is important to carefully evaluate which one is best suited for a specific farm’s needs. For instance, several studies have applied GNSS technology combined with LPWAN to send GPS coordinates over networks like LoRaWAN, NB-IoT, and Sigfox. Livestock theft management is another use case for livestock location monitoring, with systems using technologies like RFID and GPRS for tagging and identification [10]. GPS coordinates can be tracked in real time to prevent theft and ensure the safety of livestock. LoRaWAN enhances livestock monitoring by offering a beneficial and adaptable solution for real-time comprehensive tracking and oversight while ensuring regulatory compliance. It provides both online and offline monitoring; adaptive dual radio (FSK and LoRaWAN) for optimizing energy, bandwidth, and range; adaptive movement data streaming modes utilizing a vector quantization compression technique; and extended battery longevity [10,13]. The system is designed to improve efficiency and accuracy in livestock management. On the reverse side, Zigbee is used for short-range and low-power wireless communication in livestock monitoring systems. Additionally, Zigbee technology allows for easy scalability and integration with other devices, but it may not be suitable for larger outdoor areas with extensive range requirements. However, Zigbee can still be a useful tool for smaller-scale livestock operations. Similarly to Zigbee, Bluetooth Low Energy (BLE) is a short-range and low-cost wireless technology that is used in indoor smart farming applications for monitoring livestock and poultry feeding environments. BLE has lower costs and power consumption compared to traditional Bluetooth, making it suitable for scenarios requiring high real-time transmission. Additionally, Bluetooth Low Energy (BLE) technology is utilized for short-range communication between devices [14,15,16]. GNSS technology has been integrated with cellular communication for monitoring livestock location, with GPS technology widely used for accurate location estimations.
Cloud computing and Fog computing have significantly changed how smart livestock farming systems work, enabling real-time data gathering, analysis, and decision-making. By utilizing Cloud and Fog computing technologies, farmers are able to monitor and manage their livestock more efficiently and effectively. Integrating Cloud and Fog computing in smart farming systems has the potential to significantly enhance productivity and sustainability in the agricultural industry. Raspberry Pi was utilized as a Fog device for initial data analysis, with the results being transmitted to the Cloud supported by Amazon Web Services (AWS) [17]. A system leveraging Cloud technology, incorporating the ESP2866 Wi-Fi module and HC-05 Bluetooth module, was implemented in [11] for the purposes of data collection and communication. A livestock tracking system was established [5], enabling the use of a Wireless Power Transmitter (WPT) to transmit Radio Frequency signals (RF) via a Wireless Sensor Node (WSN) attached to the livestock, enhancing monitoring capabilities. Furthermore, a range of smart devices and schemes were innovated, such as advanced smart sensors, to further enhance the capabilities of smart livestock farming systems [18,19].
The system described in reference [20,21] was simulated using iFogsim. It utilized an IPex16 CPS to connect sensors and transmit the collected data to the Cloud via an ordinary computer. However, the systems mentioned above were designed with a focus on crop farming, not livestock farming. In those systems, sensor-collected data undergo initial processing in the Fog for latency-sensitive tasks before being transmitted to the Cloud for further processing.
For instance, other related works, such as [1], delved into the software aspect of the system. In livestock farming [22], Machine Learning algorithms like support vector machines and k-nearest neighbors are commonly employed. Computer vision and deep learning techniques were specifically used in [23] to identify undergrown pigs in a group-housed pig room. Data were captured using a top-mounted camera and transmitted to the Cloud via radio links for analysis by employing deep learning techniques.
As Table 1 demonstrate, the majority of studies and research concentrate on various data collection methods, including sensor-based data collection, and Machine Learning algorithms for disease prevention and crop development. Based on the current literature, a limited number of studies, such as [21], have addressed the significance of latency and reduced power consumption in smart livestock systems. The strategy involves bringing the Cloud device closer to the data source with the use of Fog devices. A similar architecture was proposed in healthcare monitoring [24,25,26], demonstrating 36% and 52% total power reduction when processing at the Fog compared to traditional Cloud-based systems, leading to improved efficiency in patient data management. Furthermore, in the domain of traffic management [25], research has shown a 40.88% enhancement in task execution efficiency and a 66.39% reduction in power consumption within the Fog infrastructure, showcasing the applicability of these advancements in optimizing traffic control systems.
This paper introduces a network architecture for smart livestock systems that includes both Fog and Cloud layers. The Fog layer aims to reduce power consumption by processing the data closer to the source, minimize latency through a distributed processing approach, and improve response time by leveraging edge computing capacities, contrasting the higher latency in Cloud-based systems attributed to the distance from data collection devices to the Cloud server. Within the proposed architecture, positioning data collection devices in proximity to the processing layer offers advantages such as faster data processing and reduced latency, enhancing the overall efficiency of the system. Incorporating a Fog layer in the proposed architecture facilitates local processing, enabling immediate responses for applications such as livestock tracking without necessitating data transmission to the Cloud server, thereby enhancing system responsiveness and data privacy.

3. Fog–Cloud-Based Smart Farming System

3.1. Structure of the Proposed Fog–Cloud-Based Smart Farming System

The main difference between the Fog–Cloud-based system and the Cloud-based system is that the former contains a Fog computing layer between the data collection devices (sensors) and the Cloud. The Fog computing layer, consisting of smaller computing devices, provides services such as computing and storing data, which act as the extension of the Cloud on the network’s edge. The purpose of this Fog layer is to use technology, such as virtualization, distributed computing, load balancing, and analytics, to improve overall system performance. The proposed Fog–Cloud-based smart farming system is a three-layer network, with the structure shown in Figure 1. The data collection device consists of sensors that collect the data and send them to the Fog layer. A device consisting of sensors (based on the type of data that need to be collected) is placed on the animal’s body and at strategic locations in the farm area to collect data about the animal and the environment. The Fog layer contains a group of computing devices, i.e., Fog nodes, which will then process the data received from the data collection layer and send the results to the Cloud layer for remote users’ viewing and/or further processing.

3.2. Components of the Proposed Fog–Cloud-Based Smart Farming System

3.2.1. Data Collection Units

The data collection layer consists of wearable devices attached to the livestock to gather data such as the animal’s body temperature, heart rate, and position (standing or in motion). It also contains environmental sensors to measure the temperature, humidity, and other concerned parameters. The collected data are sent to the Fog nodes for processing. In this study, sensors are created using the “sensor” class in iFogSim to simulate a data collection device (Colar). The simulation consists of five scenarios with 2, 4, 8, 16, and 32 sensors. These scenarios are used to model the system with different numbers of sensors. Figure 2 shows an example of the basic structure of the collar. A temperature sensor, a heartbeat sensor, and a pedometer sensor are included in the collar.

3.2.2. Fog Nodes

The Fog node is a critical device; this is where most of the local data processing is performed. The Fog layer consists of multiple Fog nodes for receiving sensed data, temporarily storing and processing the data, and transmitting the results to the Cloud server for user viewing or further processing. The devices are placed locally on the farm. They can communicate with each other in the network to share data and computation loads. Obviously, a distributed system and load balancing strategy are necessary, although they are out of the scope of this paper. Using Fog computing units in a smart farming system retains all the advantages of the traditional Cloud-based systems and has more critical benefits, as follows.
(1)
Low Latency
Latency is the time spent when the data travel from the data collection devices (sensors) to the Cloud server. The Cloud server is usually situated far from farms, and the potential for network problems always exists. This will increase the response time of the entire system. A smart livestock system has some critical requirements for response time, such as in the scenario of the animal tracking system. A Fog layer at the network’s edge (in the farming area), with the capacity of local data processing, will significantly improve the system’s response time as sensed data will be processed locally and only the results (small-size data) are sent to the Cloud server.
(2)
Data Security
In a Cloud-based system, the raw data are transmitted from the collection devices (sensors) to the Cloud for processing. This creates a security risk as raw data could be intercepted while traveling to the Cloud to either be used for malicious purposes or be entirely compromised. With a Fog device handling the processing at the edge network, the raw data do not have to leave the farming area. Only the results of the processing are transmitted to the Cloud server, and encryption of the results can be performed in the Fog nodes.
(3)
Reduced Bandwidth Utilization
In the legacy Cloud-based systems, all the raw data are transmitted to the Cloud server. This process increases the bandwidth (which is not always available) requirements. In a Fog–Cloud-based system, the Fog nodes perform most of the data processing tasks and only transmit the results to the Cloud. This architecture significantly reduces the amount of data to be transmitted. In this study, various classes, such as FogDevice, sensors, and actuators, are imported from the iFogSim library. The “FogDevice” class is used to create Fog and Cloud node objects and to simulate its functional operation, and each instance of a Fog node has characteristics such as name, amount of memory RAM, and idle and busy power consumption.
The “Fog” class will receive data from the “sensor” class and simulate the operation of a Fog node. Devices such as Raspberry Pi, a low-cost and small computer box, could also be used as a Fog node in a real-world system, which provides the capacity for Internet browsing, video processing, and complex data analysis capabilities.

3.2.3. Cloud Server

The Cloud server is a data center with extensive storage and computational power. The Cloud, in this architecture, makes the processed data available to users in the form of reports and graphs from anywhere.

3.2.4. Communication Models for the Proposed System

The proposed Fog–Cloud-based smart farm system is a hierarchical network, with data traveling among multiple layers and nodes, as shown in the signal flow graph in Figure 3. The connectivity is achieved by connecting all the site devices (the data collection devices and Fog devices) to the same WIFI hotspot. Numerous Wireless Access Points will be installed in strategic areas around the farm to broadcast the wireless network. Both ESP32-S and Raspberry Pi 4 support the IEEE 802.11 b/g/n protocol to connect to a broadcasted wireless network. When connected, ESP32-S and Raspberry Pi 4 will use the MQTT (MQ Telemetry Transport) communication protocol to send and receive data from each other. MQ Telemetry Transport (MTQQ) is a lightweight and energy-efficient communication protocol used in IoT for communication between things. Mosquitto, one of the first open-source MQ Telemetry Transport brokers, is used in this type of system.
Figure 3 shows an overview of how the system works. The Node-RED application controls the actuator output and receives sensor readings from ESP32-S using an MQTT protocol (Mosquitto). Both the Node-RED application and the MQTT protocol are run in Raspberry Pi 4. The Mosquitto broker installed in Raspberry Pi is responsible for receiving messages, filtering them, deciding who needs them, and publishing them to subscribed clients. ESP32-S publishes messages under “esp/temperature”, “esp/heartbeat”, and “esp/accelerometer” topics. The Node-RED application (installed in Raspberry Pi) subscribes these messages; then, it can receive temperature, heartbeat, and accelerometer readings using the MQTT protocol. The data are transmitted to the Cloud, and the required action is sent to the actuator.
The total time spent for the collected data to be processed is defined by the Equation (1) below.
T = L i C i + D i j
where T is the time taken for data transmission and, thereafter, for processing in a Fog node (i); L i is the load in the Fog node; C i is the computation capacity of the Fog node; and D i j is the delay resulting from the data traveling from a data collection device (j) to the Fog node (i).
Given that T s is the total time taken by all sensors to collect data from the animal, T s 1 , T s 2 ,…, T s n represent the time that each sensor takes to collect data. The total time T s will be the sum of the time that each sensor takes to collect data, as shown in Equation (2).
T s = T s 1 + T s 2 + T s 3 + + T s n .
Likewise, in Equation (3), T c is the sum of the time taken by all collected data traveling from the sensors to the Cloud.
T c     = T c 1 + T c 2 + T c 3 + + T c n .
In Equation (4), T f is the time taken by the collected data traveling from the sensors to the Fog nodes.
T f = T f 1 + T f 2 + T f 3 + + T f n .
Since the Fog nodes are located in the farm, close to data collection devices, it takes far less time for data to travel from the sensors to the Fog nodes than to the Cloud, as shown in Equations (5)–(7):
T c > T f ,
T c b = T s + T f
In addition,
T f c b = T s + T f ,
Therefore, the total system delay ( T c b ) in the Cloud-based system will be greater than the total time delay ( T f C b ) of the Fog–Cloud-based system, as shown in Equation (8):
T c b > T f c b .
This is suitable for the livestock farming system because it is latency-sensitive, where the sensed data should be processed in real time for scenarios of animal tracking and disease monitoring. Additionally, power consumption will be lower in the Fog–Cloud-based system compared to the conventional Cloud-based system. In this context, Equation (9) calculates the energy ( E F o g ) consumed when the tasks are processed by the Fog nodes.
E F o g = N F o g U F o g + P S e n s e d F o g ,
where C F o g represents the number of tasks performed by a Fog node, P S e n s e d F o g represents the amount of energy used to transmit sensed data to the Fog nodes for processing, and U F o g is the total amount of energy needed to perform a task. By comparison, Equation (10) calculates the energy ( E C l o u d ) consumed when the tasks are performed in the Cloud.
E C l o u d = ( N C l o u d U C l o u d ) + P S e n s e d C l o u d .
In Equation (10), N C l o u d   represents the number of tasks performed by the Cloud, U C l o u d is the total energy needed to perform a task in the Cloud, and P S e n s e d C l o u d represents the amount of energy used to transmit sensed data from the sensors to the Cloud.
Since the Cloud device is located far away from the data collection devices and the Fog nodes closer to the data collection devices, the amount of energy used to transmit sensed data to the Cloud will be superior to the amount of energy needed to transmit sensed data to the local Fog nodes as illustrated in Equation (11).
P S e n s e d C l o u d >   P S e n s e d F o g .
Additionally, due to the high computing and processing capacity of the Cloud device, processing a task will consume more energy than in the Fog device, as shown in Equations (12) and (13):
U C l o u d > U F o g ,
Therefore,
E C l o u d > E F o g .

4. Results

The simulation was conducted using iFogsim. The simulator is used to evaluate resource utilization, such as the bandwidth utilized, the energy utilized by the devices, the latency of the system, and the computation cost [26]. This study proposes two simulation scenarios: a Cloud-based scenario and a Fog–Cloud-based scenario. The two scenarios are then compared regarding power consumption and the system’s latency.
In both scenarios, the devices are configured as shown in Table 2.
In both simulation scenarios, we used LoRaWAN’s characteristics for network communication. LoRaWAN is a Low-Power Wide-Area Network (LPWAN) protocol that uses LoRa (long-range) physical radio communication techniques. Its data transmission ranges between 300 bps and 50,000 bps depending on factors such as poor weather conditions, signal interference, and the distance between the sensors and the gateway. LoRaWan is also a great network communication solution for livestock monitoring systems in remote farms as its low power consumption and long range of data transmission are ideal for the remote framing setup.
The simulation uses 1000 bps of symmetrical (uplink and downlink) data transmission rates for both the Cloud-based and the Fog–Cloud-based models. However, the propagation delay—the amount of time it takes for a signal to go from one place to another—is higher in the Cloud-based model because of the greater distance between the sensors and the ISP router. We consider in this simulated model that the closest animal is 1000 m (one thousand meters) away from the ISP router. The propagation delay is calculated as follows.
P r o p a g a t i o n   D e l a y = D i s t a n c e S p e e d   o f t h e   s i g n a l
The simulation also uses 1000 bps of symmetric bandwidth for the Fog–Cloud-based system. Due to the shorter distance between the Fog devices and the sensors, the propagation delay is smaller. In this design, the processing of sensed data is performed in the Fog layer and only the result is sent to the Cloud.
Additionally, more RAM (64 GB) and computing power are allocated to the Cloud-based simulation scenario because of the massive computing power of the Cloud unit.
We measured the system operation’s delay and energy consumption in both systems (Cloud-based and Fog–Cloud-based). To achieve this, five different setups were built for both scenarios with sensors ranging from 1 to 32.
In the Cloud-based design, the sensors collect data and send them directly to the Cloud through an access point (ISP router). In this method, the processing of sensed data is performed in the Cloud. Figure 4 illustrates how devices are connected in a Cloud-based system in the simulator.
In a real-world farm layout, the ISP router is situated in a farmhouse that is kilometers away from the animal pasture. This is caused by certain networks and, occasionally, electrical limitations. Sensed data are gathered using sensors that are attached to the animal and strategically placed across the pasture. The sensed data will then travel from the sensors to the ISP router and, from there, will be routed to the Cloud.
In the simulated setup, the sensed data travel from the sensors, where they are generated, through the switches (ISP) to the Cloud, where the processing is performed. Then, the resulting action tuple is generated and travels back through the same switches to the actuator to execute the task. The symmetric propagation delay in this scenario is 2 s due to the delay between the sensors and the ISP router. In a real-life setup over a LoRaWAN infrastructure, this delay typically ranges from 0.1 to 0.5 milliseconds. It depends on the physical distance between the sensors and the ISP router, as well as the delay between the ISP router and the Cloud, which commonly ranges between 500 milliseconds to 2 s or more. This depends on the type of infrastructure in use (e.g., fiber, satellite, or cellular) and the distance between the ISP router and the Cloud. For instance, if the Cloud is hosted in New York City (USA) and the farm is located in a small village in Mpumalanga (South Africa), the data must travel through multiple routers and switches to reach the Cloud and return. Other environmental factors, such as trees and terrain in the pasture, also affect the propagation delay. This scenario also assumes that the communication protocol used is LoRaWAN.
In the Fog–Cloud-based system, as shown in Figure 5, data collected from the sensors are processed locally in the Fog nodes and the action is sent to the actuator from the Fog layer. Then, the result is sent to the Cloud for remote viewing or access.
In a real-world setup, the Fog devices will be placed at strategic locations in the animal’s pasture, thus reducing the distance between the sensed data and the processing unit.
The propagation delay in this scenario is 0.1 s (s) due to the shorter distance between the sensors and the Fog nodes. Data travel from the sensors, where they are generated, to the Fog nodes, where they are processed. Then, the resulting action is generated in the Fog layer and sent to the actuator for the execution of the task. In this scenario, only the final result is sent to the Cloud to enable the system’s user to view it from a remote location. Both scenarios (Cloud-based and Fog–Cloud-based) defined above were simulated using iFogsim.
Table 3 shows the results from the simulation performed. In the simulation, one finds the differences in energy consumption and the overall delay of the system. However, it is also worth noting that the processing delay for the execution of each tuple (task sequence of the application) remains the same in the Cloud-based system and the Fog–Cloud-based system. This is because, since the task’s execution delay is not part of this study, the assumption is that the Cloud’s and the Fog’s execution time of each tuple will be the same.
In Figure 6, we compared the overall delays of the proposed system and the Cloud-based system. We conducted the simulation using six different scenarios with 1, 2, 4, 8, 16, and 32 sensors. The simulation results showed that the proposed method outperformed the Cloud-based system in all experiments. This was mainly due to the higher propagation delay of the Cloud-based system. We also observed that as the number of sensors increased, both the Cloud-based and the Fog–Cloud-based systems’ overall delays also increased due to queueing delays that occur when multiple packets are sent to the ISP router or Fog nodes simultaneously. Additionally, the results revealed that the overall latency of the Cloud-based system was 5 to almost 10 times higher than that of the proposed Fog–Cloud-based system due to its higher propagation delay.
Figure 7 shows that the energy consumption is almost similar when using one sensor. This is because of the small packet sizes that are generated when using one sensor. However, when using two or more sensors, the energy consumption is far greater in the Cloud-based than in the Fog–Cloud-based system because of the greater distance that packets need to travel to reach the processing device and back.

5. Conclusions

In this paper, a Fog–Cloud-based architecture was proposed for smart farming systems. A comparison was made between the proposed method and the traditional Cloud-based smart farming, which shows that there is twice as much power consumption and five to ten times higher latency in the Cloud-based system depending on the number of sensors. It was demonstrated that Cloud-based smart farming systems may face challenges including high latency, increased energy consumption, and security risks. These issues arise as raw data have to travel long distances between the farms and the Cloud. It was widely noted that smart livestock systems’ operations, such as disease monitoring or animal tracking, need proper real-time responses. A lack of real-time responses could jeopardize the effectiveness of these systems. The related work has shown that there are insufficient studies conducted on the infrastructure of smart livestock systems. This challenge inspired the development of the Fog–Cloud-based system design, tailored for applications sensitive to latency like livestock disease monitoring and animal tracking. In this system, data are first processed in the local Fog nodes, and only the processed results are sent to the Cloud for remote viewing. This approach enables efficient and effective real-time monitoring and decision-making.
The evaluation compared the proposed Fog–Cloud-based architecture to the traditional Cloud-based design. The proposed technique significantly improved the system’s latency and energy consumption. In specific simulation scenarios, the latency in the Cloud-based design is around five to ten times higher than in our proposed design. The experiments were conducted using iFogsim, a tool specifically created for studying IoT, Fog, and Cloud technologies. LoRaWAN characteristics simulated sensor communication to the Fog/ISP router, while LTE characteristics simulated communication from the ISP router to the Cloud. This was carried out to closely replicate real-life scenarios in the simulation. Overall, the simulation results suggest that the Fog–Cloud-based design is more suitable for a smart livestock farming system than the Cloud-based design, mainly because data processing occurs in the Fog layer.
It is important to note that the execution time of the tuples (tasks within the application) was not considered in this study. Thus, in this study, it was assumed that both the Fog and the Cloud possess sufficient processing power to execute the tuples concurrently.
In our future work, we will extend this work by focusing more on optimizing the execution performance of the tuples. A distributed approach will be used between the Fog nodes to execute the tuples. This approach will also be compared to the standard Cloud-based system in terms of performance and cost-effectiveness. Designing the Fog–Cloud-based system in a real-world situation (farming environment) is also part of our future work. Devices such as ESP32 C3 Mini will be attached to the animal and ESP32 S3 as the Fog node to track the animals and send the results to the Cloud server through a gateway.

Author Contributions

Conceptualization, A.B. and C.T.; methodology, A.B. and C.T.; software, A.B.; validation, A.B.; formal analysis, A.B.; investigation and data curation, A.B.; writing—original draft preparation and writing—review and editing, C.T. and S.D.; supervision, C.T., P.A.O. and D.D.P.; project administration, C.T.; and funding acquisition, C.T. All authors have read and agreed to the published version of the manuscript.

Funding

This work is based on the research supported in part by the National Research Foundation of South Africa (Grant Numbers TTK210408592955) and the TIA Seed fund of TUT.

Data Availability Statement

No new Data were collected for this study.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Mohit, T.; Nikita, J.; Paul, M.; John, B.; Alan, D.; Cristian, O. Connected Cows: Utilizing Fog and Cloud Analytics Toward Data-Driven Decision for Smart Dairy Farming. IEEE Internet Things Mag. 2019, 2, 32–37. [Google Scholar]
  2. Khatate, P.; Savkar, A.; Patil, D. Wearable Smart Health Monitoring System for Animals. In Proceedings of the 2nd International Conference on Trends in Electronics and Informatics, Tirunelveli, India, 11–12 May 2018. [Google Scholar]
  3. Kim, S.; Kim, D. Animal Situation Tracking Service Using RFID, GPS and Sensors. In Proceedings of the Second Internation Conference on Computer and Network Technology, Astana, Kazakhstan, 15–17 August 2018. [Google Scholar]
  4. Bonomi, F.; Milito, R.; Zhu, J. Fog Computing and its role in the internet of things. In Proceedings of the Edition of the Mcc Workshop on Mobile Cloud Computing, New York, NY, USA, 17 August 2012. [Google Scholar]
  5. Beng, L.T.; Kiat, P.B.; Meng, L.M.; Cheng, P.N. Field Testing of IoT Devices for Livestock Monitoring using Wireless Sensor Network, Near Field Communication and Wireless Power Transfer. In Proceedings of the 2016 IEEE Conference on Technologies for Sustainability (SusTech), Singapore, 9–11 October 2016. [Google Scholar]
  6. Tedeschi, L.O.; Greenwood, P.L.; Halachmi, I. Advancements in sensor technology and decision support intelligent tools to assist smart livestock farming. J. Anim. Sci. 2021, 99, skab038. [Google Scholar] [CrossRef]
  7. Singh, J.Y.S.A.; Brar, P.S.; Kour, G. Smart Technologies in Livestock Farming. In Smart and Sustainable Food Technologies; Springer Nature: Singapore, 2022; pp. 25–57. Available online: https://link.springer.com/chapter/10.1007/978-981-19-1746-2_2 (accessed on 20 May 2023).
  8. Terence, S.; Immaculate, J.; Raj, A.; Nadarajan, J. Systematic Review on Internet of Things in Smart Livestock Management Systems. Sustainability 2024, 16, 4073. [Google Scholar] [CrossRef]
  9. Halachmi, I.; Guarino; Bewley, J.; Pastell, M. Smart Animal Agriculture: Application of Real-Time Sensors to Improve Animal Well-Being and Production. Annu. Rev. Anim. Biosci. 2017, 7, 403–425. [Google Scholar] [CrossRef]
  10. Ojo, M.; Viola, I.; Baratta, M.; Giordan, S. Practical Experiences of a Smart Livestock Location Monitoring System Leveraging GNSS, LoRaWAN and Cloud Services. Sensors 2022, 22, 273. [Google Scholar] [CrossRef] [PubMed]
  11. Saravanan, K.; Saraniya, S. Cloud IoT Based Novel Livestock Monitoring and Identification System Using UID. Sens. Rev. 2018, 38, 21–33. [Google Scholar]
  12. Wierig, M.; Mandtler, L.P.; Rottmann, P.; Stroh, V.; Müller, U.; Büscher, W.; Plümer, L. Recording heart rate variability of dairy cows to the cloud—Why smartphones provide smart solutions. Sensors 2018, 18, 2541. [Google Scholar] [CrossRef] [PubMed]
  13. Casas, R.; Hermosa, A.; Marco, Á.; Blanco, T.; Zarazaga-Soria, F.J. Real-Time Extensive Livestock Monitoring Using LPWAN Smart Wearable and Infrastructure. Appl. Sci. 2021, 11, 1240. [Google Scholar] [CrossRef]
  14. Yawen, D.; Sun, G.; Zheng, B.; Qu, Y. Design and Implementation of Intelligent Gateway System for Monitoring Livestock and Poultry Feeding Environment Based on Bluetooth Low Energy. Information 2021, 12, 218. [Google Scholar] [CrossRef]
  15. Nikodem, M.; Paszynski, M.; Kranzlmüller, D.; Krzhizhanovskaya, V.V.; Dongarra, J.J.; Sloot, P.M. Bluetooth Low Energy Livestock Positioning for Smart Farming Applications. In Proceedings of the Computational Science—ICCS 2021. ICCS, Krakow, Poland, 16–18 June 2021; Volume 12745. [Google Scholar] [CrossRef]
  16. Trogh, J.; Plets, D.; Martens, D.; Joseph, W. Bluetooth low energy based location tracking for livestock monitoring. In Proceedings of the 8th European Conference on Precision Livestock Farming (EC-PLF 2017), Nantes, France, 12–14 September 2017; pp. 469–475. [Google Scholar]
  17. Caria, M.; Schudrowitz, J.; Jukan, A.; Kemper, N. Smart Farm Computing Systems for Animal Welfare Monitoring. In Proceedings of the 2017 40th International Convention on Information and Communication Technology, Electronics and Microelectronics (MIPRO), Opatija, Croatia, 22–26 May 2017. [Google Scholar]
  18. Soussi, A.; Zero, E.; Sacile, R.; Trinchero, D.; Fossa, M. Smart Sensors and Smart Data for Precision Agriculture: A Review. Sensors 2024, 24, 2647. [Google Scholar] [CrossRef] [PubMed]
  19. Bersani, C.; Ruggiero, C.; Sacile, R.; Soussi, A.; Zero, E. Internet of Things Approaches for Monitoring and Control of Smart Greenhouses in Industry 4.0. Energies 2022, 15, 3834. [Google Scholar] [CrossRef]
  20. Baghrous, M.; Ezzouhairi, A.; Nabil, B. Deploying Fog Computing in Smart Farming. Int. J. Comput. Digit. Syst. 2020, 9, 1–10. [Google Scholar]
  21. Zamora-Izquierdo, A.M.; Santa, J.; Martinez, A.J.; Martinez, V.; Skarmeta, F.A. Smart Farming IoT Platform based on Edge and Cloud Computing. Biosyst. Eng. 2019, 177, 4–17. [Google Scholar] [CrossRef]
  22. Jukan, A.; Carpio, F.; Masip, X.; Ferrer, J.A.; Kemper, N.; Stetina, U.B. Fog to Cloud Computing for Farming: Low-Cost Technologies, Data Exchange, and Animal Welfare. Computer 2019, 52, 41–51. [Google Scholar] [CrossRef]
  23. Lee, S.; Ahn, H.; Seo, J.; Chung, Y.; Park, D.; Pan, S. Practical Monitoring of Undergrown Pigs for IoT-Based Large-Scale Smart Farm. s. IEEE Access 2019, 7, 173796–173810. [Google Scholar] [CrossRef]
  24. Isa, I.S.B.M.; El-Gorashi, T.E.H.; Musa, M.O.I.; Elmirghani, J.M.H. Energy Efficient Fog-Based Healthcare Monitoring Infrastructure. IEEE Access 2020, 8, 197828–197852. [Google Scholar] [CrossRef]
  25. Alenizi, F.; Rana, O. Minimising Delay and Energy in Online Dynamic Fog Systems. In Proceedings of the 10th International Conference on Advances in Computing and Information Technology, Hague, The Netherlands, 7–10 December 2020; pp. 139–158. [Google Scholar]
  26. Gupta, H.; Dastjerdi, V.A.; Ghosh, K.S.; Buyya, R. iFogSim: A toolkit for modelling and simulation of resource management techniques in the Internet of Things, Edge and Fog computing environments. Softw. Pract. Exp. 2017, 47, 1275–1296. [Google Scholar] [CrossRef]
Figure 1. Structure of the proposed Fog–Cloud-based livestock farming system.
Figure 1. Structure of the proposed Fog–Cloud-based livestock farming system.
Iot 06 00017 g001
Figure 2. Basic structure of a data collection module.
Figure 2. Basic structure of a data collection module.
Iot 06 00017 g002
Figure 3. Signal flow graph of the proposed system.
Figure 3. Signal flow graph of the proposed system.
Iot 06 00017 g003
Figure 4. Cloud-based design.
Figure 4. Cloud-based design.
Iot 06 00017 g004
Figure 5. Fog–Cloud-based design.
Figure 5. Fog–Cloud-based design.
Iot 06 00017 g005
Figure 6. Cloud-based and Fog–Cloud-based overall system delay.
Figure 6. Cloud-based and Fog–Cloud-based overall system delay.
Iot 06 00017 g006
Figure 7. Cloud-based and Fog–Cloud-based energy consumption.
Figure 7. Cloud-based and Fog–Cloud-based energy consumption.
Iot 06 00017 g007
Table 1. Summary of the literature review.
Table 1. Summary of the literature review.
AuthorsResearch ProblemData Collection MethodsResultsSimilarities/Differences
[1]Early detection of lameness in livestockPedometersDetected lameness 3 days earlier with 87% accuracyFocuses on developing the ML algorithm
[5]Develop a low-cost smart farming systemAccelerometersAnimal movement observedFocuses on data collection
[6]Cloud-based livestock monitoringSensorsInsemination is improvedA Fog–Cloud-based system is used
[21]Develop a low-latency systemBody and environmental sensorsBetter performance in Fog–Cloud-based than Cloud-based systemsFocuses on crop farming
[22]Develop a 3-tier system for Precision AgricultureSensorsEarly detection of diseases in plantsFocuses on crop production
[23]Improve the latency of the system using Fog computingCameras and sensorsEarly detection of diseasesFocuses on the software part of the system
[24]Detect undergrown pigs using deep learningCamerasEarly detection of diseasesNo Fog layer in this study
Table 2. Device configuration.
Table 2. Device configuration.
NameBandwidth
Uplink\Downlink
(bps)
Propagation Delay Uplink\Downlink
(s)
Processing Power
(MIPS)
RAM
(GB)
Idle Power
(Watts)
Busy Power (Watts)
10001010,240,00064830.251003
Fog–Cloud-based100010102,400483.25103
Table 3. Simulation results.
Table 3. Simulation results.
Number of Sensors System
Delay (ms)
Energy Consumption (Watts)
1Cloud
Fog–Cloud
1783.332
317.187
5.081
5.001
2Cloud
Fog–Cloud
1835.416
317.383
29.386
16.767
4Cloud
Fog–Cloud
1939.584
345.547
42.606
22.606
8Cloud
Fog–Cloud
2147.916
357.109
80.009
45.794
16Cloud2821.042168.16
Fog–Cloud360.23498.714
32Cloud3737.425360.308
Fog–Cloud396.484190.308
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Biheng, A.; Tu, C.; Owolawi, P.A.; Du Plessis, D.; Du, S. Network Architecture of a Fog–Cloud-Based Smart Farming System. IoT 2025, 6, 17. https://doi.org/10.3390/iot6010017

AMA Style

Biheng A, Tu C, Owolawi PA, Du Plessis D, Du S. Network Architecture of a Fog–Cloud-Based Smart Farming System. IoT. 2025; 6(1):17. https://doi.org/10.3390/iot6010017

Chicago/Turabian Style

Biheng, Alain, Chunling Tu, Pius Adewale Owolawi, Deon Du Plessis, and Shengzhi Du. 2025. "Network Architecture of a Fog–Cloud-Based Smart Farming System" IoT 6, no. 1: 17. https://doi.org/10.3390/iot6010017

APA Style

Biheng, A., Tu, C., Owolawi, P. A., Du Plessis, D., & Du, S. (2025). Network Architecture of a Fog–Cloud-Based Smart Farming System. IoT, 6(1), 17. https://doi.org/10.3390/iot6010017

Article Metrics

Back to TopTop