ADVANCED PEDOMETER FOR SMARTPHONE-BASED
ACTIVITY TRACKING
Michal Tomlein, Pavol Bielik, Peter Kr´atky,
ˇ
Stefan Mitr´ık, Michal Barla and M´aria Bielikov´a
Institute of Informatics and Software Engineering, Faculty of Informatics and Information Technologies
Slovak University of Technology in Bratislava, Ilkoviˇcova 3, 842 16 Bratislava, Slovakia
Keywords:
Advanced pedometer, Activity tracking, Cheating detection, Neural networks.
Abstract:
This paper describes the design of an advanced smartphone pedometer developed as part of a larger solution
aimed at encouraging a healthier lifestyle through regular physical activity, called Move2Play. Move2Play
provides several motivational methods to promote exercise, some of which are based on the use of points
derived from tracked activity. While current pedometers are easily tricked into counting steps by shaking the
device, our advanced pedometer uses a neural network to detect and prevent this kind of cheating. In this paper,
we discuss both the method for counting steps and our innovative approach to the recognition of cheating.
1 INTRODUCTION AND
RELATED WORK
Evolution in IT has resulted in significant changes in
our everyday life. Information has become ubiqui-
tous, can be accessed almost anywhere and anytime
and be leveraged to deal with our tasks more effi-
ciently. Moreover, we now have access to new kinds
of information previously unavailable. One such kind
of information that can have a major impact is an
overview of our everyday physical activity. Having
this information is a basic prerequisite if we want to
tackle one of the biggest problems of our society – the
lack of physical activity, overweight and obesity.
This information can be captured and interpreted
by an intelligent wearable device. However, the re-
quirement to wear an additional measuring device is a
key barrier to achieving long-term sustainability (Fu-
jiki, 2008). It is therefore preferable to rely on a de-
vice people already carry, i.e. a smartphone.
Currently available solutions track users’ move-
ment “on-demand”, mainly using GPS sensors. How-
ever, they are mainly used by already rather physi-
cally active people, while most of the people who
need to become more physically active are unaware
of such solutions or are not motivated to use them
as they do not exercise regularly. We focus on such
people who require additional motivation in order to
become more physically active.
There is an activity we perform naturally, with-
out paying much attention to it walking. Walking
reduces rates of chronic disease, ameliorates health
care costs (Lee and Buchner, 2008) and is one of a
few activities that every age group can and should
participate in. However, over the last few decades,
the amount of walking people do every day has been
on the decrease, which has been one of the reasons
of increased overweight and obesity and other health
problems.
To change this, we track and analyse walking
throughout the day, not “on-demand but continu-
ously, using smartphone sensors. Once captured, we
provide users with a visual overview of their perfor-
mance, which is the first step towards improvement.
However, activity tracking and visualisation alone are
insufficient, as the drop out rate is a serious problem
even in professional training programmes and can be
as high as 89 % (Iwane, 2000).
Therefore, we proposed a broader concept of com-
prehensive physical activity management, driven by
various motivational factors supporting its users in
achieving the required amount of daily activity. The
process consists of recommendation of the appropri-
ate amount of activity in the form of a personalised
daily plan and automatic tracking and evaluation of
performed activity. An important part of the process is
the integration of different motivational factors, both
intrinsic and extrinsic, which ensure its long-term sus-
tainability. We implemented this process in a solu-
tion called Move2Play (Bielik, 2012). This paper de-
scribes the design of an important part of our solution
– an advanced pedometer.
Most current smartphones come with an ac-
401
Tomlein M., Bielik P., Krátky P., Mitrík Š., Barla M. and Bieliková M..
ADVANCED PEDOMETER FOR SMARTPHONE-BASED ACTIVITY TRACKING.
DOI: 10.5220/0003786704010404
In Proceedings of the International Conference on Health Informatics (HEALTHINF-2012), pages 401-404
ISBN: 978-989-8425-88-1
Copyright
c
2012 SCITEPRESS (Science and Technology Publications, Lda.)
celerometer, which is widely used by pedome-
ter applications for step counting. According
to (Marschollek et al., 2008), there exist only a
few well-known freely available accelerometer-based
step detection algorithms. Most of these approaches
rely on threshold-based detection and they generally
achieve sufficient precision.
Motivating people to be more physically active is
a non-trivial task. In our case, we use measured ac-
tivity as an input to motivational mechanisms such as
various kinds of rewards. Especially with children,
there is the risk that they will choose the easier path
to get to the rewards offered, which means cheating,
i.e., imitation of steps by shaking the phone in hand,
becomes a problem. Current pedometers, both dedi-
cated devices and phone applications, do not address
this problem as they rely on motivated users.
2 STEP DETECTION BASED ON
SMARTPHONE SENSORS
The accelerometer in a mobile phone sends events in
regular intervals with the three components of accel-
eration (x, y, z), which range between -1 and 1. Be-
cause the orientation of the phone inside the pocket
is not known in advance and may be different each
time, it is convenient to track the changes in the di-
rection of the vector of acceleration. For this purpose
we use the dot product of two consecutive accelera-
tions. Given normalised vectors, this is the cosine of
the angle between them let it be d (1). When the
phone stops abruptly and reverses direction, this an-
gle should equal 180
. In practice, this is rarely the
case, since the phone slips inside the pocket.
d
i
= (cosα)
i
=
x
i
x
i1
+ y
i
y
i1
+ z
i
z
i1
q
x
2
i
+ y
2
i
+ z
2
i
q
x
2
i1
+ y
2
i1
+ z
2
i1
(1)
During inactivity and between successive steps, d
equals 1. A negative peak (a decrease below a thresh-
old) is considered a step. This threshold is different
for the left and right leg, depending on which is closer
to the phone. To increase the precision of the mea-
surement and to filter out noise, we use a weighted
moving average of the last 10 values of d (2).
WMA
10
(d)
i
=
10d
i
+ 9d
i1
+ · ··+ d
i9
55
(2)
Figure 1 shows 20 walking and running steps. In
case of walking, it is straightforward to recognise
steps taken with the right foot from steps taken with
the left foot. In case of running, the difference is not
sufficiently recognisable.
WMA
10
(cos )
501 451 401 351 301 251 201 151 101 51 1
0.2
0.4
0.6
0.8
1
1.2
iteration
Figure 1: Walking (dashed line) and running (solid line)
20 steps (LG with Windows Phone 7).
Figure 2 shows two forms of cheating, slow and
fast shaking of the phone in hand, in contrast to walk-
ing. Similarly to previous figures, the lines denote
the weighted moving averages of d values as given
by (2). Greater regularity can be seen in both forms
of cheating than in walking or running, as well as
more frequent alternation of minima and maxima.
The weighted moving average often does not reach
the value of 1, as is the case in between walking and
running steps.
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1 51 101 151 201 251 301 351 401 451 501
iteration
Cheating (slow)
Cheating (fast)
Walking
WMA
10
(cos )
Figure 2: Cheating by slow and fast shaking of the phone in
contrast to walking (iPhone).
Our algorithm utilises threshold-based detection
of steps with different thresholds for left and right
legs. When the weighed moving average as given by
(2) decreases below these thresholds, the algorithm
increments the step count. The thresholds are de-
fined differently for various models of smartphones
and are based on experimental results. The values for
the particular devices are shown in table 1. In the next
stages of development, the Wolf method may be used
to eliminate the hardware-specific constants.
The algorithm takes several attributes of walking
into account:
the alternation of the left and right legs – via spe-
cific thresholds,
vibrations after the foot strikes the ground using:
minimum step duration,
minimum required deceleration computed for
a given value of d before acceleration can take
place.
HEALTHINF 2012 - International Conference on Health Informatics
402
The core logic of our algorithm without the above
considerations every hundredth of a second executes
the following steps:
1. Calculate the current value of d using (1) and av-
erage using (2).
2. If the average is lower than the threshold for the
right (left) leg: increase the step count.
Table 1: Thresholds for step detection.
iPhone HTC HD7
Samsung Omnia 7
LG Optimus 7
Right leg 0.96 0.97 0.9
Left leg 0.98 0.995 0.985
3 INTELLIGENT DETECTION OF
CHEATING
Figure 2 shows the striking difference between walk-
ing and cheating, which can be described as a differ-
ence of patterns. Searching for patterns in measured
data can be done in several different ways. One solu-
tion is the creation of a decision tree. However, un-
like a decision tree designed to simply count steps,
a tree capable of detecting those patterns of cheating
that make it different from walking or running, would
necessarily be considerably more complicated.
A common solution to problems which involve a
search for patterns in measured data is the training and
application of an artificial neural network. This is the
approach we explore and test the applicability of.
Given that the solution is to be deployed on a mo-
bile platform, where computational complexity is un-
desirable because of battery life constraints, we chose
a feedforward neural network with one hidden layer.
We opted for 50 inputneurons, which is the number of
weighted averages of d calculated each second. It is
also the approximate number of averages necessary to
distinguish between cheating and valid activity using
the unaided eye, the patterns being clearly visible. We
need only a single output neuron, whose output value
we defined as 0 for valid activity and 1 for cheating.
We prepared a total of 269 training sets of 50 inputs.
Following an analysis of the input sets, we chose the
incremental training method as the most suitable one.
We found that the sigmoid function is the most suit-
able for the hidden layer, whereas the linear symmet-
ric function was chosen for the output layer.
We implemented the neural network in our appli-
cation for the iOS platform, i.e., for the iPhone. We
used the FANN Library
1
, one of the best-known and
most widely deployed libraries for training and the
application of artificial neural networks.
In order to evaluate the neural network, we cre-
ated separate sets of measured data for walking, run-
ning and cheating. Figure 3 shows typical outputs
of the neural network for walking. When determin-
ing whether or not the user is currently cheating, a
weighted moving average of the last 4 outputs of the
neural network is used. As can be seen, the average
rarely exceeds the value of 0.5.
-1.5
-1
-0.5
0
0.5
1
1.5
1 21 41 61 81 101 121
iteration
Expected
output
Network
output
Moving
average
WMA
10
(cos )
Figure 3: Outputs of the neural network while walking.
Figure 4 shows typical outputs for running. As
can be seen, the neural network has a higher tendency
to classify running as cheating compared to walking.
In spite of that, the weighted moving average of the
last four outputs rarely exceeds the value of 0.7.
-1.5
-1
-0.5
0
0.5
1
1.5
1 21 41 61 81 101 121
iteration
WMA
10
(cos )
Expected
output
Network
output
Moving
average
Figure 4: Outputs of the neural network while running.
Figure 5 shows typical outputs of the neural net-
work for cheating, which significantly differ from the
previous values for walking and running.
-1.5
-1
-0.5
0
0.5
1
1.5
1 21 41 61 81 101 121 141 161 181
iteration
WMA
10
(cos )
Expected
output
Network
output
Moving
average
Figure 5: Outputs of the neural network while cheating.
The most frequent output of the neural network
when cheating is 1. The weighted moving average of
the last four outputs mostly stays above 0.5.
Table 2 shows a comparison of the desired and av-
erage output of the neural network. The results are
1
The Fast Artificial Neural Network Library is available
at: http://leenissen.dk/fann/wp/
ADVANCED PEDOMETER FOR SMARTPHONE-BASED ACTIVITY TRACKING
403
sufficiently accurate for walking. There is room for
improvement especially in the case of running.
Table 2: A comparison of the desired and average outputs
of the neural network.
Activity
Sample
size
Desired
output
Average
output
Standard
deviation
Walking 693 0 0.0612 0.3175
Running 151 0 0.2116 0.3654
Cheating 251 1 0.818 0.257
Solving the Problem with Punning. At first glance
it may seem problematic to distinguish running from
cheating, since the outputs of the neural network fre-
quently overlap. The solution involves the current
minimum of d from (1), which will be lower for run-
ning steps than for walking steps. This is also the case
with fast as opposed to slow shaking of the phone in
hand during cheating.
The problem can be solved using a moving thresh-
old between valid activity and cheating. As an exam-
ple, a threshold of 0.5 can be chosen for values typ-
ically measured when walking or cheating by slower
shaking. As more vigorous activity is detected, the
threshold may be raised to a higher value, such as 0.7.
This is possible as a consequence of the fact
that more intensive shaking sees the neural network
produce outputs of 1 with a higher probability than
slower, less intensive shaking. The moving threshold
can therefore be used without fear of misinterpreta-
tion of cheating for running.
It is important to realise, though, that in the cur-
rent state the neural network fulfils the purpose it was
designed for. The purpose of the implementation of
the neural network was not to detect cheating with an
accuracy of a hundred per cent. First and foremost,
the purpose was to discourage cheating by making it
sufficiently difficult and tedious, so that it is more re-
warding to take a walk and receive points for real ac-
tivity. The current implementation of our neural net-
work meets this goal.
4 CONCLUSIONS
In this paper, we describe the design and implementa-
tion of an advanced smartphone accelerometer-based
pedometer, which uses an innovative approach to the
detection of cheating. This is important for applica-
tions where activity is a base for rewarding and there
is no natural way of ensuring motivation for being ac-
tive (typically for children).
We have based our solution on the recognition of
patterns characteristic to cheating. To that end, we
have successfully trained and used a feedforward ar-
tificial neural network. The results we have obtained
in evaluation confirm the applicability of an artificial
neural network for the detection of cheating. We have
been able to detect cheating with a sufficient precision
and have thus met our goal of discouraging potential
users from such an activity.
We have developed our advanced pedometer as
part of a larger solution. Specifically, the pedometer is
part of the activity tracking module of our Move2Play
system. The activity tracking module uses GSM sig-
nal strength fluctuation analysis to determine whether
an activity is taking place or not and thus to save bat-
tery life (Bielik, 2011). Activity tracking together
with personalised activity recommendation and eval-
uation are the essential parts of our solution. In order
to evaluate our solution, we realised its specialisation
called Move2PlayKids, which depends on the intelli-
gent pedometer module as children who need to exer-
cise more tend to cheat.
ACKNOWLEDGEMENTS
This work was partially supported by the grants
VG1/0675/11, KEGA 028-025STU-4/2010 and it is
the partial result of the OP R&D for the project ITMS
26240220039, co-funded by the ERDF.
REFERENCES
Bielik, P., e. a. (2012). Move2play: An innovative approach
to encouraging people to be more physically active.
2
nd
ACM SIGHIT Int. Health Informatics Symposium.
Accepted.
Bielik, P. (2011). Personalized training plan recommenda-
tion and activity tracking for a healthier lifestyle. Bul-
letin of the ACM Slovakia, 3(4).
Fujiki, Y. e. a. (2008). Neat-o-games: blending physical ac-
tivity and fun in the daily routine. Comput. Entertain.,
6:21:1–21:22.
Iwane, M., e. a. (2000). Walking 10,000 steps/day or more
reduces blood pressure and sympathetic nerve activ-
ity in mild essential hypertension. Hypertens Res,
23(6):573–580.
Lee, I. and Buchner, D. M. (2008). The importance of walk-
ing to public health. Medicine & Science in Sports &
Exercise, 40(7).
Marschollek, M. et al. (2008). A performance comparison
of accelerometry-based step detection algorithms on a
large, non-laboratory sample of healthy and mobility-
impaired persons. In Engineering in Medicine and Bi-
ology Society, EMBS 2008, pages 1319 –1322. IEEE.
HEALTHINF 2012 - International Conference on Health Informatics
404