Next Article in Journal
A Novel Cloud Energy Consumption Heuristic Based on a Network Slicing–Ring Fencing Ratio
Previous Article in Journal
Exploring the Performance of Transparent 5G NTN Architectures Based on Operational Mega-Constellations
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Applying Machine Learning to DEEC Protocol: Improved Cluster Formation in Wireless Sensor Networks

by
Abdulla Juwaied
* and
Lidia Jackowska-Strumillo
Institute of Applied Computer Science, Lodz University of Technology, ul. Stefanowskiego 18, 90-537 Lodz, Poland
*
Author to whom correspondence should be addressed.
Network 2025, 5(3), 26; https://doi.org/10.3390/network5030026
Submission received: 1 July 2025 / Revised: 16 July 2025 / Accepted: 22 July 2025 / Published: 24 July 2025

Abstract

Wireless Sensor Networks (WSNs) are specialised ad hoc networks composed of small, low-power, and often battery-operated sensor nodes with various sensors and wireless communication capabilities. These nodes collaborate to monitor and collect data from the physical environment, transmitting it to a central location or sink node for further processing and analysis. This study proposes two machine learning-based enhancements to the DEEC protocol for Wireless Sensor Networks (WSNs) by integrating the K-Nearest Neighbours (K-NN) and K-Means (K-M) machine learning (ML) algorithms. The Distributed Energy-Efficient Clustering with K-NN (DEEC-KNN) and with K-Means (DEEC-KM) approaches dynamically optimize cluster head selection to improve energy efficiency and network lifetime. These methods are validated through extensive simulations, demonstrating up to 110% improvement in packet delivery and significant gains in network stability compared with the original DEEC protocol. The adaptive clustering enabled by K-NN and K-Means is particularly effective for large-scale and dynamic WSN deployments where node failures and topology changes are frequent. These findings suggest that integrating ML with clustering protocols is a promising direction for future WSN design.

1. Introduction

Wireless Sensor Networks (WSNs), comprising numerous sensor nodes with integrated sensing, processing, and communication capabilities, represent transformative technology for data collection and monitoring. Clustering these nodes into groups, known as clusters, is a proven strategy to enhance both energy efficiency and overall network performance. WSNs continue to grow as they become foundational technologies in various emerging application domains. In the Industrial Internet of Things (IIoT), WSNs enable the real-time monitoring and predictive maintenance of complex manufacturing systems, supporting increased automation and operational efficiency. In the context of unmanned aerial vehicles (UAVs), WSNs facilitate dynamic environmental sensing, infrastructure inspection, and disaster response, where rapid deployment and adaptability are essential. Smart infrastructure applications, such as intelligent transportation systems and energy-efficient buildings, rely on dense WSN deployments for continuous data collection, anomaly detection, and adaptive control. Recent studies [1,2] have demonstrated the integration of WSNs with advanced analytics and edge computing to address the stringent requirements of these domains, including scalability, reliability, and low-latency operation. By addressing the challenges of energy efficiency and adaptive clustering, this work aims to contribute solutions that are directly applicable to these rapidly evolving and practically significant areas.
Each cluster is presided over by a cluster head (CH), and each CH is responsible for collecting the data from the nodes and transmitting it to the base station, thus reducing the energy consumption by reducing the amount of communication. In this paper, a protocol called DEEC is used for clustering, and this protocol is suitable for various types of WSNs and helps prolong a network’s lifetime.
For example, DEEC selects CHs by the residual energy of nodes, so nodes with higher residual energy are selected as CHs, and this can balance the energy consumption of nodes and avoid the premature death of nodes. However, traditional clustering algorithms such as DEEC cannot always achieve the best performance under any scenario, so ML can be used to solve this problem and the K-NN and K-Means algorithms can be introduced to optimise the clustering algorithm and achieve better performance. The K-NN algorithm can determine whether nodes belong to the same cluster according to the similarity between nodes and their k-nearest neighbouring nodes, and the K-NN algorithm can be used to select CHs and detect abnormal behaviour. The K-Means algorithm can classify nodes based on location or other attributes, thus resulting in better quality and more evenly distributed clusters [3,4].
Clustering is an essential technique for WSNs to achieve optimal performance and energy consumption, and integrating ML with clustering is a promising research direction. This can solve issues and lead to new applications for WSNs; thus, this can help in opening new avenues for research and development in the field of WSNs [5]. However, DEEC suffers from several technical shortcomings, including static cluster formation, extended operational longevity, overloaded cluster heads, and energy consumption across a network. These issues can lead to premature node failures and a reduced network lifetime. The proposed DEEC-K-NN and DEEC-K-Means methods specifically target these limitations by introducing adaptive and data-driven cluster head selection mechanisms. The novelty of this work lies in the integration of unsupervised ML algorithms (K-NN and K-Means) with the DEEC protocol for adaptive cluster head selection in heterogeneous WSNs. Our simulation results show that these methods significantly outperform the original DEEC protocol in terms of packet delivery, network stability, and energy efficiency.
The key contributions of this article are as follows: (1) We propose two novel modifications to the DEEC protocol by integrating K-NN and K-Means algorithms for adaptive cluster head selection. (2) We present a comprehensive simulation-based evaluation demonstrating significant improvements in network lifetime, energy efficiency, and packet delivery. (3) We provide a comparative analysis of the original and modified protocols, highlighting the advantages of ML-based clustering in WSNs.

1.1. Clustering Techniques for WSNs

WSNs consist of numerous small sensors deployed to gather data, and clustering is a technique used to group these sensors to conserve energy. By minimising communication and energy consumption, clustering can extend a network’s lifetime; therefore, clustering also improves the manageability of a network and its scalability. Clustering in WSNs is crucial for energy conservation, minimising node communication, and extending a network’s lifetime. Thus, clustering facilitates the scalability and manageability of large-scale sensor networks. Different clustering algorithms have been proposed for WSNs, and some algorithms aim to conserve energy while others aim to balance the workload among sensors. In contrast, others consider mobility or Quality of Service (QoS) because some advanced clustering algorithms utilise fuzzy logic or ML techniques for clustering decisions. The following points explain some clustering techniques for WSNs [6,7,8,9]:
-
The load-controlled clustering method is an associate node primarily selected to assist a cluster head in performing its data collection and processing functions. This node is responsible for transferring data to the base station. The cluster head manages the collected data and forwards it to the associate node, which then relays this information to the base station. A multi-hop data transfer approach prevents the associated node from quickly depleting its energy. The multi-hop data transmission distributes the load, thus ensuring that all nodes share the load. It saves energy, so it increases the longevity of the network.
-
Low-Energy Adaptive Clustering is a technique that allows all nodes to become the cluster head. Since the cluster head consumes more energy, this method promotes balanced energy consumption among the nodes. This helps ensure that no single node exhausts its energy simply because it is repeatedly chosen as the cluster leader. The process consists of two operational phases: the setup and steady phases.
-
The Weight-Based Clustering approach is applied in Wireless Sensor Networks (WSNs) to conserve energy, and this approach increases the lifetime of Wireless Sensor Networks. It is a non-heuristic approach that applies to WSNs in various environments, so it can be used in different types of networks. In this approach, each sensor node is assigned to a “weight” value, which is used to select the optimal sensor node as a leader. Thus, the weight value plays a crucial role in leader selection.
-
The Fuzzy-Based Clustering algorithm is based on the Fuzzy Inference System (FIS). It uses the fuzzy inference system to select optimal nodes to be cluster heads based on various factors, including capacity, size, and node density. The fuzzy-based clustering algorithm is efficient and can balance the load, maintain stable connection quality, and improve the network lifetime. Therefore, it can effectively transmit key information to the sink. It can be used in heterogeneous WSNs because this algorithm is suitable for such networks, so it is a viable option for various applications.
-
The Hierarchical Clustering Energy-Efficient Algorithm is a modified version of LEACH for Wireless Sensor Networks that deploys a hierarchical multi-hop architecture to conserve energy. When a node gets selected as a CH, it notifies the neighbouring non-CH nodes to join it, so the non-CH nodes join the CHs based on the signal strength. After the formation of clusters, the non-CH nodes transmit the gathered data to their CHs, and the CHs also transmit data to the base station, either directly or through the other CHs. This reduces the energy consumption of all nodes. Therefore, this approach has some advantages, such as energy efficiency, longer network life, scalability, and better data transmission.
There are some challenges in clustering in WSNs; sensors have limited energy, network topologies change, and networks can be extensive, so clustering also needs to deal with sensors with different capabilities and ensure each network is secure. Future clustering research will use ML, energy harvesting, and secure protocols, and clustering will also adapt to new technologies like the Internet of Things (IoT) and 5G networks because clustering is necessary for WSNs to work well. It helps save energy, makes networks easier to manage, and helps them last longer. Clustering is a technique that reduces the energy consumption of Wireless Sensor Networks (WSNs), and the clustering technique divides nodes into clusters with a cluster head (CH) [7]. A CH gathers data from the nodes and transmits it to the base station, thus conserving energy and improving the network’s lifetime. K-NN and K-Means are some clustering algorithms used to improve DEEC’s performance. DEEC is suitable for WSNs with heterogeneous nodes, so CHs are selected based on the residual energy. K-Means and K-NN are ML techniques; therefore, they can be used for various purposes [8]. The k-means algorithm clusters nodes according to their location or other characteristics, and the K-Nearest Neighbour (K-NN) algorithm clusters nodes according to their similarity with their nearest neighbour node [9]. A variety of clustering techniques can be used to improve clustering in WSNs. Thus, this leads to improvements in the lifetime and performance of networks. Figure 1 shows the clustering process in WSNs.

1.2. Machine Learning in WSNs

ML has emerged as a powerful tool in Wireless Sensor Networks (WSNs), enabling systems to learn from data and adapt to dynamic environments. ML methodologies can be leveraged across various stages of WSN operation, including data acquisition, analysis, and communication. ML can be used to improve Wireless Sensor Networks, extending their capabilities and applications, and ML can enable them to be more intelligent with data, make more informed decisions, and use resources efficiently. Consequently, ML approaches are being widely adopted in this field. The advantages of using ML in WSNs include improved adaptability to changing network conditions, the ability to learn from data for more intelligent decision-making, and enhanced performance in tasks such as clustering, anomaly detection, and data prediction. However, there are also notable challenges: WSN nodes typically have limited computational power and memory, which restricts the complexity of the ML models that can be deployed. The data collected by sensors may be noisy or incomplete, affecting the reliability of ML-based decisions.
Furthermore, many ML algorithms assume centralised data processing, while WSNs often require distributed or in-network computation to save energy and bandwidth. Therefore, the aim of this work is to propose methods that are designed with these considerations in mind, aiming to balance the benefits of ML with the realities of WSN environments. Lastly, it may be difficult to deploy Wireless Sensor Networks in large environments [10].

1.2.1. Supervised Learning

Supervised learning involves training models on labelled datasets to enable predictive capabilities. In WSNs, supervised learning algorithms are commonly employed for event detection (e.g., identifying fires or earthquakes), fault detection (e.g., recognising malfunctioning nodes or communication failures), and data classification. The ability to accurately predict and classify events based on sensor data makes supervised learning an essential component in developing intelligent WSN applications [11,12]. For example, support vector machines (SVMs) and decision trees have been used to classify sensor readings for anomaly detection or to identify faulty nodes. While supervised learning can achieve high accuracy when sufficient labelled data is available, its application to clustering in WSNs is limited. This is because clustering is an inherently unsupervised problem, and obtaining labelled data in large-scale, dynamic WSNs is often impractical. Additionally, supervised models may require significant computational resources for training and inference, which can be prohibitive for resource-constrained sensor nodes.

1.2.2. Unsupervised Learning

Unsupervised learning focuses on uncovering hidden patterns or structures within unlabelled data. In the context of WSNs, unsupervised learning techniques are utilised for clustering sensor nodes based on spatial proximity or similarity in sensed data and anomaly detection, which involves identifying abnormal or unexpected sensor readings. The absence of a requirement for labelled data makes unsupervised learning particularly valuable in large-scale or dynamically changing WSN deployments [13,14,15,16,17]. The main strength of unsupervised learning for clustering is its ability to operate without labelled data and adapt to changing network topologies. However, some algorithms (e.g., K-Means) may require the number of clusters to be specified in advance, and their performance can be sensitive to initial conditions or parameter choices.

1.2.3. Reinforcement Learning

Reinforcement learning learns optimal actions through trial and error, and it is used in WSNs to select optimal routes for messages. In WSNs, RL algorithms are applied to optimise routing protocols, allocate resources such as energy and bandwidth, and adaptively control network operations in response to environmental changes. The capacity of RL to autonomously improve decision-making over time underscores its significance in the management and optimisation of WSNs [18,19,20]. For example, Q-learning has been used to select energy-efficient routes or to dynamically adjust node transmission power. While RL can theoretically be used for clustering (e.g., learning optimal CH selection policies), it typically requires a large number of interactions to converge and may introduce significant computational and communication overhead. This makes RL less practical for real-time clustering in large-scale, energy-constrained WSNs.

1.2.4. Deep Learning

Deep learning, a subset of ML, automatically utilises deep neural networks to extract hierarchical features from raw data. In WSNs, deep learning approaches are being increasingly adopted for complex tasks such as feature extraction from raw sensor signals, temporal data analysis, and the processing of high-dimensional data types, including images and video streams. The ability of deep learning models to handle large volumes of heterogeneous data positions them as a promising solution for advanced WSN applications [21,22,23,24,25]. For instance, convolutional neural networks (CNNs) have been used for event recognition in multimedia sensor networks. However, deep learning models are typically resource-intensive, requiring substantial memory, computation, and energy, which limits their deployment on typical sensor nodes. For clustering, deep learning approaches (e.g., autoencoders for feature extraction) may offer benefits in high-dimensional data scenarios but are generally not suitable for lightweight, distributed clustering in WSNs.

1.3. Distributed Energy-Efficient Clustering (DEEC)

Wireless Sensor Networks (WSNs) have emerged as a pivotal technology for various applications, including environmental monitoring, industrial automation, healthcare, and smart cities. One of the most popular challenges in WSNs is the energy consumption of sensor nodes, as they are typically battery-powered and often deployed in inaccessible environments. Clustering is a technique used in WSNs to enhance energy efficiency. Clustering is a method of partitioning a network into clusters (groups of nodes) and selecting a cluster head (CH) for each cluster [1,2,3,4,5]. A CH gathers and aggregates the data from other nodes in the cluster and transmits it to the base station (BS), which reduces the number of nodes directly communicating the data to the BS and thus saves energy. The Distributed Energy-Efficient Clustering (DEEC) protocol is proposed for heterogeneous WSNs because, in DEEC, the residual energy of nodes is considered in the CH selection. Nodes with higher energy are given more chances of becoming CHs; therefore, this results in an efficient distribution of energy consumption in the network. DEEC is adaptive, according to a network’s energy variation, and it is suitable for WSNs with heterogeneous energy capacities [26].

1.3.1. DEEC Principles and Operation

Traditional clustering protocols, such as LEACH (Low-Energy Adaptive Clustering Hierarchy), assume homogeneous energy distribution among nodes and select CHs randomly. However, sensor nodes often exhibit energy heterogeneity in real-world deployments due to different initial energy levels or energy harvesting capabilities. Random CH selection in such scenarios can lead to premature node failures and suboptimal network performance. DEEC is proposed to address these limitations by considering both nodes’ initial and residual energy during CH selection [26,27,28,29,30,31,32]. This approach ensures that nodes with higher energy are more likely to become CHs, balancing energy consumption across the network and extending its operational lifetime.
-
Network Model: The Distributed Energy-Efficient Clustering protocol operates in a WSN comprising n sensor nodes, which may have different initial energy levels. The network is assumed to be deployed randomly over a target area, with a stationary BS located either inside or outside the sensing field. Nodes periodically sense the environment and transmit data to the BS via CHs.
-
Cluster Head Selection: The main aim of DEEC lies in its CH selection mechanism. Unlike protocols that assign equal probability to all nodes, DEEC assigns a higher probability to nodes with greater residual energy. The probability Pi for node i to become a CH in round r is given by Equation (1):
P i = P o p t · E i ( r ) E ( r )
where Popt is the optimal probability of a node becoming a cluster head, Ei(r) is the residual energy of node i at round r, and E′ is the average residual energy of all nodes at round r. This adaptive probability ensures that energy nodes are preferentially selected as cluster heads, distributing the energy load more evenly.
-
Data Transmission and Cluster Formation: Once CHs are selected, they send advertisement messages to nearby nodes in the network. Nodes that are not selected as CHs will join a CH with the strongest received signal (typically the closest CH) and join its cluster. During the data transmission phase, member nodes send their sensed data to the CH, which aggregates data to eliminate redundancy before forwarding the aggregated data to the BS.
-
Energy Model: DEEC employs a first-order radio energy model where the energy consumed for transmitting a k-bit message over a distance d, as shown in Equation (2):
E T X ( k , d ) = E e l s e · k + a m p · k · d 2
and the energy for receiving is shown in Equation (3):
E R X ( k ) = E e l s e · k
where Eelse is the energy dissipated per bit to run the transmitter or receiver circuitry and ϵamp is the energy for the transmit amplifier.

1.3.2. DEEC Protocol and Machine Learning

Recent research has explored the integration of ML and intelligent optimisation algorithms with DEEC to further improve energy efficiency and network performance. For example, fuzzy logic systems have been used to factor in additional parameters (e.g., node density and distance to BS) during CH selection, while metaheuristic algorithms like the Firefly Algorithm and Genetic Algorithm have been applied to optimise clustering and routing decisions. These hybrid approaches demonstrate superior load balancing, reduced energy consumption, and increased network longevity [13].
The DEEC protocol is beneficial for Wireless Sensor Networks facing energy constraints, and it is suitable for networks with heterogeneous nodes with varying energy levels. The residual-energy-based CH selection technique leads to uniform energy consumption distribution, which results in extended network lifetimes because energy consumption is evenly distributed among the nodes. Exploring the use of machine learning and intelligent optimization algorithms in DEEC presents an interesting avenue for future research, as these techniques can improve the decision-making, forecasting, and real-time optimization capabilities of wireless sensor networks.

1.3.3. Advantages and Limitations of the DEEC Protocol

DEEC offers several advantages over traditional clustering protocols. Energy Adaptivity: by considering residual energy, DEEC dynamically adapts CH selection, preventing the early depletion of low-energy nodes. DEEC is well-suited for heterogeneous WSNs, where nodes may have different initial energies. Simulation studies consistently show that DEEC extends the stability period (time until the first node dies) and overall network lifetime compared with protocols like LEACH and SEP. The distributed nature of DEEC makes it scalable for large-scale WSN deployments.
Despite its strengths, DEEC has some limitations. Cluster Head Overload: nodes with higher energy may be selected as CHs too frequently, leading to rapid energy depletion. Distance Ignorance: because the protocol does not explicitly consider the distance between CHs and the BS, this can affect energy consumption for long-range transmissions. To address these issues, several enhancements and variants of DEEC have been proposed, such as DDEEC (Developed DEEC), EDEEC (Enhanced DEEC), and hybrid approaches integrating fuzzy logic or ML for more intelligent CH selection [31].

2. Related Works

A study introduced an improved DEEC protocol called IoT-DEEC [5] designed to enhance the energy efficiency and lifetime of Wireless Sensor Networks (WSNs), especially in IoT scenarios. The protocol incorporates a threshold-based cluster head selection and dynamic power level switching for nodes. Simulation results showed that IoT-DEEC significantly increases the number of packets delivered to the base station and extends the network’s operational rounds compared with traditional DEEC and its variants, making it highly effective for large-scale, energy-constrained WSN deployments.
A new variant of the DEEC protocol for heterogeneous WSNs was introduced (M-DEEC) [26]. M-DEEC employs a unique clustering strategy that further reduces energy consumption and extends network lifespans. Simulation results confirmed that M-DEEC outperforms the original DEEC and other variants in terms of energy efficiency, stability period, and overall network longevity, making it suitable for modern heterogeneous sensor network applications. A study related to IoT presented a modified version of the DEEC protocol [27]. This protocol optimises cluster head selection and energy management, resulting in an 843% increase in the number of packets sent to the base station and a substantial extension in the number of alive nodes compared with the original DEEC. The study demonstrated that the new protocol is highly effective in prolonging WSN lifetimes and improving data delivery in heterogeneous IoT environments. Another study investigated how various parametric constraints affect the latency and lifetime of DEEC-based protocols in IoT-oriented WSNs [28]. The authors proposed a constraint optimisation approach for distributed clustering, aiming to enhance both latency and network longevity. The study provides insights into how tuning protocol parameters can lead to significant improvements in the performance of DEEC-based WSNs, especially for time-sensitive IoT applications.
An enhanced version of the DEEC protocol that incorporates a priority queue mechanism to better balance energy consumption among sensor nodes was proposed in [29]. The enhanced protocol achieves a longer network lifetime and improved energy efficiency compared with the standard DEEC. Simulation results demonstrated that the proposed enhancements lead to more balanced energy usage and greater network performance in WSNs. Another investigation focused on DEEC implementations for 1-level, 2-level, and 3-level heterogeneous WSNs, proposing a new 3-level heterogeneous model [23]. The study showed that increasing the total network energy and heterogeneity can significantly extend a network’s lifetime. The proposed protocol was compared with existing DEEC versions, demonstrating improved energy efficiency and network longevity performance. A further study compared the DEEC and EDEEC protocols, focusing on their application in heterogeneous WSNs [24]. DEEC uses two energy levels (normal and advanced nodes), while EDEEC introduces a third level (super nodes). The study discussed how these protocols manage energy consumption and cluster head selection, concluding that EDEEC performs better in highly heterogeneous environments. The integration of ML algorithms with the DEEC protocol to optimise packet transmission in WSNs was proposed in [25]. The study highlighted how ML can be used to enhance network longevity and efficiency, and it explored hybrid meta-heuristic optimisation methods for energy-efficient protocol design. That research proposed a hybrid routing protocol that combines fuzzy logic (an AI technique) with DEEC for cluster head selection and cluster formation [30]. The fuzzy system considers factors like distance to base station, node energy, and compactness to improve load balancing and node longevity. The results showed significant improvements in energy consumption, network lifetime, and throughput compared with conventional protocols. A study compared DEEC and EDEEC protocols in the context of heterogeneous WSNs. While not strictly an ML paper, it is included in an AI-focused conference and discusses the role of intelligent algorithms in optimising energy and routing efficiency [31]. Table 1 organizes the main DEEC variants by their approach, targeted improvement, key features, and limitations.
These gaps in Table 1 highlight the need for clustering protocols that can dynamically adapt to both energy and spatial characteristics of a network while maintaining computational efficiency. The proposed K-NN and K-Means-based enhancements are designed to address these challenges by enabling adaptive, proximity-aware, and energy-balanced cluster formation, thus improving both network lifetime and reliability in diverse WSN scenarios. The motivation for adopting K-NN and K-Means in DEEC stems from their proven ability to enhance clustering efficiency and adaptivity in dynamic WSN environments, addressing the limitations of traditional clustering protocols in terms of energy balancing and network longevity.

3. Implementation

The choice of K-NN and K-Means clustering algorithms as the core algorithms for cluster head selection in this work was motivated by their unique strengths in addressing WSNs’ dynamic and heterogeneous nature. K-NN is inherently proximity-based, making it highly effective for grouping nodes in environments where network topology may change due to node failures or mobility. On the other hand, K-Means is a widely used unsupervised learning algorithm that excels at partitioning nodes into spatially balanced clusters by minimising intra-cluster distances. This property is particularly advantageous in heterogeneous WSNs, where the even distribution of nodes and workload is critical for prolonging network lifetime and preventing energy holes. Compared with other ML techniques, such as supervised classifiers or reinforcement learning, K-NN and K-Means offer lower computational complexity and do not require labelled data or extensive training, making them practical for resource-constrained sensor nodes. K-NN and K-Means were chosen for their lightweight, unsupervised nature, making them ideal for WSNs where computational resources and labelled data are limited. In contrast, more complex or supervised ML models would impose significant computational and data collection burdens, making them less practical for real-time, distributed sensor networks. Cluster head (CH) selection is a critical factor in the energy efficiency and longevity of Wireless Sensor Networks (WSNs). This section presents a comparative analysis of three CH selection strategies: the original probabilistic method, the K-Nearest Neighbours (K-NN)-based approach, and the K-Means clustering-based approach. The evaluation focuses on key performance metrics, including total network energy, energy efficiency, CH-to-base station (CH–BS) distance, cluster head count stability, and network lifetime. The simulation for the original and modified protocols used the same parameters as shown in Table 2.

3.1. Original DEEC

The original method employs a probabilistic approach, where each node’s likelihood of becoming a CH is proportional to its residual energy relative to the network average. After 2000 simulation rounds, some nodes remained active, underscoring the protocol’s ability to ensure robust network longevity. Throughout the simulation, 5982 data packets were successfully delivered to the base station. The packet delivery trend remained consistent over most of the network’s operational period, with a stable transmission rate observed until the onset of node failures. This consistency highlights the protocol’s reliability in maintaining data flow across a network lifetime. Each node was initialised with 0.5 J of energy, resulting in a total network energy of 50 J. At the end of the simulation, the residual network energy was measured at 0.0065 J, corresponding to an average energy consumption rate of 0.024997 J per round. The energy depletion profile exhibited a linear and controlled decline, indicative of efficient energy utilisation and management by the protocol. Table 3 shows the DEEC protocol simulation results summary.
The simulated network comprised 100 sensor nodes randomly distributed in the network within a 100 m × 100 m area. The base station (sink) was centrally located at coordinates (50, 50). This uniform node distribution ensured comprehensive network coverage and facilitated effective communication with the base station. Figure 2 shows the implementation results of the original DEEC protocol.
The modification approach provides formal justification for the key design choices implemented in the K-NN and K-Means-based DEEC protocols. Regarding cluster size selection, the proposed approach dynamically adjusts the number of clusters based on the current number of active nodes, following the theoretical insight that optimal cluster size in WSNs is a function of node density and network area. This adaptive strategy reduces communication overhead and prevents cluster head overload, as supported by empirical results in the literature. Furthermore, the choice of K-NN and K-Means is justified by their proven ability to efficiently partition nodes in a distributed manner, with low computational complexity and strong performance in both static and dynamic network scenarios. By grounding our design in these theoretical and empirical findings, we ensure that the proposed protocol modifications are intuitive, robust, and generalizable to a wide range of WSN applications.

3.2. DEEC-K-NN

The proposed algorithm implements a novel approach to cluster head selection utilising K-Nearest Neighbours (K-NN) methodology. The configuration parameters for the mathematical models and main steps are shown in Algorithm 1.
Algorithm 1 DEEC-K-NN Cluster Head Selection and Node Assignment
Input:
  Set of sensor nodes with positions and residual energy
Output:
  Cluster assignments and selected cluster heads
begin
    1.
Initialise all nodes with position and energy.
    2.
For each round:
    3.
 a. Update the list of alive nodes.
    4.
 b. Select candidate cluster heads (CHs) based on residual energy.
    5.
 c. For each candidate CH:
    6.
   Calculate total distance to base station and to assigned nodes.
    7.
   Calculate the total residual energy of CH and its assigned nodes.
    8.
   Score each candidate as: score = E_total/(D_total + ε)
    9.
 d. Select CHs with the highest scores.
       10.
  e. For each non-CH node:
       11.
    Use K-NN to find the nearest CHs.
       12.
    Assign node to CH with the highest residual energy and shortest distance to base.
       13.
  f. Update clusters and repeat for the next round.
end

3.2.1. Proposal Approach

The following modification is proposed for the Distributed Energy-Efficient Clustering (DEEC) protocol:
-
Stage 1: Network Initialisation
Let the WSN consist of n sensor nodes, each with initial energy E0 and spatial coordinates (xi, yi), where i = 1, 2, …, n. Nodes are randomly deployed in a two-dimensional field of size 100 m × 100 m. Initial CHs are selected according to the baseline DEEC protocol. The state of each node is stored in a database as shown in Equation (4):
Nodei = {xi, yi, Ei, statusi}
where statusi ∈ {alive, dead}. 0, ‘status’: ‘alive’} for i in range(n)].
All nodes’ positions, energy levels, and connectivity information are stored in a central database. Before each operational round, the network state is updated by removing nodes and CHs that have exhausted their energy reserves.
-
Stage 2: Calculation of Dtotal and Etotal
For each candidate CH, compute the Euclidean distance to the base station (BS) at (xBS, yBS) as shown in Equation (5):
d i , B S = ( x i x B S ) 2 + ( y i y B S ) 2
Calculate the TOTAL distance (Dtotal) for a CH j as shown in Equation (6):
D t o t a l , j = k C j ( x i x j ) 2 + ( y i y j ) 2
where Cj is the set of nodes assigned to CH j.
The total residual energy (Etotal) for a CH is shown in Equation (7):
E t o t a l ,   j =   E j +   k C j E k
-
Stage 3: Cluster Head Selection Optimisation
Cluster head selection is refined by applying a decision-making process that jointly considers Dtotal and Etotal. Specifically, nodes are evaluated based on their proximity to the BS and residual energy. The node with the optimal combination of minimal distance and maximal energy is designated the CH for its respective cluster. Therefore, cluster head selection is performed by evaluating each candidate node based on its distance to the BS and its residual energy. The selection rule can be formalised as shown in Equation (8):
S e l e c t   C H j = a g r   m a x j ( E t o t a l ,   j D t o t a l ,   j +   )
where ϵ is a small constant to avoid division by zero.
-
Stage 4: Node Assignment via K-NN Clustering
For each non-CH node, the K-NN algorithm is used to identify the k-nearest CHs based on Euclidean distance. In cases where multiple CHs are nearby, preference is given to the CH with the highest residual energy and the shortest distance to the BS. This assignment process is iteratively repeated, ensuring that all nodes are efficiently clustered and that no CH is overloaded or underutilised.
-
Stage 5: Iterative Re-Clustering and Network Update
The clustering and CH selection process is repeated for each operational round. After each round, the network state is updated to reflect node energy levels and connectivity changes. Dead nodes and CHs are excluded from subsequent rounds, and the K-NN-based clustering is re-applied to adapt to the evolving network topology. This iterative process continues until the network ends its operational lifetime.

3.2.2. Methodology

The proposed clustering approach enhances the Distributed Energy-Efficient Clustering (DEEC) protocol by integrating a K-Nearest Neighbours (K-NN)-based cluster head selection mechanism. The process begins by evaluating the spatial density of sensor nodes using their positional information. The K-NN algorithm identifies nodes centrally located within dense regions, making them strong candidates for CHs. This spatial analysis is combined with an energy-aware weighting scheme, where each node’s residual energy is compared with its initial energy. The number of clusters is not fixed; instead, it dynamically adjusts according to the number of active (alive) nodes in the network. This adaptive clustering maintains an optimal cluster size, which helps balance the energy consumption across the network and prolongs the operational lifetime of the sensor system. The value of k determines the number of nearest neighbours considered for node assignment and cluster head selection. In our simulations, we set k = 3, a commonly used value in WSN clustering literature. This choice balances local neighbourhoods’ awareness with computational efficiency. Through preliminary experiments, we found that increasing k beyond 3 did not yield significant improvements in energy efficiency or network lifetime, while smaller values led to less stable clusters.
Our experimental results demonstrated significant improvements in the DEEC-K-NN protocol compared with conventional DEEC implementation. These quantitative improvements validate the effectiveness of the K-NN-based clustering approach in optimising network organisation and resource utilisation compared with traditional DEEC protocols.

3.2.3. Performance Results

The implementation results of the DEEC-K-NN protocol, as shown in Table 4, show that the proposed protocols significantly outperformed the original DEEC in several critical aspects. Most notably, the time until the first node dies was extended by 12%, indicating improved network longevity. The total number of data packets successfully delivered nearly doubled, reflecting more efficient and reliable communication. The adaptive nature of the clustering process resulted in fewer but more effective clusters on average, contributing to better energy utilisation and load balancing among cluster heads.
A visual analysis of network performance plots further supports these findings. As shown in Figure 3, the node death curve was more gradual, indicating a slower and more controlled depletion of network resources. Packet delivery was higher and more consistent throughout the network’s lifetime, and energy consumption was more evenly distributed among nodes. The spatial distribution of cluster heads was also improved, leading to better coverage and network stability.
Integrating K-NN-based clustering into the DEEC protocol led to a more energy-efficient, stable, and long-lasting Wireless Sensor Network compared with the original protocol, as shown in Table 5. The proposed method achieved superior network lifetime, energy balance, and communication reliability compared with the original DEEC protocol. These results highlight the potential of ML techniques, such as K-NN, to enhance the organisation and efficiency of resource-constrained sensor networks.

3.3. DEEC-KM

The DEEC-KM approach integrates a Distributed Energy-Efficient Clustering protocol with K-Means optimisation to enhance network lifetime and energy efficiency. The protocol distinguishes between normal and advanced nodes, with advanced nodes having α times more energy than normal nodes. The configuration parameters for the mathematical models and main steps are shown in Algorithm 2.
Algorithm 2 DEEC-KM Clustering and Cluster Head Selection
Input:
  Set of sensor nodes with positions and residual energy
Output:
  Cluster assignments and selected cluster heads
begin
    1.
Initialise all nodes with position and energy.
    2.
 For each round:
    3.
    a. Determine number of clusters: num_clusters = max(2, floor(sqrt(n_alive))
    4.
    b. Apply K-Means clustering to node positions:
    5.
      Randomly initialise cluster centroids.
    6.
      Repeat until convergence or max iterations (100):
    7.
          - Assign each node to the nearest centroid.
    8.
          - Update centroids as the mean position of assigned nodes.
    9.
    c. For each cluster:
       10.
      Select node with highest residual energy as cluster head (CH).
       11.
      If no node meets the energy threshold, reassign nodes to neighbouring clusters.
       12.
     d. Update clusters and repeat for the next round.
end

3.3.1. Proposal Approach

The following modification is proposed for the Distributed Energy-Efficient Clustering (DEEC) protocol:
-
Stage 1: Initial Energy Distribution and Clustering
Calculate the initial cluster areas and cluster heads using the DEEC protocol. The probability of node selection as cluster head is shown in the Equation (9):
p i = p o p t   E i ( r ) ( 1 + m a ) E ( r )   f o r   n o r m a l   n o d e s p o p t   E i ( r ) ( 1 + a ) ( 1 + m a ) E ( r )   f o r   a d v a n c e d   n o d e s
where Popt is the optimal probability of cluster head selection, m is a fraction of advanced nodes, a is the energy factor for advanced nodes, Ei represents the residual energy of node i, E′ is the average energy and r represents the round.
-
Stage 2: K-Means Optimisation
The K-Means optimisation process iteratively refines cluster formation through centroid calculation, as shown in Equation (10):
μ i ( w i ) = 1 | w i | x w i x
where µi represents the centroid of cluster i, wi is the set of nodes in cluster i and x represents node coordinates.
Equation (11) calculates the distance of the node to the centroids:
D = x w n | x μ ( w n ) | 2
Clustering is complete when there are no changes in clusters or the maximum number of iterations is reached. If either condition is not met, the process is repeated until the stopping criteria are satisfied.
-
Stage 3: Cluster Head (CH) Selection and Validation
Spatial Validation: For each candidate CH, verify if it remains within its cluster and is closer to the base station than the cluster centroid. If so, confirm its role as CH.
Centroid Proximity Selection: If the candidate fails validation, select the node nearest to the cluster centroid as a tentative CH.
Energy Assessment: Evaluate the tentative CH’s residual energy. If sufficient, confirm as CH; otherwise, iteratively assess the next closest node.
Cluster Reassignment: If no node meets the energy requirement, dissolve the cluster and reassign its nodes to neighbouring clusters.

3.3.2. Methodology

The proposed DEEC-KM protocol introduces a more adaptive and energy-efficient approach to clustering in WSNs. The algorithm starts by identifying all live nodes in the network and dynamically adjusting the number of clusters based on the current network size. This ensures that clusters remain balanced and efficient as nodes die over time. The K-Means algorithm is then applied to the spatial coordinates of the nodes, grouping them into spatially balanced and well-distributed clusters across the network area.
The node with the highest residual energy in the network will be selected as the CH within each cluster. This energy-aware selection ensures that leadership roles are assigned to nodes best equipped to handle the additional communication load, thereby prolonging the network’s operational life. The number of clusters in K-Means was not fixed but dynamically adjusted based on the number of active nodes in the network at each round. Specifically, we used the heuristic Number of Clusters = max(2, floor(sqrt(nalive))), where nalive is the number of currently active nodes. This approach ensures that clusters remain balanced as the network evolves, which is particularly important in WSNs with node failures. We clarify this rule in the methodology section and provide a brief discussion of its impact. The K-Means algorithm was set to terminate when cluster assignments no longer changed between iterations or when a maximum of 100 iterations was reached, whichever came first. This stopping criterion is standard in clustering applications and ensures convergence without excessive computation.
Using the K-Means clustering algorithm improves the spatial organisation of clusters and allows for adaptive resizing, which helps maintain optimal cluster sizes and load balancing as the network evolves.

3.3.3. Performance Results

The experimental results showed that the K-Means based approach significantly improved several key performance metrics compared with the original DEEC protocol. Energy management was also enhanced. The protocol achieved a slightly lower energy consumption rate per round and a much higher amount of residual energy remaining in the network at the end of the simulation. The adaptive clustering mechanism resulted in an average of 6.3 clusters, each with about 8.7 nodes, which helped distribute the workload more evenly and prevented premature energy depletion in any single area. Table 6 shows that the proposed protocols significantly outperformed the original DEEC in several critical aspects.
As shown in Figure 4, the node death curve was more gradual and the network remained operational for longer. Packet delivery rates were higher and more consistent, and energy depletion was more uniform across nodes. The spatial distribution of clusters was also improved, leading to better coverage and organisation throughout the network’s lifetime.
Regarding simulation results, the time until the first node died was extended by 6.7% and the network maintained 70% of its nodes until round 1204, indicating better stability and longevity. Most notably, the total number of data packets delivered more than doubled, reflecting a 110.7% increase in communication throughput and reliability, as shown in Table 7.
The motivation for introducing K-NN and K-Means into the DEEC protocol arose from several key limitations of the original DEEC approach. First, DEEC’s cluster head (CH) selection is primarily based on residual energy and follows a probabilistic, largely static process. This means it does not dynamically adapt to changes in node distribution, energy heterogeneity, or network topology. The result of implementation can lead to unbalanced cluster formation, uneven energy consumption, and premature node failures, especially in large-scale or dynamic networks. Additionally, DEEC does not explicitly consider the spatial proximity of nodes when forming clusters, which can increase communication costs and reduce network efficiency. The modified approaches for DEEC address these shortcomings: K-NN enables adaptive, proximity-aware cluster formation that responds to local network changes, while K-Means ensures spatially balanced clusters and more even workload distribution. Together, these ML-based enhancements make the protocol more robust, energy-efficient, and better suited for heterogeneous and evolving WSN environments.

4. Discussion

Clustering is a fundamental technique in Wireless Sensor Networks (WSNs) used to enhance energy efficiency and prolong network lifetimes. The Distributed Energy-Efficient Clustering (DEEC) protocol is a well-known approach that selects cluster heads (CHs) based on residual energy. This study compares the original DEEC with two enhanced variants: DEEC-K-NN (using K-Nearest Neighbours for CH selection) and DEEC-KM (using K-Means clustering for CH selection). The discussion is based on key performance metrics: network lifetime, energy consumption, packet delivery, and clustering efficiency. For network lifetime in the original DEEC, the first node died at round 1010, indicating a moderate network lifetime. The protocol maintains a fixed number of clusters, which may not adapt well to changing network conditions as nodes die. In DEEC-K-NN, the first node died later (1131 rounds), and the last node died at round 1400, significantly improving network stability and longevity. The adaptive cluster count allows for better energy balancing as the network evolves. In DEEC-KM, the first node died at round 1078, and 70% of nodes remained alive until round 1204, outperforming both the original and K-NN variants regarding stable network operation. Both K-NN and K-Means clustering extended the stable period of the network, with K-Means providing the longest period with 70% of nodes alive. Regarding packet delivery, the original DEEC delivered 5982 packets to the base station, reflecting the baseline performance. DEEC-K-NN nearly doubled the packet delivery (11,865 packets), indicating more efficient data aggregation and transmission due to better cluster formation. DEEC-KM achieved the highest packet delivery (12,607 packets), suggesting that spatially balanced clusters further optimise communication paths and reduce energy waste. Both advanced clustering methods significantly improved throughput, with K-Means offering the best performance. For energy efficiency, the original DEEC consumed energy at a rate of 0.024997 J/round, with almost all energy depleted by the end of the simulation. DEEC-K-NN showed a similar energy consumption rate (0.025018 J/round) but with a slightly negative remaining energy, indicating some nodes may have died abruptly. In DEEC-K-Means, there was a slightly lower energy consumption rate (0.024952 J/round) and the highest remaining energy (0.0951 J), indicating more balanced and efficient energy usage. K-Means clustering not only conserves more energy but also distributes it more evenly, reducing the risk of early node death. For clustering efficiency, the original DEEC used a fixed number of clusters (10), which may not be optimal as network topology changes. DEEC-K-NN adapted the number of clusters (average of 5.93), leading to more efficient cluster sizes and better energy distribution. DEEC-KM also adapted the number of clusters (average of 6.30) and achieved a balanced average cluster size (8.66 nodes), which is ideal for load balancing and minimising intra-cluster communication costs. Adaptive clustering (K-NN and K-Means) is superior to fixed clustering, with K-Means providing the most balanced cluster sizes. Although the simulation results demonstrate significant improvements in network lifetime, energy efficiency, and packet delivery, it is important to acknowledge that these results were obtained under idealised conditions. Several non-ideal factors may influence the effectiveness of the proposed algorithms:
-
Node Mobility: In many real-world applications, sensor nodes may be mobile (e.g., attached to vehicles, animals, or moving equipment). Mobility can lead to frequent changes in network topology, causing cluster memberships and optimal cluster head assignments to change dynamically. The current versions of DEEC-K-NN and DEEC-K-Means are designed for static networks; thus, their performance may degrade in highly dynamic environments.
-
Environmental Noise and Communication Errors: Wireless communication in real environments is subject to interference, signal attenuation, and packet loss. Such noise can result in inaccurate distance measurements, unreliable neighbour discovery, and data loss, all of which can affect the stability and accuracy of clustering.
-
Hardware Variability: In practice, sensor nodes may have heterogeneous hardware capabilities, including differences in battery life, processing power, and sensing accuracy. These variations can lead to uneven energy consumption and may affect the fairness and efficiency of cluster head selection.

5. Conclusions

The DEEC-K-NN and DEEC-KM approaches dynamically adjust the number and location of cluster heads, leading to more balanced energy consumption and extended network lifetimes. The K-Means approach optimises spatial distribution and outperforms K-NN and the original DEEC in packet delivery and energy conservation. Selecting cluster heads based on spatial proximity and residual energy (as in K-Means) ensures that no single node is overburdened, reducing the likelihood of early node death and network partitioning. The novelty of this work lies in the integration of unsupervised ML algorithms (K-NN and K-Means) with the DEEC protocol for adaptive cluster head selection in heterogeneous WSNs. Our simulation results show that these methods significantly outperform the original DEEC protocol in terms of packet delivery, network stability, and energy efficiency. Overall, this work highlights the promise of combining ML with traditional clustering protocols to address the persistent challenges of energy efficiency and scalability in WSNs. The proposed methods achieved up to 110% improvements in packet delivery and significant increases in network stability and energy efficiency, as demonstrated by our simulation results. The results suggest that spatially aware, adaptive clustering is a compelling direction for future protocol design, especially in applications demanding high reliability and longevity. Limitations of the proposed methods include increased computational overhead compared with traditional DEEC, the assumption of static node deployment, and potential scalability challenges in very large networks. Addressing these limitations will be the focus of future work, which will also explore hybrid models, real-time adaptation, and the integration of additional ML techniques to unlock even greater efficiencies and resilience in Wireless Sensor Networks.

Author Contributions

Conceptualisation, A.J. and L.J.-S.; methodology, A.J. and L.J.-S.; software, A.J.; validation, A.J.; formal analysis, A.J.; investigation, A.J.; resources, A.J.; data curation, A.J.; writing—original draft preparation, A.J.; writing—review and editing, L.J.-S.; visualisation, A.J.; supervision, L.J.-S.; project administration, A.J.; funding acquisition, A.J. All authors have read and agreed to the published version of the manuscript.

Funding

This research work was financed with statutory funds of the Institute of Applied Computer Science, Lodz University of Technology, Poland, No. 501/2-24-1-3.

Data Availability Statement

The data are not available because they are being used for a PhD thesis that is in progress.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Tang, M.; Lau, V.K.N. Online Identification and Temperature Tracking Control for Furnace System With a Single Slab and a Single Heater Over the Wirelessly Connected IoT Controller. IEEE Internet Things J. 2024, 11, 6730–6747. [Google Scholar] [CrossRef]
  2. Maman, A.; Yadi, S.; Fitra Zul, F. A Modified E-LEACH Routing Protocol for Improving the Lifetime of a Wireless Sensor Network. J. Inf. Process. Syst. 2020, 16, 845–858. [Google Scholar]
  3. Sharma, T.; Kumar, B.; Tomar, G.S. Performance Comparison of LEACH, SEP, and DEEC Protocol in Wireless Sensor Net-work. In Proceedings of the Proceedings of International Conference on Advances in Computer Science and Electronics Engineering, New Delhi, India, 3 February 2020; Maharaja Surajmal Institute of Technology: New Delhi, India, 2020. [Google Scholar]
  4. Singh, S.; Malik, A. hetDEEC: Heterogeneous DEEC protocol for prolonging lifetime in wireless sensor networks. J. Inf. Optim. Sci. 2017, 38, 699–720. [Google Scholar] [CrossRef]
  5. El-Sayed, H.H.; Hashem, Z.M. Comparison of the new version of DEEC protocol to extend WSN lifetime. EURASIP J. Wirel. Commun. Netw. 2023, 2023, 56. [Google Scholar] [CrossRef]
  6. Juwaied, A.; Jackowska-Strumiłło, L.; Sierszeń, A. Modified TEEN Protocol in Wireless Sensor Network Using K-NN Algorithm. In Image Processing and Communications Challenges 10. In Advances in Intelligent Systems and Computing, Proceedings of the 10th International Conference, IP&C’2018, Bydgoszcz, Poland, 14–16 November 2018; Springer: Berlin/Heidelberg, Germany, 2018; Volume 892, pp. 161–168. [Google Scholar]
  7. Behiry, M.H.; Aly, M. Cyberattack detection in wireless sensor networks using a hybrid feature reduction technique with AI and machine learning methods. J. Big Data 2024, 11, 16. [Google Scholar] [CrossRef]
  8. Ajmi, N.; Helali, A.; Ridha, M. A Quantum-Behaved Particle-Swarm-Optimization-Based K-NN Classifier for Improving WSN Lifetime. In Sensor Data Analysis and Management: The Role of Deep Learning; IEEE: New York, NY, USA, 2021; pp. 117–129. [Google Scholar]
  9. Fan, L.; Liu, L.; Gao, H.; Ma, Z.; Wu, Y. Secure K-Nearest neighbor queries in two-tiered mobile wireless sensor networks. Digit. Commun. Netw. 2021, 7, 247–256. [Google Scholar] [CrossRef]
  10. El Khediri, S.; Fakhet, W.; Moulahi, T.; Khan, R.; Thaljaoui, A.; Kachouri, A. Improved node localization using K-means clustering for Wireless Sensor Networks. Comput. Sci. Rev. 2020, 37, 100284. [Google Scholar] [CrossRef]
  11. Jong-Yong, L.; Daesung, L. K-means clustering-based WSN protocol for energy efficiency improvement. Int. J. Electr. Comput. Eng. 2021, 11, 2371–2377. [Google Scholar]
  12. Mahboub, A.; Arioua, M.; En-Naimi, E. Energy-Efficient Hybrid K-Means Algorithm for Clustered Wireless Sensor Networks. Int. J. Electr. Comput. Eng. 2017, 7, 2054–2060. [Google Scholar]
  13. Kadim, A.; Al-Mukhtar, F.; Hasan, N.; Alnajjar, A.; Altaei, M. K-Means clustering of optimized wireless network sensor using genetic algorithm. Period. Eng. Nat. Sci. 2022, 10, 276–285. [Google Scholar] [CrossRef]
  14. Juwaied, A.; Jackowska-Strumillo, L. Improving Performance of Cluster Heads Selection in DEC Protocol Using K-Means Algorithm for WSN. Sensors 2024, 24, 6303. [Google Scholar] [CrossRef] [PubMed]
  15. Liu, X.; Moh, S. A Q-learning-based energy-efficient clustering algorithm for wireless sensor networks. Sensors 2016, 16, 1460. [Google Scholar]
  16. Wang, Y.; Attebury, G.; Ramamurthy, B. Reinforcement learning-based data collection scheme for lifetime maximization in wireless sensor networks. IEEE Sens. J. 2019, 19, 11261–11271. [Google Scholar]
  17. Wang, S.; Zhang, X.; Wang, Y. Deep reinforcement learning for energy-efficient wireless sensor networks. IEEE Internet Things J. 2020, 7, 9441–9455. [Google Scholar] [CrossRef]
  18. Liu, Y.; Wu, J. Reinforcement learning-based clustering for wireless sensor networks. In Communication and Intelligent Systems; Springer: Singapore, 2021; Volume 204, pp. 503–512. Available online: https://link.springer.com/chapter/10.1007/978-981-16-1089-9_40#citeas (accessed on 21 July 2025).
  19. Sarker, I.H. Deep Learning: A Comprehensive Overview on Techniques, Taxonomy, Applications and Research Directions. SN Comput. Sci. 2021, 2, 420. [Google Scholar] [CrossRef] [PubMed]
  20. Taye, M.M. Understanding of Machine Learning with Deep Learning: Architectures, Workflow, Applications and Future Directions. Computers 2023, 12, 91. [Google Scholar] [CrossRef]
  21. Ahmed, S.F.; Alam, M.S.B.; Hassan, M.; Rozbu, M.R.; Ishtiak, T.; Rafa, N.; Mofijur, M.; Shawkat Ali, A.B.M.; Gandomi, A.H. Deep learning modelling techniques: Current progress, applications, advantages, and challenges. Artif. Intell. Rev. 2023, 56, 13521–13617. [Google Scholar] [CrossRef]
  22. Juwaied, A.; Jackowska-Strumillo, L.; Majchrowicz, M. Enhanced Distributed Energy-Efficient Clustering (DEEC) Protocol for Wireless Sensor Networks: A Modular Implementation and Performance Analysis. Sensors 2025, 25, 4015. [Google Scholar] [CrossRef] [PubMed]
  23. Singh, S.; Malik, A.; Kumar, R. Energy efficient heterogeneous DEEC protocol for enhancing lifetime in WSNs. Eng. Sci. Technol. Int. J. 2017, 20, 345–353. [Google Scholar] [CrossRef]
  24. Kenza, R.; Mohammed, R. The DEEC and EDEEC Heterogeneous WSN Routing Protocols. Int. J. Adv. Netw. Appl. 2022, 13, 5045–5051. [Google Scholar] [CrossRef]
  25. Asha, A.; Srivastava, A.K.; Doohan, N.V.; Sharma, D.; Bist, A.S.; Neware, R.; Kumar, S. An optimized DEEC approach for efficient packet transmission in sensor based IoTs network. Microprocess. Microsyst. 2023, 96, 104714. [Google Scholar] [CrossRef]
  26. Padmaja, A.R.L.; Jyothirmaye, S.; Vallathan, G.; Karthi, G. Modified-Distributed Energy-Efficient Clustering (M-DEEC) for Heterogeneous Wireless Sensor Network. In Proceedings of the International Conference on Emerging Research in Computational Science (ICERCS), Coimbatore, India, 7–9 December 2023; pp. 1–5. [Google Scholar] [CrossRef]
  27. El-Sayed, H.H.; Mostafa, Z. Modified Distributed Energy-Efficient Clustering Protocol to Increase WSN Lifetime for the IoT Applications (IoT-DEEC). Internet Things 2022. preprint. [Google Scholar] [CrossRef]
  28. Gupta, S.K.; Singh, S. Constrains and their Impacts for Improving Latency of DEEC based Routing Protocols for IOT-WSN. In Proceedings of the 2021 IEEE 6th International Conference on Computing, Communication and Automation (ICCCA), Arad, Romania, 17–19 December 2021; pp. 291–296. [Google Scholar] [CrossRef]
  29. Kaur, K.; Sharma, E.S. Enhanced Distributed Energy Efficient Clustering Protocol. In Proceedings of the 2020 International Conference on Computer Communication and Informatics (ICCCI), Coimbatore, India, 22–24 January 2020; pp. 1–5. [Google Scholar] [CrossRef]
  30. Subramani, N.; Mardani, A.; Mohan, P.; Mishra, A.R.; Ezhumalai, P. A fuzzy logic and DEEC protocol-based clustering routing method for wireless sensor networks. AIMS Math. 2023, 8, 8310–8331. [Google Scholar] [CrossRef]
  31. Redjimi, K.; Boulaiche, M.; Redjimi, M. DEEC and EDEEC Routing Protocols for Heterogeneous Wireless Sensor Networks: A Brief Comparative Study. In Progresses in Artificial Intelligence & Robotics: Algorithms & Applications, ICDLAIR 2021. Lecture Notes in Networks and Systems, Salerno, Italy, 13–31 December 2021; Troiano, L., Vaccaro, A., Kesswani, N., Díaz Rodriguez, I., Brigui, I., Eds.; Springer: Cham, Switzerland, 2022; Volume 441. [Google Scholar] [CrossRef]
  32. Juwaied, A.; Jackowska-Strumillo, L.; Sierszeń, A. Enhancing Clustering Efficiency in Heterogeneous Wireless Sensor Network Protocols Using the K-Nearest Neighbours Algorithm. Sensors 2025, 25, 1029. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Overview of the clustering process in Wireless Sensor Networks.
Figure 1. Overview of the clustering process in Wireless Sensor Networks.
Network 05 00026 g001
Figure 2. DEEC original protocol simulation results.
Figure 2. DEEC original protocol simulation results.
Network 05 00026 g002
Figure 3. Results of implementing the proposed approach, DEEC-K-NN.
Figure 3. Results of implementing the proposed approach, DEEC-K-NN.
Network 05 00026 g003
Figure 4. DEEC-KM protocol simulation results.
Figure 4. DEEC-KM protocol simulation results.
Network 05 00026 g004
Table 1. Comparative summary of DEEC variants.
Table 1. Comparative summary of DEEC variants.
Protocol/VariantApproach/CategoryTargeted ImprovementKey Features/TechniquesMain Limitations/Gaps
DEEC [3,4]Heuristic, Energy-basedEnergy efficiency, LifetimeCH selection based on residual energyIgnores distance to BS, static clustering
IoT-DEEC [5,27]Heuristic, Threshold-basedEnergy efficiency, IoTThreshold-based CH selection, dynamic powerLimited adaptability to topology changes
M-DEEC [26]Heuristic, Multi-levelHeterogeneity, LifetimeMulti-level energy heterogeneity, unique clusteringIncreased complexity, static cluster size
EDEEC [24,31]Heuristic, Multi-levelHeterogeneity, LifetimeThree energy levels (normal, advanced, super)May not adapt to dynamic node failures
Fuzzy-DEEC [30]Learning-based (Fuzzy)Load balancing, LifetimeFuzzy logic for CH selection (energy, distance, compactness)Parameter tuning required, computational overhead
DEEC Metaheuristics [25]Learning-based (GA, Firefly)Energy efficiency, RoutingMetaheuristic optimisation for clustering/routingMay require global knowledge, convergence time
Table 2. Parameters used to implement the proposed protocols in MATLAB®(2024).
Table 2. Parameters used to implement the proposed protocols in MATLAB®(2024).
NoParametersDefinitionDefinition
1x × y100 m × 100 mArea of network, dimensions
2n100Number of nodes in the network
3Rmax2000Maximum number of rounds
4Popt0.1The probability of a node becoming CH
5Eelec50 nJ/bitEnergy dissipation per bit
6Efs10 pJ/bit/m2Energy dissipation for free space
7Emp0.0013 pJ/bit/m4Energy dissipation for multipath delay
8ERx50 nJ/bitReceiving the energy of the sensor
9ED5 nJ/bit/messageData aggregation energy
10Px0.1Probability of a node to become a cluster head
11L4000 bitsPacket size
Table 3. DEEC protocol simulation results summary.
Table 3. DEEC protocol simulation results summary.
NoMetricsValue
1Total Nodes100
2Initial Energy per Node0.5 J
3FND (First Node Death at Round)1010
4LND (Last Node Death at Round)N/A
5Total Packets Sent to BS5982
5Remaining Network Energy0.0065 J
6Energy Consumption Rate0.024997 J/round
Table 4. DEEC-K-NN protocol simulation results summary.
Table 4. DEEC-K-NN protocol simulation results summary.
NoMetricOriginal DEEC
1Total Nodes100
2Initial Energy per Node0.5 J
3First Node Death at Round1131
4Last Node Death at Round1400
5Total Packets Sent to BS11,865
6Remaining Network Energy0.0989 J
7Energy Consumption Rate0.025018 J/round
8Average Number of Clusters5.93
9Network Lifetime (70% alive)1204 rounds
Table 5. Comparative analysis of DEEC and DEEC-K-NN protocols.
Table 5. Comparative analysis of DEEC and DEEC-K-NN protocols.
NoMetricOriginal DEECDEEC-K-NNImprovement
1First Node Death (FND)1010 rounds1131 rounds+12.0%
2Total Packet Delivery5982 packets11,865 packets+98.3%
3Average Cluster Formation10 (static)5.93 (dynamic)Enhanced efficiency
4Network Stability PeriodNot quantified1155 roundsSuperior stability
5Energy Consumption Rate0.024997 J/round0.024988 J/round+0.6%
Table 6. DEEC-KM protocol simulation results summary.
Table 6. DEEC-KM protocol simulation results summary.
NoMetricOriginal DEEC
1Total Nodes100
2Initial Energy per Node0.5 J
3First Node Death at Round1078
4Last Node Death at Round1276
5Total Packets Sent to BS12,607
6Remaining Network Energy0.0951 J
7Energy Consumption Rate0.024952 J/round
8Average Number of Clusters6.30
9Network Lifetime (70% alive)1155 rounds
Table 7. Comparative analysis of DEEC and DEEC-KM protocols.
Table 7. Comparative analysis of DEEC and DEEC-KM protocols.
NoMetricOriginal DEECDEEC-KMImprovement
1First Node Death (FND)1010 rounds1078 rounds6.7%
2Total Packet Delivery5982 packets12,607 packets110.7%
3Average Cluster Formation10 (static)6.30 (dynamic)Enhanced efficiency
4Network Stability PeriodNot quantified1204 roundsEnhanced
5Energy Consumption Rate0.024997 J/round0.024952 J/round0.18%
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

Juwaied, A.; Jackowska-Strumillo, L. Applying Machine Learning to DEEC Protocol: Improved Cluster Formation in Wireless Sensor Networks. Network 2025, 5, 26. https://doi.org/10.3390/network5030026

AMA Style

Juwaied A, Jackowska-Strumillo L. Applying Machine Learning to DEEC Protocol: Improved Cluster Formation in Wireless Sensor Networks. Network. 2025; 5(3):26. https://doi.org/10.3390/network5030026

Chicago/Turabian Style

Juwaied, Abdulla, and Lidia Jackowska-Strumillo. 2025. "Applying Machine Learning to DEEC Protocol: Improved Cluster Formation in Wireless Sensor Networks" Network 5, no. 3: 26. https://doi.org/10.3390/network5030026

APA Style

Juwaied, A., & Jackowska-Strumillo, L. (2025). Applying Machine Learning to DEEC Protocol: Improved Cluster Formation in Wireless Sensor Networks. Network, 5(3), 26. https://doi.org/10.3390/network5030026

Article Metrics

Back to TopTop