Data loss in wireless transmission is an important factor that restricts the reliable development of wireless sensor networks. However, the compression sensing theory indicates that as long as the signal is sparse or compressible, it can be collected in a low sampled frequency and reconstructed by an algorithm accurately while in data loss. It shows that compressed sensing theory can be a good solution to the problem of data loss. In this paper, a wireless data loss compensation algorithm based on compressed sensing is proposed, and a WiFi-based wireless sensor network hardware system is designed to verify the effectiveness of the algorithm. The developed system with star topology, is composed of sensor nodes, base stations and host computers. The workflow of the system is: when receiving the acquisition instructions issued by the host compute, the nodes begin to collect data, the central processing unit randomly encodes the collected data, the processed data and the original one are sent to the host computer to stores and displays separately. If some data lost during transmission, the compensation algorithm is used for data reconstruction. Through the test, the developed system can realize the expected function, and the proposed algorithm can reconstruct the lost data in the wireless transmission process to a certain extent. In summary, the data loss compensation algorithm is of great value in solving data loss problem and also has far-reaching significance to the development of structural health technology based on wireless sensor network.