An Applying of Accelerometer in Android Platform for Controlling

ISS & MLB︱September 24-26, 2013
AN APPLYING OF ACCELEROMETER IN ANDROID
PLATFORM FOR CONTROLLING WEIGHT
Sasivimon Sukaphat
Computer Science Program, Faculty of Science, Thailand
[email protected]
ABSTRACT
This research intends to present a mobile calorie counting application which utilizes
Android accelerometer to perform human movement recognition. The proposed
application uses accelerometer on the Android platform for identifying the physical
activity a user is performing. The acceleration generated by user’s movement will be
converted into speed and further be used in ACSM metabolic equations in order to
find the number of calories burned. The proposed application also shows the statistics
of calories burned per day and suggests the appropriate number of calories burned for
each user which can help people to control their weight anytime and anywhere.
Keyword: Accelerometer, Android, Activity Recognition, Calorie counting
INTRODUCTION
Health-care is one of people’s major concerns, especially when obesity problem
becomes fast growing. Several weight control techniques have been proposed for
diminishing this health problem. In particular, foot pod gadgets such as running watch,
pedometer and embedded foot pod shoe (Willson, 2010) were introduced for helping
people to control weight. These gadgets calculate the amount of burned calories by
counting the number of steps that the user walks or runs which will be used for
measuring the distance that the user takes.
However, the ability of these devices may not be quite accurate. The
pedometer and related devices identify person’s step by using a hair spring
mechanism which tends to droop after a constant usage (Flaherty, 2005). In addition,
the distance of each person gait varies, thus requiring an informal calibration which is
quite inconvenient to perform. Moreover, people need to pay more for purchasing
these gadgets. It would be better if we can use everyday life devices to perform this
task.
In order to solve the problems mentioned above, we try to present a new
health-care paradigm which only uses a common device for helping people control
their weight at ease. This research presents SWL (SWU Weight Loss), a mobile
calorie counting application on the Android platform which utilizes an accelerometer
for classifying continuous human motions. The Android platform was proved by
many researches (Ayu, Mantoro, Matin, & Basamh, 2011), (Brezmes, Gorricho, &
ISS 294
ISS & MLB︱September 24-26, 2013
Cotrina, 2009), (Kwapisz, Weiss, & Moore, 2010)
human activities.
that it has an ability to recognize
By using an accelerometer, the acceleration generated when a user is moving
will be converted into speed which is used for classifying user’s activities. Because
the vertical motion acceleration such as stair climbing is still difficult to recognize by
Android accelerometers (Kwapisz, Weiss, & Moore, 2010), the SWL application only
focus on the acceleration from the x-axis for classifying planar motion. The speed will
be further used in ACSM metabolic equations (ACMS, 2006) for calculating the
number of calories used in that activity. The SWL application also shows the statistics
of calorie burned per day and suggests the appropriate number of calories burned for
each user which can help people who want to control weight anytime and anywhere.
LITERATURE REVIEW
1.1.Embedded Accelerometer in Smartphone
The SWL application works with Android accelerometer which is a built-in sensor
that measures the motion and tilt of a mobile. By using interface SensorListener
(SensorListener, 2013), we can measure the acceleration force in m/s2 which is
applied to a mobile on the x, y, and z axes, including the force of gravity. By using
IBMEyes program (Ableson, 2009), we can demonstrate the example outputs from
the accelerometer when a mobile was lying and when it was tilting shown in figure 1.
Figure 1 Example outputs from Android accelerometer when mobile was lying (left)
and when mobile was tilting (right).
The acceleration from the accelerometer is converted into speed for using in
ACSM metabolic equations described in the next section.
ISS 295
ISS & MLB︱September 24-26, 2013
1.2.ACSM metabolic equations
In order to find the number of calories burned in each activity, we use two ACSM
metabolic equations:
maximal oxygen consumption equations and caloric
expenditure equation for two purposes. Firstly, the maximal oxygen consumption
equation is used for calculating the maximum oxygen consumption of a client's body
(VO2Max) for a given exercise. Secondly, the caloric expenditure equation is used for
calculating the number of calories burned from physical activity. In addition, the
Basal Metabolic Rate (BMR) equation is also used for calculating the appropriate
number of calories expended per day for each person. The components of each
equation are described below:
2.1. Maximal Oxygen Consumption Equation
VO2Max = H + V + R
Where H, V and R are the amount of oxygen consumed in horizontal motion,
vertical motion and resting (ml/kg/min).
This research only focuses on two activities: walking and running. In the case of
walking (the speed is not over 5.95 kilometer/hour or 99.167 meter/minute), the
components of equation are:
VO2Max = (0.1 x Speed) + (1.8 x Speed x Gradient) + 3.5
In the case of running (the speed is greater than 5.95 kilometer/hour or 99.167
meter/minute), the components of equation are:
VO2Max = (0.2 x Speed) + (0.9 x Speed x Gradient) + 3.5
Where

0.1 is oxygen cost per meter of moving each kilogram (kg) of body
weight while walking (horizontally).

0.2 oxygen cost per meter of moving each kg of body weight while
running (horizontally).

1.8 is oxygen cost per meter of moving total body mass against gravity
(vertically).

0.9 is oxygen cost per meter of moving total body mass against gravity
(vertically).
2.2. Caloric Expenditure Equation
Caloric expenditure = (VO2Max x Weight/1000) x 5
Where the unit of caloric expenditure is kilocalorie (kcal).
ISS 296
ISS & MLB︱September 24-26, 2013
2.3. BMR (Basal Metabolic Rate) Equation
In order to suggest the appropriate number of calories expended per day for each
person, we use the BMR (Basal Metabolic Rate) equation (Wikipedia, 2013) to find
the number of calories the client body needs at rest for each day. The BMR equation
for male and female consists of components described below:
Male BMR = 66 + (13.7 x Weight) + (5 x Height) – (6.8 x Age)
Female BMR = 665 + (9.6 x Weight) + (1.8 x Height) – (4.7 x Age)
RELATED WORK
There are various weight control applications on the Android platform which
can be classified into three major groups:
1. GPS Tracking Application
The GPS tracking application is used for measuring the distance of the client’s
exercise. An example of Android GPS tracking application is Runstar (Runstar, 2013),
which can track distance and time of user’s exercise. However, the flaw of this
application is the GPS network that has limited range and the lack of abilities to
pierce through barriers (Otsason, Varshavsky, LaMarca, & Lara, 2005). Thus, it does
not work well indoor.
2. Pedometer Application
The pedometer application generally mimics the functions of the pedometer
device. Therefore, this application can count user steps, show the approximate
distance, speed and the number of calories burned. Accupedo-Pro Pedometer (LLC,
2013) is an example of this kind of application. Because this application measures the
approximate distance calculated from user’s paces, it cannot measure user’s speed
accurately, thereby affecting the precision of calorie calculation.
3. Calorie Counting Application
Android calorie counting application is an application that helps users to keep
track of their meals, exercise and weight. An example of Android calorie counting
application is Calorie Counter by FatSecret (FatSecret, 2013) . This application works
by providing necessary information such as nutrition facts on foods and number of
calories burned in each exercise mode. The number of calories burned by user’s
activities will be counted and recorded in the application. Since the calorie counting
process does not come from the real practice, the result may be incorrect.
ISS 297
ISS & MLB︱September 24-26, 2013
SYSTEM DESIGN AND IMPLEMENTATION
The SWL application was developed as a calorie counting tool that helps people
control their weight in anywhere and anytime. This application works by applying
Android accelerometer to perform human activity recognition and task classification.
The SWL application consists of four modules: interface module, motion recognition
and classification module, calorie calculation module and SQLite module.
1. Interface Module
Interface module deals with user input and display output. First of all, user has to
register into SWL application by submitting personal information such as age, gender,
height and weight (figure. 2) which will further be used in calorie calculation module.
SWL application displays two types of outputs:
1.1. Calorie Per Activity
This is a single result of each activity a user performs and is immediately shown
after the user finishes his/her motion. Figure 4 (left) shows the output screen which
consists of activity date, activity type, total time spent, average speed and the number
of calorie burned.
1.2.Calorie Burned Statistic
This is a summary result of all activities the user performs throughout the day,
including with the BMR suggestion. Figure 4 (right) shows the output screen which
consists of user’s BMR in a specific date. The BMR result will be used to compare
with the BMR standard for giving a suggestion about the appropriate metabolic rate to
the user. Under BMR suggestion is the accumulated number of calories burned from
all exercises that the user performs in one day, including the details of each exercise.
2. Motion Recognition and Classification Module
In order to perform motion recognition and classification task, the Android APIs
were used to receive the acceleration from the accelerometer. The interface
SensorListener (SensorListener, 2013) was used for receiving notifications from the
SensorManager class when sensor values have changed. By calling
onAccuracyChanged method and onSensorChanged method, the acceleration from
sensor can be received and further be used in the calorie calculation module. Figure 3
(right) shows the acceleration from the x-axis while the user is moving.
3. Calorie Calculation Module
This module consists of two tasks:
ISS 298
ISS & MLB︱September 24-26, 2013
3.1 Maximum Oxygen Consumption Calculation
After the user finishes his/her exercise, the maximum oxygen consumption
calculation task is performed by using the ACSM's maximal oxygen consumption
equations to find VO2Max of the client's body for a given exercise. The VO2Max
value will be used in the caloric expenditure equation for finding caloric expenditure
of each activity that user performs. The result from this process will be sent to the
interface module for showing calories per activity on screen.
3.2 BMR Calculation
In case that user wants to know his/her statistics of calorie burned per day, the
BMR calculation task will be performed. The BMR from this calculation process will
be sent to the interface module for showing the statistics of calories burned on screen.
4. SQLite Module
In order to compute the statistics of calories burned per day, the number of
calories burned from each user’s activity has to be kept in SQLite database. After
specifying date on the calorie statistics screen, the number of calories from every
activity that user performed in that day will be retrieved from SQLite database and
further be accumulated. The result from this process will be sent to the calorie
calculation module under the BMR calculation task.
Figure 2 The input screen of SWL application.
ISS 299
ISS & MLB︱September 24-26, 2013
Figure 3 (Left) The acceleration starting screen, (right) the user speed acquired from
accelerometer sensor
Figure 4 (Left) The output screen of calories per activity, (right) the output screen of
the statistics of calories burned per day.
EXPERIMENT RESULT
The experiment was conducted by calculating the number of calories burned in
2 activities: walking and running, of which a 10-minute continuous movement was
performed 15 times per activity. The 3-axis accelerometer, Sumsung Galaxy S II, was
used for installing the SWL application. In order to evaluate the accuracy of the SWL
application, an accelerated standard device, Tech 4 O Accelerator Woman’s Running
ISS 300
ISS & MLB︱September 24-26, 2013
Watch: the built-in accelerometer and calorie counting was used to compare the result
to the SWL application. The accelerometer watch and mobile phone were both
attached to the tester’s body throughout the testing period. After testing 15 times in
each activity, we found that the SWL application can reach a good accuracy rate of
activity classification: the overall walking speeds are lower than 99.167 meter/minute
(table 1) and the overall running speeds are greater than 99.167 meter/minute (table 2).
Besides, the number of calories burned from the SWL application is closely to the one
from the running watch: the average percent of discrepancies which are 28.57% and
26.27% in walking and running activity respectively.
TABLE 1 THE RESULT OF WALK TESTING
Running
Watch
Calories
(kcal/min)
SWL Application
Speed
Calories
(kcal/min)
(m/min)
Percent of
Discrepancy
6.67
84.96
5.88
+11.80
7.35
80.71
5.66
+22.96
7.35
60.01
4.66
+36.51
7.06
84.5
5.86
+16.92
6.79
58.9
4.6
+32.22
7.06
80.15
5.64
+20.50
5.66
42.65
3.8
+32.81
6.92
68.56
5.08
+26.56
5.66
57.43
4.52
+20.90
6.92
41.70
3.76
+45.63
4.90
39.48
3.20
+34.63
4.90
40.49
3.24
+33.82
5.28
44.43
3.42
+35.15
4.70
47.07
3.52
+25.50
5.30
46.94
3.52
+33.52
The average percent of discrepancy
ISS 301
28.57
ISS & MLB︱September 24-26, 2013
TABLE 2 THE RESULT OF RUN TESTING
Running
Watch
Calories
(kcal/min)
SWL Application
Speed
Calories
(kcal/min)
(m/min)
Percent of
Discrepancy
11.54
98.24
6.54
+43.32
12.00
117.92
13.28
-10.67
12.00
106.38
12.14
-1.17
12.50
145.84
16.00
-28.00
13.04
95.35
6.38
+51.09
9.60
97.96
6.52
+32.08
12.00
97.96
6.52
+45.67
10.91
129.44
14.40
-32.00
10.43
103.60
11.86
-13.66
12.50
119.01
13.38
-7.04
10.43
109.42
12.44
-19.22
13.04
135.07
14.96
-14.69
10.43
99.00
6.56
+37.13
10.43
115.45
13.02
-24.78
10.91
131.13
14.56
-33.47
The average percent of discrepancy
26.27
CONCLUSION
This research aims to propose the SWL application: a new paradigm of weight
controlling application which can be used anywhere and anytime. By utilizing an
accelerometer on the Android platform, we can create a mobile application that users
can use for counting the number of calories burned from their exercises including
statistics of calorie burned. From the experiment, we found that the SWL application
ISS 302
ISS & MLB︱September 24-26, 2013
was well performed in activity classification task, precisely identifying user activities
in horizontal movements. Moreover, this application also has an average percent of
discrepancy from both waking and running activity less than 30% comparing to the
accelerometer running watch. Therefore, we can conclude that the SWL application is
accurate and reliable enough to use as a calorie counting device. However, user needs
to calibrate the accelerometer sensor at the first time of use. Thus, the accelerometer
calibration program installation is required for improving sensor performance by
removing structural errors in the sensor outputs.
REFERENCES
SensorListener. (2013, June 21). Retrieved from Android Developer:
http://developer.android.com/reference/android/hardware/SensorListener.html
Ableson, F. (2009, June 16). Tapping into Android's sensors. Retrieved from IBM:
http://www.ibm.com/developerworks/library/os-android-sensor/
ACMS. (2006). Amercan college of Sports Medicine's Guidelines for Exercise Testing
and Prescription. Lippinkott Williams & Wilkins.
Ayu, M. A., Mantoro, T., Matin, A. F., & Basamh, S. S. (2011). Recognizing User
Activity Based on. IEEE Symposium on Computers & Informatics, (pp.
617-621).
Brezmes, T., Gorricho, J.-L., & Cotrina, J. (2009). Activity Recognition from
Accelerometer Data on a Mobile Phone. IWANN 2009 (pp. 769-799).
Springer-Verlag Berlin Heidelberg.
FatSecret. (2013, January 26). Calorie Counter by FatSecret. Retrieved from
Google-Play:
https://play.google.com/store/apps/details?id=com.fatsecret.android&hl=en
Flaherty, C. (2005, May 2). Hip-riding pedometers are popular, but how accurate are
they? Retrieved from Montana State University:
http://www.montana.edu/news/2410/hip-riding-pedometers-are-popular-but-ho
w-accurate-are-they
Kwapisz, J. R., Weiss, G. M., & Moore, S. A. (2010). Activity Recognition using Cell
Phone Accelerometers. SensorKDD ’10. Washington, DC.: ACM.
LLC, C. (2013, May 12). Accupedo-Pro Pedometer. Retrieved from Google-Play:
https://play.google.com/store/apps/details?id=com.corusen.accupedo.widget&
hl=en
Otsason, V., Varshavsky, A., LaMarca, A., & Lara, E. d. (2005). Accurate GSM Indoor
Localization. UbiComp (pp. 141-158). Springer-Verlag Berlin Heidelberg.
Runstar. (2013, Febuary 21). Runstar™. Retrieved from Google-Play:
https://play.google.com/store/apps/details?id=se.runstar.pro
ISS 303
ISS & MLB︱September 24-26, 2013
Wikipedia. (2013, April 12). Basal metabolic rate. Retrieved from
http://en.wikipedia.org/wiki/Basal_metabolic_rate
Willson, S. (2010, September 20). Nike+ iPod vs Nike+ GPS Application Review.
Retrieved from Learn Fitness:
http://www.learnfitness.com/2010/09/nike-ipod-vs-nike-gps-application-revie
w/
ISS 304