Localization has many important applications in wireless sensor networks. A variety of wireless technologies, such as acoustic, infrared, and ultra-wide band (UWB) media have been applied for localization purposes. This paper consists of two parts. The first part presents new UWB-based communication protocols for received signal strength (RSS) information collection, namely, a robust UWB coding method called U-BOTH (UWB based on Orthogonal Variable Spreading Factor and Time Hopping), an ALOHA-type channel access method and a message exchange protocol to collect location information. The second part presents the localization algorithm, which is applied in coal mine environments. The localization algorithm first derives the corresponding UWB path loss model, then applies the maximum likelihood estimation (MLE) method to compute the distances to the reference sensors using the RSS information, and to estimate the coordinate of the moving sensor using least squares (LS) method. The performance of the system is validated using theoretic analysis and simulations. Results show that U-BOTH transmission technique can effectively reduce the bit error rate under the path loss model, and the corresponding ranging and localization algorithms can accurately compute object locations in coal mine environments.