Nowadays there are a variety of algorithms for robotic sensors that attack the problem of tracking perimeters of anomalies in physical environments. Such anomalies can be seen in applications such as forest fire detection or tracking temperature gradients in the sea. In this paper we propose an improved algorithm for anomalies perimeter tracking, which is based on the bang-bang algorithm and is complemented with a Proportional Integral Derivative control to optimize the direction of movement of each robotic sensor belonging to a network. The tests are performed on a specific simulator for mobile sensors networks and we evaluate the performance of the proposed algorithm in comparison with the bang-bang and bang-bang improved algorithms. Finally, we highlight the improvement in speed and accuracy of the proposed algorithm by applying two metrics for comparison.