Leveraging Accelerometers in Mobile Devices - Presentation Transcript
LEVERAGING
ACCELEROMETERS
IN MOBILE DEVICES
Scott Janousek, Hooken Mobile
scott janousek
AGENDA
INTRO
OVERVIEW
MOBILE DEVICES & PLATFORMS
OUTRO
scott janousek
INTRO
scott janousek
MINI BIO
Scott Janousek
Founder & Lead Developer, Hooken Mobile
Developer, Evangelist, Coauthor, Educator, Gadget Geek
Flash > 8 years
Mobile & Devices >= 4 years
Symbian, webOS, Android, iPhone = Core Targets
Work with OEMS, partners ... those using Flash & related tech
scott janousek
HOW MANY PEOPLE ...
ARE IPHONE DEVELOPERS?
WEBOS?
ANDROID?
SYMBIAN?
WINDOWS MOBILE?
RIM?
FLASH?
OTHERS?
scott janousek
HOW MANY PEOPLE ...
... ARE NEW TO ACCELEROMETER?
... HAVE WORKED WITH AN
ACCELEROMETER API?
... ON WHAT PLATFORMS?
scott janousek
READ THIS
scott janousek
JUSTIFICATION
“Over 1/3 of Mobile Phones are expected
to integrate accelerometers by 2010 ...”
- iSuppli
scott janousek
OVERVIEW
scott janousek
CONTROLLER EVOLUTION
80’s 90’s 2008 >= 2009
“Joysticks” Mobile Pointers Embedded
Accelerometers
scott janousek
BEHIND THE SCENES
scott janousek
MATH & PHYSICS
scott janousek
THE 3RD DIMENSION
scott janousek
3 AXIS COORDINATE
SYSTEM
X AXIS Y AXIS Z AXIS
scott janousek
GRAVITY
9.81 m/s²
scott janousek
BASICS
MEASURES ACCELERATION
OF DEVICE RELATIVE
TO FREE FALL
scott janousek
PULLING G’S
7 g's = 68.64655 m / s2
scott janousek
“OLD SCHOOL”
(LINEAR) “ACCELEROMETER” IN 1783
GEORGE ATWOOD (1746-1807)
ENGLISH PHYSICIST
scott janousek
“NEW SCHOOL”
scott janousek
TYPES
SINGLE AXIS ACCELEROMETERS
(X OR Y OR Z)
MULTI AXIS ACCELEROMETERS
(X & Y & Z)
scott janousek
DETECTS ...
MAGNITUDE & DIRECTION OF ACCELERATION
AS A VECTOR QUANTITY
scott janousek
MEASUREMENTS
Static Acceleration (aka Gravity)
Tilt of an object
Dynamic Acceleration
Shock to an Object
Velocity
Orientation
Vibration of an object
scott janousek
DETECTION OF ...
ORIENTATION
VIBRATION
SHOCK
scott janousek
MOBILE GESTURES
SWIPE
postive-negative spike
SHAKE
oscillating wave
ROTATE
2 axis change
scott janousek
HARDWARE
scott janousek
TYPES
Capacitive Heat transfer
Accelerometers sense a change in electrical capacitance, with respect to Accelerometers measure internal changes in heat transfer due to
acceleration. The accelerometer senses the capacitance change between acceleration. A single heat source is centered in a substrate and
a static condition and the dynamic state. suspended across a cavity. Thermoresistors are spaced equally on all
four sides of the suspended heat source. Under zero acceleration the
heat gradient will be symmetrical. Acceleration in any direction causes
Piezoelectric the heat gradient to become asymmetrical due to convection heat
Accelerometers use materials such as crystals, which generate electric transfer.
potential from an applied stress. This is known as the piezoelectric
effect. As stress is applied, such as acceleration, an electrical charge is
created. Future Accelerometer
Advancements
In the next decade, NANO technology will create new applications and
Piezoresistive dramatically reshape this area of technology.
Accelerometers (strain gauge accelerometers) work by measuring the
electrical resistance of a material when mechanical stress is applied
MEMS-Based Accelerometers
MEMS (Micro-Electro Mechanical System) technology is
Hall Effect based on a number of tools and methodologies, which
Accelerometers measure voltage variations stemming from a change in
are used to form small structures with dimensions in
the magnetic field around the accelerometer.
the micrometer scale (one millionth of a meter). This
technology is now being utilized to manufacture state
Magnetoresistive of the art MEMS-Based Accelerometers.
Accelerometers work by measuring changes in resistance due to a
magnetic field. The structure and function is similar to a Hall Effect
accelerometer except that instead of measuring voltage, the
magnetoresistive accelerometer measures resistance.
scott janousek
MEMS
MEMS = Microelectromechnical System
Accelerometers = MEMS “Sensors”
Motion Sensors are fraction of MEMS out
there in mobile devices
scott janousek
USE CASES
scott janousek
USAGE
Menu Navigation Screen Rotation
Pedometer Gestures
GPS-Dead Reckoning Fall Detection
Gaming Scrolling
Telephony Tap Detection
Power conservation Camera Stabilization
3-D object manipulation & More!
scott janousek
MARKETS
Navigation
Medical
Engineering
Transport
Building & Structural Monitoring (dynamic loads)
Machinery Health Monitoring
Mobile & other Electronic Devices
scott janousek
... HELP US SNAP
BETTER MEDIA
Image Stabilization
scott janousek
...MAKES LIVES JUST A
TINY BIT EASIER ...
txtr eBook Reader Kindle DX
http://reader.txtr.com/ http://www.kindle.com/
scott janousek
... KEEPS US
ENTERTAINED
Nintendo Wii Remote Playstation 3 - Dual Shock Controller
(3 axis accelerometer) (6 axis accelerometer)
scott janousek
... PROTECT OUR DATA!
IBM/Leveno Apple MacBook Pro
(Active Protection System) (Sudden Motion Sensor)
scott janousek
... HELP US STAY IN
SHAPE!
FitBit - http://www.fitbit.com/
scott janousek
... IMPROVES
MOBILE EXPERIENCES !
iPod HTC Hero iPhone BlackBerry SEMC 905C Pre Touch Diamond Omnia N97 Zune HD
Android, Symbian, Windows Mobile, iPhone, webOS, RIM, other devices ...
scott janousek
CORE SMARTPHONE
FEATURES
Camera
WiFi & 3G
GPS
TouchScreen (ideally Multi-touch)
Accelerometer
scott janousek
MOBILE DEVICES &
PLATFORMS
scott janousek
FLASH ENABLED
MOBILE DEVICE
PLATFORMS
scott janousek
S60
S60 Mobile Device Platform
is underlying OS
Nokia has millions of S60 (Symbian) devices on market
Most SmartPhones from Nokia have accelerometers
(e.g. N900, X-Series, Nokia N97, N96/95, 5800, 5500 Sport)
scott janousek
WAYS TO TAP ...
First Party 3rd Party
Solution Solutions
Nokia S60
PLATFORM (Flash only Solution)
SERVICES
(Native, Flash, other platform access)
scott janousek
S60 PLATFORM
SERVICES
1.) Download from www.forum.nokia.com:
ActionScript Library for S60 Platform Services
S60_ActionScript_API_library_1_0.zip
2.) Copy the folder to:
/Users/$username/Library/Application/Support/Adobe/Flash
CS4/en/Configuration
%USERPROFILE%Local SettingsApplication DataAdobeFlash
CS3enConfigurationClasses
scott janousek
S60 PLATFORM
SERVICES
//-- Import Platform Service Interface
import com.nokia.lib.Service;
//-- Create a new Service object which has Sensor data
var sensors = new Service( "Service.Sensor", "ISensor" );
//-- Define input parameters for picking Rotation sensor
var inParam = { SearchCriterion:"Rotation" };
//-- Define result value
var outParams = sensors.FindSensorChannel( inParam );
scott janousek
S60 PLATFORM
SERVICES
//-- Define channel info (rotation)
var channelInfo = outParams.ReturnValue;
//-- Define valid values for channel info
var channelId = channelInfo[0].ChannelId;
var contextType = channelInfo[0].ContextType;
var quantity = channelInfo[0].Quantity;
var channelType = channelInfo[0].ChannelType;
var location = channelInfo[0].Location;
var vendorId = channelInfo[0].VendorId;
var dataItemSize = channelInfo[0].DataItemSize;
var channelDataTypeId = channelInfo[0].ChannelDataTypeId;
var channelInfo = {
ChannelId:channelId, ContextType:contextType, Quantity:quantity,
ChannelType:channelType, Location:location, VendorId:vendorId,
DataItemSize:dataItemSize, ChannelDataTypeId:channelDataTypeId
}
scott janousek
S60 PLATFORM
SERVICES (CONT)
//-- Define input parameters for listening rotation channel data
var inParams = { ListeningType:"ChannelData", ChannelInfoMap:channelInfo };
//-- The RegisterForNotification method registers the user to receive data from
//-- one sensor channel asynchronously
sensors.RegisterForNotification( inParams, callBack );
//-- Because this is an asynchronous method, you need to define the callback
function
//-- Callback function includes all the channel data
function callBack( transactionID:String, eventID:String, outParam:Object ) {
if ( outParam.ErrorCode == 0 ) {
var channelData = outParam.ReturnValue;
var xRot = channelData.XRotation;
var yRot = channelData.YRotation;
var zRot = channelData.ZRotation;
} else {
var errorId = outParam.ErrorCode;
}
}
scott janousek
S60 PLATFORM
SERVICES EXAMPLE
scott janousek
KUNERI LITE
Flash Lite does not (natively) support Accelerometer API
Kuneri Lite = 3-rd Party “Extender”
Kuneri Lite Accelerometer “Plug-in”
http://wiki.kunerilite.net/index.php?title=Accelerometer_plugin
scott janousek
KUNERI LITE
ARCHITECTURE
Architecture
Flash Lite (1.1/2.x/3.x)
ActionScript
Local HTTP calls
Kuneri Lite Server
Symbian C++
Native
Kuneri Lite Plug-ins
(GPS, Camera, etc)
Native
S60 on device
scott janousek
KUNERI LITE
ACCELEROMETER API
Start Sensor
loadVariables("http://127.0.0.1:1001/Basic/accelerometer?klCommand=readsensor", MC );
Stop Sensor
loadVariables("http://127.0.0.1:1001/Basic/accelerometer?klCommand=stopsensor", MC );
Read Sensor
loadVariables("http://127.0.0.1:1001/Basic/accelerometer?klCommand=startsensor", MC );
scott janousek
KUNERI LITE EXAMPLE
scott janousek
FLASH 10 &
ACCELEROMETER
Multitouch
Accelerometer *
GPS *
Other Features = TBD Flash Lite now, Flash 10 = 2010
* Check out Mark Doherty’s session here at FITC for more info scott janousek
SONY ERICSSON
scott janousek
SONY ERICSSON
18/19 new devices from Sony Ericsson have Accelerometers
Motion sensor in games, picture UI, & auto rotation
“Shaker Feature” = task switching in music player, etc
Can use J2ME and/or Flash to tap into accelerometer API
scott janousek
NATIVE FLASH API
Tapping into Accelerometer via Flash Lite
//-- returns back X,Y,Z values from accelerometer sensor into
//-- accX, accY, accZ variables (if supported on target device)
loadVariables("accelerometer://data", _root );
Accessing Accelerometer via Flash Lite
var sensorCheck_bool:Boolean = true;
onEnterFrame = function {
loadVariables("accelerometer://data", _root);
if (sensorCheck_bool) {
//-- only check sensor once!
sensorCheck_bool = false;
if (accX != undefined && accY != undefined && accZ != undefined) {
//-- sensor is reporting, so continue
} else {
trace("No sensor is reporting! Is this a supported device?");
}
}
}
scott janousek
CAPUCHIN API
TAPPING ACCELEROMETER VIA CAPUCHIN
http://developer.sonyericsson.com/
scott janousek
CHUMBY
scott janousek
CHUMBY - WHAT IS IT?
Fun, Open Source Linux Device
TouchScreen, Accelerometer, Microphone, Speakers, WiFi
Flash Lite 3.x User Interface & Widgets
Not Portable without a “Battery Hack”! :)
scott janousek
CHUMBY -
ORIENTATIONS
Source:
Developing widgets for Chumby with Flash Lite 3
http://www.adobe.com/devnet/devices/articles/chumby_development.html
scott janousek
CHUMBY - FLASH API
Source:
Developing Flash Lite Widgets for the Chumby Platform
http://www.slideshare.net/scottjanousek/developing-flash-lite-widgets-for-the-chumby-platform
scott janousek
CHUMBY
Source: Cloud Clock
http://www.chumby.com/guide/widget/Cloud%20Clock
scott janousek
CHUMBY - SOME
RESOURCES
Developing widgets for Chumby with Flash Lite 3
Includes ActionScript 2.0 Accelerometer Class you can reuse
Source: http://www.adobe.com/devnet/devices/articles/chumby_development_06.html
AdvancED Flash on Devices - Flash Lite and Flash 10
Chapter 7 - Mobile and Devices Widgets on the Flash Platform (pg 203)
http://advancED.flashmobilebook.com/
scott janousek
WEBOS
scott janousek
WEB OS
Set ability to switch orientation
this.controller.listen(document, 'orientationchange',
this.handleOrientation.bindAsEventListener(this));
handleOrientation(event) { … } //.position=[1:5], .roll=float, .pitch=float
Run code when orientation changes
this.controller.listen(document, 'orientationchange',
this.handleOrientation.bindAsEventListener(this));
handleOrientation(event) { … } //.position=[1:5], .roll=float, .pitch=float
Set ability to switch orientation
if (this.controller.stageController.setWindowOrientation) {
this.controller.stageController.setWindowOrientation("free");
}
Run code when orientation changes
this.controller.listen(document, 'orientationchange',
this.handleOrientation.bindAsEventListener(this));
handleOrientation(event) { … } //.position=[1:5], .roll=float, .pitch=float
scott janousek
WEB OS EXAMPLE
AccellBall Example
scott janousek
IPHONE
scott janousek
LIS302DL COMPONENT
LIS302DL Accelerometer
scott janousek
IPHONE AXIS
scott janousek
OBJECTIVE-C & CLASSES
scott janousek
ACCELEROMETER
SIMULATOR
http://code.google.com/p/acc
http://
www.iphonearch.com/
topic/6/iphone-
accelerometer-simulator
http://code.google.com/p/accelerometer-simulator/
scott janousek
http://mashable.com/
IPHONE EXAMPLE
2008/12/03/iphone-
games-accelerometer/
http://www.switchonthecode.com/tutorials
iphone-application-with-interface-builder
gravity tutorials ...
http://www.switchonthecode.com/tutoria
accelerometer
http://www.tuaw.com/2007/09/10/iphon
Gravity Tutorial from Keith Peters
scott janousek
ANDROID
scott janousek
ANDROID API
Haven’t explored yet ... :(
API exists
Very similar to iPhone
scott janousek
scott janousek
BUG COMPONENTS
scott janousek
BUGMOTION
Module
Collar to reduce motion detection field for “spot” detection
Motion Sensor
2m range
Passive Infrared (PIR) Sensor
Sensing Area: 110 degrees horizontal, 93 vertical
80 zones sensitivity
10m rated detection distance
Accelerometer
3-Axis accelerometer
Software selectable sensitivity (2.5g/3.3g/6.7g/10g)
Low non-linerarity ( less than +/- 1% FSO)
scott janousek
BUG COMMUNITY APPS
http://www.buglabs.net/applications?tag=accelerometer
scott janousek
OUTRO
scott janousek
Q&A
What are your questions?
scott janousek
RESOURCES
My FITC 2009 Site
http://fitc2009.scottjanousek.com/
SEMC Developer’s Site
http://developer.sonyericsson.com/
Forum Nokia
http://wiki.forum.nokia.com/index.php/Sensor_API
http://wiki.forum.nokia.com/index.php/CS001253_-_Displaying_sensor_data_in_Flash_Lite
http://wiki.forum.nokia.com/index.php/
How_to_use_S60_Platform_Services_to_create_accelerometer_based_
user_interaction_with_Adobe_Flash_Lite
scott janousek
RESOURCES (CONT)
iPhone Resources
http://www.bit-101.com/blog/?p=1824
http://www.iphonedevsdk.com/
http://www.geekpedia.com/PageView2916_iPhone-Tutorial--Reading-the-Accelerometer.html
Android Resources
Search on Android, Accelerometer on google. :)
Chumby
http://www.adobe.com/devnet/devices/articles/chumby_development_06.html
scott janousek
RESOURCES (CONT)
webOS
http://www.webos-internals.org/wiki/Accelerometer
BugLabs
http://www.buglabs.net/modules/bugmotion
Audrino
http://www.arduino.cc
scott janousek
THE “NEXT” THINGS ...
iSuppli predicts the industry for MEMS
components will grow from $460 million
last year to over $1.6 billion in 2013.
The company also expects technology
such as gyroscopes and projectors to hit
the market as early as 2010.
scott janousek
THE “NEXT” THINGS ...
Magnetometer = Electronic Compasses
Precise Location = Magnetometer + Accelerometer + GPS + (Camera)
Next Generation = Augmented Reality + Precise Location
scott janousek
In this session, we'll look at some cool things you more
In this session, we'll look at some cool things you can do today with accelerometer hardware found commonly in millions of mobile and devices, whether it be Apple's iPhone, or millions of other mobile devices from Nokia, Sony Ericsson, and other mobile device manufacturers. We'll explain basic fundamentals on how accelerometers work, as well as explore how to harness the power of accelerometer technology in a range of different devices.
Who this presentation is for: Developers who want to learn about some of the ways to tap into accelerometer on devices (not just iPhone).
What attendees will take from this presentation: Attendees will come away understanding how to better apply force and motion based feedback interaction to their mobile content through accelerometers; not only across not only iPhone, but also other mobile device platforms.
http://www.fitc.ca/events/presentations/presentation.cfm?event=92&presentation_id=966 less
0 comments
Post a comment