With the widespread usage of wireless sensor networks for many monitoring and control applications, a significant number of researchers proposed different types of structures for the WSNs to control the large volume of data that flows through the networks and save sensor node energy to increase the network lifetime. One which can achieve all these requirements is a hierarchical structure which is also called clustering. All previous clustering algorithms that have been proposed use the IEEE 802.15.4 standard which comes with a technique to access the shared communication medium by using the Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA). On the other hand, many researchers demonstrated that the CSMA/CA does not work well with an increasing number of nodes in the network. Therefore, in this paper a novel distributed method has been presented to classify the individual nodes in clusters without depending completely on CSMA/CA technique. The proposed method classifies the network nodes based on a knowledge database installed in advance inside each node in the network. Hardware nodes have been used to evaluate the performance of the new method. The results show that the proposed clustering algorithm achieved better performance compared with the LEACH algorithm in terms of clustering scalability, but it takes longer time than the LEACH to classify the cluster members.