International Journal of Scientific & Engineering Research, Volume 4, Issue 8, August-2013 1295
ISSN 2229-5518
Smitha K.S
Department of Electronics and Communication, Kerala University
E-mail: smithec_2006@yahoo.co.in
Nowadays mobile phones become part of human life and it will change life style patterns. Mobile phone technology is an active area of research and now at present it includes more sensors for enabling advanced applications. Latest generations of mobile phones incorporates GPS systems, vision cameras, micro phones, accelerometers, temperature sensors,
etc. The availability of these sensors in mobile
The activity recognition module includes four main steps. Create an application on the android phone, datacollection,segmentation,featureextraction,classifi cation. Block diagram of activity recognition module is shown in figure 2. 1.
phones creates new opportunities for data mining applications. The built in sensors are very helpful for health care applications.
Key words: Activity recognition, android phone, Accelerometer, FFT analysis, server connection
Activity application development
Data collection
Feature extraction
Energy Expenditure calculation
Classification
In recent years smart phones becomes the new generation of cell phones. It includes number of sensors such as cameras, microphones, light sensors, GPS, acceleration sensors, orientation sensors, etc.
This work is a sensor based application, which is implemented on an android phone. Android is an open source platform and it is easy to implement. Also the operating system of Android is dominant in the smart phone market .Among these sensors ,in this work accelerometer sensor is listened for identifying and tracking the physical activities of the user such as walking, running, stand idle. This process is known as Activity Recognition.
Activity recognition has important role in health care systems. Home monitoring of activities can improve medical care and also reduces the cost, since it uses a smart phone having android platform. For activity recognition the user can place the smart phone on his shirt’s pocket or trousers’ pocket. Also it is possible to calculate the energy spent for each
activity.
Figure 2.1: block diagram of activity classification module
Android is an open source mobile operating system with Linux kernel. The Android SDK is installed in to Eclipse. Android treats both native and third party applications as the same. So users can build and develop their own applications. The android software development kit includes a set of development tool such as a debugger, libraries, handset emulator, documentation, sample code and tutorials.
Android SDK has a java frame work and a powerful API for the hardware embedded on smartphones. Figure 2.2 shows the different layers of android operating system. The android smart phone consists of number of sensors. In order to access the accelerometer sensor accelerometer listener.java class is used.
IJSER © 2013 http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 8, August-2013 1296
ISSN 2229-5518
listener;
running = false;
}
!= null) { sensorManager.unregisterListener(sensorEventListen er);
}
} catch (Exception e) {
}
}
The accelerometer listener.java and accelerometer manager.java together forms a bundle and make it as
.apk file. This .apk file is installed on the android phone.
Sensor manager class is provided to access the sensors embedded in to a smart phone. Two important functions related to this class is
• Public Sensor get Default Sensor (int type) – Returns a sensor class object such as SENSOR. TYPE_ ACCELEROMETER.
• public boolean registerListener (SensorEventListener listener, Sensor sensor, int rate) –during the data collection , it registered a sensor object to the accelerometer listener object with a sample rate .
Figure 2.1: Android Operating system layers
The raw data for walking,running and stand idle are collected seperately by activating the application on the phone and place it on shirt’s pocket or on trouser’s pocket.Raw data is collected for every 20 seconds interval.The accelerometer values are the change in position with respect to time.That is it is not exact acceleration values.So these values are converted to actual acceleration
IJSER © 2013 http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 8, August-2013 1297
ISSN 2229-5518
values by considering the gravity of earth.Figure 2.3 shows the application running on the phone.
The accelerometer in the android phone returnes three acceleration values.that is acceleration in X,Y,Z directions.X axis gives sideways accelerations,Y axis gives forward or backward acceleration and z axis gives upward or downward accelerations.
Figure 2.3: screenshot of Application running on the phone
The graph in the screen shows the peak variation with respect to time for each activity.From observations,it should be under stood that for standing the peak should be low,relatively at zero level,for walking it should be at medium level and for running the peak should be high.
A buffer register is initialized for saving the collected data.First the buffer will be initialised with zero values for x axis,Y axis and z axis values.The data is stored as array.For creating the data set it can be possible to extract both time domain features and frequency domain features.The time domain features include mean ,standard deviation,maximum value and minimum value.Frequency domain features can be computed from the FFT analysis of the data. In
this work fequency domain features are computed.The java class used for FFT computation is
public final class Fast Fourier Transform {
It computes the discrete Fourier transform in
3-D with the specified arrays and direction using the fast Fourier transform (FFT) algorithm. Two double type arrays representing the real part and imaginary part of data in the spatial domain are required for the computation .Dimension of the arrays must be the same and be an integer power of 2,otherwise, an error will be catched and an exception will be thrown without any computation. If the boolean value of the direction is true, the forward FFT will be performed, or the inverse FFT if false. The computation results are returned in the corresponding real and imaginary input arrays. Therefore, the original data in the two arrays will be lost after the computation.
After computing the FFT of each axis separately, store the frequency points and corresponding amplitudes for each axis in different arrays.
For classifying activities like standing, walking and running, continuously observe each activity so many times and set a threshold frequency value corresponding to maximum amplitude level for activities. In training stage, the frequency point corresponding to maximum amplitude is compared with the threshold value and fixes the activity. During testing stage, the activity will be classified accurately.
After each activity is classified, it should be possible to calculate the energy spent for that particular activity. The energy expenditure is calculated with the help of Metabolic Equivalent (METS) and the speed.
Energy Expenditure in Kcal is
Kcal = 1.05 * mets * weight * time_win / (60 * 60) Where
METS = 2, for standing
= (0.0272 * (maxPosOfZ * 0.5 * 60)) + 1.2, For walking
= 0.093 * (maxPosOfZ * 0.5 * 60) - 4.7,
For running
IJSER © 2013 http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 8, August-2013 1298
ISSN 2229-5518
During data collection stage, collected data can either save as a .csv file or it will be directly send to the server through Wi-fi connection. For that enable the Wi-fi connection on both mobile and the PC. Set the same IP address for both mobile and PC. Set up a port address on PC for collecting data directly from the mobile. The java class for server connection is
Context con;
calculated using equation (2).Figure 4.1 shows the screen shot of phone display that shows the activity performed .
(a)
Socket(ipaddredss, 55); BufferedReader(new
s = new
in = new
InputStreamReader(s.getInputStream()));
out=new
PrintWriter(s.getOutputStream(), true);
Figure 3 shows the screen shot for the server connection.
In this work, an android application has been developed for activity classification. This process was performed using motion sensors embedded in the phone. Data set for the work were gathered at a frequency of 50Hz. It collected three types of activity patterns. The three activities are stand idle, walking
and running. Energy spent for each activity were also
(b)
(c)
IJSER © 2013 http://www.ijser.org
International Journal of Scientific & Engineering Research, Volume 4, Issue 8, August-2013 1299
ISSN 2229-5518
Figure 4.1: screen shot of phone display that shows the activity performed (a) stand idle (b) Walking (c) Running
Nowadays, mobile phone technology is an active area of research. Today’s mobile phones, called smartphones are equipped with number of sensors. The built-in accelerometers are very common in all smart phones and it has better computational power. Also people don’t consider mobile phones as a burden and carrying them all day long in pockets .These characteristics make these devices suitable for classifying physical activities for longer durations. In this work an android application is developed for recognizing different human activities.
As a future work, this application can be extended to recognize more activities like jumping, jogging, biking, etc. Also to develop a user- server interface that asks users age, height and weight. Knowing this information about a person it is possible to calculate the average amount of calories he/she spent for a particular activity.
[1] “Recognizing Human Activities User independently on Smartphones Based on AccelerometerData “Pekka Siirtola and Juha Röning, Department of Computer Science and Engineering P.O. BOX 4500, FI-90014 University of Oulu, Finland. Special Issue on Distributed Computing and Artificial Intelligence.
[2] “Activity Recognition using Cell Phone Accelerometers”Jennifer R. Kwapisz, Gary M. Weiss, Samuel A. Moore,Department of Computer and Information Science,Fordham University441
East Fordham Road Bronx, NY 10458.
[3]” Smart Phone-based Human Activity Classification and Energy Expenditure Generation in Building Environments”,Jin-Ho Cho1, Jeong Tai Kim2, Tae-Seong Kim1*, SHB2012 - 7th
International Symposium on Sustainable Healthy
Buildings, Seoul, Korea,18 May 2012.
[4] “Android Sensors”,byStefan Varga, Michal,Kostic touchqode.com. jsug.at,University of Technology Vienna,October 25th 2010
IJSER © 2013 http://www.ijser.org