## 3 Act
### Compression
#### 3.3.2 Applicability  
TinyOS Tools for Wavelet Decomposition on motes [41] provides a modular library of components to facilitate the construction of application-specific progressive transmission or lossy compression solutions over WSN devices, or sensor motes in wireless sensor network. This project provides a multi-resolution data transmission library in order to reduce latency/bandwidth/energy of data transmission after vibration events. Efficient Integer-Integer Wavelet Lifting Transform is a wavelet lifting transform that uses only integer operations and can decompose data in real-time for data rates as high as 250 Hz. The filter was chosen after evaluating the performance over building vibration signals that were obtained from tests. Threshold builds a histogram of the signal to determine ideal threshold for signal de-noising and compression. Quantization is a uniform quantizer that can be used to reduce the resolution of data depending on the range of the signal and number of bits allocated to each sample. Run-Length Encoding is an encoder that takes a thresholded/quantized wavelet decomposed stream, compresses it and packs it into a bit-stream. Bit-Stream is an embedded bit-stream that can be used to pack samples depending on resolution of each sample. EEPROM Circular Buffer Manager partitions the EEPROM into different circular buffers that can be used for event storage. These modules can be used independently. One application may decide to use solely quantization followed by packing data in a bit-stream.  
Distributed Wavelet Transform for Wireless Sensor Networks [42] implements data compression for wireless sensor networks by using a distributed wavelet transform. This compression system lowers the number of devices which need to transmit data to a base station, and thus reduces power consumption and increases the average lifetime of the network. The source code running on the mote, was written in neS C for TinyOS [9] and tested on Crossbow's MicaZ platform [43]. The first was a suite of networking components. As the focus of this project is not on routing protocols, we opted for simplicity by using basic broadcast and unicast protocols. The broadcast protocol waits for packets with a sequence number larger than the last sequence number received, and then repeats those new packets a set number of times. The unicast protocol uses a static routing table to determine the next hop for a given packet. Above these protocols, a multi-packet fragmentation and reassembly service were built. It allows for bidirectional communication of any data size. TinyOS 1.x uses a fixed data length of 29 bytes, so expanding beyond this limit in a reusable manner simplifies code significantly. By using small descriptor records, this system can even rebuild data structures that use pointers or variable-length arrays. These techniques were used to send the initial wavelet transform parameters to the motes and also to request statistical data from the motes about network traffic. The distributed wavelet transform is the core application running on top of these and other standard TinyOS system services.  
To ensure that each mode runs each scale of the transform at the same time, a finite state machine with fixed-length delays between each state is used. To achieve data compression, each more compares its value against a list of target values from the sink, which are arranged in decreasing order. Each mode compares its results from the current round of the wavelet transform with the target values. The first target value that is less than the result value determines the transmission band. Each more assigned to a specific band transmits its data back to the sink at roughly the same time. When the sink determines it has received enough values to reconstruct a good approximation of the original data, it broadcasts a stop message to prevent further bands from being transmitted. This message also includes updated target values that will be used during the next transform round.