Implementation of Denoising...
Implementation of Denoising...
Prepared By:
Mohammed Abd Elmonim Mohammed Yousif
Supervisor:
Dr. Omer Abdel Razag Sharif Abubaker
MARCH 2019
ﺍﻵﻳﺔ
ﻗﺎﻝ ﺗﻌﺎﻟﻲ:
ii
ACKNOWLEDGEMENT
An endless appreciation cannot fulfill my research supervisor Dr. Omer
Abdelrazag Sharif for his help throughout this thesis writing, he provides me
with the strength to complete this thesis, I thank him very much for his
endless support, guidance, encouragement, wise advice along with his
precious time he gave to me, hoping him all the best of success in his life.
Many thanks also go to Dr. Sakher who shows us the principles of
successful research work, also for his encouragement and support. Also
sincerest gratitude goes to my all lectures throughout the whole year of my
master study. For their endless knowledge that they never hesitate to answer
all my questions, queries to help me understand advanced aeronautical
engineering sciences.
Also not to forget my colleague in the master class for their cooperation
and the endless knowledge sharing throughout the whole year of our class
studies hoping them all the best in their future studies and work.
Also many thanks go to my superiors in SCAA Eng: Hisham Dawod
Airworthiness Director for the facilitation he gave to allow me complete my
class studies successfully, and also Eng: DAFFALLA, for his advices and
help. Also Engineers: WAHIB, ATIF, SULAF and OMER for their help,
support, encouragement and cooperation during class studies.
Before all most thanks and gratitude be to ALLAH, who without his
approvingly nothing can be done.
iii
DEDICATION
goals
To
My Brother and Sister other part of mine
To
To
TO
To
My Colleagues
To
My Family
To them all I dedicate this work hoping them all the best
iv
ABSTRACT
The MEMS accelerometer is an important sensor to measure the object’s
motion state (acceleration), and it is a key device in inertial systems such as,
vibration measurement and navigation systems. MEMS accelerometer has the
advantages of high precision and large measurement range, but it suffers from
noise problems which results in negative consequences, because of double
integration process to calculate the distance which results in erroneous
measurements especially when integrated in IMU or INS systems, that may
jeopardize safety.
In this research wavelet transformation method evaluated against Kalman
and Kalman-wavelet combination methods, multi test scenarios were
examined to select the outperformed method to be implemented using MPU-
6050 sensor, and Arduino DUE development board. From the above
mentioned multi test scenarios it concludes that the developed Wavelet
transformation-based denoising algorithm outperforms Kalman and Kalman-
Wavelet combination filtering methods by a percentage of 82% and 80%
respectively so that it was the optimum method to be implemented as
hypothesized in this research.
Finally it was implemented successfully in the single microcontroller
platform (Arduino DUE) but with certain limitation in the decomposition
level and the type of the mother wavelet used in addition to the number of
signal samples.
v
ﺍﻟﻤﺴﺘﺨﻠﺺ
ﻳﻌﺘﺒﺮ ﺟﻬﺎﺯ ﻗﻴﺎﺱ ﺍﻟﺘﺴﺎﺭﻉ ﺍﻹﻟﻜﺘﺮﻭﻣﻴﻜ�ﺎﻧﻴﻜﻲ ﺍﻟ�ﺪﻗﻴﻖ ﺃﺣ�ﺪ ﺍﻟﻤﻜﻮﻧ�ﺎﺕ ﺍﻟﻬﺎﻣ�ﺔ ﻷﺟﻬ�ﺰﺓ
ﺍﻟﻘﺼﻮﺭ ﺍﻟﺬﺍﺗﻰ ﻭﺃﻧﻈﻤﺔ ﺍﻟﻤﻼﺣﺔ ،ﺣﻴ�ﺚ ﺗﻤﺘ�ﺎﺯ ﺑﺎﻟﺪﻗ�ﺔ ﺍﻟﻌﺎﻟﻴ�ﺔ ﻭﻣﺠ�ﺎﻝ ﺍﻟﻘﻴ�ﺎﺱ ﺍﻟﻮﺍﺳ�ﻊ .ﻳﻌ�ﺎﻧﻰ
ﻣﻘﻴﺎﺱ ﺍﻟﺘﺴﺎﺭﻉ ﺍﻹﻟﻜﺘﺮﻭﻣﻴﻜﺎﻧﻴﻜﻲ ﺍﻟﺪﻗﻴﻖ ﻣﻦ ﺗﺄﺛﺮﻩ ﺑﺎﻟﻀ�ﺠﻴﺞ ﺍﻟ�ﺬﺍﺗﻲ ﻭ ﺍﻟﺒﻴﺌ�ﻲ ﻭﺍﻟ�ﺬﻱ ﻳ�ﺆﺩﻯ
ﺇﻟﻰ ﺣﺪﻭﺙ ﺃﺧﻄﺎء ﻗﻴﺎﺱ ﺗﺮﺍﻛﻤﻴﺔ ﻧﺴ�ﺒﺔ ﻟﻌﻤﻠﻴ�ﺔ ﺍﻟﺘﻜﺎﻣ�ﻞ ﺍﻟﻤ�ﺰﺩﻭﺝ ﻟﺤﺴ�ﺎﺏ ﻗﻴﻤ�ﺔ ﺍﻟﻤﺴ�ﺎﻓﺔ ﻣ�ﻦ
ﺍﻟﺘﺴﺎﺭﻉ.
ﻓ��ﻰ ﻫ��ﺬﺍ ﺍﻟﺒﺤ��ﺚ ﺗ��ﻢ ﺇﺳ��ﺘﺨﺪﺍﻡ ﻁﺮﻳﻘ��ﺔ ﺍﻟﺘﺤﻮﻳ��ﻞ ﺍﻟﻤ��ﻮﻳﺠﻲ ﻛﻤﺮﺷ��ﺢ ﻟﻀ��ﺠﻴﺞ ﻣﺘﺤﺴ��ﺲ
ﺍﻟﺘﺴ��ﺎﺭﻉ ﺍﻹﻟﻜﺘﺮﻭﻣﻴﻜ��ﺎﻧﻴﻜﻲ ﺍﻟ��ﺪﻗﻴﻖ )ﺍﻡ–ﺑ��ﻰ -ﻳ��ﻮ (6050ﻭﻣﻘﺎﺭﻧﺘﻬ��ﺎ ﻣ��ﻊ ﻣﺮﺷ��ﺢ "ﻛﺎﻟﻤ��ﺎﻥ".
ﻟﺘﻘﻴﻴﻢ ﺃﺩﺍء ﺍﻟﻤﺮﺷﺢ ﺍﻟﻤﻘﺘﺮﺡ ﻭﺍﻟﻤﺮﺷﺤﺎﺕ ﺍﻷﺧﺮﻯ ،ﺗﻢ ﺗﺼﻤﻴﻢ ﻋ�ﺪﺩ ﻣ�ﻦ ﺍﻟﺘﺠ�ﺎﺭﺏ ﺍﻟﺤﺎﺳ�ﻮﺑﻴﺔ
ﺑﺈﺳﺘﺨﺪﺍﻡ ﺑﺮﻧﺎﻣﺞ ﺍﻟﻤﺎﺗﻼﺏ ﻭﺍﻟﺘﻲ ﺃﻭﺿﺤﺖ ﺃﻥ ﻁﺮﻳﻘﺔ ﺍﻟﺘﺤﻮﻳﻞ ﺍﻟﻤﻮﻳﺠﻰ ﺗﻔﻮﻗ�ﺖ ﻋﻠ�ﻰ ﻁ�ﺮﻕ
ﺍﻟﺘﺮﺷﻴﺢ ﺍﻷ ﺧﺮﻯ ﻣﺜﻞ ﻛﺎﻟﻤﺎﻥ ﻭﺍﻟﻄﺮﻳﻘﺔ ﺍﻟﻤﺮﻛﺒﺔ ﻛﺎﻟﻤ�ﺎﻥ-ﺍﻟﺘﺤﻮﻳ�ﻞ ﺍﻟﻤ�ﻮﻳﺠﻰ ﺑﻨﺴ�ﺒﺔ %82ﻭ
%80ﻋﻠﻰ ﺍﻟﺘﻮﺍﻟﻲ .ﺃﻳﻀﺎ ً ﺗﻢ ﺗﻄﺒﻴ�ﻖ ﺧﻮﺍﺭﺯﻣﻴ�ﺔ ﺍﻟﺘﺤﻮﻳ�ﻞ ﺍﻟﻤ�ﻮﻳﺠﻰ ﻹﺯﺍﻟ�ﺔ ﺍﻟﻀ�ﺠﻴﺞ ﺑﻨﺠ�ﺎﺡ
ﻓ��ﻰ ﺍﻟﻤ��ﺘﺤﻜﻢ ﺍﻟ��ﺪﻗﻴﻖ "ﺃﺭﺩﻭﻳﻨ��ﻮ ﺩﻳ��ﻮ" ﻣ��ﻊ ﺑﻌ��ﺾ ﺍﻟﻤﺤ��ﺪﺩﺍﺕ ،ﺍﻟﻤﺘﻤﺜﻠ��ﺔ ﻓ��ﻰ ﻣﺴ��ﺘﻮﻳﺎﺕ ﺍﻟﺘﻔﻜﻴ��ﻚ
ﻭﻧﻮﻉ ﺩﺍﻟﺔ ﺍﻟﺘﺤﻮﻳﻞ ﺍﻟﻤﻮﻳﺠﻰ ﺍﻷﻡ ﺑﺎﻷﺿﺎﻓﺔ ﺍﻟﻰ ﻋﺪﺩ ﻋﻴﻨﺎﺕ ﺍﻹﺷﺎﺭﺓ.
vi
TABLE OF CONTENTS
PAGE
TITLE
No.
ﺍﻻﻳﺔ ii
Acknowledgement iii
Dedication iv
Abstract v
ﺍﻟﻤﺴﺘﺨﻠﺺ vi
Table of Contents vii
List of Figures ix
List of Tables xi
List of Abbreviations xii
List of Symbols xiv
CHAPTER ONE : INTRODUCTION
1.1 Preface 2
1.2 Problem Statement 3
1.3 Research Objective 3
1.4 Hypothesis 3
1.5 Research Questions 3
1.6 Research Methodology 4
1.7 Scope and Limitation 4
1.8 Thesis Outlines 5
CHAPTER TWO : LITRITURE REVIEW AND THEORTICAL
BACKGROUND
2.1 Introduction 7
2.2 Literature Review 7
2.3 MEMS Accelerometer Concept 9
vii
2.4 MEMS Benefits and Limitations 12
2.5 Denoising Techniques 14
2.5.1 Digital Low Pass Filter (DLPF) Technique 14
2.5.2 Kalman Filter Technique 15
2.5.3 Wavelet Transform Technique 19
CHAPTER THREE: METHODOLOGY
3.1 Introduction 26
3.2 The MEMS MPU-6050 System 26
3.3 ARDUINO DUE Board 29
3.4 Development of Denoising MEMS Test Platform 31
CHAPTER FOUR : RESULTS AND DISCUSSION
4.1 Introduction 38
4.2 Denoising Technique Using Kalman Filter 38
4.3 Denoising Technique Using Wavelet and Kalman Wavelet 40
Combination
4.4 Discussion 62
CHAPTER FIVE: CONCLUSION AND RECOMMENDATION
5.1 Conclusions 70
5.2 Recommendation and Future Work 71
REFERENCES 72
APPENDICES
Appendix (A) Denoising MPU-6050 Using Kalman Estimation b
MATLAB Program
Appendix (B) ARDUINO DUE Program i
viii
LIST OF FIGURES
Page
Figure Description
No.
Figure (2.1) Accelerometer Structure 12
Figure (2.2) Noise Types at MEMS Sensors 13
Figure (2.3) The Kalman Filter Cycle 17
Figure (2.4) The Operation of the Kalman Filter Overview 18
Figure (2.5) Wavelet Multi Resolution 20
Figure (2.6) Wavelet Decomposition Concept 22
Figure (2.7) Hard and Soft Thresholding Functions 24
Figure (3.1) Embedded Test Platform MEMS-Base Accelerometer 27
Figure (3.2) The InvenSense MPU-6050 28
Figure (3.3) (A) Front, and (B) Back Side of Arduino DUE Board 30
Figure (3.4) Arduino Due Board Connection With MPU-6050 31
Figure (3.5) The MPU-6050 Raw Data at Serial Monitor 33
Figure (3.6) General Block Diagram of Accelerator Data 34
Acquisition and Applying Denoising Techniques
Figure (4.1) MPU-6050 Accelerometer Measured and Denoised 39
One Using Kalman Estimator
Figure (4.2) Histogram of MPU-6050 Accelerometer Measured 40
and Denoised Signals Using Kalman Estimator
Figure (4.3) Results of Test Scenario No (1) 41
Figure (4.4) Histogram of Test Scenario No (1) 41
Figure (4.5) Results of Test Scenario No (2) 42
Figure (4.6) Histogram of Test Scenario No (2) 43
Figure (4.7) Results of Test Scenario No (3) 44
Figure (4.8) Histogram of Test Scenario No (3) 44
ix
Figure (4.9) Results of Test Scenario No (4) 45
Figure (4.10) Histogram of Test Scenario No (4) 46
Figure (4.11) Results of Test Scenario No (5) 47
Figure (4.12) Histogram of Test Scenario No (5) 47
Figure (4.13) Results of test scenario No (6) 48
Figure (4.14) Histogram of Test Scenario No (6) 49
Figure (4.15) Results of Test Scenario No (7) 50
Figure (4.16) Histogram of Test Scenario No (7) 50
Figure (4.17) Results of Test Scenario No (8) 51
Figure (4.18) Histogram of Test Scenario No (8) 52
Figure (4.19) Results of Test Scenario No (9) 53
Figure (4.20) Histogram of Test Scenario No (9) 53
Figure (4.21) Results of Test Scenario No (10) 54
Figure (4.22) Histogram of Test Scenario No (10) 55
Figure (4.23) Results of Test Scenario No (11) 56
Figure (4.24) Histogram of Test Scenario No (11) 56
Figure (4.25) Results of Test Scenario No (12) 57
Figure (4.26) Histogram of Test Scenario No (12) 58
Figure (4.27) The Best Test Scenario Results With Level (5) 63
Figure (4.28) Histogram of The Best Test Scenario With Level (5) 64
Figure (4.29) The Best test Scenario With Level (3) Results. 64
Figure (4.30) Histogram of The Best Test Scenario With Level (3) 65
Figure (4.31) Results of The Best Test Scenario With Level (7) 65
Figure (4.32) Histogram of The Best Test Scenario With Level (7) 66
Figure (4.33) Screenshot of Arduino DUE Wavelet 68
Implementation And Results
x
LIST OF TABLES
Page
Table Description
No
Table (2.1) The value of DLPF configuration for bandwidth and 15
delay
Table (3.1) Pin layout and signal description of the MPU-6050 28
Table (3.2) Pin connection ARDUINO DUE VS MPU-6050 32
Table (4.1) Results of Measured and Kalman Estimated Values 39
Table (4.2) Measured and denoised Z-axis Values (mg) 59
Table (4.3) Measured and denoised X-axis Values (mg) 60
Table (4.4) Measured and denoised Y-axis Values (mg) 61
Table (4.5) Measured and denoised Z-axis values (mg) for different 66
levels
Table (4.6) Measured and denoised X-axis values (mg) for 67
different levels
Table (4.7) Measured and denoised Y-axis values (mg) for 67
different levels
xi
LIST OF ABBREVIATIONS
ACC. Accelerometer
AREF Analog REFrence
ARM Advanced RISC Machine
COTS Commercial off the shelves
CPU Central processing unit
DAC Digital to analogue convertor
DC Direct current
DLPF Digital Low pass Filter
DMA Direct Memory Access
DMP Digital motion processing
GPS Global positioning system
I2C A communication standard
IDE Integrated Development Environment
INS Inertial Navigation System
KF Kalman Filter
MEMS Micro-Electro-Mechanical systems
PWM Pulse width modulation
RISC Reduced Instruction Set Computers
RADAR RAdio Detection And Ranging
SCL Serial clock
SDA Serial data
SNR Signal to Noise Ratio
SPI Serial Peripheral Interface
STFT Short Time Fourier Transform
SD Standard Deviation
xii
TWI Two Wire Interface
UART Universal Asynchronous Receive Transmit
UAV Un-manned Aerial Vehicles
VC Variable Capacitive
WF Wavelet-based Filter
xiii
LIST OF SYMBOLS
𝛆𝐀 Permittivity
𝛆° Initial Permittivity
𝛆 Permittivity
𝐀 Area of the electrodes
B Optional control input n*l matrix
𝑪° Parallel-plate capacitance
d Distance between capacitor plates
C1 Formed Capacitor 1
C2 Formed Capacitor 2
x1 Displacement 1
x2 Displacement 2
∆𝐂 Change in capacitance
ks Spring constant
𝑲𝒌 Kalman gain
𝐱 State value
𝕽𝒏 Real numbers
wk Random variable
vk Random variable
R Measurement noise covariance
Q Process noise covariance
A Matrix n*n
𝑧𝑘 Measurement Matrix
H Measurement Matrix m*n
Pk Estimation Error Covariance
𝝉 Translation
xiv
s Scale parameters
𝝍 (t) The transforming function
∅(𝐭) Scale function
𝚿(𝐭) Wavelet function
λ Threshold
𝛔 Standard deviation
n Signal sample
xv
CHAPTER ONE
INTRODUCTION
CHAPTER ONE
INTRODUCTION
1.1. Preface
MEMS stand for micro-electro-mechanical-systems. Hence, they are devices
in the “micro” scale, in which one or more of their dimensions are in the
micrometer range. The “electro” part indicates that they use electric power, for
example for actuation and detection, “Mechanical” means these devices rely on
some kind of mechanical, actions. The word “system” refers to the fact that they
functioned, with in systems not stand alone [1].
The accelerometer is an important sensor to present the object’s motion state
(acceleration), and it is a key device in inertial systems such as, vibration
measurement and navigation systems, and has the advantages of high precision
and large measurement range. Therefore, this accelerometer has acquired much
attention, especially in the aeronautical field. One of major problems that affect
accelerometer performance is noise hence; the noise reduction is highly required.
Fabrication of accelerometers by MEMS technology is now an emerging
technology due to its endless benefits such as light weight, less power
consumption, high accuracy. MEMS have been used in many wide ranges of
applications such as industrial, medical, military, inertia systems and Un-manned
Aerial Vehicles (UAV) [2].
There are many types of MEMS –Based accelerometer such as: resistive,
capacitive and piezoelectric. The Variable Capacitive (VC), MEMS
accelerometers are high sensitivity devices used to measure constant acceleration
this research concern on study the VC accelerometer. It is worthy to note that,
the accelerometer that gives the highest accurate measurement may not be the
smallest size, while one with the lowest noise may not be the lowest power.
Although MEMS is small size, less power consumption, it is susceptible to white
Gaussian noise, offset or drift.
2
1.2. Problem Statement
The MEMS accelerometer signal contaminated by noise during signal
acquisition, due to sensor’s physical characteristics, circuit devices and complex
environmental factors which are degrading the accuracy and performance this
results in negative consequences, because of double integration process to
calculate the distance from the MEMS accelerometer signal which results in
erroneous measurements, especially when integrated in IMU or INS systems,
that may jeopardize safety. This research trying to solve this noise problem using
Wavelet transformation method as well as implementation of the resultant filter
in a single microcontroller/microprocessor (Arduino DUE).
1.3. Research Objective
a. Denoise MEMS Accelerometer (MPU 6050) by using wavelet
transformation method.
b. Evaluate and validate the wavelet transformation method by,
comparison with Kalman filter technique.
c. Implement the optimum method into the single microcontroller
/microprocessor Arduino DUE.
1.4. Hypothesis
i. Wavelet transformation can be utilized as a denoising method for MEMS-
based accelerometer; therefore the accelerometer performance can be
improved noticeably.
ii. The wavelet transformation-based denoising algorithm can be
implemented in a single microprocessor/microcontroller platform with
acceptable performance.
1.5. Research Questions
i. To what extend noise level can be reduced in MEMS accelerometer by
applying wavelet?
3
ii. If the proposed wavelet algorithm combined with other denoising methods
shall it produce better results?
iii. Can the proposed denoising wavelet-based algorithm be implemented in a
single microprocessor/microcontroller platform?
1.6. Research Methodology
To achieve the research objective, the following method is followed:
4
1.8. Thesis Outlines
Including this chapter, the thesis contains five chapters. In Chapter Two brief
representations of the utilized techniques on denoising MEMS sensor such as
low pass filter, Kalman filter and Wavelet transformation. In Chapter Three, the
connection of the Arduino-based MEMS acquisition system was presented
where the required software was developed. Moreover, the proposed denoising
MEMS technique based on Wavelet was also elaborated. In Chapter Four, the
obtained results were depicted and discussed, where in Chapter Five the
conclusion and recommendations were drawn.
5
CHAPTER TWO
LITRITURE REVIEW AND THEORTICAL
BACKGROUND
CHAPTER TWO
LITRITURE REVIEW AND THEORTICAL
BACKGROUND
2.1. Introduction
In this chapter literature review presents some previous studies related to the
usage of wavelet technique in different MEMS applications also a brief
theoretical background will be given, describing the MEMS accelerometers
technology in general in addition to the denoising techniques used throughout
this research to reduce it’s noise effects which degrades the performance and
hence the output data that may lead to negative consequences for all system
using MEMS accelerometer.
2.2. Literature Review
Wavelet transforms have been successfully applied for de-noising,
classification, recognition, compression, and other applications. It can
decompose the signal to a frequency component in local time. By using this
characteristic, the wavelet denoising method shrinks the signal noise by
eliminating the frequency component which contains only noise. Furthermore,
denoising quality is also improved by wavelet thresholding techniques. These
are the schemes which are used to remove the noise in wavelet transform domain
by using thresholding operator.
Woo et al. (2010) have proposed the wavelet transform in MEMS-GPS to
reduce the signal distortion while improving the SNR of the signal. By applying
this technique, it was proved that the INS signal could be improved and the
overall navigation performance was also enhanced. Unfortunately, applying the
wavelet transform in such complex system cause algorithm complexity.
7
Elkhidir T.A, et al. (2011) has proposed a wavelet multi-resolution analysis
(WMRA) to solve MEMS-based INS performance which is affected by
stochastic complex errors. Two threshold denoising functions were proposed to
rise above the limitations of hard and soft threshold denoising, The results
showed that the proposed threshold denoising functions compared with soft and
hard thresholding denoising methods made the denoising better, and enhances
the signal to noise ratio [9].
Recently, LI et al. (2014) have addressed the random noise that affects the
precision of MEMS gyroscope. The Analysis of noise characteristic of
gyroscope by using Allan variance method was used. The performed static and
dynamic tests showed an effective elimination for random noise MEMS
gyroscopes and improve the stability characteristics of the signal [10].
In addition EDU et al., (2014) aimed to implement and validate procedures by
proposing new algorithms that receive data from inertial navigation systems and
provide accurate navigation information. In the first phase, an implementation of
a real-time evaluation criterion with the intention of achieving real-time data
from an accelerometer was done. It is well known that most errors in the
detection of position, velocity and attitude in inertial navigation occur due to
difficult numerical integration of noise. The main goal of the study was to
propose a signal processing algorithm, based on the Wavelet filter, used along
with a criterion for evaluating and updating the Wavelet’s optimal level of
decomposition, for reducing the noise component. A numerical simulations was
performed using signals received from an accelerometer and analyzed the
numerical results to see whether the improved Wavelet (proposed method) can
be used to achieve more precise information on a vehicle. The results show great
improvements [11].
ADOCHIEI, et al.(2015), have proposed a new software procedure for
processing data from an inertial navigation system boarded on board a moving
8
vehicle , in order to achieve accurate navigation information on the displacement
of the vehicle in terms of position, speed, acceleration and direction., a real-time
evaluation criterion was implemented to achieving real-time data from an
accelerometer. A signal processing algorithm, based on Wavelet filter was
developed, to achieve accurate information from inertial sensors [12].
Most recently AMMAR, et al (2017),uses Kalman filters as a proposed noise
reduction technique for MPU-6050 gyroscope signal the produced results was
compared with the low pass filter, the proposed Kalman filter was performing
[13].
2.3. MEMS Accelerometer Concept
An accelerometer is an electromechanical device that measures acceleration
forces. These forces may be static, like the constant force of gravity pulling at
our feet, or they could be Dynamic - caused by moving or vibrating the
accelerometer. There are many types of accelerometers developed and reported
in the literature. The vast majority is based on piezoelectric crystals, but they are
too big. Scientist tried to develop something smaller, that could increase
applicability and started searching in the field of microelectronics, and finally
they developed MEMS accelerometer.
The first MEMS accelerometer was designed in 1979 at Stanford University,
but it took over 15 years before such devices became accepted mainstream
products for large volume applications In the 1990s MEMS accelerometers
revolutionized the automotive-airbag system industry [3]. Since then they have
enabled unique features and applications ranging from hard-disk protection on
laptops …etc. More recently, used in industrial applications Such as aviation
with advancements in MEMS the estimate of vehicle position and attitude has
become affordable and increasingly accurate as sensors have become smaller
and cheaper. Micro machined accelerometers are a highly enabling technology.
9
They provide lower power, compact and robust sensing in addition to the
removal of the most mechanical complexity of conventional platform systems.
Multiple sensors are often combined to provide multi-axis sensing and more
accurate data [3]. Such combination in the inertial navigation system (INS)
which combined with gyroscopes to provide the angular velocity.
There are many different ways to make an accelerometer. Some
accelerometers use the piezoelectric effect - they contain microscopic crystal
structures that get stressed by accelerative forces, which cause a voltage to be
generated. Another way is by sensing changes in capacitance .This thesis is
focused on the later one.
Capacitive interfaces have several attractive features. In most
micromachining technologies no or minimal additional processing is needed.
Capacitors can operate both as sensors and actuators. They have excellent
sensitivity and the transduction mechanism is intrinsically insensitive to
temperature. Capacitive sensing is independent of the base material and relies on
the variation of capacitance when the geometry of a capacitor is changing.
Neglecting the fringing effect near the edges, the parallel-plate capacitance is:
𝐴 1
𝐶° = 𝜀° 𝜀 = 𝜀𝐴 (2.1)
𝑑 𝑑
where: εA = ε° ε A and (A) is the area of the electrodes, (d) the distance
between them and (ε) the permittivity of the material separating them. A change
in any of these parameters will be measured as a change of capacitance and
variation of each of the three variables has been used in MEMS sensing. For
example, whereas chemical or humidity sensor may be based on a change of ( ε)
accelerometers have been based on a change in (d) or in (A). If the dielectric in
the capacitor is air, capacitive sensing is essentially independent of temperature
but contrary to piezo resistivity, capacitive sensing requires complex readout
electronics. Still the sensitivity of the method can be very large and, for example,
10
Analog Device used for his range of accelerometer a comb capacitor having a
suspended electrode with varying gap. Measurement showed that the integrated
electronic circuit could resolve a change of the gap distance of only 20 Pico
meter, a mere 1/5th of the silicon inter-atomic distance [3].
Typical MEMS accelerometer is composed of movable proof mass with
plates that is attached through a mechanical suspension system to a reference
frame, Proof mass is attached through springs (k s =spring constant) at substrate
as shown in Figure 2.1. Movable plates and fixed outer plates represent
capacitors. The deflection of proof mass is measured using the capacitance
difference. The free-space (air) capacitances between the Movable plate and two
stationary outer plates C 1 and C 2 are functions of the corresponding
Displacements x 1 and x 2 :
1 1
𝐶1 = 𝜀𝐴 = 𝜀𝐴 = 𝐶° − ∆𝐶
𝑥1 𝑑+𝑥
� 1 1 (2.2)
𝐶2 = 𝜀𝐴 = 𝜀𝐴 = 𝐶° + ∆𝐶
𝑥2 𝑑−𝑥
12
Noise: sources in the MEMS sensor systems generally are summarized as:
Noise from the environment such as temperature fluctuations, and gravity.
Unwanted movements, for example, shocks, vibrations.
Noise from the hardware such as electrical noise and mechanical
thermal noise.
Figure (2.2): Noise Types at MEMS which are: Noise, Offset and Drift.
Offset: is also called zero error or bias error. It is characterized that the output
of the sensor is constant when there is no measured value. This implies a shift or
displacement of the zero point. It is a common error that exists with most of the
measured sensor signals.
Drift: means that the output changes with time when there is no change of the
input signal. Drift can be caused by vibration, shock, aging, and temperature
variations. Temperature drift is generated due to the temperature changes. This
phenomenon is well-known with the MEMS gyroscope [4].
Accumulation error can also be regarded as a drift due to numerical
integration during the position calculation. That is integration of the acceleration
to get the velocity, and the integration of the velocity to get the position. The
problem is that while acquiring the noisy signal due to error sources explained
above, these integrations will increase noise levels at the output, it looks like
amplifying them and here is the potential error source in INS navigation
information.
13
2.5. Denoising Techniques
In the following, the used denoising techniques in this research were briefly
highlighted. These techniques are Digital Low pass Filter (DLPF), Kalman Filter
(KF) and Wavelet-based Filter (WF). For the purpose of implementation, those
methods were firstly implemented and tested on MATLAB platform for
comparison; to ensure right implementation for individual and combination
methods, and verification. Then, an implementation of the best method has been
applied to a single microcontroller i.e. Arduino DUE as a test platform.
2.5.1. Digital Low pass Filter (DLPF) Technique
A low pass filter is simply to pass appropriate certain frequency below a
cut-off frequency. The normalized cut-off frequency is a parameter with a value
from zero to one. A low-pass filter was applied to the MEMS accelerometer for
noise reduction embedded into the MPU 6050. Normally the output of the
MEMS is divided into signals of different frequencies. The idea behind is, that
something known about the acceleration that would be measured. So that
filtering out signals with a higher frequency can be filtered out easily using the
configurable DLPF provided into the MPU 6050. The MPU 6050 is set up for
applying the DLPF; typical values are between 0 and 6 to the last 3 bits of
register DLPF_CFG i.e. the values from 00000000 to 00000110. [14]
Table 2.1 shows DLPF response to different bit setting it is shows how the
DLPF reacts to the bits set. The delay factor should be considered with respect to
the used hardware, which comes from the need to buffer values internally by the
DLPF used for dividing the signal into different frequencies. In this thesis, the
default DLPF setting i.e. DLPF_CFG is set to (2).
It is worthy to note that these filtered data is considered as the original
measurement data throughout this thesis unless other consideration is stated
explicitly.
14
Table (2.1): The value of DLPF configuration for bandwidth and delay [14].
Accelerometer
Gyroscope
(Fs=1kHz)
DLPF_CFG
Bandwidth Bandwidth Delay
Delay Fs(kHz)
(Hz) (ms) (Hz) (ms)
0 260 0 256 0.98 8
1 184 2.0 188 1.9 1
2 94 3.0 98 2.8 1
3 44 4.9 42 4.8 1
4 21 8.5 20 8.3 1
5 10 13.8 10 13.4 1
6 5 19.0 5 18.6 1
7 RESERVED RESERVED 8
15
real time processing, and also it is easy to formulate and implement given a basic
understanding.
For application purposes, Kalman filter is used in determination of planet
orbit parameters from limited earth observations. Also it is used in tracking
targets - e.g. aircraft, missiles using RADAR, and recently it is used in Robot
Localization and Map building from range of sensors. [5].
The Kalman filter addresses the general problem of trying to estimate the state
𝑥 ∈ ℜ𝑛 of a discrete-time controlled process that is governed by the linear
stochastic difference equation:
Xk = Axk – 1 + Buk – 1 + wk – 1 (2.6)
With a measurement 𝑧𝑘 ∈ ℜ𝑚 that is:
zk = Hx k + vk (2.7)
where wk and vk are random variables represent the process and measurement
noise (respectively). They are assumed to be independent (of each other), white,
and with normal probability distributions:
𝑝(𝑤)~𝑁(0, 𝑄) (2.8)
𝑝(𝑣)~𝑁(0, 𝑅) (2.9)
In practice, the process noise covariance Q and measurement noise
covariance R matrices might change with each time step or measurement,
however here we assume they are constant. The n×n matrix A in the difference
equation (2.6) relates the state at the previous time step k – 1 to the state at the
current step k, in the absence of either a driving function or process noise. Note
that in practice A might change with each time step, but here we assume it is
constant. The n×l matrix B relates the optional control input 𝑢 ∈ ℜ𝑙 to the state
x. The m×n matrix H in the measurement equation (2.7) relates the state to the
measurement zk. In practice H might change with each time step or
measurement, but here we assume it is constant [6].
16
The Kalman filter estimates a process by using a form of feedback control:
the filter estimates the process state at some time and then obtains feedback in
the form of (noisy) measurements. As such, the equations for the Kalman filter
fall into two groups: time update equations and measurement update equations.
The time update equations are responsible for projecting forward (in time) the
current state and error covariance estimates to obtain the a priori estimates for
the next time step. The measurement update equations are responsible for the
feedback i.e. for incorporating a new measurement into the a priori estimate to
obtain an improved a posteriori estimate. The time update equations can also be
thought of as predictor equations, while the measurement update equations can
be thought of as corrector equations. Indeed the final estimation algorithm
resembles that of a predictor-corrector algorithm for solving numerical problems
as shown below in Figure (2.3).
Time update
(“Predict”) Measurement update
(“Correct”)
18
Figure (2.4) gives a complete view of Kalman filter operation, combining the
diagram of Figure (2.3) with the equations from (2.10) to (2.14). In the actual
implementation of the filter, the measurement noise covariance R is usually
measured prior to operation of the filter. Measuring the measurement error
covariance R is generally practical (possible) because it is the process can be
measured anyway (while operating the filter) so that some off-line sample
measurements should be taken in order to determine the variance of the
measurement noise. The determinant of the process noise covariance Q is
generally more difficult as typically do not have the ability to directly observe
the process that can be estimated. Sometimes a relatively simple (poor) process
model can produce acceptable results if enough uncertainty injected into the
process via the selection of Q. Certainly in this case hoping that the process
measurements are reliable. In either case, whether or not having a rational basis
for choosing the parameters, often times superior filter performance (statistically
speaking) can be obtained by tuning the filter parameters Q and R. The tuning is
usually performed off-line, frequently with the help of another (distinct) Kalman
filter in a process generally referred to as system identification under conditions
where Q and R .are in fact constant, both the estimation error covariance Pk, and
the Kalman gain K k will stabilize quickly and then remain constant. If this is the
case, these parameters can be pre-computed by either running the filter off-line,
or for example by determining the steady-state value of Pk It is frequently the
case however that the measurement error (in particular) does not remain constant
the process noise Q is sometimes changed dynamically during filter operation ,
becoming Q k in order to adjust to different dynamics [6].
2.5.3. Wavelet Transform Technique
Wavelet transform is a signal transform technique popularly used in several
areas such as image processing and audio signal processing. The wavelet
19
analysis is based on a windowing technique with variable-sized windows as
shown in Figure 2.5. The wavelet transform applies the wide window (long time
intervals) to low frequency and the narrow window (short time intervals) to high
frequency.
Wavelet transform can be defined as: “The wavelet transform is a tool that
cuts up data, functions or operators into different frequency components, and
then studies each component with a resolution matched to its scale”.
Continuous wavelet transform is given by the following equation:
𝜓 𝜓 1 𝑡−𝜏
𝐶𝑊𝑇𝑥 (𝜏, 𝑠) = 𝜓𝑥 (𝜏, 𝑠) =
√|𝑠|
∫ 𝑥(𝑡)𝜓 ∗ � 𝑠
� 𝑑𝑡 (2.15)
Time
Figure (2.5): Wavelet multi resolution [7].
20
The term translation is used in the same sense as it was used in the
Short Time Fourier Transform (STFT); it is related to the location of
the window, as the window is shifted through the signal. This term,
obviously, corresponds to time information in the transform domain.
Instead of a frequency parameter as in STFT, a scale parameter
which is defined as (1/frequency) is used.
The parameter scale in the wavelet analysis is similar to the scale
used in maps. As in the case of maps, high scales correspond to a
non-detailed global view (of the signal), and low scales correspond
to a detailed view. Similarly, in terms of frequency, low frequencies
(high scales) correspond to a global information of a signal (that
usually spans the entire signal), whereas high frequencies (low
scales) correspond to a detailed information of a hidden pattern in
the signal (that usually lasts a relatively short time) [7].
Discrete time wavelet transform is executed as formula (2.16) and (2.17)
∅(𝑡) = ∑𝑘 𝑔0 [𝑘]∅(2𝑡 − 𝑘) (2.16)
𝛹(𝑡) = ∑𝑘 𝑔1 [𝑘]∅(2𝑡 − 𝑘) (2.17)
Where ∅ (t) is called the scale function and 𝛹 (𝑡) is called the wavelet function.
Each g 0 and g 1 refers to the wavelet coefficient [8].
Wavelet function can be any function that satisfies the relationship of formula
(2.16) and (2.17). The scale function of upper level can be expressed as the
convolution of the scale function and the wavelet function of lower level. It
means that the low-frequency area can be decomposed to the high-frequency
area and low-frequency area. Such relationship is shown in Figure (2.6).
Wavelet transform is progressed stage by stage. When the signal is divided
into low-frequency waves, it requires twice the amount of data. In addition, the
21
lowest possible decomposable frequency area matches the Direct Current (DC)
value of the Fourier transform calculated using the entire data.
22
filter for the inertial sensor signal and overcomes the shortages of the existing
low-pass filter. The thresholding technique is classified into the hard
thresholding and soft thresholding operation.
𝑥 𝑖𝑓 |𝑥| ≥ 𝜆
𝑇𝜆ℎ𝑎𝑟𝑑 = � (2.18)
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝑠𝑜𝑓𝑡 (𝑥 − 𝑠𝑖𝑔𝑛 (𝑥)𝜆 ) 𝑖𝑓 |𝑥| ≥ 𝜆
𝑇𝜆 =� (2.19)
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
The formula (2.18) shows the hard thresholding function and the formula (2.19)
shows the soft thresholding function, which are illustrated in Figure 2.7. (x) is
the wavelet coefficient. The wavelet coefficient means that the magnitude of a
certain frequency component. Thus, wavelet coefficients in the band of noise
become zero. Among the two methods, the soft thresholding technique is known
to have better performance than the hard thresholding technique. One of the
important elements influencing the performance in thresholding technique is
how the standard value of (λ) is set. Generally, it is determined by the formula
(2.20). Here, (𝝈) is the standard deviance of the signal, and (n) is the number of
signal samples.
𝝀 = �(𝟐 𝒍𝒐𝒈 𝒏) 𝝈 (2.20)
The value determined by the formula, however, does not lead to the optimal
result, so the appropriate (𝝀) must be determined through experimentation.
The thresholding algorithm is executed as follows:
- First, the wavelet transform is executed for the signal to acquire the
wavelet coefficients.
- Second, the thresholding operation is executed for each wavelet
coefficient. Then, the original coefficients are replaced to the coefficients
from the result of the thresholding operation.
- Finally, inverse transform is carried out [8].
23
Figure (2.7): Hard and soft thresholding functions [8].
24
CHAPTER THREE
METHODOLOGY
CHAPTER THREE
METHODOLOGY
3.1. Introduction
In this chapter, the proposed wavelet transformation denoising technique is
discussed. To evaluate the proposed technique and compare it with the previous
filtering techniques, a test bed is designed and developed using the following
commercial of the shelves (COTS) components: MPU-6050 (motion sensor
unit), and the Arduino DUE board (processing unit) interconnected and
programmed to process the raw data comes from the sensor (Figure 3.1).
The methods for MEMS denoising such as DLPF, Kalman Filter and
Wavelet-based are simulated in the MATLAB environment to determine which
is more convenient to the MPU-6050 by addressing different parameters in these
techniques. Moreover, the resultant wavelet based technique is implemented in
the composed system to show a real demonstration as can be seen in Chapter
Four. The following paragraphs give a brief description of the proposed wavelet-
based technique as well as the system’s components and interconnection.
3.2. The MEMS MPU-6050 Sensor
For the purpose of this study the sensor MPU-6050 (see Figure (3.2) and
Table (3.1)) is used. It is an integrated 6-axis motion processor solution that
eliminates the package-level gyroscope and accelerometer cross-axis
misalignment associated with discrete solutions.
The devices combine a 3-axis gyroscope and a 3-axis accelerometer on the
same silicon die together with an onboard Digital Motion Processor™ (DMP™)
capable of processing complex 9-axis sensor fusion algorithms using the field-
proven and proprietary Motion Fusion™ engine. MPU-6050’s integrated 9-axis
Motion Fusion algorithms access external magnetometers or other sensors
26
through an auxiliary master I 2 C bus, allowing the devices to gather a full set of
sensor data without intervention from the system processor. The devices are in
the 4x4x0.9 mm frame. The MPU-6050 supports communications at up to 400
kHz and has a Vcc pin that defines its interface voltage level [14].
The MPU-6050
Raw data
Arduino IDE for
programming
MPU-6050 (motion
sensor unit
27
(A) (B)
Figure (3.2): (A) The InvenSense MPU-6050 MEMS Sensor (B) MPU-6050
typical interface Board [15].
28
3.3. Arduino DUE Board
The Arduino DUE is a microcontroller board based on the Atmel SAM3X8E
ARM Cortex-M3 CPU. It is the first Arduino board based on a 32-bit Advanced
RISC Machine (ARM) core microcontroller. It has 54 digital input/output pins
(of which 12 can be used as Pulse Width Modulation (PWM) outputs), 12 analog
inputs, 4 UARTs (hardware serial ports), a 84 MHz clock, an USB OTG capable
connection, 2 DAC (digital to analog), 2 TWI, a power jack, an SPI header, a
JTAG header, a reset button and an erase button.
The board contains everything needed to support the microcontroller; it is
connected to the computer with a USB cable or by powers it with an AC-to-DC
adapter or battery to get started. The Atmel AT91SAM3X8E has 512 KB (2
blocks of 256 KB) of flash memory for storing code. The boot loader is pre-
burned in factory from Atmel and is stored in a dedicated ROM memory. The
available SRAM is 96 KB in two contiguous banks of 64 KB and 32 KB. All the
available memory (Flash, RAM and ROM) can be accessed directly as a flat
addressing space.
The DUE is compatible with all Arduino shields that work at 3.3V and are
compliant with the 1.0 Arduino pin-out as follow:
• TWI: SDA and SCL pins that are near to the AREF pin.
• The IOREF pin which allows an attached shield with the proper
configuration to adapt to the voltage provided by the board. This
enables shield compatibility with a 3.3V board like the DUE and AVR-
based boards which operate at 5V.
• An unconnected pin, reserved for future use.
• The DUE has a 32-bit ARM core that can outperform typical 8-bit
microcontroller boards.
29
The most significant differences are:
• A 32-bit core, that allows operations on 4 bytes wide data within a
single CPU clock.
• CPU Clock at 84Mhz.
• 96 KBytes of SRAM.
• 512 KBytes of Flash memory for code.
• a DMA controller, that can relieve the CPU from doing memory
intensive tasks [16].
(A)
(B)
Figure (3.3): (A) front, and (B) back side of Arduino DUE Board [16]
30
3.4. Development of denoising MEMS test platform
For the purpose of this thesis, a test bed for the proposed wavelet based
technique as well as the other denoising techniques. The test bed development
can be implemented in many stages which include: sub-systems interconnections
and communications for data acquisition and system demonstration as follow:
i. Sub-systems interconnection
The connection between Arduino DUE Board and the MPU-6050 is
shown in the Figure (3.4), and the pins connections are shown in the Table (3.2).
31
Table (3.2): Pin connection Arduino DUE VS MPU-6050
Arduino DUE MPU-6050
VCC 3.3 VCC
GND GND
SCL (pin 21) SCL
SDA (pin 20) SDA
PWM (pin 2) INT
Once unzipped, the Arduino folder was found within it and copied the two
folders "I2Cdev" and "MPU6050" over to the Arduino "libraries" folder in the
following directory: C:\Program Files (x86)\Arduino\libraries.
Then the Arduino IDE was opened and in the examples section
MPU6050_DMP6 was found within MPU-6050, it was then opened, Arduino
was plugged in, the appropriate com port was selected and the sketch was
uploaded. In the serial window, a baud rate of 9600 was selected. It was
prompted that the MPU-6050 connection is successful. The data collection was
32
tested by typing any key in the text bar and pressing enter, the data then started
showing up as in figure (3.5).
The sensor MPU-6050 was connected with an Arduino DUE board and
suitable codes were uploaded, then the output data at the three axes X, Y and Z
sensing MEMS were collected through MATLAB and arduino IDE. In figure
(3.6) shows Matlab program flowchart for MEMS MPU-6050 data i.e.
acceleration and gyroscope data acquisition and applying denoising techniques
i.e. Kalman and Wavelet was shown,
Figure (3.5): The MPU-6050 raw data at the serial monitor of Arduino IDE.
33
Figure (3.6): MATLAB program flowchart of accelerator data acquisition and
applying denoising techniques.
34
iii. Development of MATLAB Simulation Test Bed
The used denoising techniques in this thesis were simulated in MATLAB
platform to explore the performance for each one, those are:, Kalman filter (KF)
and Wavelet-based filter (WF) in addition to Kalman–wavelet filter combination
For the purpose of wavelet denoising the MATLAB function “wden( )” is
used. It performs an automatic denoising process of a one-dimensional signal
using wavelets with certain parameters. These parameters were formed in
different proposed test scenarios in order to find the optimum denoised signal.
The most important parameter is the threshold which can be selected based on:
• Stein's Unbiased Estimate of Risk (quadratic loss function) which gets
an estimate of the risk for a particular threshold value (λ). Minimizing
the risks in (λ) and gives a selection of the threshold value. This method
of selection rule is expressed as ‘rigrsure’.
• The other selection criteria is one that uses a fixed-form threshold
yielding minimax performance multiplied by a small factor proportional
to log(length(X)). This one is expressed as ‘sqtwolog'.
• The third selection criteria use a fixed threshold chosen to yield minimax
performance for mean square error against an ideal procedure. This
minimax principle is used in statistics in order to design estimators.
Since the denoised signal can be assimilated to the estimator of the
unknown regression function, the minimax estimator is the one that
realizes the minimum of the maximum mean square error obtained for
the worst function in a given set. This criterion is expressed as
‘minimaxi’.
• The forth one is ‘heursure’. It is a mixture of the two options ‘rigrsure’,
and ‘sqtwolog’, which is already addressed in the previous methods.
35
In addition, the thresholding criteria can be: soft or hard ('s' or 'h'). Also in
these scenarios, a scale parameter is used ‘scal’. It defines multiplicative
threshold rescaling with the following options: 'one' for no rescaling. 'sln' for
rescaling using a single estimation of level noise based on first-level coefficients.
And the last option is 'mln' for rescaling using level-dependent estimation of
level noise. In addition, the Wavelet decomposition is performed at level (N) for
this thesis level (5) will be used as default where 'wname' is a character vector
containing the name of the desired orthogonal wavelet function, therefore , a
complete wavelet denoising function in MATLAB syntax can be given by:
X D =wden(X,TPTR,SORH,SCAL,N,'wname')
which returns a denoised version X D of input signal X obtained by thresholding
the wavelet coefficients. For generality, a wavelet family Daubechies wavelets
dbN (db 4/8) will be used where it covers most of the wavelet properties as can
be grasped from Appendix (D) [19].
Based on the above options a set of twelve test scenarios will be proposed to
investigate denoising response. The good scenarios out the twelve will be
selected to compose the best scenario. To explore the effect of decomposition
level on the wavelet denoised acceleration, another two levels will be
investigated i.e. Level (3), and level (7) as well as level (5).
The results of these proposed scenarios will be presented using the denoised
signal comparable to the measured one, their histograms, and basic statistical
measurements such as average and standard deviation (SD) in a tabulation
manner.
iv. Implementation of Denoising techniques at Arduino DUE:
Finally, the outperformed denoising method by the running simulation will be
implemented in Arduino DUE / MPU-6050 test platform to evaluate its
performance in a real time at single microcontroller platform.
36
CHAPTER FOUR
38
Figure (4.1): Result of MPU-6050 accelerometer measured and denoised signal
using Kalman estimator.
39
Figure (4.2): Histogram of MPU-6050 accelerometer measured and denoised
signals using Kalman estimator
4.3. Results of Denoising Technique Using Wavelet and
Kalman-Wavelet Combination:
In this subsection, a set of different test scenarios were established to explore
the optimum performance of these different denoising techniques for the MPU -
6050 Accelerometer as well as recording the optimal parameters of the best
filtering technique which will be utilized in the implementation. The following
are twelve MATLAB syntax and their related results figures as follow:
4.3.1. Test Scenario No (1):
%---------- Z-Axis -----------------------------
Z-Axis _WAVELET = wden(Z-Axis_MEASURE,'modwtsqtwolog','h','mln',5,'db8');
Z-Axis _KLWLESTM = wden(Z-Axis_KALMAN,'modwtsqtwolog','h','mln',5,'db8');
%---------- X-Axis -----------------------------
X-Axis _WAVELET= wden(X-Axis_MEASURE,'minimaxi','h','one',5,'db8');
X-Axis _KLWLESTM = wden(X-Axis_KALMAN,'minimaxi','h','one',5,'db8');
%---------- Y-Axis -----------------------------
Y-Axis _WAVELET = wden(Y-Axis _MEASURE,'rigrsure','h','one',5,'db8');
Y-Axis _KLWLESTM = wden(Y-Axis _KALMAN,'rigrsure','h','one',5,'db8');
40
Figure (4.3): Results of test scenario No (1)
41
4.3.2. Test Scenario No (2):
%---------- Z-Axis -----------------------------
Z-Axis _WAVELET = wden(Z-Axis_MEASURE,'modwtsqtwolog','s','mln',5,'db8');
Z-Axis _KLWLESTM = wden(Z-Axis_KALMAN,'modwtsqtwolog','s','mln',5,'db8');
%---------- X-Axis -----------------------------
X-Axis _WAVELET= wden(X-Axis_MEASURE,'minimaxi','h','sln',5,'db8');
X-Axis _KLWLESTM = wden(X-Axis_KALMAN,'minimaxi','h','sln',5,'db8');
%---------- Y-Axis -----------------------------
Y-Axis _WAVELET = wden(Y-Axis _MEASURE,'rigrsure','h','sln',5,'db8');
Y-Axis _KLWLESTM = wden(Y-Axis _KALMAN,'rigrsure','h','sln',5,'db8');
42
Figure (4.6): Histogram of Test scenario No (2)
43
Figure (4.7): Results of test scenario No (3)
44
4.3.4 Test Scenario No (4):
%---------- Z-Axis -----------------------------
Z-Axis _WAVELET = wden(Z-Axis_MEASURE,'minimaxi','s','one',5,'db8');
Z-Axis _KLWLESTM = wden(Z-Axis_KALMAN,' minimaxi ','s','one',5,'db8');
%---------- X-Axis -----------------------------
X-Axis _WAVELET= wden(X-Axis_MEASURE,' modwtsqtwolog ','h','mln',5,'db8');
X-Axis _KLWLESTM = wden(X-Axis_KALMAN,' modwtsqtwolog ','h','mln',5,'db8');
%---------- Y-Axis -----------------------------
Y-Axis _WAVELET = wden(Y-Axis _MEASURE,'rigrsure','s','one',5,'db8');
Y-Axis _KLWLESTM = wden(Y-Axis _KALMAN,'rigrsure','s','one',5,'db8');
45
Figure (4.10):Histogram of Test scenario No (4)
46
Figure (4.11):Results of test scenario No (5)
47
4.3.6 Test scenario No (6) :
48
Figure (4.14): Histogram of Test scenario No (6)
49
Figure (4.15): Results of test scenario No (7)
50
4.3.8 Test Scenario No (8):
%---------- Z-Axis -----------------------------
Z-Axis _WAVELET = wden(Z-Axis_MEASURE,' modwtsqtwolog ','h','mln',5,'db4');
Z-Axis _KLWLESTM = wden(Z-Axis_KALMAN,' modwtsqtwolog ','h','mln',5,'db4');
%---------- X-Axis -----------------------------
X-Axis _WAVELET= wden(X-Axis_MEASURE,' minimaxi ','s','sln',5,'db4');
X-Axis _KLWLESTM = wden(X-Axis_KALMAN,' minimaxi ','s','sln',5,'db4');
%---------- Y-Axis -----------------------------
Y-Axis _WAVELET = wden(Y-Axis _MEASURE, ' rigrsure ','s','sln',5,'db4');
Y-Axis _KLWLESTM = wden(Y-Axis _KALMAN,' rigrsure ','s','sln',5,'db4');
51
Figure (4.18): Histogram of Test scenario No (8).
52
Figure (4.19): Results of test scenario No (9)
53
4.3.10 Test Scenario No (10):
54
Figure (4.22): Histogram of Test scenario No (10).
55
Figure (4.23): Results of test scenario No (11)
56
4.3.12 Test Scenario No (12) :
57
Figure (4.26): Histogram of Test scenario No (12)
58
Table (4.2): Measured and denoised Z-Axis Acc. Values (mg)
Scenario 1 Scenario 2 Scenario 3 Scenario 4 Scenario 5 Scenario 6 Scenario 7 Scenario 8
Measured 1.8015e+04 1.8016e+04 1.8019e+04 1.8008e+04 1.8013e+04 1.8016e+04 1.8000e+04 1.7991e+04
Average
60
Table (4.4): Measured and denoised Y-Axis Acc. Values (mg)
Scenario 1 Scenario 2 Scenario 3 Scenario 4 Scenario 5 Scenario 6 Scenario 7 Scenario 8
Measured 1.1892e+03 1.2021e+03 1.2286e+03 1.2373e+03 1.2325e+03 1.2126e+03 1.2070e+03 884.8127
Average
61
4.4. Discussion
From the above Figures and Tables the following can be deduced:
1- During the test it is shown that no single denoising technique suitable for
all acceleration components , therefore:
- For Z-Axis measurement can be denoised with minimum SD of
19.6329 mg as shown in Table (4.2) in scenario No. 1 when Kalman-
Wavelet combination filtering technique was used. The second good
result was achieved by using Wavelet filter with SD of 24.9628 mg.
- For X-Axis the best result of SD achieved is 13.2268 mg also when
using the Kalman-Wavelet combination as in scenario No 9 at Table
(4.3) However, denoising using Wavelet filter achieves much more
closer result of 13.2289 mg SD value as in scenario No 5.
- For Y-Axis the best result of SD achieved is 12.0108 mg also when
using the Kalman-Wavelet combination as in scenario No 11 at Table
(4.4) However, denoising using wavelet filter achieves much closer
result of 14.5696 mg SD value as in scenario No 11.
2- There is no much differences in performance of Wavelet and Kalman-
Wavelet denoising techniques, where the differences in SD Values
between Wavelet and Kalman-Wavelet combination are as follows:
For Z-Axis: 5.3299 mg more for wavelet.
For X-Axis: 0.0021 mg more for wavelet.
For Y-Axis: 2.5588 mg more for wavelet.
3- For more investigation the outperformed scenario composed out of the
good results achieved from previous test scenarios and in sake of
optimization by studying the effect of decomposition level on the proposed
denosing technique, different decomposition levels (3) and (7) were
examined.
Therefore, the MATLAB syntax to achieve this study is:
%---------- Z-Axis -----------------------------
Z-Axis_WAVELET = wden(Z-Axis_MEASURE ,'modwtsqtwolog','h','mln',5/3/7,'db8');
Z-Axis_KLWLESTM = wden(Z-Axis_KALMAN,'modwtsqtwolog','h','mln', 5/3/7,'db8');
%---------- X-AXIS -----------------------------
X-Axis _WAVELET= wden(X-Axis _MEASURE,'minimaxi','s','sln', 5/3/7,'db8');
X-Axis _KLWLESTM = wden(X-Axis _KALMAN,'minimaxi','s','sln', 5/3/7,'db8');
%---------- Y-Axis -----------------------------
Y-Axis _WAVELET = wden(Y-Axis _MEASURE, 'modwtsqtwolog','s','mln', 5/3/7,'db4');
Y-Axis _KLWLESTM = wden(Y-Axis_KALMAN, 'modwtsqtwolog','s','mln', 5/3/7,'db4');
63
Figure (4.28): Histogram of the outperformed test scenario with level (5)
4.3.14 Best Scenario with level-3:
64
Figure (4.30): Histogram of the outperformed test scenario with level (3)
4.3.15 Best Scenario with level (7):
Figure (4.31): Results of the outperformed test Scenario with level (7).
65
Figure (4.32): Histogram of the outperformed test scenario with level (7)
Table (4.5): Measured and denoised Z-Axis Acc values (mg) for different levels
The Best with level The Best with The Best with
3 level 5 level 7
Measured 1.7997e+04 1.8015e+04 1.8011e+04
Average
66
Table (4.6): Measured and denoised X-Axis Values (mg) for different levels
The Best with level The Best with The Best with
3 level 5 level 7
Measured 3.2196e+03 3.2192e+03 3.2277e+03
Average
Table (4.7): Measured and denoised Y-Axis Values (mg) for different levels
The Best with level The Best with The Best with
3 level 5 level 7
Measured 387.5171 447.1341 462.9076
Average
4- The result of the Decomposition level change to level (3) and (7)
respectively shown on Tables (4.5, 4.6, and 4.7). From these Tables it is
quite evident that a very good result achieved at level 7 for X-Axis and Y-
Axis with only Wavelet filter with SD of 6.1812, 7.7808 mg respectively.
For Z-Axis a good result achieved was in Kalman-Wavelet filter
combination with level (5) by a difference in SD of 1.7159 mg. from
wavelet filter alone.
5- From the figure (4.32) it is noticed that, when uncontaminated measured
signal is acquisitioned all filters becomes neutral.
6- From the test scenarios it is seen that wavelet decomposition levels has
considerable effect on the results.
67
7- The overall result achieved is that the optimum method for denoising MPU
only with decomposition level (5) will be used with a negligible effect as
follows:
For Z-Axis ----------'modwtsqtwolog','h','mln', 5,'db8').
For X-Axis -----------('minimaxi','s','sln',7,'db8').
For Y-Axis ----------('modwtsqtwolog','s','mln',7,'db4').
9- When the proposed technique implemented in Arduino DUE as shown in
Figure (4.33); unfortunately available Wavelet Arduino library did not
supports decomposition level higher than level (2). In addition, only small
size of signals samples i.e. 64 samples can be processed by Arduino DUE.
Although of these limitations, the obtained results by the implemented
Wavelet filter are accepted in terms of real time applications, costs and
simplicity.
68
CHAPTER FIVE
70
limitation mentioned above , although the overall results concludes that Wavelet
transformation outperformed Kalman and Kalman-Wavelet combination .
5.2 Recommendation and Future Work
It is recommended to use the Wavelet as an optimum denoising technique for
MEMS based sensors, for practical application such as UAV, INS, IMU and all
other MEMS applications. Moreover, when implementing a good consideration
should be made to hardware and software limitations.
This research can be continued with the following future work suggestions:
• Re-inspect these methods with gyro signals.
• Make tests and comparisons against mechanical accelerometer for
validation.
• Implement Wavelet denoising methods into a real MEMS based INS,
UAV systems with the consideration for limitation mentioned above.
• Explore the implementation of Wavelet denoising in other platforms
such as Raspberry Pi.
• Develop an Arduino suitable Wavelet library to include the most
thresholding selection techniques and higher levels of decomposition.
71
REFERENCES
[1] Mohammad, I.,Younis, “MEMS Linear and Nonlinear Statics and Dynamic”,
Department of Mechanical Engineering State University of New York.
Binghamton, NY, USA, ISSN 1389-2134 .ISBN 978-1-4419-6019-1
Springer New York Dordrecht Heidelberg London, Springe Science,
Business Media, LLC 2011.
[2] Prime Faraday Technology Watch “An Introduction to MEMS ” , Wolfson
School of Mechanical and Manufacturing Engineering Loughborough
University, Loughborough, Leics LE11 3TU ISBN 1-84402-020-7 ,
January 2002.
[3] Matej Andrejašiˇc ,MEMS Acceleromete Seminar , University of
Ljubljana,Faculty for mathematics and physics, Department of
physics,march 2008.
[4] Jiaying Du, “signal processing for MEMS sensor based motion analysis
system”, Mälardalen University Press Licentiate Theses No. 228,
2016.ISBN 978-91-7485-256-1ISSN 1651-9256Printed by Arkitektkopia,
Västerås, Sweden.
[5] Lindsay Kleeman, “Understanding and Applying Kalman Filtering”,
Department of Electrical and Computer Systems Engineering, Monash
University, Clayton.
[6] Greg Welch , Gary Bishop “An Introduction to the Kalman Filter”,
University of North Carolina at Chapel Hill Department of Computer
Science Chapel Hill, NC 27599-3175.
[7] Robi Polikar, “The Wavelet Tutorial”, Second Edition, Ames,IA,1994.
[8] Woo, C. K., Ho, C. K., and Gook, C. P., “Wavelet Denoising Technique for
Improvement of the Low Cost MEMS-GPS Integrated System”
72
,International Symposium on GPS/GNSS, Taipei, Taiwan. October 26-28,
2010.
[9] Elkhidir T. Y., and Shuhimi M., Musa T. A., Satti. A., “Pre-Filtering Low-
Cost Inertial Measuring Unit using a Wavelet Thresholding De-noising for
IMU/GPS Integration”, Sept. 27-29, 2011–Shah Alam, MALAYSIA .
[10] Li, Z.P., Fan, Q.J., Chang, L.M., Yang, X., “Improved wavelet threshold
denoising method for MEMS Gyroscope” IEEE 11th International
Conference on Control & Automation (ICCA), Taichung, Taiwan, June
18-20, 2014.
[11] Edu, I.R. Adochiei, F.C., Obreja, R. Rotaru, C. Grigorie, T. L., “New
Tuning Method of the Wavelet Function for Inertial Sensor Signals
Denoising”. Advances in Applied and Pure Mathematics Journal, pp. 153-
157. ISBN: 978-1-61804-240-8. Published on 07/ 07/ 2014.
[12] Adochiei, F., Obreja ,R. Ggrigorie, T. L.,“ Inertial Sensor Signals Denoising
with Wavelet Transform”, INCAS BULLETIN, volume 7, issue 1/ 2015,
pp. 57 – 64 ISSN 2066 – 8201.
[13] AMMAR, HIBA, and SHIHAB,”Digital Signal Processing for MEMS
Sensor Based Motion Analysis System”, B.Sc. thesis, Aeronautical
Engineering Department, Sudan University for science and technology
(SUST), October 2017.
[14] InvenSense Inc., “MPU-6000 and MPU-6050 Register Map and
Descriptions”, Revision 4.0, Document Number: RM-MPU-6000A-00
Revision: 4.0 Release Date: 03/09/2012.
[15] InvenSense Inc., “MPU-6000 and MPU-6050 Product Specification”,
Revision 3.2, Document Number: PS-MPU-6000A-00, Release Date:
11/16/2011.
[16] Arduino, “Arduino Due data sheet” Arduino Due Board doc No 102312.
73
[17] Christoffer, Lundager, Nedergaard, “Gait Sensor- For Monitoring
Movement before fall” AALBORG University 7th semester project
January 2016.
[18] Jeff Rowberg ‘https://github.com/jrowberg/i2cdevlib/zipball/master.’ Sep
2017
[19] MATLAB 2017 Package Documentations.
74
APPENDICES
APPENDIX (A)
Denoising MPU-6050 using Kalman, Wavelet, and
combination MATLAB programme
%############################################################################
clear ALL
close all
clc
AcY=(data(1,(Ac_indx(2)+6): (Ac_indx(3)-4)));
AcY= str2double(AcY);
AcZ=(data(1,(Ac_indx(3)+6): (Tmp_indx(1)-4)));
AcZ= str2double(AcZ);
yaw_MEASURE= AcZ;
roll_MEASURE= AcX;
pitch_MEASURE= AcY;
%----------------wavelet Initialization-------------------------
yaw_WAVELET=AcZ;
roll_WAVELET=AcX;
pitch_WAVELET=AcY;
%-------------Kalman Initialization-----------------------------
yaw_TRUErate= rate;
yaw_EST= yaw_MEASURE;
II
yaw_KALMAN=yaw_MEASURE;
yaw_bias=bias;
yaw_p=p;
%-----------------------------------------------
roll_TRUErate= rate;
roll_EST= roll_MEASURE;
roll_KALMAN=roll_MEASURE;
roll_bias=bias;
roll_p=p;
%------------------------------------------------
pitch_TRUErate= rate;
pitch_EST= pitch_MEASURE;
pitch_KALMAN=pitch_MEASURE;
pitch_bias=bias;
pitch_p=p;
%-------------Combination Initialization------------------------
yaw_KLWLESTM= yaw_MEASURE;
roll_KLWLESTM= roll_MEASURE;
pitch_KLWLESTM= pitch_MEASURE;
for i = drange(1:yrpNO) % yaw ,roll , pitch numbers of itration
%---------- Z-axis -----------------------------
data=fscanf(arduinoDUE);
%-------------- Accellerometer, Temperature and Gyro indices---
Ac_indx=strfind(data,'Ac');
Tmp_indx=strfind(data,'Tmp');
Gy_indx=strfind(data,'Gy');
%--------------------------------------
AcX=(data(1,(Ac_indx(1)+6): (Ac_indx(2)-4)));
AcX= str2double(AcX); % convert string to number with 4bytes
(double)
AcY=(data(1,(Ac_indx(2)+6): (Ac_indx(3)-4)));
AcY= str2double(AcY);
AcZ=(data(1,(Ac_indx(3)+6): (Tmp_indx(1)-4)));
AcZ= str2double(AcZ);
%----------------Kalman denoising ------------------------------
------------- Z-axis --------------------
yaw_MEASURE =[yaw_MEASURE AcZ];
[yaw_TRUErate, yaw_EST, yaw_bias
,yaw_p]=Kalman_Acc(dt,yaw_TRUErate,yaw_bias,yaw_p,AcZ, yaw_EST);
yaw_KALMAN=[yaw_KALMAN yaw_EST];
%---------- X-axis -----------------------------
roll_MEASURE=[roll_MEASURE AcX];
III
[roll_TRUErate roll_EST roll_bias
roll_p]=Kalman_Acc(dt,roll_TRUErate,roll_bias,roll_p,AcX,
roll_EST);
roll_KALMAN=[roll_KALMAN roll_EST];
%---------- Y-axis -----------------------------
pitch_MEASURE=[pitch_MEASURE AcY];
[pitch_TRUErate pitch_EST pitch_bias
pitch_p]=Kalman_Acc(dt,pitch_TRUErate,pitch_bias,pitch_p, AcY,
pitch_EST);
pitch_KALMAN=[pitch_KALMAN pitch_EST];
end
fclose(arduinoDUE);
roll_KLWLESTM = wden(roll_KALMAN,'heursure','h','mln',5,'db4');
%---------- Y-axis -----------------------------
pitch_WAVELET =
wden(pitch_MEASURE,'heursure','h','mln',5,'db4');
pitch_KLWLESTM =
wden(pitch_KALMAN,'heursure','h','one',5,'db4');
%===============================================================
i =1:yrpNO+1;
figure (1)
subplot(3,1,1)
plot(i,yaw_MEASURE,'-b','linewidth',1);
hold on
plot(i,yaw_KALMAN,'^k','linewidth',1);
hold on
plot(i,yaw_WAVELET,'oy','linewidth',2);
hold on
plot(i,yaw_KLWLESTM,'*r','linewidth',1)
hold on
xlabel('No. of Samples');
ylabel('MPU6050 Acc. Z-axis Values');
title('MPU6050 Measured, Wavelet and KL-Wavelet Estimated Acc.
Z-axis Values');
legend('Measured Acc. Z-axis ',...
IV
'Estimated KL-Acc. Z-axis ',...
'Estimated WL-Acc. Z-axis ',...
'Estimated KL-WL-Acc. Z-axis ')
grid on;
subplot(3,1,2)
plot(i,roll_MEASURE,'-b','linewidth',1);
hold on
plot(i,roll_KALMAN,'^k','linewidth',1);
hold on
plot(i,roll_WAVELET,'oy','linewidth',2);
hold on
plot(i,roll_KLWLESTM,'*r','linewidth',1);
hold on
xlabel('No. of Samples');
ylabel('MPU6050 Acc. X-axis Values');
title('MPU6050 Measured, Wavelet and KL-Wavelet Estimated Acc.
X-axis Values');
legend('Measured Acc. X-axis ',...
'Estimated KL-Acc. X-axis ',...
'Estimated WL-Acc. X-axis ',...
'Estimated KL-WL-Acc. X-axis ');
grid on;
subplot(3,1,3)
plot(i,pitch_MEASURE,'oy','linewidth',2);
hold on
plot(i,pitch_KALMAN,'-k','linewidth',1);
hold on
plot(i,pitch_WAVELET,'-r','linewidth',1);
hold on
plot(i,pitch_KLWLESTM,'*m','linewidth',1)
hold on
grid on;
xlabel('No. of Samples');
ylabel('MPU6050 Y-axis Values');
title('MPU6050 Measured, Wavelet and KL-Wavelet Estimated Acc.
Pitch Values');
legend('Measured Acc. Y-axis ',...
'Estimated KL-Acc. Y-axis ',...
'Estimated WL-Acc. Y-axis ',...
'Estimated KL-WL-Acc. Y-axis ');
figure (2)
subplot (2,2,1);
hist(yaw_MEASURE);
title (' Z-axis measured value');
subplot (2,2,2);
hist(yaw_KALMAN);
V
title (' Y-axis kalman estimate value');
subplot (2,2,3);
hist(yaw_WAVELET);
title (' Y-axis wavelet estimate value');
subplot (2,2,4);
hist(yaw_KLWLESTM);
title (' Y-axis kalman-wavelet combination estimate value');
figure (3)
subplot (2,2,1);
hist(roll_MEASURE);
title (' X-axis measured value');
subplot (2,2,2);
hist(roll_KALMAN);
title (' X-axis kalman estimate value');
subplot (2,2,3);
hist(roll_WAVELET);
title (' X-axis wavelet estimate value');
subplot (2,2,4);
hist(roll_KLWLESTM);
title (' X-axis kalman-wavelet combination estimate value');
figure (4)
subplot (2,2,1);
hist(pitch_MEASURE);
title (' Y-axis measured value');
subplot (2,2,2);
hist(pitch_KALMAN);
title (' Y-axis kalman estimate value');
subplot (2,2,3);
hist(pitch_WAVELET);
title (' Y-axis wavelet estimate value');
subplot (2,2,4);
hist(pitch_KLWLESTM);
title (' Y-axis kalman-wavelet combination estimate value');
VI
YAW_KL_offset = [' Z-axis offset value_KALMAN = ',
num2str(yaw_KALMAN_average),'+-', num2str(yaw_KALMAN_STNDEV)];
disp (YAW_KL_offset)
% (1.2) Z-axis wavelet estimate error calculation and offset:
yaw_WAVLETEST_STNDEV = std (yaw_WAVELET) % yaw standard
deviation for wavelet estimate
yaw_WAVLETEST_average = mean (yaw_WAVELET) % yaw mean value for
wavelet estimate
YAW_WL_offset = [' Z-axis offset value_wavelet = ',
num2str(yaw_WAVLETEST_average),'+-',
num2str(yaw_WAVLETEST_STNDEV)];
disp (YAW_WL_offset)
% (1.3) Z-axis wavelet and kalman comination estimate error
calculation and offset:
yaw_KLWLESTM_STNDEV = std (yaw_KLWLESTM)
yaw_KLWLESTM_average = mean (yaw_KLWLESTM)
YAW_KLWLCOM_offset = [ ' Z-axis offset value_KLWLCOM = ',
num2str(yaw_KLWLESTM_average),'+-',
num2str(yaw_KLWLESTM_STNDEV)];
disp (YAW_KLWLCOM_offset)
%#########################(2)X-axis ############################
% (2.0) X-axis measured values:
roll_MEASURED_value_STNDEV = std (roll_MEASURE)
roll_MEASURED_value_average = mean(roll_MEASURE)
roll_MEASURED_value_offset = [ ' X-axis offset value_MEASURED =
', num2str(roll_MEASURED_value_average),'+-',
num2str(roll_MEASURED_value_STNDEV)];
disp (roll_MEASURED_value_offset)
VII
% (2.3) X-axis wavelet and kalman comination estimate error
calculation and offset:
roll_KLWLESTM_STNDEV = std (roll_KLWLESTM)
roll_KLWLESTM_average = mean (roll_KLWLESTM)
ROLL_KLWLCOM_offset = [ ' X-axis offset value_KLWLCOM = ',
num2str(roll_KLWLESTM_average),'+-',
num2str(roll_KLWLESTM_STNDEV)];
disp (ROLL_KLWLCOM_offset)
%###############################################################
VIII
APPENDIX (B)
Arduino DUE Implementation Wavelet Program
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "wavemin.h"
#include<Wire.h>
double AcX[64],AcY[64],AcZ[64],Tmp[64],GyX[64],GyY[64],GyZ[64];
double max;
int i;
max = 0.0;
max = fabs(array[i]);
return max;
int main() {
init();
Wire.begin();
Wire.beginTransmission(MPU_addr);
IX
Wire.write(0); // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
Serial.begin(9600);
Wire.beginTransmission(MPU_addr);
Wire.endTransmission(false);
wave_object obj;
wt_object wt;
int N, i, J;
Wire.beginTransmission(MPU_addr);
Wire.endTransmission(false);
X
AcZ[i]=Wire.read()<<8|Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
J = 2; //Decomposition Levels
setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option
Serial.print(AcZ[i]);
Serial.println(wt->output[i]);
//+++++++++++++++++++++++++++++++++ (X-axis)+++++++++++++++++++++++++++++++++++++++++
wave_object obj;
wt_object wt;
int N, i, J;
XI
diff = (double*)malloc(sizeof(double)* N);
Wire.beginTransmission(MPU_addr);
Wire.endTransmission(false);
J = 2; //Decomposition Levels
setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option
setWTConv(wt, "direct");
//***********************************************************************************
Serial.print("AcX= ");
Serial.print(AcX[i]);
Serial.print(wt->output[i]);
XII
{
wave_object obj;
wt_object wt;
int N, i, J;
Wire.beginTransmission(MPU_addr);
Wire.endTransmission(false);
J = 2; //Decomposition Levels
setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option
setWTConv(wt, "direct");
//***********************************************************************************
XIII
//dwt(wt, AcY);// Perform DWT for AcY
// Serial.print("AcX= ");
// Serial.print(AcX[i]);
Serial.print(wt->output[i]);
Serial.print(AcY[i]);
//*******************************************************************************
wave_object obj;
wt_object wt;
int N, i, J;
//Test Reconstruction;
XIV
wave_free(obj);
wt_free(wt);
free(inp);
free(out);
free(diff);
Serial.flush();
return 0;
XV
APPENDIX (C)
XVI