**An Algorithm for Denoising and Compression in Wireless Sensor Networks**

Ehsan Sheybani

16 Wireless Sensor Networks Book 2

[14] Jain, A., Chang, E. & Wang, Y. [2004]. Adaptive stream resource management using kalman filters., *ACM SIGMOD/PODS Conference (SIGMOD Š04), Paris, France* .

[16] Min, R., Bhardwaj, M., hwan Cho, S. & Sinha, E. S. A. [2001]. Low-power wireless sensor

[18] Olston, C., Jiang, J. & Widom, J. [2003]. Adaptive filters for continuous queries over distributed data streams, *ACM SIGMOD, Intl Conference on Management of data (SIGMOD*

[19] Olston, C., Loo, B. T. & Widom, J. [2001]. Adaptive precision setting for cached

[20] Olston, C. & Widom, J. [2005]. Efficient monitoring and querying of distributed, dynamic

[22] Santini, S. [2006]. Poster abstract: Towards adaptive wireless sensor networks, *3rd*

[23] Santini, S. & Romer, K. [2006]. An adaptive strategy for quality-based data reduction in wireless sensor networks, *Proceedings of 3rd International Conference on Networked Sensing*

[24] Tulone, D. & Madden, S. [2006a]. An energy-efficient querying framework in sensor networks for detecting node similarities, *MSWiM '06: Proceedings of the 9th ACM international symposium on Modeling analysis and simulation of wireless and mobile systems*,

[25] Tulone, D. & Madden, S. [2006b]. Paq: Time series forecasting for approximate query answering in sensor networks, *European Workshop on Wireless Sensor Networks EWSN*

[26] G. Patterson & M. Mehmet-Ali [2011 ] "Modeling of data reduction in wireless sensor

[27] Rooshenas,A. , Rabiee,H.R. , Movaghar,A., & M.Y. Naderi,[2010 ] "Reducing the data transmission in wireless sensor networks using the principal component analysis," *In Proceeding of the Sixth International Conference on Intelligent Sensors, Sensor Networks and*

[28] E.Msechu & G.Giannakis, [2012 "Sensor-centric data reduction for estimation with wsns via censoring and quantization," *IEEE Transactions on Signal Processing*, vol. 60, no. 1,

networks," *Wireless Sensor Network*, vol. 3, no. 8, pp. 283–294, 2011.

*Information Processing (ISSNIP'10)*, (Brisbane, Australia), IEEExplore, 2010.

[15] Jolliffe, I. [2002]. *Principal Component analysis*, Springer Berlin Heidelberg.

[17] Olston, C. [2003]. *Approximate Replication*, PhD thesis, Stanford University.

approximate values, *Proceedings of SIGMOD Conference* .

[21] Proakis, J. [2006]. *Digital Signal Processing*, Prentice Hall.

data via approximate replication, *IEEE Data Engineering Bulletin* .

*European Workshop on Wireless Sensor Networks (EWSN 2006)* pp. 13–15.

networks, *In VLSI Design*, pp. 205–210.

*03))* pp. 563–574.

*Systems(INSS 2006),Chicago* .

pp. 21–37.

pp. 400–414, 2012.

ACM, New York, NY, USA, pp. 191–300.

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/48518

## **1. Introduction**

Many wireless sensor network datasets suffer from the effects of acquisition noise, channel noise, fading, and fusion of different nodes with huge amounts of data. At the fusion center, where decisions relevant to these data are taken, any deviation from real values could affect the decisions made. We have developed computationally low power, low bandwidth, and low cost filters that will remove the noise and compress the data so that a decision can be made at the node level. This wavelet‐based method is guaranteed to converge to a stationary point for both uncorrelated and correlated sensor data. Presented here is the theoretical background with examples showing the performance and merits of this novel approach compared to other alternatives.

Noise (from different sources), data dimension, and fading can have dramatic effects on the performance of wireless sensor networks and the decisions made at the fusion center. Any of these parameters alone or their combined result can affect the final outcome of a wireless sensor network. As such, total elimination of these parameters could also be damaging to the final outcome, as it may result in removing useful information that can benefit the decision making process. Several efforts have been made to find the optimal balance between which parameters, where, and how to remove them. For the most part, experts in the field agree that it is more beneficial to remove noise and/or compress data at the node level [Closas, P., 2007], [Yamamoto, H., 2005], [Son, S.‐H., 2005]. This is mainly stressed so that the low power, low bandwidth, and low computational overhead of the wireless sensor network node constraints are met while fused datasets can still be used to make reliable decisions [Abdallah, A., 2006], [Schizas, I.D., 2006], [Pescosolido, L., 2008].

Digital signal processing algorithms, on the other hand, have long served to manipulate data to be a good fit for analysis and synthesis of any kind. For the wireless sensor networks

© 2012 Sheybani, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Sheybani, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

a special wavelet‐based approach has been considered to suppress the effect of noise and data order. One of the advantages of this approach is in that one algorithm serves to both reduce the data order and remove noise. The proposed technique uses the orthogonality properties of wavelets to decompose the dataset into spaces of coarse and detailed signals. With the filter banks being designed from special bases for this specific application, the output signal in this case would be components of the original signal represented at different time and frequency scales and translations. A detailed description of the techniques follows in the next section.

### **2. Wavelet‐based transforms**

Traditionally, Fourier transform (FT) has been applied to time‐domain signals for signal processing tasks such as noise removal and order reduction. The shortcoming of the FT is in its dependence on time averaging over entire duration of the signal. Due to its short time span, analysis of wireless sensor network nodes requires resolution in particular time and frequency rather than frequency alone. Wavelets are the result of translation and scaling of a finite‐length waveform known as mother wavelet. A wavelet divides a function into its frequency components such that its resolution matches the frequency scale and translation. To represent a signal in this fashion it would have to go through a wavelet transform. Application of the wavelet transform to a function results in a set of orthogonal basis functions which are the time‐frequency components of the signal. Due to its resolution in both time and frequency wavelet transform is the best tool for detection and classification of signals that are non‐ stationary or have discontinuities and sharp peaks. Depending on whether a given function is analyzed in all scales and translations or a subset of them the continuous (CWT), discrete (DWT), or multi‐resolution wavelet transform (MWT) can be applied.

An example of the generating function (mother wavelet) based on the Sinc function for the CWT is:

$$\log\left(t\right) = \text{2Sinc}\left(2t\right) - \text{Sinc}\left(t\right) \tag{1}$$

The subspaces of this function are generated by translation and scaling. For instance, the subspace of scale (dilation) *a* and translation (shift) *b* of the above function is:

$$
\psi\_{a,b}(t) = \frac{1}{\sqrt{a}} \nu(\frac{t-b}{a}) \tag{2}
$$

When a function *x* is projected into this subspace, an integral would have to be evaluated to calculate the wavelet coefficients in that scale:

$$WT\_{\boldsymbol{\nu}}\{\mathbf{x}\}(a,b) = \left\langle \mathbf{x}, \boldsymbol{\nu}\_{a,b} \right\rangle = \int\_{\mathcal{R}} \mathbf{x}(t) \overline{\boldsymbol{\nu}\_{a,b}(t)} dt \tag{3}$$

And therefore, the function *x* can be shown in term of its components:

An Algorithm for Denoising and Compression in Wireless Sensor Networks 189

$$\text{tr}\_a(t) = \int\_R \mathcal{W} T\_\psi \, \{\mathbf{x}\} (a, b) . \mathcal{W}\_{a, b}(t) db. \tag{4}$$

Due to computational and time constraints it is impossible to analyze a function using all of its components. Therefore, usually a subset of the discrete coefficients is used to reconstruct the best approximation of the signal. This subset is generated from the discrete version of the generating function:

$$
\psi\_{m,n}(t) \;= a^{-m/2} \psi \left( a^{-m} t - nb \right). \tag{5}
$$

Applying this subset to a function *x* with finite energy will result in DWT coefficients from which one can closely approximate (reconstruct) *x* using the coarse coefficients of this sequence:

$$\mathbf{x}(t) = \sum\_{m \in \mathbb{Z}} \sum\_{n \in \mathbb{Z}} \left< \mathbf{x}\_{\prime} \boldsymbol{\nu}\_{m,n} \right> \boldsymbol{\nu}\_{m,n}(t). \tag{6}$$

The MWT is obtained by picking a finite number of wavelet coefficients from a set of DWT coefficients. However, to avoid computational complexity, two generating functions are used to create the subspaces:

Vm Subspace:

188 Wireless Sensor Networks – Technology and Applications

techniques follows in the next section.

**2. Wavelet‐based transforms**

CWT is:

a special wavelet‐based approach has been considered to suppress the effect of noise and data order. One of the advantages of this approach is in that one algorithm serves to both reduce the data order and remove noise. The proposed technique uses the orthogonality properties of wavelets to decompose the dataset into spaces of coarse and detailed signals. With the filter banks being designed from special bases for this specific application, the output signal in this case would be components of the original signal represented at different time and frequency scales and translations. A detailed description of the

Traditionally, Fourier transform (FT) has been applied to time‐domain signals for signal processing tasks such as noise removal and order reduction. The shortcoming of the FT is in its dependence on time averaging over entire duration of the signal. Due to its short time span, analysis of wireless sensor network nodes requires resolution in particular time and frequency rather than frequency alone. Wavelets are the result of translation and scaling of a finite‐length waveform known as mother wavelet. A wavelet divides a function into its frequency components such that its resolution matches the frequency scale and translation. To represent a signal in this fashion it would have to go through a wavelet transform. Application of the wavelet transform to a function results in a set of orthogonal basis functions which are the time‐frequency components of the signal. Due to its resolution in both time and frequency wavelet transform is the best tool for detection and classification of signals that are non‐ stationary or have discontinuities and sharp peaks. Depending on whether a given function is analyzed in all scales and translations or a subset of them the continuous (CWT), discrete

An example of the generating function (mother wavelet) based on the Sinc function for the

*t Sinc t Sinc t* 2 2 – *Sin t Sin t* (2 ) ( )

The subspaces of this function are generated by translation and scaling. For instance, the

<sup>1</sup> () ( ) *a b t b <sup>t</sup> a a*

When a function *x* is projected into this subspace, an integral would have to be evaluated to

, , { }( , ) , ( ) ( ) *a b a b*

*WT x a b x x t t dt*

 

*R*

 

 

subspace of scale (dilation) *a* and translation (shift) *b* of the above function is:

,

And therefore, the function *x* can be shown in term of its components:

*t* 

(2)

(3)

(1)

(DWT), or multi‐resolution wavelet transform (MWT) can be applied.

calculate the wavelet coefficients in that scale:

$$\phi\_{m,n}(t) := 2^{-m/2} \phi(2^{-m}t - n) \tag{7}$$

And Wm Subspace:

$$
\psi\_{m,n}(t) := 2^{-m/2} \varphi \left( 2^{-m} t - n \right). \tag{8}
$$

From which the two (fast) wavelet transform pairs (MWT) can be generated:

$$
\phi(t) = \sqrt{2} \sum\_{n \in \mathbb{Z}} h\_n \phi(2t - n) \tag{9}
$$

and

$$
\psi(t) = \sqrt{2} \sum\_{n \in \mathbb{Z}} g\_n \phi(2t - n) \tag{10}
$$

In this paper the DWT has been used to suppress noise and reduce order of data in a wireless sensor network. Due to its ability to extract information in both time and frequency domain, DWT is considered a very powerful tool. The approach consists of decomposing the signal of interest into its detailed and smoothed components (high‐and low‐frequency). The detailed components of the signal at different levels of resolution localize the time and

frequency of the event. Therefore, the DWT can extract the coarse features of the signal (compression) and filter out details at high frequency (noise). DWT has been successfully applied to system analysis for removal of noise and compression [Cohen, I., 1995], [Daubechies, I., 1992]. In this paper we present how DWT can be applied to detect and filter out noise and compress signals. A detailed discussion of theory and design methodology for the special‐purpose filters for this application follows.

## **3. Theory of DWT‐based filters for noise suppression and order reduction**

DWT‐based filters can be used to localize abrupt changes in signals in time and frequency. The invariance to shift in time (or space) in these filters makes them unsuitable for compression problems. Therefore, creative techniques have been implemented to cure this problem [Liang, J., 1996], [Cohen, I., 1995], [Daubechies, I., 1992], [Coifman, R., 1992], [Mallat, S., 1991], [Mallat, S., 1992]. These techniques range in their approach from calculating the wavelet transforms for all circular shifts and selecting the "best" one that minimizes a cost function [Liang, J., 1996], to using the entropy criterion [Coifman, R., 1992] and adaptively decomposing a signal in a tree structure so as to minimize the entropy of the representation. In this paper a new approach to cancellation of noise and compression of data has been proposed. The discrete Meyer adaptive wavelet (DMAW) is both translation‐ and scale‐invariant and can represent a signal in a multi‐scale format. While DMAW is not the best fit for entropy criterion, it is well suited for the proposed compression and cancellation purposes [Mallat, S., 1992].

The process to implement DMAW filters starts with discritizing the Meyer wavelets defined by wavelet and scaling functions as:

$$
\phi(t) = \sqrt{2} \sum\_{n \in \mathbb{Z}} h\_n \phi(2t - n) \tag{11}
$$

and

$$
\phi \varphi(t) = \sqrt{2} \sum\_{n \in \mathbb{Z}} g\_n \phi(2t - n) \tag{12}
$$

The masks for these functions are obtained as:

$$\left\{ \phi(0), \phi(\frac{1}{2^m}), \dots, \phi(\frac{M-1}{2^m}) \right\} \tag{13}$$

and

$$\left\{0, 0, \ldots, 0, \varphi(0), \varphi(\frac{1}{\sigma}), \ldots, \varphi(\frac{N}{\sigma})\right\}.\tag{14}$$

As these two masks are convolved, the generating function (mother wavelet) mask can be obtained as:

$$F(\frac{k}{2^m}) \quad \text{ ( $-M \le k \le N$ )}.\tag{15}$$

Where for every integer k, integers 1 2 , ,....., *kk k <sup>q</sup> nn n* can be found to satisfy the inequality:

$$1 - \mathfrak{Z} < \mu - n\_i^k + \frac{k\sigma}{2^m} < \frac{\mathfrak{Z}\sigma}{2^m} \quad \text{ ( $1 \le i \le q$ )}.\tag{16}$$

The corresponding values from mother wavelet mask can then be taken to calculate:

$$
\alpha\_i^k = \frac{\mathfrak{Z}^{m/2}}{\sigma} F(\frac{\rho\_i^k}{\mathfrak{Z}^m}) \,'
$$

where ( )2 (1 ) *k km i i n k iq*

and

190 Wireless Sensor Networks – Technology and Applications

cancellation purposes [Mallat, S., 1992].

The masks for these functions are obtained as:

by wavelet and scaling functions as:

**reduction**

and

and

the special‐purpose filters for this application follows.

frequency of the event. Therefore, the DWT can extract the coarse features of the signal (compression) and filter out details at high frequency (noise). DWT has been successfully applied to system analysis for removal of noise and compression [Cohen, I., 1995], [Daubechies, I., 1992]. In this paper we present how DWT can be applied to detect and filter out noise and compress signals. A detailed discussion of theory and design methodology for

DWT‐based filters can be used to localize abrupt changes in signals in time and frequency. The invariance to shift in time (or space) in these filters makes them unsuitable for compression problems. Therefore, creative techniques have been implemented to cure this problem [Liang, J., 1996], [Cohen, I., 1995], [Daubechies, I., 1992], [Coifman, R., 1992], [Mallat, S., 1991], [Mallat, S., 1992]. These techniques range in their approach from calculating the wavelet transforms for all circular shifts and selecting the "best" one that minimizes a cost function [Liang, J., 1996], to using the entropy criterion [Coifman, R., 1992] and adaptively decomposing a signal in a tree structure so as to minimize the entropy of the representation. In this paper a new approach to cancellation of noise and compression of data has been proposed. The discrete Meyer adaptive wavelet (DMAW) is both translation‐ and scale‐invariant and can represent a signal in a multi‐scale format. While DMAW is not the best fit for entropy criterion, it is well suited for the proposed compression and

The process to implement DMAW filters starts with discritizing the Meyer wavelets defined

( ) 2 (2 ) *<sup>n</sup> n Z*

( ) 2 (2 ) *<sup>n</sup> n Z*

1 1 (0), ( ),....., ( ) 2 2 *m m*

<sup>1</sup> 0,0,...,0, (0), ( ),....., ( ) . *<sup>N</sup>* 

 

 *t g tn* 

*M*

 

> 

 *t h tn* 

(11)

(12)

(13)

(14)

**3. Theory of DWT‐based filters for noise suppression and order**

$$\frac{\mathcal{L}\_{-m,k}}{\sqrt{\alpha}} - \sum\_{i=1}^{q} c\_{ni} \alpha\_i^k. \tag{17}$$

Decomposing the re‐normalized signal , ( ) *m k <sup>c</sup> k Z* according to the conventional DWT, will result in the entire DMAW filter basis for different scales:

$$\frac{c\_{-m+1,k}}{\sqrt{\alpha}}, \frac{d\_{-m+1,k}}{\sqrt{\alpha}}, \frac{c\_{-m+2,k}}{\sqrt{\alpha}}, \frac{d\_{-m+2,k}}{\sqrt{\alpha}}, \dots, \frac{c\_{0,k}}{\sqrt{\alpha}}, \frac{d\_{0,k}}{\sqrt{\alpha}}\tag{18}$$

#### **4. Experimental results**

Figures 1, 2, and 3 show the experimental results for the application of the proposed filter banks to a noisy sinusoidal signal. As is evident from these figures, a signal can be decomposed in as many levels as desired by the application and allowed by the computational constraints. Levels shown from top to bottom represent the coarse to detailed components of the original signal.

Once the signal is decomposed to its components, it is easy to do away with pieces that are not needed. For instance, noise, which is the lower most signal in Figure 1 can be totally discarded. On the other hand, if compression is necessary, all but the coarse component (upper most element, below the original signal) can be kept and the rest of the modules discarded. This signal alone is a fairly good approximation of the original signal. Figure 2 shows the thresholds and coefficients of the signal being filtered.

**Figure 1.** Decomposed signal showing all the components of a mixed sine wave with noise

**Figure 2.** Threshold and coefficients of the decomposed signal

**Figure 3.** Histogram and cumulative histogram of the signal

**Figure 1.** Decomposed signal showing all the components of a mixed sine wave with noise

**Figure 2.** Threshold and coefficients of the decomposed signal

Figure 3 shows the histogram (frequency of components distribution) of the signal. For comparison purposes the same filter banks have also been applied to a quad‐chirp signal with noise and the results are shown in Figures 4‐9. The denoised and compressed versions of the signal have been computed and plotted. In each case the coefficients that have remained intact for denoising and compression have also been displayed. Finally, in Figures 7‐25 the histogram for the denoised and compressed quad‐chirp, auto‐regressive, white noise, and step signals have been compared to the original signal. The effectiveness of the proposed filter banks and their capability to maintain the important components of the original signal is evident in these figures.

**Figure 4.** Decomposed signal showing all the components of a quad‐chirp wave with noise

**Figure 5.** Original and denoised signal with original and thresholded coefficients

**Figure 4.** Decomposed signal showing all the components of a quad‐chirp wave with noise

**Figure 5.** Original and denoised signal with original and thresholded coefficients

**Figure 6.** Threshold and coefficients of the decomposed signal showing retained energy and number of zeros

**Figure 7.** Histogram and cumulative histogram of the original quad‐chirp signal

**Figure 8.** Histogram and cumulative histogram of the denoised quad‐chirp signal

**Figure 9.** Histogram and cumulative histogram of the compressed quad‐chirp signal

**Figure 8.** Histogram and cumulative histogram of the denoised quad‐chirp signal

**Figure 9.** Histogram and cumulative histogram of the compressed quad‐chirp signal

**Figure 10.** Decomposed signal showing all the components of an auto‐regressive wave with noise

**Figure 11.** Histogram and cumulative histogram of the original auto‐regressive signal

**Figure 12.** Threshold and coefficients of the decomposed signal showing retained energy and number of zeros

**Figure 13.** Original and denoised signal with original and thresholded coefficients

**Figure 14.** Decomposed signal showing all the components of white noise

of zeros

**Figure 12.** Threshold and coefficients of the decomposed signal showing retained energy and number

**Figure 13.** Original and denoised signal with original and thresholded coefficients

**Figure 15.** Histogram and cumulative histogram of the original white noise signal

**Figure 16.** Threshold and coefficients of the decomposed signal showing retained energy and number of zeros

**Figure 17.** Original and denoised signal with original and thresholded coefficients

of zeros

**Figure 16.** Threshold and coefficients of the decomposed signal showing retained energy and number

**Figure 17.** Original and denoised signal with original and thresholded coefficients

**Figure 18.** Decomposed signal showing all the components of a doppler wave with noise

**Figure 19.** Histogram and cumulative histogram of the original doppler signal

**Figure 20.** Threshold and coefficients of the decomposed signal showing retained energy and number of zeros

**Figure 21.** Original and denoised signal with original and thresholded coefficients

**Figure 22.** Decomposed signal showing all the components of a step signal

of zeros

**Figure 20.** Threshold and coefficients of the decomposed signal showing retained energy and number

**Figure 21.** Original and denoised signal with original and thresholded coefficients

**Figure 23.** Histogram and cumulative histogram of the original step signal

**Figure 24.** Threshold and coefficients of the decomposed signal showing retained energy and number of zeros

**Figure 25.** Original and denoised signal with original and thresholded coefficients

#### **5. Conclusions and future work**

As expected from the theory, the DMAW filters performed well under noisy conditions in a wireless sensor network. The decomposed signal could be easily freed up from noise and reduced down to its coarse component only. This could be reduction by several orders of magnitude in some cases. Future plans include the application of these filters to fused datasets and comparison between the two approaches. Additionally, the results of these study can be used in the decision making stage to realize the difference this approach can make in speed and efficiency of this process.

Future work will address issues such as characterizing the parameters for simulation and modeling of the proposed filter for WSN; showing how complex examples with correlated sensor data will be filtered for redundancy; comparing the proposed approach with other similar approaches and giving comparative results to support the claimed advantages, both theoretically and experimentally.

### **Author details**

204 Wireless Sensor Networks – Technology and Applications

of zeros

**Figure 24.** Threshold and coefficients of the decomposed signal showing retained energy and number

**Figure 25.** Original and denoised signal with original and thresholded coefficients

Ehsan Sheybani *Virginia State University, Petersburg, VA, USA*

#### **6. References**


**Chapter 0 Chapter 10**
