## 9 Conclusions  
This paper introduced a new modification approach using the KNN algorithm. Different types of protocols have been chosen to which to apply the new algorithm. The common aspect among LEACH, SEP, and TEEN is energy consumption. Therefore, a common drawback is that, if the threshold of these protocols is reached, there will be a connection, and the user will not know where the dead nodes or cluster heads are in the network. Integrating the K-Nearest Neighbour algorithm into Wireless Sensor Network protocols offers more compact and efficient clusters with better CH distribution. These modified protocols considerably improve energy consumption in the network and operational stability by optimising cluster head selection and reducing transmission distances. This paper emphasises reducing power consumption within the network by removing all inactive CHs, resulting in a network configuration that consists solely of active CHs. These results highlight the potential of machine learning techniques, such as KNN, to address critical challenges in WSNs, paving the way for more sustainable and efficient network designs. In this modified framework, all nodes within the network utilise the K-Nearest Neighbours (KNN) algorithm to select the nearest CHs. The implemented modifications ensure no overlapping CHs within the network, ensuring each cluster area is assigned a single CH. Table 5 compares the results for the modified Low-Energy Adaptive Clustering Hierarchy (LEACH), Stable Election Protocol (SEP), and Threshold-sensitive Energy Efficient sensor Network (TEEN) protocols, highlighting the differences in energy consumption based on the configuration of the CHs. The KNN approach facilitates using fewer CHs to cover the network area effectively. Although the primary focuses of our study were energy efficiency, distance management, and network lifetime, the proposed modifications inherently contribute to other objectives. The proposed approach reduces the communication overhead and transmission delays by optimising the selection of cluster heads (CHs) and minimising the distance between nodes and CHs. This indirectly improves latency, as shorter distances result in faster data transmission. The KNN algorithm ensures that CHs are selected based on their residual energy and proximity to the base station (BS). This prevents premature CH failures and ensures consistent data transmission, thereby enhancing network reliability. Dead nodes and CHs are excluded from the clustering process in each round, ensuring that only active nodes participate in the network. This dynamic adjustment improves the fault tolerance of the network by maintaining connectivity and functionality despite node failures. After applying the evaluation algorithm to the protocols, less energy consumption appears in the network after removing the dead cluster heads. The new approach improves network lifetime and decreases energy consumption by using a smaller number of CHs to cover all networks and minimise the distance between the CHs and nodes. As was shown in Table 4, the proposed approach shows less energy dissipation, no dead cluster heads, a smaller number of dead nodes, and fewer cluster areas. All cluster areas in the network had CH, and there was no overlapping of CHs in the network. While the current study focuses on simulations using MATLAB, future work will include practical implementations in testbed environments. These environments will simulate dynamic and unpredictable events, such as node failures, environmental interference, and varying energy levels. This will allow us to evaluate the robustness and adaptability of the approach under real-world conditions. Additionally, we plan to incorporate mobility models to simulate dynamic topologies and assess the performance of the proposed protocols in such scenarios. Research could explore the application of other machine learning algorithms to enhance further the adaptability and performance of WSN protocols and real-world testing to validate the simulation results.