Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored...

50
Mobile Sensing Huber Flores [email protected] Tartu, Estonia, 2014 http://math.ut.ee/~huber/

Transcript of Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored...

Page 1: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile Sensing

Huber Flores [email protected]

Tartu, Estonia, 2014

http://math.ut.ee/~huber/

Page 2: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Outline

• What is mobile sensing?

• Mobile sensing technologies

• Development of smartphone sensing apps with Android

– Gesture and activity detection

• Next generation mobile sensing

– Event-based sensing through notifications

Huber Flores 2

Page 3: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

MOBILE SENSING

Huber Flores 3

Page 4: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

What is mobile sensing?

• Individual

– Gesture

– Activity

– Location

– Proximity

• Group

– Smart mobs

Huber Flores 4

Source: http://clout-project.eu/

Page 5: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

MOBILE SENSING TECHNOLOGIES

Huber Flores 5

Page 6: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Integrated sensors

Huber Flores 6

Compass

Gesture

Orientation Positioning

Acceleration

Page 7: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Integrated sensors: Accelerometer

Huber Flores 7

Source: Flores, H, et al. "Zompopo: mobile calendar prediction based on human activities recognition using the accelerometer and cloud services." IEEE NGMAST 2011.

Page 8: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Integrated sensors: Magnetic field

Huber Flores 8

Page 9: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Integrated sensors: Gyroscope

Huber Flores 9

Page 10: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Integrated sensors: Barometer

Huber Flores 10

Source: Muralidharan, Kartik, et al. "Barometric phone sensors: more hype than hope!." Proceedings of the 15th Workshop on Mobile Computing Systems and Applications. ACM, 2014.

Page 11: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Non-integrated sensors

Huber Flores 11

Page 12: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Non-integrated sensors

Huber Flores 12

Microcontroller: Arduino Mega ADK

Page 13: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Non-integrated sensors

Huber Flores 13

Wireless shield

Sensor shield

Page 14: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Non-integrated sensors

Huber Flores 14

Wireless module Usb to serial converter

Page 15: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Non-integrated sensors

Huber Flores 15

Page 16: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

DEVELOPMENT OF SMARTPHONE SENSING APPS

Huber Flores 16

Page 17: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile Sensing: Android

Huber Flores 17

Page 18: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

• Gesture API

Huber Flores 18

Page 19: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

• Start your Android emulator with Google APIs

• Download source code – https://github.com/huberflores/AndroidSensorSimula

tor.git

Huber Flores 19

Page 20: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

DEMO

Huber Flores 20

Page 21: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Exercise

• Try gesture API

Huber Flores 21

Page 22: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

What about other sensors?

Huber Flores 22

Page 23: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

• Physical device

• Android emulator?

• Sensor simulator?

Huber Flores 23

Page 24: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

• Sensor simulator tool – Download and extract

• http://code.google.com/p/openintents/wiki/SensorSimulator (SensorSimulator 2.0-rc1.zip)

• Install app in Android emulator – $ adb # command in /android-sdk/platform-tools/

– $ adb install SensorSimulatorSettings-2.0-rc1.apk

• Execute sensor simulator – $ java –jar sensorsimulator-2.0-rc1.jar

– Set IP address in Android emulator

– Alternatively, this repository contains everything you need (https://github.com/huberflores/AndroidSensorSimulator.git)

Huber Flores 24

Page 25: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

Huber Flores 25

Page 26: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

Huber Flores 26

Page 27: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android

Huber Flores 27

Page 28: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

DEMO

Huber Flores 28

Page 29: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Exercise

• Try and install sensor simulator

• Run accelerometer app

Huber Flores 29

Page 30: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android + Arduino

Huber Flores 30

Page 31: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android + Arduino

• Hardware requirements

– Accessory mode

• Usb cable

– Communication modules

• Wifi

• Bluetooth

Huber Flores 31

Page 32: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android + Arduino

• Software requirements (Development)

– Arduino IDE

• Sketch (C, C++)

– Hterm console

• Communication testing

Huber Flores 32

Page 33: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android + Arduino

Huber Flores 33

• Arduino side

Page 34: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Mobile sensing: Android + Arduino

• Android side

– Add permissions to AndroidManifest.xml

– Implement data streaming communication

Huber Flores 34

Page 35: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

DEMO

Huber Flores 35

Page 36: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

NEXT GENERATION MOBILE SENSING

Huber Flores 36

Page 37: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Next generation mobile sensing

Huber Flores 37

Page 38: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Notification services

• Apple Push Notification Service (APNS)

• Microsoft Push Notification Service (MPNS)

• Google Cloud Messaging (GCM)

• Message Queuing Telemetry Transport (MQTT)

• Extensible Messaging and Presence Protocol (XMPP)

Huber Flores 38

Page 39: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Notification services

Huber Flores 39

Source: Flores, H, et al. "Mobile cloud messaging supported by XMPP primitives." Proceeding of the fourth MobiSys workshop on Mobile cloud computing and services. ACM, 2013.

Page 40: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Notification services

• Push gateway proxy

– Broker

– Subscribers

• Remote executions

• Polling (e.g. HTTP)

• Heartbeats

– Highly integrated and optimized algorithms

• Low resource consumption

Huber Flores 40

Page 42: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

DEMO

Huber Flores 42

Page 43: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Exercise

• Implement a notification client in Android

Huber Flores 43

Page 44: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Next generation mobile sensing

• Participatory sensing

• Community sensing

• Mobile crowdsourcing

Huber Flores 44

Page 45: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

QUESTIONS?

Huber Flores 45

Page 47: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Home assignment 2

• We already explored the utilization of micromechanical sensors within the mobile applications – We will focus in the accelerometer

• You can use sensor emulator or a physical device for this homework – If you don’t have a device, we can provide you one, but

request it with anticipation

• Sensor emulator demonstration was provided along with some code for sensor simulator

• Sensor working code for a real device was also provided – It can be utilized as core if you find it usable, but you can

always code yours

Huber Flores 47

Page 48: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Home assignment 2

Huber Flores 48

Page 49: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Home assignment 2

Huber Flores 49

Page 50: Pervasive Mobile Applications - Kursused · 2014-10-06 · Home assignment 2 •We already explored the utilization of micromechanical sensors within the mobile applications –We

Home assignment 2

• Object moves from left to right (and vice-versa) based on the orientation of the device

• A touch event makes the object to jump over an obstacle

Huber Flores 50