The invention discloses an algorithm for avoiding a routing loop for an RPL (IPv6Routing Protocol for Low-Power and Lossy Networks) protocol, which belongs to the technical field of a wireless sensor network. In the case of a consistent event, continuous transmission for Vcon times is firstly carried out, if consistency still exists, Q*Imin times are added between each two transmission intervals, information exchange between nodes is enhanced, a situation in which link quality deterioration happens to nodes at one side, and the other side of nodes cannot be timely informed is avoided, and the probability of loop appearing can be reduced. In the case of an inconsistent event, continuous transmission for Vcon times is firstly carried out, if inconsistency still exists, transmission interruption is added cyclically in each two times of continuous transmission, transmission interruption is controlled through Crand, 1 is increased each time when Crand is used for one time, time for transmission interruption is a product between the minimal transmission interval Imin and a variate between (0, Crand),and by the analogy, when the Crand value is equal to P, a variable is reset, and control on the inconsistent event is started again. A transmission interval between consistency and inconsistency by the existing Trickle algorithm is improved, and the probability of routing loops is reduced.