Wireless sensor nodes are usually embedded in the physical environment and report sensed data to a central base station. Clustering is one of the most challenging issues in wireless sensor networks. This paper proposes a new cluster scheme for wireless sensor network by modified the K means clustering algorithm. Sensor nodes are deployed in a harsh environment and randomly scattered in the region of interest and are deployed in a flat architecture. The transmission of packet will reduce the network lifetime. Thus, clustering scheme is required to avoid network traffic and increase overall network lifetime. In order to cluster the sensor nodes that are deployed in the sensor network, the location information of each sensor node should be known. By knowing the location of the each sensor node in the wireless sensor network, clustering is formed based on the highest residual energy and minimum distance from the base station. Among the group of nodes, one node is elected as a cluster head using centroid method. The minimum distance between the cluster node’s and the centroid point is elected as a cluster head. Clustering of nodes can minimize the residual energy and maximize the network performance. This improves the overall network lifetime and reduces network traffic.