Sensors & Motion Sensors in Android platform. Minh H Dang CS286 Spring 2013



Similar documents
Android Sensors. CPRE 388 Fall 2015 Iowa State University

Android Sensor Programming. Weihong Yu

Android Sensors. XI Jornadas SLCENT de Actualización Informática y Electrónica

Android Framework. How to use and extend it

ELET4133: Embedded Systems. Topic 15 Sensors

Using the Android Sensor API

Developing Sensor Applications on Intel Atom Processor-Based Android* Phones and Tablets

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

Using Sensors on the Android Platform. Andreas Terzis Android N00b

Using Extensions or Cordova Plugins in your RhoMobile Application Darryn

Programming Mobile Applications with Android

Objective. Android Sensors. Sensor Manager Sensor Types Examples. Page 2

Android app development course

! Sensors in Android devices. ! Motion sensors. ! Accelerometer. ! Gyroscope. ! Supports various sensor related tasks

06 Team Project: Android Development Crash Course; Project Introduction

App Development for Smart Devices. Lec #5: Android Sensors

Obsoleted chapter from The Busy Coder's Guide to Advanced Android Development

CS 403X Mobile and Ubiquitous Computing Lecture 6: Maps, Sensors, Widget Catalog and Presentations Emmanuel Agu

E0-245: ASP. Lecture 16+17: Physical Sensors. Dipanjan Gope

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

Android Concepts and Programming TUTORIAL 1

Module 1: Sensor Data Acquisition and Processing in Android

Designing An Android Sensor Subsystem Pitfalls and Considerations

Lab 1 (Reading Sensors & The Android API) Week 3

Android. Mobile Computing Design and Implementation. Application Components, Sensors. Peter Börjesson

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

HP TouchPad Sensor Setup for Android

Android Programming Lecture 18: Menus Sensors 11/11/2011

Sensors and Cellphones

Introduction to NaviGenie SDK Client API for Android

Internal Services. CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr. Rajiv Ramnath

Application Note IMU Visualization Software

Tegra Android Accelerometer Whitepaper

Motion Sensing with mcube igyro Delivering New Experiences for Motion Gaming and Augmented Reality for Android Mobile Devices

How to develop your own app

How to Convert 3-Axis Directions and Swap X-Y Axis of Accelerometer Data within Android Driver by: Gang Chen Field Applications Engineer

Pedometer Project 1 Mr. Michaud /

Sensor Fusion Mobile Platform Challenges and Future Directions Jim Steele VP of Engineering, Sensor Platforms, Inc.

Performance issues in writing Android Apps

Effective Use of Android Sensors Based on Visualization of Sensor Information

CSE476 Mobile Application Development. Yard. Doç. Dr. Tacha Serif Department of Computer Engineering Yeditepe University

A DECISION TREE BASED PEDOMETER AND ITS IMPLEMENTATION ON THE ANDROID PLATFORM

Lecture 1 Introduction to Android

Developing Android Apps for BlackBerry 10. JAM854 Mike Zhou- Developer Evangelist, APAC Nov 30, 2012

UNMANNED AERIAL VEHICLE (UAV) SAFETY SYSTEM USING ANDROID APP

Making Android Motion Applications Using the Unity 3D Engine

WEARIT DEVELOPER DOCUMENTATION 0.2 preliminary release July 20 th, 2013

SENSORS ON ANDROID PHONES. Indian Institute of Technology Kanpur Commonwealth of Learning Vancouver

ELDERLY SUPPORT - ANDROID APPLICATION FOR FALL DETECTION AND TRACKING TEJITHA RUDRARAJU. B.E, Anna University, India, 2011 A REPORT

An inertial haptic interface for robotic applications

AN APPLYING OF ACCELEROMETER IN ANDROID PLATFORM FOR CONTROLLING WEIGHT

AN4503 Application note

Mobile App Sensor Documentation (English Version)

Google Android: An Emerging Innovative Software Platform For Mobile Devices

ECE 455/555 Embedded System Design. Android Programming. Wei Gao. Fall

Frameworks & Android. Programmeertechnieken, Tim Cocx

Android Introduction. Hello Mihail L. Sichitiu 1

Kathy Au Billy Yi Fan Zhou Department of Electrical and Computer Engineering University of Toronto { kathy.au, billy.zhou }@utoronto.

Basic Principles of Inertial Navigation. Seminar on inertial navigation systems Tampere University of Technology

How to build your first Android Application in Windows

Frequently Asked Questions (FAQs)

Indoor Positioning using Sensor-fusion in Android Devices

Android Security Lab WS 2014/15 Lab 1: Android Application Programming

Use It Free: Instantly Knowing Your Phone Attitude

KINEMATICS OF PARTICLES RELATIVE MOTION WITH RESPECT TO TRANSLATING AXES

Data in seismology: networks, instruments, current problems

Iotivity Programmer s Guide Soft Sensor Manager for Android

Develop a Hello World project in Android Studio Capture, process, store, and display an image. Other sensors on Android phones

Android Basics. Xin Yang

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Android For Java Developers. Marko Gargenta Marakana

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Evading Android Emulator

AdFalcon Android SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

An Introduction to 3D Computer Graphics, Stereoscopic Image, and Animation in OpenGL and C/C++ Fore June

Using the Adafruit Unified Sensor Driver. Created by Kevin Townsend

CSE476 Mobile Application Development. Yard. Doç. Dr. Tacha Serif Department of Computer Engineering Yeditepe University

E X P E R I M E N T 8

An Introduction to Android

Transcription:

Sensors & Motion Sensors in Android platform Minh H Dang CS286 Spring 2013

Sensors The Android platform supports three categories of sensors: Motion sensors: measure acceleration forces and rotational forces along three axes (in most devices) accelerometers, gravity sensors, gyroscopes, and rotational vector sensors

Sensors Position sensors: measure the physical position of a device orientation sensors and magnetometers Environmental sensors: measure environmental parameters (temperature and pressure, illumination, and humidity) (depend on device) Barometers, photometers, and thermometers.

Monitoring Sensor Events Implement 2 callback methods: - onaccuracychanged() - onsensorchanged() of interface SensorEventListener Example of Light sensor

public class SensorActivity extends Activity implements SensorEventListener { private SensorManager msensormanager; private Sensor mlight; @Override public final void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); msensormanager = (SensorManager) getsystemservice(context.sensor_service); mlight = msensormanager.getdefaultsensor(sensor.type_light); } @Override public final void onaccuracychanged(sensor sensor, int accuracy) { // Do something here if sensor accuracy changes. } @Override public final void onsensorchanged(sensorevent event) { // The light sensor returns a single value. // Many sensors return 3 values, one for each axis. float lux = event.values[0]; // Do something with this sensor value. } @Override protected void onresume() { super.onresume(); msensormanager.registerlistener(this, mlight, SensorManager.SENSOR_DELAY_NORMAL); } @Override protected void onpause() { super.onpause(); msensormanager.unregisterlistener(this);

Best Practices for Accessing and Using Sensors Unregister sensor listeners acquire data and use battery resources until unregister Don't test your code on the emulator Don't block the onsensorchanged() method avoid to have a lot of calculation in this Avoid using deprecated methods or sensor types & Choose sensor delay carefully Verify sensors before you use them detect sensors at runtime if (mlight == null)...

Motion Sensors Monitor the motion of a device such as tilt, shake, rotation, or swing Hardware based: Accelerometer Gyroscope Hardware-based or software-based: Gravity Linear acceleration Rotation vector sensors

Accelerometer Sensor Measures the acceleration applied to the device, including the force of gravity Accelerometers use the standard sensor coordinate system Uses about 10 times less power than the other motion sensors msensormanager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); macceleromater = msensormanager.getdefaultsensor(sensor.type_accelerometer);

Gyroscope Sensor Measures the rate or rotation in rad/s around a device's x, y, and z axis Rotation is positive in the counter-clockwise direction mgyroscope = msensormanager.getdefaultsensor(sensor.type_gyroscope);

Gravity Sensor Provides a three dimensional vector indicating the direction and magnitude of gravity mgravity = msensormanager.getdefaultsensor(sensor.type_gravity); When a device is at rest, the output of the gravity sensor should be identical to that of the accelerometer.

Linear Accelemeter Sensor Provides a three-dimensional vector representing acceleration along each device axis, excluding gravity msensor = msensormanager.getdefaultsensor( Sensor.TYPE_LINEAR_ACCELEMETER); The sensor coordinate system is the same as the one used by the acceleration sensor, as are the units of measure (m/s 2 ).

Rotation Vector Sensor Represents the orientation of the device as a combination of an angle and an axis msensor = msensormanager.getdefaultsensor( Sensor.TYPE_ROTATION_VECTOR);

References http://developer.android.com/guide/topics/ sensors/sensors_overview.html http://developer.android.com/guide/topics/ sensors/sensors_motion.html

Lab Draw a ball Move a ball by tilting a device