The paper introduced development and features of wireless sensor networks.Based on(analysis) and comparison of several popular wireless sensor networks routing protocols,it proposed a(ZigBee) wireless sensor networks routing algorithm combining with characteristics of heading face of coal mine underground,which was fit for mesh topology.And the routing’s establishment,maintenance and(recovery) were described in details.The routing algorithms had some reference value to other systems with ZigBee mesh topology.