The system software consists of three components: the data acquisition node program, the gateway aggregation node program, and the remote monitoring center program. Upon power-up, each node first enters an initialization state to perform hardware self-tests, clock configuration, and peripheral initialization. The data acquisition node periodically collects environmental data from the sugar beet field via sensor modules, including parameters such as temperature, humidity, light intensity, atmospheric pressure, and dissolved oxygen. Simultaneously, it obtains the node’s location information through the Beidou module, then transmits the collected data to the ZigBee coordinator node according to a routing algorithm designed as follows.
4.1. Design of the EB-LEACH Routing Algorithm
To address the shortcomings of the traditional LEACH algorithm, we have designed an improved energy-balanced routing EB-LEACH algorithm, one which presents clear, differentiated characteristics and inherent innovations. DE-LEACH adopts a joint weighting mechanism of node coordinate distance and residual energy that relies on additional positioning information and brings extra computational and communication overhead. In contrast [
18], EB-LEACH reduces the frequency and complexity of node location and distance calculation and uses distance parameters only for lightweight auxiliary judgment in cluster head election and competition radius adjustment. Unlike EE-LEACH, which employs a centralized scheduling strategy and always preferentially selects nodes with the maximum residual energy [
19], leading to the premature failure of high-energy nodes, EB-LEACH adopts a dynamic average energy threshold to realize fair rotation of eligible nodes and avoid overconsumption of individual high-performance nodes. In addition, most conventional energy-balanced clustering protocols adopt a fixed energy threshold, which cannot adapt to the continuous attenuation of network energy, whereas EB-LEACH implements an adaptive threshold update mechanism that dynamically adjusts the screening criterion following the overall energy decline of the network. Consequently, EB-LEACH is not a simple combination of existing strategies, but a minimalist dynamic energy screening clustering mechanism with outstanding advantages in reducing computational complexity, controlling network overhead, and adapting to low-cost resource-limited sensor nodes.
The algorithm introduces improvements in two key areas: the cluster head election mechanism and network topology optimization. These enhancements are designed to achieve a more balanced distribution of network power consumption, thereby extending the network’s lifespan.
4.1.1. An Improved Multi-Factor Weighted Cluster Head Election Algorithm
During the cluster head election phase, the EB-LEACH algorithm comprehensively considers a node’s remaining energy, geographical location, and network load conditions [
20]. It represents a significant improvement to the threshold calculation formula of the traditional LEACH algorithm, with a new threshold calculation formula as follows:
In this formula,
indicates the expected percentage of cluster heads relative to the total number of nodes,
this is the current round,
indicates the node’s current remaining energy,
is the initial energy of the node,
is the Euclidean distance from the node to the aggregation node,
is the maximum distance from any node in the network to the aggregation node, and
is the weighting factor (
), which is used to balance the importance of the energy factor and the distance factor in cluster head election [
21,
22,
23]. This improvement ensures that nodes with higher residual energy, closer proximity to the convergence node, and lighter historical load have a higher probability of becoming the cluster head, thereby optimizing the quality of cluster head election across multiple dimensions.
The innovation of this improvement lies in the introduction of an energy factor
. Ensuring that nodes with higher remaining energy have a greater probability of becoming cluster heads prevents low-energy nodes from dying prematurely. The distance factor is calculated as follows:
This allows nodes closer to the convergence node to have a higher probability of being elected, thereby effectively reducing the energy consumption associated with long-distance communication.
4.1.2. Adaptive Cluster Head Competition Mechanism
The EB-LEACH algorithm introduces a dynamic cluster head competition mechanism designed to optimize the spatial distribution of cluster heads within the network. It dynamically adjusts the competition radius of cluster heads based on the distance from a node to the nearest cluster head using the following formula:
In this formula, is the basic competitive radius, and is the distance adjustment factor (). The design philosophy behind this mechanism is that nodes closer to the aggregation node have a larger competition radius and can assume more cluster head responsibilities, thereby balancing the network’s overall energy consumption. Nodes farther from the aggregation node have a smaller competition radius, which prevents them from consuming excessive energy when acting as cluster heads. This design effectively reduces the average number of hops required to transmit data to the aggregation node, thereby further optimizing energy consumption across the entire network.
In summary, the EB-LEACH algorithm establishes a dual adaptive optimization mechanism comprising adaptive energy screening criteria and adaptive competition radii. The algorithm first uses the real-time average energy across the entire network as the adaptive screening criterion, dynamically updating the selection threshold to eliminate nodes with low energy and ensure the overall quality of cluster head nodes. Building on this foundation, the algorithm sets a variable competition radius based on differences in node distances, granting nodes farther from aggregation nodes a larger coverage area. This forms larger cluster structures, reduces the number of hops for data forwarding at the network edge, and alleviates the high energy consumption issue faced by edge nodes. The dual adaptive mechanism collaboratively optimizes the network topology, balances energy consumption across the entire network, and significantly improves the stability and service life of the farmland monitoring network.
4.1.3. Multi-Hop Routing
During the stable data transmission phase, the EB-LEACH algorithm uses multi-hop routing to transmit data from cluster heads to aggregation nodes, rather than having cluster heads communicate directly with base stations as in traditional LEACH. Cluster head nodes establish routing tables to aggregation nodes based on received signal strength and select the path with the lowest energy consumption for data forwarding. For cluster heads located far from the aggregation node, multi-hop forwarding via nearby cluster heads effectively avoids the significant energy consumption associated with long-distance direct communication. At the same time, multi-hop transmission further balances the network load, preventing some cluster heads from dying prematurely due to an excessive forwarding workload.
4.1.4. Algorithm Flow Design
The EB-LEACH algorithm operates in cycles, with each cycle consisting of three core phases: cluster head election, cluster formation, and stable data transmission. The workflow is illustrated in
Figure 10.
During the cluster head election phase, each node first determines whether it is eligible to participate in the election based on an improved threshold calculation formula. Specifically, a node generates a random number between 0 and 1; if this number is smaller than the calculated threshold, the node becomes a candidate cluster head. These candidate cluster heads then use a dynamic competition radius mechanism to determine which nodes will ultimately become cluster heads. During the cluster formation phase, the selected cluster head nodes broadcast an announcement message to the entire network.
Ordinary nodes select the most suitable cluster head based on the signal strength they receive, and, once selected, they send a join request to the corresponding cluster head. Upon receiving these requests, the cluster head assigns a dedicated TDMA timeslot to each joining member, thereby establishing a stable scheduling arrangement for internal communication. Once the stable data transmission phase begins, each member node within a cluster transmits the collected environmental data to its cluster head during its assigned time slot. The receiving cluster head node then fuses these data—primarily to reduce redundancy—and subsequently forwards the aggregated data step by step to the aggregation node via multi-hop routing.
This design is primarily intended to enable the network to adaptively respond to changes in the energy status of individual nodes. It is precisely this periodic mechanism of continuously re-electing cluster heads that ensures that the network structure can be dynamically optimized, allowing the EB-LEACH algorithm to automatically adjust the direction and focus of its selection strategy based on real-time changes in network energy distribution and topology. Of course, the ultimate goal is to achieve greater energy efficiency and significantly extend the service life of the entire system.
The EB-LEACH algorithm adopted in this paper addresses the issue of excessive energy consumption caused by frequent cluster head elections in the classic LEACH algorithm. This algorithm defines a 5-min interval as one complete data collection cycle and a 20-min interval as one complete data transmission cycle, with each data transmission round consolidating valid data from four consecutive 5-min collection periods. After the system completes 20 full data transmission cycles, it automatically performs a network-wide cluster head re-election and updates the clustering structure. This approach reduces the number of RF transmissions while ensuring the continuity of monitoring data, significantly lowering node energy consumption.
4.2. Simulation Testing of Routing Algorithms
Simulation verification of the EB-LEACH routing algorithm is performed using MATLAB R2020b, while the performance of the integrated Beidou and ZigBee monitoring platform is tested through field operations. To verify the effectiveness and superiority of the EB-LEACH algorithm, a simulation model of a sugar beet field monitoring network was developed using MATLAB. The simulation parameters, shown in
Table 1, primarily included network topology, energy parameters, and algorithm parameters.
Simulation experiments were used to evaluate and analyze the algorithm’s performance in terms of network life cycle, energy efficiency, and data throughput. A 100-m-by-100-m two-dimensional simulation environment was created using MATLAB to simulate a sugar beet field environment.
We deployed 100 sensor nodes using a random uniform distribution, with the collection node fixed at the center of the area (50, 50). This network topology is shown in
Figure 11. The collection node serves as the Beidou gateway and is responsible for aggregating various data from the ZigBee network.
To ensure simulation completeness and cover all sensor operating states, we have employed a standard first-order radio power consumption model. This model includes five types of power consumption: data acquisition, data transmission, data reception, data aggregation, and idle standby. All compared algorithms strictly use the same set of power consumption calculation formulas and physical parameters, ensuring that the simulation results are transparent, reproducible, and comparable.
- (1)
Energy consumption during data transmission
When a sensor node transmits data to a cluster head or base station, it automatically switches the channel loss model based on the transmission distance. Using the critical distance
as the boundary, the free-space loss model is applied for short distances, while the multipath fading loss model is applied for long distances. The formula for calculating transmission power consumption is as follows:
In the above equation, l is the bit length of the sample data; is the transmission distance for nodes; is the energy consumption coefficient for RF circuits; and denote the free-space and multipath fading gain factors, respectively; and is the critical distance for the channel.
- (2)
Energy consumption for data reception
When a node receives a data packet, it consumes power only in the RF circuitry and does not consume power for signal amplification.
, the energy consumption for a node, is calculated using the following formula:
- (3)
Data Aggregation Energy Consumption
The cluster head node must fuse and deduplicate data from multiple sources within the cluster to reduce the volume of redundant data transmitted. The energy consumption for data aggregation is expressed as follows:
In this equation, is the aggregate energy consumption data, and is the energy consumption coefficient per unit of data.
- (4)
Acquisition Power Consumption and Idle Power Consumption
To better reflect the operational characteristics of real-world agricultural sensors, this paper introduces node data acquisition power consumption and idle standby power consumption. Sensors generate acquisition Power Consumption when collecting environmental data such as temperature and humidity, whereas in practical sensing systems the acquisition energy is primarily determined by sensor operating current, acquisition duration, warm-up time, and analog front-end activity. Nodes that are not communicating remain in a low-power idle state, maintaining a baseline power consumption for monitoring. The specific formula is as follows:
denotes the acquisition power consumption of a single node;
denotes the operating current of the sensor,
denotes the supply voltage,
denotes the duration of a single acquisition,
denotes the warm-up energy consumption of the sensor,
denotes the power consumption of the analog front-end circuit,
is the idle power consumption of nodes,
is the idle power consumption for the duration of the idle period, and
denotes the idle standby time.
- (5)
Total Network Energy Consumption
The total network energy consumption is calculated by summing the energy consumption of all sensor nodes in the network, providing a comprehensive reflection of the algorithm’s energy optimization performance. Its formula is as follows:
All simulation processes described in this paper are based on iterative calculations using the aforementioned energy consumption formula. Evaluation metrics such as the number of surviving nodes, total remaining energy across the network, and throughput are all derived from a unified energy consumption model, ensuring the fairness of the experiments and the reproducibility of the results.
4.2.1. Network Life Cycle Analysis
The network life cycle is the primary metric for evaluating the performance of routing algorithms in wireless sensor networks. MATLAB simulations were used to determine how the number of surviving nodes varies with the number of simulation rounds for the three algorithms, as shown in
Figure 12. Our simulation results show that the EB-LEACH algorithm performs exceptionally well in extending the network’s lifespan. The first node failure in the traditional LEACH algorithm occurred at round 456, while the LEACH-C algorithm delayed this to round 612. The EB-LEACH algorithm significantly delayed the first node failure to round 854, representing an improvement of 87.3% and 39.5% over LEACH and LEACH-C, respectively.
In terms of network half-life (50% node failure), the EB-LEACH algorithm reached the 1105th round, whereas LEACH and LEACH-C reached only the 525th and 780th rounds, respectively. When the network completely fails, the EB-LEACH algorithm extends network survival time by approximately 30.3% compared to traditional LEACH. This significant performance improvement is primarily attributed to the energy- and distance-based cluster head election mechanism in the EB-LEACH algorithm, which effectively prevents the premature death of low-energy nodes and achieves balanced energy consumption across the entire network.
4.2.2. Analysis of Network Energy Consumption Characteristics
Since network energy consumption characteristics directly impact the system’s sustainability, simulation tests were conducted to compare these characteristics.
Figure 13 illustrates the trend of total remaining network energy over the simulation rounds for the three algorithms.
In terms of the energy consumption rate, the traditional LEACH algorithm exhibited a rapid decline in energy over the first 500 rounds, with only 5.32% of the total network energy remaining by the 1000th round. The LEACH-C algorithm improved energy efficiency to some extent through centralized cluster head selection, maintaining 11.13% of the total network energy by the 1000th round. The EB-LEACH algorithm, however, demonstrated the best energy retention capability, with 21.64% of the total network energy remaining at the 1000th round. Its energy consumption rate was reduced by 17.23% and 11.82% compared to the LEACH and LEACH-C algorithms respectively.
A further analysis of the energy consumption balance revealed that the EB-LEACH algorithm exhibited the lowest variance in energy consumption across all nodes, indicating that its energy balancing mechanism effectively prevents the occurrence of energy black holes. This balanced energy consumption pattern enables the network to maintain useful coverage for longer periods, providing reliable assurance for the continuous monitoring of the beet growing environment.
4.2.3. Data Throughput Performance Analysis
Data throughput reflects the monitoring system’s ability to effectively collect field environmental data.
Figure 14 shows the number of data packets successfully transmitted to the aggregation node per round under the three algorithms.
As shown in
Figure 14, the data throughput curves for all three algorithms exhibit a marked drop at specific rounds (approximately 400 rounds for LEACH, 800 rounds for LEACH-C, and 1200 rounds for EB-LEACH). Analysis suggests that these drops are closely related to the failure of the first critical node in the network. Taking the LEACH algorithm as an example, the first node fails due to energy depletion at approximately 400 rounds. This node is responsible for both collecting and forwarding data within its own cluster and acting as a communication relay for adjacent clusters. Its failure prevents data from being uploaded in that region, resulting in the first noticeable drop in throughput. As the number of failed nodes increases, the network gradually fragments into multiple isolated regions, leading to irrecoverable data loss and a step-like decline in the throughput curve. In contrast, the EB-LEACH algorithm, through the use of energy and distance weighting factors, effectively delays the failure of the first node (to 854 rounds), while simultaneously reducing reliance on any single node by optimizing the spatial distribution of cluster heads via an adaptive competition radius mechanism. Consequently, the throughput curve is smoother, with a much smaller sudden drop compared to LEACH and LEACH-C, demonstrating the algorithm’s advantages in load balancing and network robustness.
The experimental results show that the EB-LEACH algorithm outperforms other algorithms in terms of both data collection stability and sustainability. During the first 800 rounds of stable network operation, all three algorithms maintained a high data delivery rate (greater than 95%). Data throughput dropped sharply by the 800th round of the simulation, and, by the 1200th round, the packet delivery success rate had fallen to only 42.5%. The LEACH-C algorithm began to show a noticeable decline after the 1000th round.
The EB-LEACH algorithm still achieved a data delivery rate of over 78% after 1500 rounds, and the number of data packets transmitted throughout its entire life cycle increased by 118.3% and 52.7% compared to LEACH and LEACH-C, respectively. This advantage is primarily due to the stable cluster structure formed by the dynamic cluster head competition mechanism in the EB-LEACH algorithm, which effectively prevents transmission failures caused by the uneven distribution of cluster heads.
Based on the experimental results described above, the EB-LEACH algorithm demonstrates significant advantages across three key performance metrics: network lifetime, energy efficiency, and data throughput.
Table 2 provides a quantitative comparison of the performance of the three algorithms.
As shown in
Table 2, LEACH-C, as a typical centralized clustering routing protocol, relies entirely on the aggregation node to select cluster heads and partition the network. At the beginning of each round, all sensor nodes upload their remaining energy and location information to the base station; the base station then calculates the network-wide average energy and removes nodes with energy levels below the average. Subsequently, a simulated annealing algorithm is used to optimize the distribution of candidate cluster heads, minimizing the total communication distance within each cluster and finally broadcasting the clustering results to the entire network. Compared to the traditional LEACH algorithm, LEACH-C achieves a more uniform distribution of cluster heads, though it still has inherent limitations: the algorithm uses a fixed screening threshold throughout the network operation cycle and lacks adaptive screening criteria; furthermore, all nodes must upload status information in every round, resulting in significant control overhead. Additionally, LEACH-C cannot dynamically adjust the coverage radius based on node location, leading to excessive energy consumption by edge nodes. These inherent shortcomings make LEACH-C poorly suited for long-term monitoring scenarios in agricultural fields. The superior performance of the EB-LEACH algorithm is evident in
Table 2. The innovative design philosophy of this algorithm involves protecting low-energy nodes through an energy factor, optimizing network topology via a distance factor, and balancing network load through a dynamic competition mechanism. The combined effect of these mechanisms enables the algorithm to effectively adapt to the practical requirements of beet field monitoring networks, thereby providing reliable communication support for Beidou- and ZigBee-based beet environmental monitoring systems.