Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed...

37
MTAT.03.262 Mobile Application Development Pervasive Mobile Applications Micromechanical technologies Huber Flores [email protected] Tartu, Estonia, 2013

Transcript of Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed...

Page 1: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

MTAT.03.262 Mobile Application Development

Pervasive Mobile Applications Micromechanical technologies

Huber Flores [email protected]

Tartu, Estonia, 2013

Page 2: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Outline

• Background

• Micromechanical technologies

– Embedded

– Distributed (e.g. microcontrollers)

• Pervasive development

– Android + underlying hardware

– Android + Arduino

• Demos

Huber Flores 2

Page 3: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

BACKGROUND

Huber Flores 3

Page 4: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Pervasive Mobile Applications

• Ubiquitous sensor data

• Wireless communication

• Wearable devices

• Energy consumption

• Participatory, opportunistic and social sensing

Huber Flores 4

Page 5: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

MICROMECHANICAL TECHNOLOGIES

Huber Flores 5

Page 6: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Embedded sensors

Huber Flores 6

Page 7: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Accelerometer

Huber Flores 7

Sensor pattern (e.g. walking)

Page 9: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Magnetic field

Huber Flores 9

Page 10: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Proximity

• Air pressure

Huber Flores 10

Page 11: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Distributed (e.g microcontrollers)

Huber Flores 11

http://makezine.com/2012/03/02/processing-for-android-and-arduino-tutorial-and-samples-from-tellart/

Page 12: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Microcontroller

Huber Flores 12

Arduino Mega ADK

Page 13: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Shields

Huber Flores 13

Wireless shield Sensor shield

Page 14: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Modules

Huber Flores 14

Wireless module Usb to serial converter

Page 15: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing

• Sensors

Huber Flores 15

Page 16: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

PERVASIVE DEVELOPMENT

Huber Flores 16

Page 17: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing in Android

• Physical device

• Emulator?

Huber Flores 17

Page 18: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing in 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 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 18

Page 19: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing in Android

Huber Flores 19

Page 20: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing in Android

Huber Flores 20

Page 21: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing in Android

Huber Flores 21

Page 22: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Mobile Sensing in Android

Huber Flores 22

Page 23: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

DEMO

Huber Flores 23

Page 24: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Exercise

• Try and install sensor simulator

Huber Flores 24

Page 25: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Android + Arduino

Huber Flores 25

Page 26: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Android + Arduino

• Accessory Mode

– Usb cable

Huber Flores 26

Page 27: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Android + Arduino

• Development requirements

– Arduino IDE

• Sketch (C, C++)

– Hterm console

• Communication testing

Huber Flores 27

Page 28: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Android + Arduino

Huber Flores 28

Loop

Page 29: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Android + Arduino

Huber Flores 29

Establish communication

Bind to an Android view

Page 30: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Android + Arduino

Huber Flores 30

Send streaming

Set permissions in Manifest.xml

Page 31: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

DEMO

Huber Flores 31

Page 32: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

QUESTIONS

Huber Flores 32

Page 33: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

References

• Suggested readings

– Arduino tutorial

https://courses.cs.ut.ee/2013/MAD/fall/uploads/Main/ArduinoTutorialWithExample.zip

– Source code

https://github.com/huberflores?tab=repositories

Huber Flores 33

Page 34: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

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 34

Page 35: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Home Assignment 2

• The home assignment consists to create an image editor application with at least 3 features (e.g. cut, draw, etc) that implements redo and undo functions using the accelerometer

• The idea is to set two different thresholds (one for redo and one for undo) and to apply those functions to the images once the device detects the specified movement

Huber Flores 35

Page 36: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Home Assignment 2

• Delivery date:

– Two weeks after this lecture.

Huber Flores 36

Page 37: Pervasive Mobile Applications - ut · MTAT.03.262 Mobile Application Development ... –Distributed (e.g. microcontrollers) •Pervasive development –Android + underlying hardware

Last year app…

Huber Flores 37