Using Smartphone Bases Biodevices for Analyzing Physiological,
Psychological and Behavioral User’s Habits

1Federico Guede Fernández1, Marc Pous Solà1, Miguel Ángel García González1,
Lluís Capdevila Ortís2, Juan Ramos Castro1 and Mireya Fernández Chimeno1

Universitat Politècnica de Catalunya, Campus Nord C4 Jordi Girona 1-3, Barcelona, 08034, Spain
Universitat Autònoma de Barcelona, Campus de la UAB Edifici B Bellaterra, Cerdanyola del Vallès, 08193, Spainfederico.guede@upc.edu

2

Keywords:

Android, Real-time, Biomedical Monitoring, Biosensor.

Abstract:

As a consequence of increasing life expectancy, the promotion of lifestyles that allow aging wellbeing
guarantees has acquired great importance in the developed countries. However, the adherence to healthy
behaviors in young and adult people remains as a big problem in the community health field. The
development of markers of adherence to healthy lifestyles and the evaluation its effectiveness is a goal ofmany research groups. This paper presents a system for analyzing physiological, psychological andbehavioural user’s habits using a smartphone and externals biodevices. We use an Android smartphone withan internal tri-axial accelerometer and GPS to monitor physical activity. The smartphone is connected via
Bluetooth to a respiratory sensor for breath monitoring. In addition, Android application contains
psychological questionnaires to analyze user’s mood state and at the same, social interaction is analyzed
tracking phone usage and user’s social network. Finally, the collected information is sent to a remote server
for a long-term processing.

1

INTRODUCTION

As a consequence of increasing life expectancy, thepromotion of lifestyles that allow aging wellbeing
guarantees has acquired great importance in thedeveloped countries. However, the adherence tohealthy behaviors in young and adult people remains
as a big problem in the community health field. The
development of markers of adherence to healthy
lifestyles and the evaluation its effectiveness is agoal of many research groups.
Healthy lifestyles includes among others, regularexercising and daily physical activity, eating andsleeping habits, and stress control. In order tomeasure the adherence to these healthy lifestyles, isnecessary to have non-intrusive measurement
devices, almost transparent for the users, andmeasurement protocols suitable for every particularapplication.
The application fields of healthy lifestyleadherence measurements range from monitoring oldpeople habits to the sportsmen and sportswomenquality of training measurement. They also include
driver somnolence control, quality of life of workers
in shift, or simply individual self-help applications.

Many handheld mobile devices have high speed
data transmission capabilities (e.g., 3G, WiFi) andembedded microprocessors with the capability tocommunicate, using wireless connection (e.g.,
Bluetooth, NFC), with external sensors. Moreover
mobile devices have internal sensors (e.g.,
accelerometer, gyroscope), supplied by powerfulprocessors and large storage capacities. So,
smartphones are strong candidates to be used as
biodevices for monitoring parameters related withhealthy lifestyle behaviors. From the monitoring
point of view, the main advantage of mobile devices,compared to laptops or desktop computers, is thatthese devices are always handled by the user
collecting data during the whole day.
The smartphone market has grown, from being aniche market product segment, becoming a truly
mass-market. In 2011, total annual global shipmentsof smartphones exceeded those of client PCs(including pads) for the first time (Canalys, 2012).
In fact, in Europe the smartphone penetration havegrown just 47.6% (comScore, 2012). Regarding
operative systems in smartphones, Gartner researchshows Android’s handset annual sales reached 82,1
million units in first quarter of 2012, in comparison

243BIODEVICES2013-InternationalConferenceonBiomedicalElectronicsandDevices

with last year sales represents a growth of 123%.
This means that Android accounted more than halfof all smartphone sales (56.1%) (Gartner, 2012).
In the area of medicine preventive there somestudies about the relation among obesity, nutritionand physical activity (Hensrud, 2010). Anotherstudy concludes that sleep loss is associated withhaving an unhealthy lifestyle.(Ohida et al., 2001).
In several mobile health-care applications,mobile devices are used as gateway for receiving
bio-information from medical portable devices andmobile sensors. There, mobile device is responsibleof collecting data from sensors, pre-processing theraw signals and transferring the gathered data toremote server (Yang & Gerla, 2011).
For daily mood assessment, there is an android
application that combines accelerometer, soundsensor, light sensor, GPS, and SMS information(Yuanchao et al., 2012). In some applications,mobile device also processes the gathering data andonly when mobile detects an emergency, it sends analert to a server or to social contacts (Sposaro &Tyson, 2009).
Internal sensors of smartphone are used tomonitor heart rate variability using internal
accelerometers and recording the seismocardiogramsignal (Ramos-Castro et al., 2012).
This work exploits the increasing capabilities ofsmartphones and its success between the people topromote healthy life habits in people. The purpose ofthis work is to develop an Android application to
analyze physiological, psychological and behavioral
personal habits. First we have to collect data to get
information about user’s life habits. Thenapplication shows some data to user and some
information will be sent to a server in order to athird-party can process this information and monitor
the level of healthy habits.

2
2.1

MATERIALS AND METHODSAndroid OS

Android is an open-source software stack created formobile phones and other devices produced by
Google. The Android SDK provides the API
libraries and developer tools required to build, test,
and debug applications. Android applications are
written in Java programming language and they run
on the Dalvik virtual machine optimized for mobile
devices. Android gives an open marketplace for
distributing it to Android users called Google Play.
Application components are the essential building244

blocks of an Android application.
There are four different types of application
components: Activities, Services, Broadcast
receivers and Content providers. Each type serves a
distinct purpose and has a distinct lifecycle thatdefines how the component is created and destroyed.
Our application uses activities, for user-interaction,
and a broadcast receiver that responds to systemwide broadcast announcements, like Bluetooth
device have been found. Activities start on the main
application thread, therefore blocking I/O operations
or time-consuming processing have to be executedin our own threads to avoid blocking the activity.
The layout is the architecture to design the userinterface (UI) in an activity. Layouts may bedeclared using XML files or using Java code in
runtime. The main advantage of using XML files todesign the UI is that enables to separate thepresentation tier of the Activity logic tier that
controls its behavior (Google Inc., 2012a). This
improves the maintenance for later works.
Therefore, our application uses XML files.
We have selected Android OS to develop ourapplication for the following reasons: Android is an
open-source software and development tools are freeof charge; it also allows to interact easily withinternal sensors such GPS to track physical activity,
accelerometer to activity monitoring; it provides
simplified and well-documented Bluetooth, WiFi
APIs to communicate with external sensors.
Moreover there are several APIs to develop quickly
powerful applications.

2.2

Internal Sensor

Nowadays, the smartphones have integrated many
internal sensors, such as accelerometer, magnetic
field sensor, light sensor, GPS and proximity sensor.
The main advantage of these sensors is that they
don’t require an external communication channel,
such as Bluetooth of WiFi improves the battery
consumption and the facility to access the data
provided by the sensor.
For example, the accelerometer has been
employed in several applications to detect human
movement detection, to characterize physicalactivity (Shin et al., 2010) recognizing if the user iswalking, going upstairs or running (Brezmes et al.,2009). In our application we have developed filters
to reduce noise; Butterworth second order high-passfilter is implemented. The accelerometer gives threeaxis forces applied on the smartphone, in theimplemented application the contribution of earth
gravity have been removed.

UsingSmartphoneBasesBiodevicesforAnalyzingPhysiological,PsychologicalandBehavioralUser'sHabits

Another sensor available in most of the mobile
phone is the light sensor. This can be used to detectuser light exposure. Nevertheless this sensor is notuseful to measure the level of sun exposure because
if the mobile phone is in the pocket or bag, do notprovide information of user exposition. For thisreason this sensor isn’t useful for this propose.
So, in function of the application, several
external sensors must be connected to the device, but
this is not a problem with the level of connectivity ofthese devices

2.3

Breathing Monitoring

Breathing is a good indicator of somnolence(Rodríguez-Ibañez et al., 2011). In order to record
the respiration signal we use an external monitoring
system (Bioplux Respiband sensor). It consists in a
respiratory sensor based on an inductive band tomeasure thoracic effort. This sensor has theembedded electronic to calculate breath signal.
Moreover, it has a Bluetooth communication modulethat makes possible to connect it to smartphone.
Then, mobile application may monitor the breath
signal in real time. Mobile device parses data
received and displays breath signal to user.
Bluetooth communication uses Serial Port Profile(SPP) that defines how to set up virtual serial ports
and connect two Bluetooth enabled devices. Once
Respiband has been connected to smartphone, it
starts to send data continuously to a frequency
configured between 36 Hz and 1000 Hz. In ourapplication the sampled frequency selected is 40 Hz.
This frequency is enough to characterize properly
the breath rate signal and reduce power consumption
due to Bluetooth transmission.
Android application has an activity to manage
Bluetooth connection. This activity lists paired
devices and allows to scan new devices, to pair andto connect. Once paired an own thread is started toestablish RFCOMM channel and to maintain thecommunication. This thread is continuously reading
new incoming data in real-time. When an incoming
packet is detected, the application parses it to extract
one byte of CRC and three bytes of value data.
Firstly CRC is checked to verify data integrity andsecondly, the application sends measured breathvalue to UI to plot it. The data is visualized using an
open source charting library called AChartEngine(4ViewSoft, 2012). If the Bluetooth connection is
lost, the application detects it and tries to reconnect
continuously since user exit

2.4

User Location Monitoring

Android application uses location provider to track
exercise, using speed data, distance traveled and thealtimeter.
Android OS provide different methods todetermine the device’s current location, they arecalled location providers, and each has its different
characteristics. Each location provider offers
different capabilities, including differences in power
consumption, accuracy, and the ability to determine
altitude or speed or heading information. The threedifferent locations providers are GPS_Provider,
Network_Provider, Passive_Provider. Therefore
each one is suitable to work over different
conditions. Using the Android Location Manager
API we can find available location providers, obtain
device’s current location, track movement, set
proximity alerts for detecting movement into and outof a specified area.
GPS_provider determines location using
satellites. Depending on conditions, this provider
may take a while to return a location fix, this time iscalled Time to First Fix (TTFF.) This time can be
cut down substantially by employing Assisted GPS(A-GPS). A-GPS uses the mobile network totransmit the precise GPS satellite orbit and clock
information to a mobile device. Then the device willknow the approximate location of the GPS satellites
in its line of sight. Reducing the number of
frequency bins which must be searched to acquire
the signal reduces the TTFF (Jarvinen et al., 2002).
The main limitation of GPS_provider is that it
only can work in outdoor environment, because inindoors GPS signals don't reach. Moreover thisprovider consumes more battery than the others.
Furthermore, GPS_provider provides the mostaccurate location data and it is unique that has ability
to determine altitude information. Therefore, weneed use GPS_provider to track people exercise
properly.
Our Android application has a dedicated activity
that employs GPS_provider to obtain the user’s
location. Using information of location obtained, in
real-time, our application calculates main parametersconcerning a healthy behavior such as total traveled
distance, average speed and time spent. Apart fromdisplaying the parameters explained before theapplication shows the route followed by the user
using maps. There are several libraries that provide
maps, we used Google Maps API (Google Inc.,
2012b) and an open alternative called OSMDroid(Gramlich, 2012) to display OpenStreetMap (OSM).
The usage of both APIs is quite similar for245

BIODEVICES2013-InternationalConferenceonBiomedicalElectronicsandDevices

programmer. Android application uses overlays todraw followed route with points and lines. The main
disadvantage of Google Maps that it has a prize
policy of use otherwise OSM is totally free of use.
We have considered that more times while user
is doing exercise he is looking away from the screen.
Then for a better human-interaction Android
provides text-to-speech, application speaks to user tonotify each certain time period distance traveled andtime spent. Text to speech API provided for Android
it is used to implement this.

2.5

Social Interaction Tracker

Social interaction is important to human health. In
fact, individuals with adequate social relationships
have a 50% greater likelihood of survival comparedto those with poor or insufficient social
relationships. The influence of quality and quantityof individual’s social relationships on the risk ofdeath are comparable with well-established risk
factors for mortality such as smoking and alcohol
consumption and they exceed other many risk
factors such as physical inactivity and obesity.
(Holt-Lunstad et al., 2010).
On the other hand, one of the most importantconcerns associated with mobile phone use is that it
may become uncontrolled or excessive, which has
an impact upon daily living. Sleep disturbance isamong the most common negative outcomes
resulting from overuse of the mobile phone (Thomée
et al., 2011). Furthermore, smartphones allows
people to engage in a wide range of online
activities—such as Internet surfing, managing email,playing video games or involvement in social
networks (e.g., Facebook, Twitter). Therefore,
mobile phone addiction should be conceptualized
within a broader spectrum of “cyber addictions” thatcovers a wide range of behaviors relying on online
activities and/or activities involving communication
among individuals through technological devices.
Social network addictions is one of the mostfrequent “cyber additions” (Billieux, 2012).
Android application can collect some
information about social interaction. On the one
hand, in order to track incoming and outgoing phone
calls and SMS, the application registers
BroadcastReceiver to track the phone usage. This
information is useful to evaluate social relationship.
Nowadays new social networks based on Internet arevery used to social interaction; Facebook andTwitter are currently the most popular ones. Our
application uses Facebook (Facebook, 2012) andTwitter API (Yamamoto, 2011) for Android parsing

246

JSON data received to collect information aboutuser’s social network like number of friends,
frequency update status, messages.

2.6

Psychological State Evaluation

Professionals and researchers are working in therelationships existing between physical activity andmood state. The most popular instrument for moodstate evaluation is POMS (McNair, 1984).
Questionnaire is a subjective method to evaluate
mood sate. Android application implements a test of
POMS with fifteen questions to evaluate user´s stateof mood obtaining the components of stress,
depression, hostility, vigor, and fatigue (Andrade etal., 2010). The user has to indicate how the user
feels in 0-10 scale where 0 means not all and 10
very. There are three questions for mentioned
component to avoid random answers. In the
beginning and at the end of respiratory acquisition
the application launches the questionnaire to be
filled by the user. The results of the test answered by
the user provide useful information to study the
relationship between psychological, physiologicaland behavioral habits.

3

RESULTS

Android application will forward physiological,
psychological and behavioral data obtained to aremote server for a long term processing via
Android TCP socket when application finishes. It
uses Wi-Fi connection to reduce connection cost andto increase rate transmission.
The breath signal acquired using Respiband
external sensor is monitored in real-time by theapplication developed. In Figure 1, a screen captured
shows a XY graph displaying in y-axis the value of
amplitude and x-axis the samples. This graph isrefreshed when a packet of data is received. Usually
there is a packet for each sample of Respiband; its
sample rate is 40 Hz. The designed layout included agraph to plot respiratory signal on time domain in
real-time. To plot the data the open source charting
library called AChartEngine is used.
For user’s location monitoring, applicationshows the route tracked displaying it over a map. In
our application we have used two technologies thatprovide maps: GoogleMaps API (Figure 2a) and
OpenStreetMap API (Figure 2b). In addition, theapplication calculates and displays information
about distance traveled, average speed and timespent. In order to improve the accuracy of thisUsingSmartphoneBasesBiodevicesforAnalyzingPhysiological,PsychologicalandBehavioralUser'sHabits

information, user can pause and resume the tracking,this is essential to avoid wrong results.

To evaluate the mood state in the application atest with fifteen questions is launched in the
beginning and at the end (Figure 3a). The fivecomponents of the mood state mentioned in section
2.6 have calculated each time when the usercompletes the questionnaire (Figure 3b).

Figure 1: Mobile application screenshot: graphical breath
signal represented in real-time.

(a)

(b)

Figure 3: Screenshots: a question of the test to evaluate themood state (a). Graph that represents the five components
resulted of a completed test (b).

The results obtained are stored in a databaseproving us information of the psychological state
when the user is monitored.

4

(a)

(b)

Figure 2: Screenshots: route tracked using Google Maps(a). Route tracked using OpenStreetMap (b).

The application has provided us useful types ofdata to analyze social activity. In the application thenumber and time when an SMS is sent or received
has been monitored. It also has allowed tracking theduration, the number and the time of outgoing andincoming phone calls. Concerning the social
networks, the application has been capable toanalyze the activity on Facebook and Twitter. The
application has obtained the number of friends thatis associated with the contact network size. In
addition to measure the social activity, the wall
panel, messages and notifications have beenchecked. On Twitter social network published tweets
by the user, mentions, direct messages, the numberof followers and “following” have been quantified.

CONCLUSIONS

A smartphone based on biodevice for healthy
lifestyle adherence evaluation has been developed.
The Android application developed collects theinformation about different variables (activity,
respiration, social activity, etc.) and processes themto measure the adherence to healthy lifestyles. The
data are sent to a remote server for further
processing to get results to improve user lifestyle.

ACKNOWLEDGEMENTS
This work has been partially funded by the Spanish
MINISTERIO DE CIENCIA E INNOVACIÓN.
Proyecto IPT-2011-0833-900000. Healthy Life styleand Drowsiness Prevention-HEALING DROP.

REFERENCES
4ViewSoft. (2012). AChartEngine: Charting Library for247

BIODEVICES2013-InternationalConferenceonBiomedicalElectronicsandDevices

Android (Version 1.0.0) [Software]. Available fromhttp://code.google.com/p/achartengine/downloads/list
Andrade, E., Arce, C., Torrado, J., Garrido, J., De
Francisco, C., and Arce, I., (2010). Factor structure
and invariance of the POMS mood state questionnairein spanish. Spanish Journal of Psychology, 13(1), 444452.
Billieux, J., (2012). Problematic use of the mobile phone:
A literature review and a pathways model. Current
Psychiatry
Reviews,
8(4),299-307.
doi:
10.2174/157340012803520522.
Brezmes, T., Gorricho, J. L. and Cotrina J., (2009).
Activity recognition from accelerometer data on amobile phone. In Proceedings of the IWANN ’09, 796–
799.
Canalys, (2012). Smart phones overtake client PCs in2011. Retrieved February 3, 2012, fromhttp://www.canalys.com/newsroom/smart-phonesovertake-client-pcs-2011.
comScore, (2012). Number of european smartphone users
accessing news surges 74 percent over past year.
Retrieved
March
22,
2012,
from
http://www.comscore.com/Insights/Press_Releases/20
12/3/Number_of_European_Smartphone_Users_Acces
sing_News_Surges_74_Percent_Over_Past_Year.
Facebook, (2012). Android Tutorial. Retreived May 18,
2012,
from
https://developers.facebook.com/
docs/mobile/android/build/Gartner. (2012). Gartner says worldwide sales of mobile
phones declined 2 percent in first quarter of 2012;previous year-over-year decline occurred in second
quarter of 2009. Retrieved May 16, 2012, fromhttp://www.gartner.com/it/page.jsp?id=2017015.
Google Inc. (2012a). Android developer guide: Layouts.
Retrieved
May
11,
2012,
from
http://developer.android.com/guide/topics/ui/declaring-layout.html.
Google Inc. (2012b). Google Maps Android API External Library. Retreived June 1, 2012, fromhttps://developers.google.com/maps/documentation/an
droid/index
Gramlich, N. (2012). OSMDroid: OpenStreetMap-Tools
for Android (Version 3.0.8) [Software]. Avaliablefrom http://code.google.com/p/osmdroid/
Holt-Lunstad, J., Smith, T. B., & Layton, J. B., (2010).
Social relationships and mortality risk: A metaanalytic review. PLoS Medicine, 7(7) doi:
10.1371/journal.pmed.1000316
Jarvinen, J., DeSalas, J. & LaMance, J., (2002). Assisted
GPS: A Low-Infrastructure Approach. Retrieved
March 1, 2002, from http://www.gpsworld.com/wpcontent/uploads/2012/09/gpsworld_Innovation_0302.p
df
McNair, D., (1984). Citation classic - manual for the
profile of mood states. Current Contents/social &Behavioral Sciences, (27), 20-20.
Ohida, T., Kamal, A. M. M., Uchiyama, M., Kim, K.,
Takemura, S., Sone, T and Ishii, T., (2001) The
influence of lifestyle and health status factors on sleep

248

loss among the Japanese general population. SLEEP,
24(3), 333–338.
Ramos-Castro, J., Moreno, J., Miranda-Vidal, H., GarcíaGonzález, M .A., Fernández-Chimeno, M., Rodas, G.
& Capdevila, Ll., (2012). Heart Rate Variability
analysis using a Seismocardiogram signal. In
Engineering in Medicine and Biology Society, EMBC
2012. Accepted.
Rodriguez-Ibanez, N., Garcia-Gonzalez, M. A.,
Fernandez-Chimeno, M., & Ramos-Castro, J., (2011).
Drowsiness detection by thoracic effort signal analysis
in real driving environments. 33rd Annual
International Conference of the IEEE Engineering in
Medicine and Biology Society, EMBS 2011, Boston,MA. 6055-6058. doi: 10.1109/IEMBS.2011.6091496
Shin, J., Shin, D., Shin, D., Her, S., Kim, S., & Lee, M.,(2010). Human movement detection algorithm using 3axis accelerometer sensor based on low-power
management scheme for mobile health care system(Hualien ed.) doi: 10.1007/978-3-642-13067-0_12
Sposaro, F., & Tyson, G., (2009). iFall: An android
application for fall monitoring and response. 31st
Annual International Conference of the IEEE
Engineering in Medicine and Biology Society:Engineering the Future of Biomedicine, EMBC 2009,
Minneapolis,
MN.
6119-6122.
doi:
10.1109/IEMBS.2009.5334912
Thomée, S., Härenstam, A. & Hagberg, M., (2011).
Mobile phone use and stress, sleep disturbances, andsymptoms of depression among young adults - A
prospective cohort study. BMC Public Health, 11 doi:
10.1186/1471-2458-11-66
Yamamoto, Y., (2011). Twitter4j: an open-sourced Javalibrary for the Twitter API. (Version 2.0.4) Avaliablefrom http://twitter4j.org/en/index.html
Yang, S. & Gerla, M., (2011). Personal gateway in mobile
health monitoring. 2011 9th IEEE International
Conferenceon
Pervasive
ComputingandCommunications Workshops, PERCOM Workshops
2011,
Seattle,WA.
636-641.
doi:
10.1109/PERCOMW.2011.5766966
Yuanchao, M., Bin, X. Yin, B., Guodong, S. and Run,
Zhu, (2012). Daily Mood Assessment Based on
Mobile Phone Sensing. In Wearable and Implantable
Body Sensor Networks, 2012 Ninth International
Conference on, 142-147.