A simple algorithm for data compression in wireless sensor networks