Next Article in Journal
Spatial-Temporal Variations and Driving Factors of the Coupling and Coordination Level of the Digital Economy and Sustainable Rural Development: A Case Study of China
Previous Article in Journal
Design and Experimentation of Rice Seedling Throwing Apparatus Mounted on Unmanned Aerial Vehicle
Previous Article in Special Issue
ApIsoT: An IoT Function Aggregation Mechanism for Detecting Varroa Infestation in Apis mellifera Species
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Internet of Things-Based Cluster System for Monitoring Lactating Sows’ Feed and Water Intake

1
College of Engineering, South China Agricultural University, Guangzhou 510642, China
2
Maoming Branch, Guangdong Laboratory for Lingnan Modern Agriculture, Guangzhou 510642, China
3
State Key Laboratory of Swine and Poultry Breeding Industry, Guangzhou 510645, China
4
Schools of Automobile, Guangdong Mechanical and Electrical Polytechnic, Guangzhou 510550, China
5
Guangzhou Jiaen Technology Co., Ltd., Guangzhou 510642, China
6
Institute of Facility Agriculture, Guangdong Academy of Agricultural Sciences, Guangzhou 510640, China
*
Author to whom correspondence should be addressed.
Agriculture 2024, 14(6), 848; https://doi.org/10.3390/agriculture14060848
Submission received: 15 April 2024 / Revised: 24 May 2024 / Accepted: 27 May 2024 / Published: 28 May 2024
(This article belongs to the Special Issue Digital Innovations in Agriculture—Series II)

Abstract

:
Acquiring real-time feeding information for monitoring lactating sows and their feeding requirements is a challenging task. Real-time data represent an important input for numerous tasks, such as disease monitoring, nutritional regulation, and feeding modeling. However, concurrently monitoring large numbers of sows and processing the real-time information for modeling is challenging using existing platforms. In this paper, we describe the design and development of a system that monitors and processes sows’ feed and water consumption in real time. The system was custom-developed using open-source networking technologies. The system consists of three components: an electronic sow feeder connected to a central controller via a CAN network, an MQTT service cluster, and a data processing program. The MQTT service cluster uses Netty to develop a single service node, and it uses Zookeeper and Redis to complete node registration, discovery, and scheduling. The data processing program is based on Spark and Flink. We conducted comparative testing of three common codecs (Java Serializer, Marshalling, and Protostuff) to further speed up data transmission. The results of the experiment show that, with three service nodes, the system can concurrently monitor up to 20,000 sows. Moreover, the system achieves optimal performance when monitoring 10,000 sows at the same time, with a TPS of 6399 pcs/s and an RT of 643 ms.

1. Introduction

The Internet of Things (IoT) is applied in various industries, including smart manufacturing [1], smart cities [2], smart healthcare [3], precision agriculture [4], and smart livestock farming [5], through various applications involving machine-to-machine and machine-to-human interactions [6]. Intelligent machines continuously send data to cloud servers via the internet. The data are analyzed and presented as per the requirements of the end-users [7]. The IoT has many applications in pig farming. Monitoring the parameters related to lactating sows is one of the most vital aspects [8,9]. The feed intake and water consumption of lactating sows are required in real time for precision feeding in pig farms. These data are vital for improving feeding practices and enabling the timely prediction of diseases [10,11].
Electronic sow feeders (ESFs) are commonly used to record the feed information of lactating sows [12]. ESF systems are used during the lactation period to control the delivery of feed to individual sows in a farrowing house. Depending on the system, ESFs may also record data for individual feed intake and the timing of eating events, and the data can be rapidly transmitted back to cloud servers through the network [13]. With the help of ESFs and information technology, modern precision feeding systems for lactating sows have demonstrated their ability to meet individual requirements more efficiently [14]. Ma et al. devised an intelligent feeding equipment and network service platform, which can provide a convenient and intelligent feeding method as well as multiple areas of pig management. The platform realizes the recording of the daily feeding amount of pigs from multiple areas [15]. Chen et al. developed a precision feeding system consisting of intelligent feeders, environmental monitoring devices, a wireless data transmission module, and a remote monitoring terminal. The Alibaba Cloud server was connected using a long-range radio (LoRa) module and a general packet radio service (GPRS) module to achieve the long-distance transmission of feed and water intake data [16]. Although the above systems have realized the collection and management of pig feeding information, there is little mention of the number of devices connected to the systems and the implementation details of data transmission.
With the intelligent development of pig farming devices, higher demands have been placed on the stability and concurrency of pig farm IoT systems [17,18]. There are currently some commercial IoT platforms, such as ThingSpeak cloud platform, Microsoft Azure, and other platforms, that can support edge device access [19]. However, in terms of actual use on pig farms, commercial IoT platforms face issues such as cumbersome configuration, difficulty in flexible customization, and high costs [20]. With the application of technologies such as clusters, distributed systems, and microservices in animal husbandry, centralized servers are shifting towards distributed servers [21]. This shift provides new solutions for the development of high-performance IoT systems. A previous study [22] used microservices and cloud paradigms to implement a highly scalable livestock IoT platform. The microservice architecture of a distributed IoT system discussed in detail in [23] consists of a group of microservices that communicate with each other synchronously or asynchronously. Another study [24] involved the design of a sensor network based on a microkernel operating system. Based on the idea of modular design, the functional modules and control modules were organically combined so as to realize the monitoring and collection of farmland and livestock management information.
The aim of this study was to design an Internet of Things-based cluster system for lactating sows utilizing electronic sow feeders, a message queue telemetry transport (MQTT) service cluster, and data processing programs to collect and monitor the feed and water intake of lactating sows in real time. The MQTT server developed based on Netty provides connection services for ESFs. In order to improve the concurrency and stability of the system, an MQTT server cluster suitable for real-time applications in pig farms was built based on Zookeeper. A scheduling server was added to ensure the reasonable distribution of MQTT service nodes. Moreover, this system also includes a data processing platform that can monitor and record feed intake, water consumption, and ESF operating status. Our main objectives were (1) to design and develop a stable ESF and central controller for monitoring lactating sows, (2) to develop a high-concurrency MQTT server cluster to collect real-time values of central controllers attached to the server node, (3) to develop a data processing platform for recording and tallying the collected values at the pig farm, and (4) to utilize a user-friendly interactive interface for displaying real-time information. The present study included the design, implementation, and verification of the system.
The details of this study are presented in Section 4. Section 1 provides a brief description of related work reported in the literature and outlines the objectives for the present study. Section 2 offers technical details regarding the development of the system, including the description of the system architecture, a brief overview of the design of the ESF and central controller, the MQTT server cluster, the data processing program, and the data transmission security. The experimental results, accompanied by case study data, are discussed in Section 3. Section 5 provides a summary, along with conclusions, and outlines the future scope of the study.

2. Materials and Methods

2.1. The Architecture of the System

The system’s architecture (Figure 1) includes three significant components: an electronic sow feeder (Figure 1a) connected to a central controller (Figure 1b) via a CAN network, an MQTT service cluster, and a data processing program. An electronic sow feeder was designed to monitor the feeding status of lactating sows. It was installed above each stall in the experiment and connected to a touch rod (which initiated feed and water discharge upon the sow’s touch), a feed discharge pipe, and a water discharge pipe (Figure 1d) inside the feed trough. A central controller controls all electronic sow feeders within a unit through the controller area network (CAN). This is because the network signal is poor in the remote environment of the pig farm. The use of CAN lines can ensure the stable connection of equipment. In addition, we developed a PDA to set parameters for the electronic feeder through a QR code (Figure 1c). The electronic sow feeder records the daily feed and water intake, and the central controller transmits the data to the MQTT service cluster and data processing program running in the cloud through the MQTT protocol.

2.2. ESF and Central Controller

Figure 1 shows the designed system architecture, which includes the ESF and central controller. Detailed information of the components and instrumentation is provided in Table 1.
An entire circuit setup with its components is included inside the plastic container. The feeder control method adopts STM32 (ST Microelectronics 32-bit Microcontroller) embedded technology (Made by STMicroelectronics, Geneva, Switzerland). The core board chip uses STM32F103VET6 with large-capacity storage. The CPU is an ARM Cortex-M3, and the internal clock frequency of the main chip is increased to 72 MHz. The maximum power dissipation is 434 MW, and the operating temperature range is −40 °C to 85 °C. The main interfaces of the core circuit include CAN-bus communication, RS-232 serial communication, WiFi communication, motor control output, flow meter A/D acquisition, and alarm light display, as shown in Figure 2.
The central controller is a 12-inch touchscreen all-in-one machine (Huaxiang Zhichuang Technology Co., Ltd., Shenzhen, China). The system runs on Windows 10 (Intel(R), Celeron(R) CPU J1900, 1.99 GHz, Intel Corp, Santa Clara, CA, USA), with a memory (RAM) capacity of 4.00 GB. The central controller dynamically records and displays the actual feed intake and water consumption of sows, with the operating interface programmed using the C++ language.

2.3. MQTT Service Cluster

The purpose of the MQTT cluster service is to complete the reception of data and the issuance of operation instructions [25]. In this study, an MQTT server was designed based on the Netty [26] network communication framework to receive and parse data.

2.3.1. MQTT Service Node Design

Netty is a framework for quickly developing high-performance and reliable network servers that is easy to use [27]. The MQTT protocol is a very simple, lightweight information transmission protocol designed for use with restricted equipment, low bandwidth, high latency, or unreliable networks [28]. Many studies have shown that MQTT outperforms other protocols [29,30,31].
This section describes the design of a single-node server based on Netty and MQTT protocols. When the node starts, the ServerBootstrap component of Netty binds to a network port to listen to and process connection requests from the central controller. After a successful connection, the WorkerEventLoopGroup receives data sent by the central controller and allocates processing threads from the thread pool to the corresponding connection channels. The encoding and decoding of pig feeding data are achieved using MqttDecoder and MqttEncoder. Finally, data parsing is performed through a self-written MqttServerHandler. The feed and water intake data are sent to MySQL [32], while the electronic feeder log data are sent to Kafka [33]. The process of the server handling Connect, Subscribe, and Publish requests is depicted in Figure 3.

2.3.2. MQTT Service Cluster Construction

As the number of central controllers in pig farms increases, single-node servers quickly reach performance bottlenecks, making it difficult to monitor a large number of sows in real time. The cluster architecture can upgrade system scalability, stability, and performance at a lower cost [34]. Ensuring the cluster can provide services to the central controller of the pig farm normally during the cluster construction process, and the registration, scheduling, and management of nodes, are very important. The cluster organizational structure is shown in Figure 4.
A.
Registration of cluster nodes
The registration of MQTT service nodes in the cluster is completed using ZooKeeper and Redis. After the successful initialization of MQTT service nodes, corresponding ephemeral nodes are created in Zookeeper. The ephemeral nodes store information such as the MQTT server name, IP (Internet Protocol), port, and the number of connected central controllers. The system utilizes Zookeeper as the registration center, with the scheduling server acting as the Zookeeper client. By employing the Zookeeper node listening mechanism, it detects the online and offline status of MQTT servers and synchronizes data to Redis. The node registration process is shown in Figure 5.
B.
Connection and selection of cluster nodes
The central controller of the pig farm sends data based on the MQTT protocol, so the central controller needs to use socket information (IP and port) to establish a connection with the cluster. Each MQTT node in the cluster has its own socket information, making the central controller unable to establish a connection with the cluster through a unified entry point. Moreover, the service nodes of the cluster need to be scheduled reasonably.
To address the issues of node connection and node scheduling in the cluster, we propose deploying a scheduling server in the MQTT service cluster. This provides a unified connection interface for the central controller and realizes the reasonable scheduling of service nodes. The scheduling server is implemented using the Netty framework, essentially functioning as an HTTP (Hypertext Transfer Protocol) server. The central controller accesses the HTTP interface provided by the scheduling server (Figure 1(1)). After receiving the HTTP request, the system performs authorization validation (Figure 1(2)) and then selects appropriate MQTT service nodes using a load-balancing algorithm (Figure 1(3)). The scheduling server returns the IP and port of the selected node as interface response values to the central controller (Figure 1(4)). After receiving the socket information, the central controller establishes a connection with the target node (Figure 1(5)).
The node-scheduling server selects suitable service nodes for the central controller of the pig farm by implementing load-balancing algorithms. The algorithmic selection result is primarily determined by two factors: the load of service nodes, which refers to the number of connected pig farm controllers, and the weight of server nodes, which represents the performance configuration of the servers.
The load-balancing algorithm adopts the concept of a weighted connection count. It selects nodes with higher weights and lower loads for the central controller each time. Assuming there are n server nodes, the selection rules are as shown in Equation (1).
S k = m i n C ( S i ) / C s u m W ( S i ) , ( i = 0 , 1 , 2 , , n 1 )
where i is the selected server node; C(Si) is the number of connections held by server node i; W(Si) is the weight of server node i; W(Si) > 0; and Csum = ∑C(Si) is the total number of connections held by server nodes in the cluster.
Because Csum is a constant, and division requires more CPU cycles than multiplication, the optimization of the judgment condition can be represented as in Equation (2).
C ( S k ) × W ( S i ) < C ( S i ) × W ( S k )
When there are multiple nodes in the cluster, this rule is utilized to sort and identify the node that currently has a lower load and higher weight.

2.3.3. Transmission Security Design

Devices may be subject to malicious connections from unrelated devices when service nodes provide MQTT connections externally [35]. This can lead to increased server load and affect normal operation. Because the MQTT CONNECT message permits the inclusion of a username and password, the system is designed with a dynamic password-generation algorithm for authentication during the establishment of connections by the central controller.
The core concept of dynamic password generation is illustrated in Figure 6 and can be summarized as follows: (1) randomly generate a string S of length len; (2) extract characters from indices m, m − m/2, and m + m/2, convert these three characters to decimals, and calculate Num; (3) calculate result by combining Num with the system time (Time); (4) convert the result to a hexadecimal and insert it at position S[m] in the original string S to generate a new string S′.
The algorithm incorporates the current system time into the calculation, enabling the addition of timeliness to the generated verification code. The summation of the split characters will ignore the seconds when the time format is set to “yyyy-MM-dd-hh-mm”. The system will yield the same result when verifying the verification code within one minute. If the time format changes to “yyyy-MM-dd-hh”, then the expiration time changes from one minute to one hour. Additionally, the efficiency of authentication is improved by sending the dynamic password only once for authentication. However, the password generation algorithm requires setting factory information for the central controller in the system, including registration string length (len), index (m), and time format. The algorithm is suitable for scenarios where device registration information can be prepared in advance.

2.3.4. Integration of ProtoStuff Encoder and Decoder

Netty can integrate third-party encoders to accelerate data transmission efficiency. We compared mainstream serializers such as Java Serializer, Marshalling, and Protostuff. The experimental results demonstrate that Protostuff exhibits the highest efficiency. Therefore, we ultimately finalized the integration with Protostuff. Due to the absence of corresponding encoders and decoders in Netty, users need to implement Protostuff encoders and decoders by themselves. The Protostuff encoder and decoder need to inherit from the MessageToByteEncoder class and the ByteToMessageDecoder class provided by Netty. It is also necessary to override the encode() and decode() methods within the inherited classes. Thus, the data flow sent and received by the MQTT server is directed to the Protostuff encoder and decoder for processing.

2.4. Data Processing Program

The system was built on a big data framework to establish a data processing platform for the statistical analysis of data. The platform was built upon HDFS (Hadoop Distributed File System) [36] and Spark [37] to establish an offline data warehouse, which is utilized for processing parsed sow production data. The data platform constructs hierarchical dimension tables, including fields such as pig farm ID, house number, stall number, entry time, exit time, and farrowing date. The data platform utilizes dimensional tables to perform statistical analyses on litter size, number of live births, feed intake, water intake, and other data at different time intervals and pig farm granularities. The system utilizes Kafka and Flink for the real-time collection and processing of controller log data. The system conducts filtering and aggregation operations in Flink to calculate the number of devices online, the quantity of alarms, alarm information, and operational dynamics for intelligent devices in each pig farm. The architecture of the data processing platform is illustrated in Figure 7.

2.5. System Testing Methods

2.5.1. Test Environment

The system described in this paper was deployed on three Alibaba Cloud servers. The servers are of the shared computing type n4 (ecs.n4.small). The configuration information parameters are as follows: Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50 GHz, 1 vCPU, 2 GB RAM, and 100 GB HDD. The operating system was Alibaba Cloud Linux release 3, and JDK version 1.8 was used. Additionally, two computers with 8-core CPUs were used as load-testing machines. The detailed configuration information parameters are as follows: Intel(R) Core(TM) i5-1035G1 processor, 16 GB RAM, 500 GB solid-state drive, and Windows 10 operating system.

2.5.2. Test Indicators

Transactions per second (TPS): TPS is a performance metric for system processing capability, indicating the number of messages processed per second. A higher TPS indicates better system performance.
System response time (RT): RT is the time it takes for the system to respond to user input or requests. A shorter system response time indicates better system performance.
Error rate (ER): ER is the number of request errors as a percentage of the total number of requests.

2.5.3. Test Methods

A.
Performance Testing of the Scheduling Server
The test involved performance testing of the scheduling server. The performance of the scheduling server was tested and compared with mainstream Tomcat web applications. The Tomcat web application was written in the Java programming language. We employed JMeter to conduct separate tests on both the Tomcat web application and the scheduling server [38]. The testing process was as follows: (1) Ten sets of HTTP requests were configured in JMeter. (2) The request threads were configured to start and complete within 3 s for each of the three cycles. (3) The comparison of the response time, throughput, and failure rate of the two systems was based on the JMeter aggregated report.
B.
Load-balancing algorithm correctness testing
The test utilized three server nodes: node1, node2, and node3. The weight ratio among the three nodes was 6:3:1 with an initial connection count of 0. The testing machine sent HTTP requests to the scheduling server to trigger the load-balancing algorithm. After receiving responses, the testing machine recorded the node selection results to verify the correctness of the algorithm. The test evaluated the correctness of the algorithm under scenarios of node failure and reconnection after disconnection. The testing process was as follows: (1) Firstly, all three server nodes were simultaneously started. Then, during the test machine sending the request, we shut down the server node1. (2) Firstly, both server node2 and node3 were simultaneously started. Then, during the test machine sending the request, we opened server node1. (3) We recorded the node selection results.
C.
Cluster Performance Testing
The average response time and the number of requests processed per unit time by the cluster in handling MQTT requests were tested using JMeter software (version: 5.6.2). The testing process was as follows: (1) We configured multiple sets of MQTT request counts and completed initialization within 1 s. (2) Each MQTT request sent a 507 byte JSON string to the server. (3) The cluster parsed the data and replied with a successful reception message.
D.
Encoding and decoding efficiency testing
In order to test the impacts of different encoding and decoding methods on MQTT server data transmission, we compared the performances of three encoding and decoding methods: Java serialization, Marshalling, and Protostuff. The testing process was as follows: (1) The testing machine was configured with 100 thread groups and sent data three times. It sent 100, 500, and 1000 packets each time. The packet size was 1250 bytes and included the current timestamp information T1. (2) The tested program appended the current timestamp information T2 to the data packet after completing data parsing and sent the data packet back to the load-testing machine. (3) The testing machine calculated the response time Trs of the program based on the two timestamps (T1 and T2) in the packet.
T r s = T 2 T 1

3. Results

3.1. Test Results

3.1.1. Scheduling Server Performance Test Results

The test results are shown in Figure 8a,b. The response time of the scheduling server was within 250 ms under 22,000 requests. The overall response time of the scheduling server was faster than that of the Tomcat web application. The TPS of the Tomcat Web application peaked at 6301 pcs/s with 16,000 requests, accompanied by a response time of 153 ms. The TPS of the scheduling server peaked at 7351 pcs/s with 18,000 requests, accompanied by a response time of 145 ms. The scheduling server exhibited an increase of 1050 pcs/s compared to the Tomcat application. The Tomcat web application and the scheduling server experienced request failures at 20,000 and 22,000 request counts, respectively. The failure rates of both began to increase after the number of requests exceeded 20,000. Clearly, the increase in resource utilization led to a higher failure rate.

3.1.2. Load-Balancing Algorithm Correctness Test Results

The test results are shown in Figure 8c,d. Figure 8c shows the change in node connections when node1 crashes. When node1 was shut down after the 5000th request, the connection counts of node2 and node3 gradually approached a ratio of 3:1. Figure 8d illustrates the change in node connection count during the reconnection of node1. Node1 was prioritized for connection requests after it was started at the 1500th request. Finally, the connection ratio of the three nodes tended towards 6:3:1.
The test results indicate that nodes with higher weights received more connections, but they did not hold all connections. As the number of requests increased, the proportion of connections among all nodes tended to approach the ratio of node weights. The results demonstrate that the load-balancing algorithm was influenced by both weights and connection counts, and it functioned properly even during node failures and reconnects.

3.1.3. Cluster Performance Test Results

The test results are shown in Figure 8e. When the number of requests reached 4000, 6000, and 8000, the TPS of the cluster gradually increased to 3699 pcs/s, 5917 pcs/s, and 6050 pcs/s respectively. When the number of requests reached 10,000, the TPS peaked at 6399 pcs/s, with a corresponding response time of 643 ms. After the number of requests exceeded 10,000, the TPS gradually decreased as the system reached its bottleneck. When there were 20,000 requests, the TPS was 3738 pcs/s, with a response time of 1308 ms. The test results indicate that the system performed well with 10,000 connections. Overall, it was capable of meeting the communication requirements of the central controller in pig farms.

3.1.4. Encoding and Decoding Efficiency Test Results

The test results are shown in Figure 8f. Under the test with 10,000 data packets, Protostuff showed a response time of 258 ms, while Marshalling and Java serialization showed 348 ms and 376 ms. The test results indicate that Java serialization had the longest response time, while Protostuff had the shortest response time. The advantages of Protostuff are more obvious with many data.

3.2. PC and App Application Interface

The system supports real-time access from both mobile phones and computers. The equipment status interface (Figure 9a) provides real-time displays on the deployment, online, and abnormal status of electronic sow feeding in the pig farm, along with detailed alarm information prompts. When the sow’s feed intake is less than 40% of the planned feeding amount set by the electronic sow feeding, the system determines that the sow’s feed intake is insufficient. Clicking on the number allows for querying the location of the alarmed electronic sow feeding in the stall. Figure 9b provides a summary of information for each farrowing house, including the number of sows, total feed intake for the day, and total feed intake for the batch. The feeding status interface displays detailed information for each sow in the stall (Figure 9c), including its ear tag number, farrowing information, and feed intake level. The system also supports displaying historical feed intake data for the sow since its entry into the stall in the form of a line graph. The feeding scheme interface (Figure 9d) displays the feeding plan for sows throughout the entire farrowing cycle, including key information such as daily feeding schedules and feed-to-water ratios.
As shown in Figure 10, the PC interface displays the online status and detailed information of the MQTT server nodes in the cluster. This information includes TCP (Transmission Control Protocol) connection count, weight information, and node IP addresses, as well as the CPU, memory, and disk usage of the servers. Additionally, the system monitors the resource usage of key components such as MySQL, Zookeeper, Redis, and Kafka. When the system encounters abnormalities, it will notify administrators via email for timely resolution.
The system displays statistical data after the completion of data platform processing in the backend management interface (as shown in Figure 11). The interface presents data such as feed and water intake per farrowing house, daily farrowing statistics, sow feeding plans, and sow anomalies. Additionally, it allows for querying detailed meal information for each sow throughout the day.

4. Discussion

4.1. Analysis of Feeding Behaviors in Pig Farms

This system is installed at the ZhongRenWang sow farm in Baise City, Guangxi Province, China (longitude: 105.465639, latitude: 24.595144). We installed equipment in five farrowing houses of the pig farm, with each farrowing house installing 1 central controller and 59 electronic sow feeders. In this section we analyze the feeding data of lactating sows collected from 1 June 2023 to 1 February 2024. The fields of the original data are shown in Table 2.
We eliminated data with negative values for feed and water intake and discontinuous entry dates. The time range of the production data of each lactating sow is from the time of entry to the stall to the time of exit from the stall. After cleaning the data, the production data of 1447 lactating sows were obtained. Moreover, descriptive analysis of the obtained data was performed using SPSS.

4.1.1. Production Interval Days Frequency Statistics

We calculated the frequency of different production interval days by analyzing the time intervals between sows in the same stall within each farrowing house (i.e., the time from the end of one sow’s lactation to the beginning of the next sow’s lactation). The time interval was calculated by subtracting the entry time of the next sow from the exit time of the previous sow. Finally, after the calculation of all stalls was completed, the number of occurrences of different time intervals was counted.
The frequency distribution of production interval days for each farrowing house is shown in Figure 12a. SPSS statistical indicators are shown in Table 3. The highest frequency days in each farrowing house are 8 d, 4 d, 5 d, 5 d, and 8 d. The average production interval days are 10.79 d, 8.06 d, 6.95 d, 12.29 d, and 12.29 d. These data show that the production interval days of the pig farm range from 6.95 d to 12.29 d, and the production rhythm of the No. 2 farrowing house is faster than that of other houses.

4.1.2. Distribution of Weaning Days Frequency Statistics

Figure 12b shows the frequency distribution of weaning days for lactating sows. It represents the number of days post-farrowing when sows finish lactation. The number of weaning days was obtained by subtracting the farrowing date from the exit stall date of the lactating sow.
SPSS statistical indicators are shown in Table 3. The most frequent weaning days for each farrowing house are 21 d, 23 d, 19 d, 18 d, and 21 d. The data reflect the fact that the sow farms will wean the lactating sows around 20 days. Weaning in intensive pig production usually occurs between days 21 and 28 of age, which is beneficial for sow recovery and piglet survival [39]. Another frequently occurring weaning day in the No. 5 farrowing house is Day 13. This indicates that early weaning occurred in the farrowing house during a specific period.

4.1.3. Distribution of Prepartum Days Frequency Statistics

Figure 12c shows the frequency distribution of prepartum days for sows. It represents the number of days before parturition during which lactating sows entered the farrowing house. The number of prepartum days was obtained by subtracting the entry date from the farrowing date of the lactating sow.
SPSS statistical indicators are shown in Table 3. The most frequent prepartum days in each farrowing house are 13 d, 3 d, 12 d, 6 d, and 11 d. In intensive pig production, sows will enter the farrowing house about 7 days before parturition [40]. The average data indicate that the farm typically places lactating sows in the farrowing house around 5.03 d–13.16 d before farrowing, which is basically in line with the production rules of intensive pig farms. It is noteworthy that 94 sows in the No. 2 farrowing house were placed in the farrowing house only 3 days before farrowing. This may have increased the sows’ stress response. The cause of this situation may be related to the fast production pace of this farrowing house.

4.1.4. Feed and Water Intake of Sows

Through the above analysis, it has been made evident that sows in this pig farm enter the farrowing house 10 days before farrowing and are weaned 20 days after farrowing. Therefore, the average feed intake and average water consumption levels of sows within this time range were calculated for analysis. The results are shown in Figure 13. Sows showed a noticeable decrease in both feed intake and water consumption in the 3 days before farrowing. Sows consumed only a small amount of water and hardly ate on the day of farrowing. After farrowing, the feed intake and water consumption of sows started to increase gradually day by day. The growth rate was fastest during the first 7 days, slowed down between days 7 and 14, and stabilized after 14 days. In some farrowing houses, feed intake and water consumption decreased between 18 and 20 days. After consulting with the farrowing house manager, this was found to be related to the early weaning practice employed by the farm.
It is difficult to collect accurate feeding data for each production batch in traditional pig farms. Digital devices and systems can effectively address this issue. The production interval days can effectively reflect the production efficiency of the farrowing house [41]. The lactating sows at an average of 4.8 days after weaning have a lower anestrus rate [42]. By 1 week after weaning, 90–95% of the multiparous sows are expected to exhibit estrus [43]. Pig farm managers can utilize this system to track the duration between production cycles in the farrowing house. Additionally, the production rhythm of the farrowing house should be reasonably arranged based on the duration of the lactating sow’s estrus cycle.
Related research indicates that extending the weaning age from 19 to 28 days has a positive effect on pig performance in the nursery, resulting in increased body weight sold per pig weaned. This suggests that 25 days is the optimal age for weaning [41,44]. Furthermore, increasing the weaning age from 18.5 to 24.5 days positively affected pig performance by increasing the average daily gain and feed intake [45]. Using digital technology to count the number of prepartum and weaning days can help correct erroneous production strategies on pig farms. Furthermore, tracking the feed and water intake of lactating sows on different days will aid in establishing appropriate feeding plans for future pig farms.

4.2. IoT of Pig Farm

We focused on constructing an Internet of Things (IoT) system specifically designed for the feeding requirements of lactating sows. Table 4 shows the architectural layers of the present and earlier systems, as well as data displays, data transmission, and cluster technology, confirming that the proposed monitoring system is reasonable compared to other similar systems.
As the level of technology in pig farms increases, an increasing number of intelligent devices are being employed. Various intelligent devices are used in farrowing houses, such as environmental monitoring equipment [47] and weighing devices [49]. Different intelligent devices can complement each other’s functional deficiencies. However, the data barriers between different devices result in poor interoperability among them. This phenomenon is attributed to the adoption of different communication protocols and data formats by intelligent devices produced by different manufacturers. It is important to research universal data formats and communication protocols applicable to intelligent devices in pig farming [50]. Due to the lack of standardization in communication protocols for intelligent devices, the development of IoT platforms currently faces challenges, including high complexity and poor adaptability. The IoT platform struggles to meet the connectivity requirements of various types of intelligent devices.
With the further development of deep learning, intelligent cameras and recording devices have begun to be used in pig farms. They play an important role in disease monitoring [51], behavior monitoring [52], and video-based weight estimation [53]. The collection and storage of unstructured data such as video and audio also face challenges. The next focus of our research will be on meeting the connectivity requirements of diverse intelligent devices and achieving the remote collection of unstructured data (with a focus on audio and video) based on the developed system. In addition, pig farms have a high demand for the digital management of personnel, pigs, vehicles, and materials. It will be important to improve the management level of pig farms and prevent African swine fever by building a comprehensive digital platform for the entire pig farm using digital technology [54].
Establishing a cluster effectively addresses the issue of system concurrency in order to cope with the increase in intelligent equipment in pig farms. The volume of data in the Internet of Things (IoT) is also enormous. Effective data processing and analysis are required to extract useful information and insights. However, this requires powerful computing and data analysis capabilities [55]. The maturity of e-commerce platforms has a certain reference value for the pig farm IoT. E-commerce platforms need to deal with large amounts of product information, order data, and user information. Pig farm IoT systems also need to manage large amounts of pig data, sensor data, and environmental data. Efficient data storage and processing systems can be established drawing from the data management experience of e-commerce platforms. By leveraging the data management experience of e-commerce platforms, efficient data storage and processing systems can be developed to effectively manage and analyze pig data. In the process of digitization in pig farming, drawing from the experiences of other industries can accelerate its development. However, it is necessary to customize the design according to the characteristics and needs of pig farming.

4.3. Limitations

4.3.1. Accurate Acquisition of Feed and Water Intake for Lactating Sows

The feed and water intake data described in this article refer to the amounts dispensed by the sow electronic feeder. We assume that the sow consumes all the dispensed feed and water. However, this assumption may not always hold true, highlighting a limitation that needs to be addressed in future work. References [12,56,57] suggest that using load cells to accurately measure pig feed intake is an effective solution.

4.3.2. Multi-Dimensional Data Collection and In-Depth Data Analysis

This article describes the remote monitoring of feed and water intake for lactating sows. However, actual production requires the collection of additional data, such as feeding times, body weight, litter size, weaning litter size, and weaning litter weight. Gathering more comprehensive data and scientifically analyzing them in conjunction with feed and water intake will help pig farm managers develop more effective feeding plans and advance the intelligent feeding of lactating sows.

5. Conclusions

We developed a smart IoT feeding system for lactating sows. The system implements an MQTT server based on the Netty framework to collect, transmit, parse, and store information regarding feed intake, water consumption, and the operational status of electronic sow feeders from the cloud. The system implements clustered job scheduling based on an HTTP server and a custom load-balancing algorithm for node selection. Additionally, we utilized the Spark and Flink computing frameworks to construct a big data analytics platform. This study lays the foundation for further in-depth analysis of sow feeding data. In actual operation on a pig farm, the system runs stably and can provide real-time feedback on sow feeding conditions. It holds practical value for application in the production and construction of pig farms.

Author Contributions

X.H.: writing—original draft, writing—review and editing, conceptualization, methodology, investigation, data curation, software, formal analysis, validation, resources. Z.Z.: writing—review and editing, supervision, conceptualization, resources, funding acquisition. Y.L. (Yanhua Liu): investigation, data curation, software, formal analysis, resources, conceptualization, funding acquisition. E.L.: data curation, investigation, methodology, software. J.X.: data curation, investigation, methodology, software. F.W.: data curation, resources, investigation, review, software. Y.L. (Yizhi Luo): investigation, data curation, formal analysis, resources. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Guangzhou Key Research and Development Project (2023B03J 1363), Special Fund for the Rural Revitalization Strategy of Guangdong (2023TS-3, 2024TS-3), Key Laboratory of Modern Agricultural Intelligent Equipment in South China, Ministry of Agriculture and Rural Affairs, China (HNZJ202209), Guangzhou Basic and Applied Research Project (2023A04J0752), Independent Research Project of Maoming Laboratory (2021ZZ003, 2021TDQD002), and Fundamental Research Funds for the State Key Laboratory of the Swine and Poultry Breeding Industry (ZQQZ-25), (2023QZ-NK16).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

Because the raw data involve production privacy on commercial pig farms, the data presented in this study are available upon request from the corresponding author.

Acknowledgments

We acknowledge Guangzhou Jiaen Technology Co., Ltd. for the materials and facilities.

Conflicts of Interest

Author Feiren Wang was employed by the company Guangzhou Jiaen Technology Co., Ltd. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

References

  1. Wang, B.; Tao, F.; Fang, X.; Liu, C.; Liu, Y.; Freiheit, T. Smart Manufacturing and Intelligent Manufacturing: A Comparative Review. Engineering 2021, 7, 738–757. [Google Scholar] [CrossRef]
  2. Laufs, J.; Borrion, H.; Bradford, B. Security and the Smart City: A Systematic Review. Sustain. Cities Soc. 2020, 55, 102023. [Google Scholar] [CrossRef]
  3. Deebak, B.D.; Al-Turjman, F. Smart Mutual Authentication Protocol for Cloud Based Medical Healthcare Systems Using Internet of Medical Things. IEEE J. Sel. Areas Commun. 2021, 39, 346–360. [Google Scholar] [CrossRef]
  4. Roy, S.K.; De, D. Genetic Algorithm Based Internet of Precision Agricultural Things (IopaT) for Agriculture 4.0. Internet Things 2022, 18, 100201. [Google Scholar] [CrossRef]
  5. Pereira, W.F.; Fonseca, L.D.S.; Putti, F.F.; Góes, B.C.; Naves, L.D.P. Environmental Monitoring in a Poultry Farm Using an Instrument Developed with the Internet of Things Concept. Comput. Electron. Agric. 2020, 170, 105257. [Google Scholar] [CrossRef]
  6. Gaikwad, S.V.; Vibhute, A.D.; Kale, K.V.; Mehrotra, S.C. An Innovative IoT Based System for Precision Farming. Comput. Electron. Agric. 2021, 187, 106291. [Google Scholar] [CrossRef]
  7. Misra, N.N.; Dixit, Y.; Al-Mallahi, A.; Bhullar, M.S.; Upadhyay, R.; Martynenko, A. IoT, Big Data, and Artificial Intelligence in Agriculture and Food Industry. IEEE Internet Things J. 2022, 9, 6305–6324. [Google Scholar] [CrossRef]
  8. Gauthier, R.; Largouët, C.; Dourmad, J.-Y. Prediction of Litter Performance in Lactating Sows Using Machine Learning, for Precision Livestock Farming. Comput. Electron. Agric. 2022, 196, 106876. [Google Scholar] [CrossRef]
  9. Gauthier, R.; Largouët, C.; Bussières, D.; Martineau, J.-P.; Dourmad, J.-Y. Precision Feeding of Lactating Sows: Implementation and Evaluation of a Decision Support System in Farm Conditions. J. Anim. Sci. 2022, 100, skac222. [Google Scholar] [CrossRef]
  10. Chen, W.-E.; Lin, Y.-B.; Chen, L.-X. PigTalk: An AI-Based IoT Platform for Piglet Crushing Mitigation. IEEE Trans. Ind. Informat. 2021, 17, 4345–4355. [Google Scholar] [CrossRef]
  11. Torres, A.B.B.; Da Rocha, A.R.; Coelho Da Silva, T.L.; De Souza, J.N.; Gondim, R.S. Multilevel Data Fusion for the Internet of Things in Smart Agriculture. Comput. Electron. Agric. 2020, 171, 105309. [Google Scholar] [CrossRef]
  12. Vargovic, L.; Hermesch, S.; Athorn, R.Z.; Bunter, K.L. Feed Intake and Feeding Behavior Traits for Gestating Sows Recorded Using Electronic Sow Feeders. J. Anim. Sci. 2021, 99, skaa395. [Google Scholar] [CrossRef]
  13. Halachmi, I.; Guarino, M.; Bewley, J.; Pastell, M. Smart Animal Agriculture: Application of Real-Time Sensors to Improve Animal Well-Being and Production. Annu. Rev. Anim. Biosci. 2019, 7, 403–425. [Google Scholar] [CrossRef] [PubMed]
  14. Gaillard, C.; Dourmad, J.-Y. Application of a Precision Feeding Strategy for Gestating Sows. Anim. Feed. Sci. Technol. 2022, 287, 115280. [Google Scholar] [CrossRef]
  15. Ma, W.; Fan, J.; Zhao, C.; Wu, H. The Realization of Pig Intelligent Feeding Equipment and Network Service Platform. In Computer and Computing Technologies in Agriculture XI; Li, D., Zhao, C., Eds.; IFIP Advances in Information and Communication Technology; Springer International Publishing: Cham, Switzerland, 2019; Volume 546, pp. 473–484. ISBN 978-3-030-06178-4. [Google Scholar]
  16. Chen, C.; Liu, X.; Liu, C.; Pan, Q. Development of the Precision Feeding System for Sows via a Rule-Based Expert System. Int. J. Agric. Biol. Eng. 2023, 16, 187–198. [Google Scholar] [CrossRef]
  17. Hussain, F.; Hussain, R.; Hassan, S.A.; Hossain, E. Machine Learning in IoT Security: Current Solutions and Future Challenges. IEEE Commun. Surveys Tuts. 2020, 22, 1686–1721. [Google Scholar] [CrossRef]
  18. Friha, O.; Ferrag, M.A.; Shu, L.; Maglaras, L.; Wang, X. Internet of Things for the Future of Smart Agriculture: A Comprehensive Survey of Emerging Technologies. IEEE/CAA J. Autom. Sin. 2021, 8, 718–752. [Google Scholar] [CrossRef]
  19. Chamara, N.; Islam, M.D.; Bai, G.F.; Shi, Y.; Ge, Y. Ag-IoT for Crop and Environment Monitoring: Past, Present, and Future. Agric. Syst. 2022, 203, 103497. [Google Scholar] [CrossRef]
  20. Prakash, C.; Singh, L.P.; Gupta, A.; Lohan, S.K. Advancements in Smart Farming: A Comprehensive Review of IoT, Wireless Communication, Sensors, and Hardware for Agricultural Automation. Sens. Actuators A Phys. 2023, 362, 114605. [Google Scholar] [CrossRef]
  21. Dineva, K.; Atanasova, T. Design of Scalable IoT Architecture Based on AWS for Smart Livestock. Animals 2021, 11, 2697. [Google Scholar] [CrossRef]
  22. Mateo-Fornés, J.; Pagès-Bernaus, A.; Plà-Aragonés, L.M.; Castells-Gasia, J.P.; Babot-Gaspa, D. An Internet of Things Platform Based on Microservices and Cloud Paradigms for Livestock. Sensors 2021, 21, 5949. [Google Scholar] [CrossRef] [PubMed]
  23. Dineva, K.; Atanasova, T. Architectural ML Framework for IoT Services Delivery Based on Microservices. In Distributed Computer and Communication Networks; Vishnevskiy, V.M., Samouylov, K.E., Kozyrev, D.V., Eds.; Lecture Notes in Computer Science; Springer International Publishing: Cham, Switzerland, 2020; Volume 12563, pp. 698–711. ISBN 978-3-030-66470-1. [Google Scholar]
  24. Si, L.F.; Li, M.; He, L. Farmland Monitoring and Livestock Management Based on Internet of Things. Internet Things 2022, 19, 100581. [Google Scholar] [CrossRef]
  25. Liu, X.; Zhang, T.; Hu, N.; Zhang, P.; Zhang, Y. The Method of Internet of Things Access and Network Communication Based on MQTT. Comput. Commun. 2020, 153, 169–176. [Google Scholar] [CrossRef]
  26. Maurer, N.; Wolfthal, M.A. Netty in Action; Manning Publications: Shelter Island, NY, USA, 2015; ISBN 978-1-61729-147-0. [Google Scholar]
  27. Amoretti, M.; Pecori, R.; Protskaya, Y.; Veltri, L.; Zanichelli, F. A Scalable and Secure Publish/Subscribe-Based Framework for Industrial IoT. IEEE Trans. Ind. Inf. 2021, 17, 3815–3825. [Google Scholar] [CrossRef]
  28. Mishra, B.; Kertesz, A. The Use of MQTT in M2M and IoT Systems: A Survey. IEEE Access 2020, 8, 201071–201086. [Google Scholar] [CrossRef]
  29. Glaroudis, D.; Iossifides, A.; Chatzimisios, P. Survey, Comparison and Research Challenges of IoT Application Protocols for Smart Farming. Comm. Com. Inf. Sc. 2020, 168, 107037. [Google Scholar] [CrossRef]
  30. Naik, N. Choice of Effective Messaging Protocols for IoT Systems: MQTT, CoAP, AMQP and HTTP. In Proceedings of the 2017 IEEE International Systems Engineering Symposium (ISSE), Vienna, Austria, 11–13 October 2017; IEEE: Vienna, Austria, 2017; pp. 1–7. [Google Scholar]
  31. Luzuriaga, J.E.; Perez, M.; Boronat, P.; Cano, J.C.; Calafate, C.; Manzoni, P. A Comparative Evaluation of AMQP and MQTT Protocols over Unstable and Mobile Networks. In Proceedings of the 2015 12th Annual IEEE Consumer Communications and Networking Conference (CCNC), Las Vegas, NV, USA, 9–12 January 2015; pp. 931–936. [Google Scholar]
  32. Nichter, D. Efficient MySQL Performance; O’Reilly Media, Inc.: Sonoma County, CA, USA, 2021; ISBN 978-1-09-810506-8. [Google Scholar]
  33. Calderon, G.; del Campo, G.; Saavedra, E.; Santamaría, A. Monitoring Framework for the Performance Evaluation of an IoT Platform with Elasticsearch and Apache Kafka. Inf. Syst. Front. 2023, 1–17. [Google Scholar] [CrossRef]
  34. Nguyen, N.; Kim, T. Toward Highly Scalable Load Balancing in Kubernetes Clusters. IEEE Commun. Mag. 2020, 58, 78–83. [Google Scholar] [CrossRef]
  35. Yazdinejad, A.; Parizi, R.M.; Dehghantanha, A.; Zhang, Q.; Choo, K.-K.R. An Energy-Efficient SDN Controller Architecture for IoT Networks with Blockchain-Based Security. IEEE Trans. Serv. Comput. 2020, 13, 625–638. [Google Scholar] [CrossRef]
  36. Mostafaeipour, A.; Jahangard Rafsanjani, A.; Ahmadi, M.; Arockia Dhanraj, J. Investigating the Performance of Hadoop and Spark Platforms on Machine Learning Algorithms. J. Supercomput. 2021, 77, 1273–1300. [Google Scholar] [CrossRef]
  37. Zhang, X.; Li, X.; Du, H.; Ruiz, R. Task Scheduling for Spark Applications with Data Affinity on Heterogeneous Clusters. IEEE Internet Things J. 2022, 9, 21792–21801. [Google Scholar] [CrossRef]
  38. Wang, J.; Wu, J. Research on Performance Automation Testing Technology Based on JMeter. In Proceedings of the 2019 International Conference on Robots & Intelligent System (ICRIS), Haikou, China, 15–16 June 2019; pp. 55–58. [Google Scholar]
  39. Blavi, L.; Solà-Oriol, D.; Llonch, P.; López-Vergé, S.; Martín-Orúe, S.M.; Pérez, J.F. Management and Feeding Strategies in Early Life to Increase Piglet Performance and Welfare around Weaning: A Review. Animals 2021, 11, 302. [Google Scholar] [CrossRef]
  40. Tokach, M.D.; Menegat, M.B.; Gourley, K.M.; Goodband, R.D. Review: Nutrient Requirements of the Modern High-Producing Lactating Sow, with an Emphasis on Amino Acid Requirements. Animal 2019, 13, 2967–2977. [Google Scholar] [CrossRef]
  41. Bortolozzo, F.P.; Zanin, G.P.; Ulguim, R.D.R.; Mellagi, A.P.G. Managing Reproduction in Hyperprolific Sow Herds. Animals 2023, 13, 1842. [Google Scholar] [CrossRef]
  42. Gianluppi, R.D.F.; Lucca, M.S.; Mellagi, A.P.G.; Bernardi, M.L.; Orlando, U.A.D.; Ulguim, R.R.; Bortolozzo, F.P. Effects of Different Amounts and Type of Diet during Weaning-to-Estrus Interval on Reproductive Performance of Primiparous and Multiparous Sows. Animal 2020, 14, 1906–1915. [Google Scholar] [CrossRef]
  43. Poleze, E.; Bernardi, M.L.; Amaral Filha, W.S.; Wentz, I.; Bortolozzo, F.P. Consequences of Variation in Weaning-to-Estrus Interval on Reproductive Performance of Swine Females. Livest. Sci. 2006, 103, 124–130. [Google Scholar] [CrossRef]
  44. Faccin, J.E.G.; Laskoski, F.; Hernig, L.F.; Kummer, R.; Lima, G.F.R.; Orlando, U.A.D.; Gonçalves, M.A.D.; Mellagi, A.P.G.; Ulguim, R.R.; Bortolozzo, F.P. Impact of Increasing Weaning Age on Pig Performance and Belly Nosing Prevalence in a Commercial Multisite Production System. J. Anim. Sci. 2020, 98, skaa031. [Google Scholar] [CrossRef] [PubMed]
  45. Faccin, J.E.G.; Tokach, M.D.; Allerson, M.W.; Woodworth, J.C.; DeRouchey, J.M.; Dritz, S.S.; Bortolozzo, F.P.; Goodband, R.D. Relationship between Weaning Age and Antibiotic Usage on Pig Growth Performance and Mortality. J. Anim. Sci. 2020, 98, skaa363. [Google Scholar] [CrossRef]
  46. Germani, L.; Mecarelli, V.; Baruffa, G.; Rugini, L.; Frescura, F. An IoT Architecture for Continuous Livestock Monitoring Using LoRa LPWAN. Electronics 2019, 8, 1435. [Google Scholar] [CrossRef]
  47. Li, Y.; Fu, C.; Yang, H.; Li, H.; Zhang, R.; Zhang, Y.; Wang, Z. Design of a Closed Piggery Environmental Monitoring and Control System Based on a Track Inspection Robot. Agriculture 2023, 13, 1501. [Google Scholar] [CrossRef]
  48. Zeng, Z.; Zeng, F.; Han, X.; Elkhouchlaa, H.; Yu, Q.; Lü, E. Real-Time Monitoring of Environmental Parameters in a Commercial Gestating Sow House Using a ZigBee-Based Wireless Sensor Network. Appl. Sci. 2021, 11, 972. [Google Scholar] [CrossRef]
  49. Chen, H.; Liang, Y.; Huang, H.; Huang, Q.; Gu, W.; Liang, H. Live Pig-Weight Learning and Prediction Method Based on a Multilayer RBF Network. Agriculture 2023, 13, 253. [Google Scholar] [CrossRef]
  50. Astill, J.; Dara, R.A.; Fraser, E.D.G.; Roberts, B.; Sharif, S. Smart Poultry Management: Smart Sensors, Big Data, and the Internet of Things. Comput. Electron. Agric. 2020, 170, 105291. [Google Scholar] [CrossRef]
  51. Lagua, E.B.; Mun, H.-S.; Ampode, K.M.B.; Chem, V.; Kim, Y.-H.; Yang, C.-J. Artificial Intelligence for Automatic Monitoring of Respiratory Health Conditions in Smart Swine Farming. Animals 2023, 13, 1860. [Google Scholar] [CrossRef] [PubMed]
  52. Li, B.; Xu, W.; Chen, T.; Cheng, J.; Shen, M. Recognition of Fine-Grained Sow Nursing Behavior Based on the SlowFast and Hidden Markov Models. Comput. Electron. Agric. 2023, 210, 107938. [Google Scholar] [CrossRef]
  53. Paudel, S.; De Sousa, R.V.; Sharma, S.R.; Brown-Brandl, T. Deep Learning Models to Predict Finishing Pig Weight Using Point Clouds. Animals 2023, 14, 31. [Google Scholar] [CrossRef] [PubMed]
  54. Collins, L.M.; Smith, L.M. Review: Smart Agri-Systems for the Pig Industry. Animal 2022, 16, 100518. [Google Scholar] [CrossRef] [PubMed]
  55. Rudrakar, S.; Rughani, P. IoT Based Agriculture (Ag-IoT): A Detailed Study on Architecture, Security and Forensics. Inf. Process. Agric. 2023, in press. [Google Scholar] [CrossRef]
  56. He, Y.; Tiezzi, F.; Howard, J.; Maltecca, C. Predicting Body Weight in Growing Pigs from Feeding Behavior Data Using Machine Learning Algorithms. Comput. Electron. Agric. 2021, 184, 106085. [Google Scholar] [CrossRef]
  57. Thomas, J.; Rousselière, Y.; Marcon, M.; Hémonic, A. Early Detection of Diarrhea in Weaned Piglets from Individual Feed, Water and Weighing Data. Front. Anim. Sci. 2021, 2, 688902. [Google Scholar] [CrossRef]
Figure 1. Architecture of the IoT-based intelligent feeding equipment and cloud components. (a) Electronic sow feeder, (b) central controller, (c) PDA, (d) feed discharge pipe and water discharge pipe. (1) The central controller sends request to scheduling server, (2) permission information is verified for the central controller, (3) an MQTT server node is selected, (4) the internet protocol (IP) and port of the selected server node are returned, (5) the central controller establishes a connection with the service node, (6) the service node transfers the received data to the data processing program, (7) composition of data processing program, and (8) PC and phone.
Figure 1. Architecture of the IoT-based intelligent feeding equipment and cloud components. (a) Electronic sow feeder, (b) central controller, (c) PDA, (d) feed discharge pipe and water discharge pipe. (1) The central controller sends request to scheduling server, (2) permission information is verified for the central controller, (3) an MQTT server node is selected, (4) the internet protocol (IP) and port of the selected server node are returned, (5) the central controller establishes a connection with the service node, (6) the service node transfers the received data to the data processing program, (7) composition of data processing program, and (8) PC and phone.
Agriculture 14 00848 g001
Figure 2. Main interfaces of the core circuit.
Figure 2. Main interfaces of the core circuit.
Agriculture 14 00848 g002
Figure 3. The process of the server handling Connect, Subscribe, and Publish requests.
Figure 3. The process of the server handling Connect, Subscribe, and Publish requests.
Agriculture 14 00848 g003
Figure 4. The components and overall processes used in the cluster.
Figure 4. The components and overall processes used in the cluster.
Agriculture 14 00848 g004
Figure 5. The registration process of the MQTT server in the cluster.
Figure 5. The registration process of the MQTT server in the cluster.
Agriculture 14 00848 g005
Figure 6. The core concept of dynamic password generation.
Figure 6. The core concept of dynamic password generation.
Agriculture 14 00848 g006
Figure 7. The architecture of the data processing platform. (1) ODS stands for operation data source, (2) DWD stands for data warehouse details, (3) DWM stands for data warehouse middle, (4) ADS stands for application data service, and (5) OLAP stands for Online Analysis Processing.
Figure 7. The architecture of the data processing platform. (1) ODS stands for operation data source, (2) DWD stands for data warehouse details, (3) DWM stands for data warehouse middle, (4) ADS stands for application data service, and (5) OLAP stands for Online Analysis Processing.
Agriculture 14 00848 g007
Figure 8. Test result graph. (a) TPS results of scheduling server and Tomcat application, (b) RT and ER results of scheduling server and Tomcat application, (c) the change in node connections when node1 crashes, (d) the change in node connection count during the reconnection of node1, (e) TPS and RT test results for cluster performance, and (f) TPS comparison results of three serialization methods.
Figure 8. Test result graph. (a) TPS results of scheduling server and Tomcat application, (b) RT and ER results of scheduling server and Tomcat application, (c) the change in node connections when node1 crashes, (d) the change in node connection count during the reconnection of node1, (e) TPS and RT test results for cluster performance, and (f) TPS comparison results of three serialization methods.
Agriculture 14 00848 g008
Figure 9. The mobile interface. (a) The equipment status interface, (b) the farrowing house summary information interface, (c) the feeding status interface, and (d) the feeding scheme interface.
Figure 9. The mobile interface. (a) The equipment status interface, (b) the farrowing house summary information interface, (c) the feeding status interface, and (d) the feeding scheme interface.
Agriculture 14 00848 g009
Figure 10. The online status and detailed information of the MQTT server nodes in the cluster. Blue means free, orange means used.
Figure 10. The online status and detailed information of the MQTT server nodes in the cluster. Blue means free, orange means used.
Agriculture 14 00848 g010
Figure 11. The backend management interface for displaying statistical data.
Figure 11. The backend management interface for displaying statistical data.
Agriculture 14 00848 g011
Figure 12. Frequency distribution figure of days. (a) The frequency distribution of production interval days for each farrowing house, (b) the frequency distribution of weaning days for lactating sows, and (c) the frequency distribution of prepartum days for lactating sows.
Figure 12. Frequency distribution figure of days. (a) The frequency distribution of production interval days for each farrowing house, (b) the frequency distribution of weaning days for lactating sows, and (c) the frequency distribution of prepartum days for lactating sows.
Agriculture 14 00848 g012
Figure 13. Feed and water intake of sows. (a) The average feed intake for each farrowing house and (b) the average water consumption for each farrowing house.
Figure 13. Feed and water intake of sows. (a) The average feed intake for each farrowing house and (b) the average water consumption for each farrowing house.
Agriculture 14 00848 g013
Table 1. Brief information of components used.
Table 1. Brief information of components used.
Component NameModelOperating VoltageOutputComponent RoleManufacturers
Motor10–50 mm24 VAnalogMaximum thrust: 250 NLouis, Changzhou, China
Water flow sensorYF-S2015 VDigitalFlow range: 1–25 L/minDijiang, Cangzhou, China
Electromagnetic valve2W160-1524 VAnalogTemp: −5 °C–150 °CXiangjun, Hangzhou, China
CANUSBCAN-E-mini5 VDigitalBaud rate: 5 kbps~1 MbpsLigong, Guangzhou, China
Table 2. Fields of original data.
Table 2. Fields of original data.
Field NameData TypeNote
Pig_Farm_IdNumberThe only sign of the pig farm.
Center_Controller_IdNumberThe only sign of the central controller in houses.
ESF_IdNumberThe only sign of the ESF in farrowing houses.
House_IdNumberThe only sign of the farrowing house.
Stall_IdNumberThe only sign of the stall in farrowing houses.
Current_DateStringCurrent date, format is “yyyy-MM-dd”.
Has_PigBooleanHas a sow entered the stall?
Enter_DataStringSow entry date, format is “yyyy-MM-dd”.
Enter_DayNumberNumber of days sows have been in stall.
Is_FarrowingBooleanHas the sow finished farrowing?
Farrowing_DateStringDate of farrowing, format is “yyyy-MM-dd”.
Feed_IntakeFloatFeed intake of the sow throughout the day.
Water_IntakeFloatWater intake of the sow throughout the day.
Table 3. Statistical indicator data of production interval days, weaning days, and prepartum days.
Table 3. Statistical indicator data of production interval days, weaning days, and prepartum days.
HouseProduction Interval DaysWeaning DaysPrepartum Days
ModeAverageSEM *ModeAverageSEMModeAverageSEM
House 1810.790.4652119.510.1761313.160.235
House 248.060.2822322.850.21235.030.193
House 356.950.1841919.350.200129.800.175
House 4512.290.4621817.680.28866.420.119
House 5812.290.31713/2117.910.244118.440.163
* SEM: Standard error of mean.
Table 4. Comparison of other similar systems with the present system.
Table 4. Comparison of other similar systems with the present system.
PaperApplicationArchitecture LayersCluster
System
Data DisplayData
Transmission
[46]Livestock monitoring2NoPCTCP/IP
[16]Precision feeding3NoMobile and PCGPRS
[22]Livestock monitoring3YesPCHTTP
[15]Intelligent feeding2NoMobile and PCGPRS
[12]Electronic sow feeders1NoNoNo
[47]Environmental monitoring2NoNoWIFI
[48]Environmental monitoring3NoPCGPRS
This proposalSow monitoring4YesMobile and PCMQTT
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

He, X.; Zeng, Z.; Liu, Y.; Lyu, E.; Xia, J.; Wang, F.; Luo, Y. An Internet of Things-Based Cluster System for Monitoring Lactating Sows’ Feed and Water Intake. Agriculture 2024, 14, 848. https://doi.org/10.3390/agriculture14060848

AMA Style

He X, Zeng Z, Liu Y, Lyu E, Xia J, Wang F, Luo Y. An Internet of Things-Based Cluster System for Monitoring Lactating Sows’ Feed and Water Intake. Agriculture. 2024; 14(6):848. https://doi.org/10.3390/agriculture14060848

Chicago/Turabian Style

He, Xinyuan, Zhixiong Zeng, Yanhua Liu, Enli Lyu, Jingjing Xia, Feiren Wang, and Yizhi Luo. 2024. "An Internet of Things-Based Cluster System for Monitoring Lactating Sows’ Feed and Water Intake" Agriculture 14, no. 6: 848. https://doi.org/10.3390/agriculture14060848

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop