Wireless sensor networks (WSNs) are attracting great interest from a large research community. The main function of these types of networks is their ability to collect physical data from a given environment such as temperature, humidity and light, etc. They are mainly designed for low-power embedded communications. One of the most felt drawbacks of sensor nodes is their inability to recognize their own positions if they are not equipped with a global positioning module (GPS). In this paper, we first implemented the traditional "Distance Vector Hop" localization algorithm, known by the acronym "DV-Hop", on the Cooja/Contiki platform, which served as a control sample. Subsequently, we developed a new contribution in which the unknown node estimated its distance to all anchors in the network, based only on locally available information. Our goal was to significantly reduce the distance gap between the actual and the estimated distance. The idea of the contribution was implemented on the Cooja/Contiki emulator, and was based on two techniques: 1-Calculating the distance error rate (Euclidean distance/SSRI distance). 2-Converting the type of node once located into an anchor. Our simulation results show that the proposed DVA-Hop algorithm had a better accuracy than the native "DV-Hop"method.