Internet of Things (IoTs) as a new network pattern for the intelligent world usually uses wireless sensor networks (WSNs) as a perception layer which consisted of numerous number of sensor nodes scattered in the environment to gather intended information. The selected information then is sent to a base station (BS) to be sent to cloud server for further processing. Since the energy of sensor nodes is limited, the most significant challenge in these networks is reducing the energy consumption of the network. It is proved that dividing the network to clusters can significantly reduce the energy consumption. One of the most popular clustering protocols in WSNs is the Low-Energy Adaptive Clustering Hierarchy (LEACH). In this protocol, cluster heads (CHs) are selected randomly which results in poor performance in real scenarios. In this article, a new energy aware CH selection algorithm is proposed which selects CHs based on the residual energy, the position and centrality of nodes. It uses a variable range upon which the centrality and the number of neighbours of each node are calculated. Simulation results show that the proposed algorithm outperforms LEACH, Multi-hope Routing with LEACH (MR-LEACH) and Enhanced Multi-hop LEACH (EM-LEACH) in terms of reducing energy consumption, increasing network lifetime and improving network reliability.This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited.