## 1 Introduction
Despite these improvements, energy-aware LEACH still fails to guarantee optimal cluster configurations or balanced node density across clusters, limiting its effectiveness in prolonging network lifetime. That is the reason that the problem of nodes with less residual energy being elected as cluster heads has been improved; it takes into account energy terms in the probability threshold and multiplies the remaining amount of energy in the nodes by the cluster head election threshold, the lower the residual energy, and the lower the probability of cluster head election. Therefore, the energy-consideration LEACH protocol still cannot guarantee optimal cluster formation or even node density per cluster. The distance between CH and the BS significantly impacts the energy consumption issue. Numerous clustering protocols, such as Improved-LEACH [10] and BN-LEACH [11], select CHs based on their proximity to minimize the energy usage. The most recent work on energy issues in WSNs [12], particularly focused on wireless-powered IoT, proposes a deep deterministic policy gradient (DDPG)-based distributed multimode resource allocation algorithm. Another approach involves using machine learning methods, such as the K-means clustering algorithm [13; 14; 15; 16], for WSN protocols. Unlike LEACH, K-means-based protocols have focused on how to enhance the CH selection process by considering factors such as residual energy and mode location. Thus, K-means-based protocols first form clusters to achieve a more uniform distribution of nodes within each cluster, selecting a node with substantial residual energy or proximity to the cluster's central point as the CH afterward. Although this method results in more balanced clusters, it has its limitations. For instance, nodes located far from the BS may still become CHs, which accelerates their energy depletion and leads to an early FND. In addition, because K-means involves iterative adjustments to the cluster center, it requires more computation time compared to traditional hierarchical algorithms. Another shortcoming of K-means-based protocols is their failure to account for the energy-intensive transmission distance between CHs and the BS, focusing only on residual energy or proximity to the cluster center. Recent work on advanced clustering methods such as the Grid-K-means-based LEACH protocol suggested improved network stability and lifetime [17]. The mobility-based CH clustering protocol in WSNs are classified into the node's mobility and network architecture aspect. The LEACH-M (Mobile LEACH) [18] protocol proposed the solution to maintain the communication between the mobile node and mobile CH for avoiding being exile from cluster members. This is an efficient approach for vehicular network utilizing a WSN, costing inevitable increased overhead. In addition, there is an increasing trend of research and application cases on autonomous vehicles with WSNs [18; 19; 20; 21]. In [18], a data acquisition algorithm for unmanned aerial vehicles (UAVs) in acoustic WSNs was proposed using a reinforcement learning method. Meanwhile, [20] examined autonomous vehicles with WSNs for monitoring greenhouse crops, focusing on design and implementation within a classical WSN topology. In this paper, we aim to address these limitations by proposing an improved clustering protocol that enhances WSN energy efficiency. Our protocol considers the residual energy of each node, the distance to the BS when electing the CH, and the mobility, utilizing an improved K-means combined with a Mobility-Aware Cluster Head-Election Score (IK-MACHES) algorithm for this purpose. This IK-MCHES algorithm assigns a score to each node based on these three factors, enabling a more energy-efficient CH selection and ultimately prolonging network lifetime.