• Like
  • Save
Sensors on android
Upcoming SlideShare
Loading in...5
×
 

Sensors on android

on

  • 17,807 views

A brief introduction to Sensor-Framework on Android. ...

A brief introduction to Sensor-Framework on Android.

Introduction to sensor hardware:
- Accelerometer
- Gyroscope
- Compass
- Light/proximity sensor

Control & Data-flow from the

h/w <--> Kernel <--> Userspace.

How-To:

Harness the power of sensors in your Android-application.

Provide uniform UX across multiple devices when developing sensor-based Apps.

Implement Sensor-fusion in your Android-app.

Reduce power consumption of sensors h/w.

Statistics

Views

Total Views
17,807
Views on SlideShare
14,784
Embed Views
3,023

Actions

Likes
2
Downloads
466
Comments
0

49 Embeds 3,023

http://thecodeartist.blogspot.com 1210
http://thecodeartist.blogspot.in 963
http://feeds.feedburner.com 179
http://thecodeartist.blogspot.de 93
http://thecodeartist.blogspot.co.uk 54
http://thecodeartist.blogspot.tw 46
http://thecodeartist.blogspot.kr 45
http://thecodeartist.blogspot.ca 43
http://thecodeartist.blogspot.nl 35
http://talkativetimes.com 29
http://thecodeartist.blogspot.fr 27
http://thecodeartist.blogspot.com.es 25
http://thecodeartist.blogspot.com.br 23
http://thecodeartist.blogspot.sg 21
http://thecodeartist.blogspot.gr 20
http://thecodeartist.blogspot.ru 19
http://thecodeartist.blogspot.ro 19
http://thecodeartist.blogspot.it 18
http://thecodeartist.blogspot.com.au 18
http://thecodeartist.blogspot.co.il 15
http://thecodeartist.blogspot.se 12
http://www.linkedin.com 10
http://thecodeartist.blogspot.co.nz 10
http://thecodeartist.blogspot.pt 8
http://thecodeartist.blogspot.dk 7
http://thecodeartist.blogspot.mx 6
http://thecodeartist.blogspot.fi 6
http://thecodeartist.blogspot.hu 5
http://thecodeartist.blogspot.be 5
http://thecodeartist.blogspot.com.ar 5
http://thecodeartist.blogspot.ch 5
http://thecodeartist.blogspot.sk 4
http://thecodeartist.blogspot.jp 4
http://thecodeartist.blogspot.ae 4
http://thecodeartist.blogspot.hk 4
http://thecodeartist.blogspot.no 3
http://www.thecodeartist.blogspot.com 3
http://thecodeartist.blogspot.co.at 3
http://thecodeartist.blogspot.ie 3
http://yawing6.kekunda.com 2
http://translate.googleusercontent.com 2
http://cloud.feedly.com 2
http://thecodeartist.blogspot.cz 2
http://newsblur.com 1
http://www.thecodeartist.blogspot.com.au 1
https://www.linkedin.com 1
http://www.thecodeartist.blogspot.co.il 1
http://www.thecodeartist.blogspot.in 1
http://www.thecodeartist.blogspot.com.es 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Sensors on android Sensors on android Presentation Transcript

    • Sensors on AndroidChinmayVS @ DroidCON-2011
    • cvs@droidcon$ who am i• Android >2yrs. Remember anyone?• - sensors development. 10million+ units sold.• Presently working @ PathPartnerTech.com10:16 PM Sensors on Android 2
    • Sensors on AndroidPART1 : Introduction PART4: Sensor Application development.• Sensors on Android Sample android app (code snippets)• Famous sensor apps• Sensors in Android apps PART5: App-dev Tips and tricks• Sensor Hardware intro • Sensor callibration. 1. one-turn deserves another (axes-calib)PART2 : Android Sensor Overview 2. zero-calib• Overview • Sensor fusion (hard-way)• Porting a new sensor onto Android • Invensense (easy-way)• Kernel • Polling rate game/ui/fastest• Sensor "HAL" • When to place Wakelocks • When to register/unregister eventListenerPART3 : Porting tips and tricks• No motion ≠ 0accel• Accel axes 3step calibration• Input devices & events (EV_ABS, EV_REL)10:20 PM Sensors on Android 3
    • “Sense-ors” on Android A sensor (also called detector) is a device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument. 1. ACCELEROMETER 2. GYROSCOPE 3. MAGNETIC_FIELD REAL 4. LIGHT 5. PRESSURE 6. AMBIENT_TEMP 7. RELATIVE_HUMIDITY 8. PROXIMITY VIRTUAL 9. LINEAR_ACCELERATION 10. GRAVITY 11. ROTATION_VECTOR DEPRECEATED 12. TEMPERATURE 13. ORIENTATION10:20 PM Sensors on Android 4
    • “Famous” sensor apps10:16 PM Sensors on Android 5
    • Sensors in Android applications • Use-cases of sensors in apps: 1. Active-Input 2. Passive-Input Application developer 3. Active-Passive 4. Auto-Rotate Android window manager10:16 PM Sensors on Android 6
    • Sensors in Android applications (1/4)• Active input10:16 PM Sensors on Android 7
    • Sensors in Android applications (2/4)• Passive input10:16 PM Sensors on Android 8
    • Sensors in Android applications (3/4)• Active-passive10:16 PM Sensors on Android 9
    • Sensors in Android applications (4/4)• Auto-rotate10:16 PM Sensors on Android 10
    • Sensor Hardware Intro (1/4)• Accelerometer + ZERO drift - Relatively slower response10:16 PM Sensors on Android 11
    • Sensor Hardware Intro (2/4)• Gyroscope (MEMS) + Extremely quick response - Gradual drift with time10:16 PM Sensors on Android 12
    • Sensor Hardware Intro (3/4)• Compass (Magnetometer) + Obtain Yaw/Azimuth + Rotation with the device on a flat surface - Picks-up surrounding magnetic noise10:16 PM Sensors on Android 13
    • Sensor Hardware Intro (4/4)• Light & Proximity10:16 PM Sensors on Android 14
    • Android Sensors Frameworks OverviewAndroid App • Use SensorManager & SensorEventListener C OAndroid Framework N D • SensorService & SensorManager T A R TAndroid sensor “HAL” O A L • Links the Kernel-Drivers to the frameworkKernel Drivers • Device drivers to control and gather data from the actual hardware.10:16 PM Sensors on Android 15
    • Porting a sensor onto AndroidQ. My board has XYZ sensor. How do I get Android to recognise it? Kernel  Device-driver  Board File Userspace  Adding New HAL -OR-  Modifying existing HAL10:16 PM Sensors on Android 16
    • Porting a sensor onto Android (kernel)  Device-driver  Poll/Interrupt? Hybrid-approach = Workqueues  Early-suspend hook  input_report_abs() / input_report_rel()  Board File  Interrupt, GPIO, SPI/I2C-lines  Axes-remap to device axes platform_data12:15 AM Sensors on Android 17
    • Porting a sensor onto Android (kernel) Workqueues12:09 AM Sensors on Android 18
    • Porting a sensor onto Android (kernel) Early-Suspend hook Input Events12:13 AM Sensors on Android 19
    • Porting a sensor onto Android (userspace) Sensor-HAL  Adding – Reference Implementation : http://goo.gl/jjF3l – Sensor-HAL implemented in : android/device/<vendor>/<device>/libsensors – Generates library : system/lib/hw/sensors.<TARGET_BOARD_PLATFORM>.so  Modifying – Update sensors.cpp in sSensorList[] – Derive a new sensor object, Include appropriate file – Update i/p dev name in constructor12:30 AM Sensors on Android 20
    • Sensor Fusion Advantages – Faster data samples – Less noise in data samples – More Accurate data samples – Advanced Sensor data (Gestures, Glyphs, Shake-count, Step-count) Disadvantage – Higher power consumption Implement inside App – Register multiple sensor-listeners. – Correlate-data. Implement using Custom-Library – android/device/sample/frameworks/PlatformLibrary http://goo.gl/OI8sg12:30 AM Sensors on Android 21
    • Using Sensors in your app SensorEvent http://goo.gl/hWOQu SensorManager http://goo.gl/1DRUv12:30 AM Sensors on Android 22
    • App-dev Tips and tricks Sensor callibration. 1. one-turn deserves another (axes-calib) 2. zero-calib Sensor fusion  Hard-way  Easy-way (Invensense ) http://goo.gl/bHmDe Polling rate ui/normal/game/fastest? When to register/unregister eventListener When to place Wakelocks1:08 AM Sensors on Android 23
    • App-dev Tips and tricks register sensorlistener acquire wakelock release wakelock unregister sensorlistener1:04 AM Sensors on Android 24
    • What Next?• Moving on… – Sensor Framework on Android 4.0 (ICS) – Sensor Drivers on Kernel 3.0• Sensor-Fusion – App / library – Unified Kernel driver(sensors-class)• Calorie-counter/Diet Advisor “You spent 800calories since breakfast. Have a Greek-salad and a cup of milk…”• Location-fix without GPS (using sensors  wink-wink) http://goo.gl/ipbrL12:57 AM Sensors on Android 25
    • Thank You!! Questions? android-porting android-developers android-kernel android-platform CONTACT ME http://goo.gl/kKMOr10:16 PM Sensors on Android 26