final presentation (revision 2)
TRANSCRIPT
Motion Recognition Using
Accelerometers
Walter Hudgens
Chad Buckallew
Jay Won
Sarah Duncan
Matt Smith
Bobby Onyeukwu
Advisor: Dr. Fei Hu
1ECE 494 University of Alabama
Agenda
• Accelerometer Background
• Wii-motes
• Extraction Program
• MATLAB Implementation
• Acceleglove
• Validation
• Administrative information
2ECE 494 University of Alabama
Project overview
• Our capstone group was given the task of creating a
virtual environment. This environment was to utilize
accelerometers in order to recognize dynamic gestures
performed by an unknown user. In the process of
recognizing these gestures, the environment was to also
be able to train and store data from past trails, creating a
library of gestures.
3ECE 494 University of Alabama
Deliverables
The deliverables expected upon completion of this project
are as follows:
1. Demonstration of Wii-motes functioning with
corresponding limb recognition software
2. Demonstration of the Acceleglove functioning
with hand recognition software
3. Generation of a group website
4. Final report
4ECE 494 University of Alabama
Full system overview
5
MATLAB User
Interface
ANNMATLAB Data
Manipulation
Acceleglove SDKExtraction
Program
Wired Digital
GloveBluetooth Adapter
Wii-motes: Wii-mote Group
: Glove Group
Legend
ECE 494 University of Alabama
Accelerometers
• Accelerometers are sensors that are capable of measuring
acceleration.
• Used to convert linear or angular accelerations into output
signals
• The sensor then splits the signal into two distinct signals
• Acceleration due to gravity
• Allows the sensor to determine which direction is down
• External acceleration
• By factoring out the external acceleration, orientation
of accelerometer can be factored.
6ECE 494 University of Alabama
Sample accelerometer spring
system
7[1]ECE 494 University of Alabama
Accelerometer theory
• Output signals are obtained by an application of Newton’s
law.
• When in equilibrium, the restorative force is equal to the
force of acceleration acting on the mass.
• The displacement of the spring (x) is then converted into
an output signal.
• Measurement of piezoresistave material
• Measurement of changing capacitance between
moving and fixed elements.
8ECE 494 University of Alabama[1]
Wii-motes
Bobby Onyeukwu
9University of AlabamaECE 494
Wii-mote comparison
10[2] University of AlabamaECE 494
Old Wii-mote New Wii-mote
Accelerometer ADXL330 ADXL330
Communication Bluetooth HID Bluetooth HID
Name Nintendo RVL-CNT-01 Nintendo RVL-CNT-01-TR
Product ID 0X0306 0X0330
Vendor ID 0X057e 0X057e
Costs $10.00 $40.00
MotionPlus Not Included Included
(X,Y,Z) axes
11[2] University of AlabamaECE 494
ADXL330 accelerometer
12[3] University of AlabamaECE 494
Why Wii-motes?
• Budget friendly
• $10.00 each
• Readily available
• User friendly
• Utilizes a triple axis accelerometer
• Coincides with research being conducted by Dr. Hu
13University of AlabamaECE 494
Wii-mote validation
Test controller functionality
PC connectivity via Bluetooth adapter
Connectivity to C# data extraction program
Inputs data into MATLAB environment
C# user interface
MATLAB user interface
14University of AlabamaECE 494
Bluetooth adapter (dongle)
15
• Rocketfish Micro Bluetooth
adapter
• RF-MRBTAD
• Size: 0.2 x 0.6.x 0.8 inches
• Cost: $ 7.00
[4] University of AlabamaECE 494
Wii-mote flowchart
Train
Complete
N
Y
N
Y
C# Testing
C# Training MATLABSuccessful
Recognition
Wii-mote
Expected
Output
University of AlabamaECE 494 16
C# program
Chad Buckallew
University of AlabamaECE 494 17
Data acquisition codes for
Wii-mote• C# API
• WiimoteCS by Brian Peek.
• C++ API
• Wiiyourself!
• Fwiine
• Window 7 platform.
University of AlabamaECE 494 18
Choosing C#
• Familiar platform – Visual Studio 2010
• Delegates and Events
• Runtime Generic Support
• Open source code with least modification required
University of AlabamaECE 494 19
Main window
• MultipleWiimoteForm.cs
• Initial User Interface
• Device status
• Access to Training/Testing functionality
• Invokes:
• Wiimoteinfo.cs
• Train.cs
• Trainusercontrol.cs
• Test.cs
• Testusercontrol.cs
University of AlabamaECE 494 20
Training
• Trainusercontrol.cs
• Training Interface
• Trials Accuracy
• Sampling Rate 40Hz
• Stores results to Train.txt
• Math Utilized - MATLAB
• Smoothing
• Dynamic Time
Warping
• Affinity Propagation
• Invokes:
• Wiimoteinfo.cs
• Trainusercontrol.cs
University of AlabamaECE 494 21
Training
University of AlabamaECE 494 22
Training Library
• Output – Train.txt
• Serves as reference
library
• Stores training data
(x,y,z)
• Wii-mote data is set of 3
columns
• Gestures denoted by ‘$’
• “%x%” Identifies Trials
• File accumulates all
gestures
University of AlabamaECE 494 23
Trial 1
Sampling
• 40Hz Sampling Rate
• 200 traces distributed
for single or multiple
Wii-motes
• Testing verified
successful recognition
Number of
Wii-motes
Number of traces
(per Wii-mote)
1 200
2 100
3 66
University of AlabamaECE 494 24
Test main window
• Test.cs
• Verify successful gesture
recognition
• Generate Test.txt
• Invokes:
• Wiimoteinfo.cs
• Testusercontrol.cs
• Math Utilized -MATLAB
• Smoothing
• DTW
• Random Projection University of AlabamaECE 494 25
Sample gesture (bicep curl)
University of AlabamaECE 494 26[17]
Wii-Mote 1 Wii-Mote 2 Wii-Mote 3 *Omit Dumbbells
C# program validation plan
Test Wii-mote compatibility (single/multi-mode)
Acquire Wii-mote data
Train simple gesture to obtain ‘Train.txt’
Obtain ‘Test.txt’
Ensure ‘Train.txt’ and ‘Test.txt’ valid for gesture
recognition
University of AlabamaECE 494 27
MATLAB Training
Jay Won
University of AlabamaECE 494 28
MATLAB overview
University of AlabamaECE 494 29
Training Data DTW AP Exemplars
Smoothing
Testing Data DTW RPL-1
Minimization
Recognized
Gesture: Training Phase
: Testing Phase
Legend
Training phase
University of AlabamaECE 494 30
Training Data DTW AP Exemplars
[16,18,17]
Dynamic Time Warping
(DTW)
• Finding the similarity
cost between two graphs.
• The lower the cost, the
most similar the graphs
are.
University of AlabamaECE 494 31[17]
Mathematical representation
University of AlabamaECE 494 32[18]
DTW Example
University of AlabamaECE 494 33
Cost:
3.3084e+05
Cost:
2.7239e+06
Affinity propagation (AP)
• Finds exemplars among the
data
• Operates using matrix
similarities
• Four Basics of AP
• Responsibility
• Availability
• Similarity
• Preference
University of AlabamaECE 494 34[17]
AP basics
• Responsibility- message between exemplars and clusters
to decide which traces are exemplars.
• Availability- message to decide which clusters belong to
which exemplars.
• Similarity- DTW costs.
• Preference- a minimum requirement for exemplars to be
optimal exemplars.
University of AlabamaECE 494 35
Mathematical representation
• Responsibility
• Availibility
• Similarity
• Preference
University of AlabamaECE 494 36[18]
MATLAB Testing
Chad Buckallew
University of AlabamaECE 494 37
Testing phase
Exemplars
Recognition of Y
R
DTW
Y
Test Data
L1 Minimization
Solving for (X,Y,Z)
(Rx,Ry,Rz)
University of AlabamaECE 494 38
RP
DTW
University of AlabamaECE 494 39
Exemplars
Recognition of Y
R
DTW
Y
Test Data
L1
Minimization
Solving for
(X,Y,Z)
(Rx,Ry,Rz)
Equation:
[17]
Random projection (RP)
• Utilized to reduce a high
dimension matrix to a
lower dimension by:
University of AlabamaECE 494 40
Exemplars
Recognition of Y
R
DTW
Y
Test Data
L1
Minimization
Solving for
(X,Y,Z)
(Rx,Ry,Rz)
[17]
RP mathematical representation
University of AlabamaECE 494 41
Exemplars
Recognition of Y
R
DTW
Y
Test Data
L1
Minimization
Solving for
(X,Y,Z)
(Rx,Ry,Rz)Generation of Matrix
[17]
Further mathematical
representationExemplars
Recognition of Y
R
DTW
Y
Test Data
L1
Minimization
Solving for
(X,Y,Z)
(Rx,Ry,Rz)
University of AlabamaECE 494 42[17]
MATLAB GUI
University of AlabamaECE 494 43
Data acquisition
University of AlabamaECE 494 44
MATLAB GUI
University of AlabamaECE 494 45
Compute
University of AlabamaECE 494 46
MATLAB validation
Train and test data acquisition
Understand and implement DTW, AP, RP
Recognize unknown gesture
Make MATLAB GUI and connect with C# Program
Work in 32-bit, 64-bit, and Mac Operating system
University of AlabamaECE 494 47
Digital Glove
Matt Smith
48University of AlabamaECE 494
Digital glove
• Java software
• MEM Accelerometers
• USB cable (wired)
• Supply Voltage: 5V
• Range: ± 1.5g
• Sampling Rate: 120 Hz
49University of AlabamaECE 494 [20]
Accelerometer placement
50University of AlabamaECE 494 [20]
SDK visualizer
University of AlabamaECE 494 51
Artificial neural networks
• Artificial neural networks
(ANN) are computer codes
that act like a human brain.
• They consist of cells which
have inputs and outputs.
• The output (y) of a cell is a
linear combination of its
inputs (x), with different
weights (w) assigned to each
one.
[8] 52University of AlabamaECE 494
Training the network
• In order to work, the neural network must be trained.
• Training a neural network assigns the value of the weights.
• The weights represent the network’s “knowledge.”
[9] 53University of AlabamaECE 494
How training works
• The network is given some sample inputs and target outputs.
• This data is divided into three classes.
• Training data
• This is the data the network will use to learn.
• Validation data
• This data is used so the network knows when to stop learning.
• Testing data
• This data is used as a final test of the network’s accuracy.
54[19] University of AlabamaECE 494
How training works
1. Give weights some random
initial value.
2. Perform calculations on the
testing data and the validation
data.
3. Calculate error for both sets
4. Change weights to reduce
training data error.
5. Repeat 2-4 until error from
validation data is a minimum.
55University of AlabamaECE 494
Flowchart
56University of AlabamaECE 494
Input Matrix
GeneratorNetwork Trainer
Target Matrix
Generator
RecognizerPerformanc
e
Acceptable?
Y
N
Gestures used
57University of AlabamaECE 494
Demo
58University of AlabamaECE 494
Validation, testing, and challenges.
Sarah Duncan
59University of AlabamaECE 494
Validation plan (visualizer)
Confirm glove functionality with
SDK/Visualizer software through
existing ASL gesture library (A-Z).
Build numerical library (1-10).
60University of AlabamaECE 494
Visualizer testing data
0
20
40
60
80
100
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Probability Filter Set on 90
61University of AlabamaECE 494
Building the numerical library
• Used the SDK from the Acceleglove
• Created a new library to train the numerical gestures into
• Determined an average number of gestures using pre-
existing library (ASL)
• Trained numerical gestures into the new library
• Determined accuracy
University of AlabamaECE 494 62
Accuracy from trained library
0
10
20
30
40
50
60
70
80
90
100
1 2 3 4 5 6 7 8 9 10
Su
ccess (
%)
One through Ten
University of AlabamaECE 494 63
Validation plan (MATLAB)
Confirm that AcceleGlove data can be accessed in
readable form through USB.
Access glove data directly through MATLAB.
Generate data to train network.
Read in and recognize gestures with the neural network.
Recognize gestures made by a user with 90% accuracy.
64University of AlabamaECE 494
USB data access
65University of AlabamaECE 494
Serial through MATLAB
• This test was undertaken to determine whether we could
access serial ports through MATLAB
• We wrote test code to access the AcceleGlove’s data
directly in MATLAB.
• Data is read in from the glove as a character vector.
• Code converts the data to a vector of type “double.”
66University of AlabamaECE 494
MATLAB-serial code
port=serial('com13','Baudrate',38400,'Terminator','CR');
fopen(port);
for k = 1:50
fprintf(port,'a');
ASCII_data = fscanf(port);
double_data = sscanf(ASCII_data,'%d')
display(double_data)
end
fclose(port);
67University of AlabamaECE 494
Generating data
68University of AlabamaECE 494
Accuracy of the trainer
0
10
20
30
40
50
60
70
80
90
100
1 2 3 4 5 6 7 8 9 10
Su
ccess (
%)
Matt
University of AlabamaECE 494 69
Accuracy comparison
0
20
40
60
80
100
1 2 3 4 5 6 7 8 9 10
Su
ccesses (
%)
Sarah
0
20
40
60
80
100
1 2 3 4 5 6 7 8 9 10
Su
ccess
(%
)
Chad
• Low: 15
• High:100
• Total Accuracy : 70
• Low: 0
• High: 100
• Total Accuracy:
65.5
University of AlabamaECE 494 70
Obtaining 90% accuracy
• Modify code
• Expand the reference library
• Test results as each new reference is added to the ANN
library
• Determine if accuracy increases for trainers and non-
trainers
University of AlabamaECE 494 71
Logs and backups
• The code is being stored on personal computers, flash
drives, and Crimson Google Drive.
• The code versions are organized by date modified.
72University of AlabamaECE 494
Challenges and issues
• Glove configures to different COM ports on different
computers.
• This requires changing the code every time it is used on
a new computer.
• IRB approval currently limits the amount of testing that
can be conducted
• Team has completed IRB Certification as of 9/13/2012
• Request submitted 10/15/2012;re-submitted 12/7/2012
• Glove is wired.
• This restricts the user.
• Cable can be disconnected. 73University of AlabamaECE 494
Budgeting and Impacts
Walter Hudgens
74ECE 494 University of Alabama
Budgeting
75
0%
100%
0%
Wii-motes
Bluetooth Adapter
Acceleglove
Equipment Price per unit Quantity Total
Wii-motes $10.00 3 $30.00*
Accelglove $650.00 1 $650.00
Bluetooth adapter $7.00 2 $14.00*
Total: $650.00
*=Donated
ECE 494 University of Alabama
Schedule
76ECE 494 University of Alabama
Societal impacts
• If implemented into hospitals, reduced cost of teletherapy
will decrease the medical costs and improve the quality of
life for stroke victims.
77ECE 494 University of Alabama
Environmental impacts
• Telerehabilitation
therapy will reduce the
amount of gasoline used
in the transportation of
patients to and from their
respective medical
centers.
78[10]ECE 494 University of Alabama
Economical impacts
• According to the World Health Organization (WHO), the
total healthcare spending in the year 2010 was $2.3
trillion, which is 17.9% of our nation’s Gross Domestic
Product (GDP). It is estimated to reach 19.5% by the year
2017.
79[14]ECE 494 University of Alabama
Healthcare spending (2010)
Hosipital Care31%
Physician/Clinal Services20%
Pharmaceuticals10%
Dental4%
Nursing Homes6%
Home Health Care3%
Govt Public Health Activites
3%
Administrative Costs
7%Investments
7%
Other (Physical Therapists)
6%
Other Retail Products3%
80[15]ECE 494 University of Alabama
Political impacts
• Under our nations
current healthcare
reforms, reimbursement
for members of the
Medicare Advantage
program will be reduced.
• If implemented, we
believe that our system
could reduce the cuts in
benefits and services the
seniors experience.
University of AlabamaECE 494 81[13]
References
[1] T. R. Burchfield, S. Venkatesan, “Accelerometer-Based Human Abnormal Movement Detection in Wireless Sensor
Networks,” Computer Engineering Program, University of Texas at Dallas, Dallas, TX.
[2] http://www.symbolicsound.com/cgi-bin/bin/view/Learn/UsingTheNintendoWiimoteWithKyma
[3] “ADXL330 Datasheet”. http://www.analog.com/static/imported-files/data_sheets/ADXL330.pdf
[4] “Rocketfish Bluetooth Micro Dongle”. http://www.rocketfishproducts.com/products/computer-accessories/RF-
MRBTAD.html
[5] Yao, B. and Zhu S. "Learning Deformable Action Templates from Cluttered
Videos". UCLA.http://www.stat.ucla.edu/~zyyao/data/Action_template_iccv09.pdf
[6] Frau, D. "Pattern Matching Techniques". http://cyber.felk.cvut.cz/gerstner/teaching/zbd/dtw.pdf.
[7] http://max-muscle-gain.blogspot.com/
[8] http://mybrainnotes.com/brain-cell-neuron.gif
[9] http://photos1.blogger.com/blogger/82/1614/320/fig121.JPG
[10] http://libbyjohnson.hubpages.com/hub/Whats-Behind-the-High-Gas-Prices-More-Than-You-Think
[11] http://castro21.files.wordpress.com/2010/10american_sign_language_numbers_at_coloringpageskidsboys.gif
[12] http://www.mathworks.com/help/nnet/examples/cancerdetectdemonnet_02.png
[13] http://seandenoyer.com/wp-content/uploads/2012/10/president_obama_lightsaber.jpg
[14] http://www.kaiseredu.org/Issue-Modules/US-Health-Care-Costs/Background-
Brief.aspx#How%20is%20the%20U.S.%20health%20care%20dollar%20spent?
[15] http://en.wikipedia.org/wiki/Health_care_in_the_United_States#cite_note-29
[16] http://www.stat.ucla.edu/~zyyao/projects/action.htm
[17] http://vimeo.com/1821063
[18] A. Ahmad, and F. Chen, “A Novel Accelerometer-based Gesture Recognition system” IEEE Trans. On Signal
Processing, VOL. 59, NO. 12, Dec. 2012
[19] http://3.bp.blogspot.com/-m2dY2-t1-Xg/TvzAgcehhOI/AAAAAAAAAHA/IOOGLTl3Sfw/s1600/end-of-semester-
student-studying-finals-week-grading-essays.jpg
[20] http://www.acceleglove.com/
82ECE 494 University of Alabama