SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Sensors on Android
ChinmayVS @ DroidCON-2011
cvs@droidcon$ who am i

• Android >2yrs. Remember           anyone?


•            - sensors development. 10million+ units sold.



• Presently working @

                          PathPartnerTech.com




10:16 PM                 Sensors on Android                  2
Sensors on Android
PART1 : 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 eventListener

PART3 : 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. ORIENTATION


10:20 PM                               Sensors on Android                           4
“Famous” sensor apps




10: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 manager




10:16 PM                           Sensors on Android               6
Sensors in Android applications (1/4)

• Active input




10:16 PM                 Sensors on Android        7
Sensors in Android applications (2/4)

• Passive input




10:16 PM                 Sensors on Android        8
Sensors in Android applications (3/4)

• Active-passive




10:16 PM                 Sensors on Android        9
Sensors in Android applications (4/4)

• Auto-rotate




10:16 PM                 Sensors on Android        10
Sensor Hardware Intro (1/4)

• Accelerometer




      + ZERO drift
      - Relatively slower response



10:16 PM                             Sensors on Android   11
Sensor Hardware Intro (2/4)

• Gyroscope (MEMS)




      + Extremely quick response
      - Gradual drift with time



10: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 noise


10:16 PM                              Sensors on Android   13
Sensor Hardware Intro (4/4)

• Light & Proximity




10:16 PM              Sensors on Android   14
Android Sensors Frameworks Overview

Android App
  • Use SensorManager & SensorEventListener              C
                                                         O
Android Framework                                        N         D
  • SensorService & SensorManager                        T         A
                                                         R         T
Android sensor “HAL”                                     O         A
                                                         L
  • Links the Kernel-Drivers to the framework

Kernel Drivers
  • Device drivers to control and gather data from the actual hardware.

10:16 PM                       Sensors on Android                         15
Porting a sensor onto Android

Q. 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 HAL




10: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_data




12:15 AM                               Sensors on Android   17
Porting a sensor onto Android (kernel)

 Workqueues




12:09 AM                  Sensors on Android        18
Porting a sensor onto Android (kernel)

 Early-Suspend hook



 Input Events




12: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 constructor




12: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/OI8sg


12:30 AM                                  Sensors on Android                   21
Using Sensors in your app




    SensorEvent     http://goo.gl/hWOQu

    SensorManager   http://goo.gl/1DRUv




12: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 Wakelocks




1:08 AM                               Sensors on Android   23
App-dev Tips and tricks



                                  register sensorlistener


                                      acquire wakelock


                                      release wakelock


                                unregister sensorlistener




1: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/ipbrL


12:57 AM                                    Sensors on Android                             25
Thank You!!

                     Questions?

              android-porting        android-developers

              android-kernel         android-platform



           CONTACT ME            http://goo.gl/kKMOr




10:16 PM                Sensors on Android                26

Contenu connexe

Tendances

AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019
AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019
AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019Amazon Web Services Korea
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web ServicesAmazon Web Services
 
Running Microsoft SharePoint On AWS - Smartronix and AWS - Webinar
Running Microsoft SharePoint On AWS - Smartronix and AWS - WebinarRunning Microsoft SharePoint On AWS - Smartronix and AWS - Webinar
Running Microsoft SharePoint On AWS - Smartronix and AWS - WebinarAmazon Web Services
 
Introduction of Open Source GIS
Introduction of Open Source GISIntroduction of Open Source GIS
Introduction of Open Source GISSANGHEE SHIN
 
Location based services (LBS)
Location based services (LBS)Location based services (LBS)
Location based services (LBS)Prem Singhaniya
 
컨테이너 기술 ( Container Technology ) 발표 자료 다운로드
컨테이너 기술 ( Container Technology ) 발표 자료 다운로드컨테이너 기술 ( Container Technology ) 발표 자료 다운로드
컨테이너 기술 ( Container Technology ) 발표 자료 다운로드Opennaru, inc.
 
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...Amazon Web Services Korea
 
Geofencing for mobile applications
Geofencing for mobile applicationsGeofencing for mobile applications
Geofencing for mobile applicationsRajith Rajan
 
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Amazon Web Services
 
Introduction to WebGIS- Esri norsk BK 2014
Introduction to WebGIS- Esri norsk BK 2014Introduction to WebGIS- Esri norsk BK 2014
Introduction to WebGIS- Esri norsk BK 2014Geodata AS
 
Micro services and Containers
Micro services and ContainersMicro services and Containers
Micro services and ContainersRichard Harvey
 
[웨비나] 다중 AWS 계정에서의 CI/CD 구축
[웨비나] 다중 AWS 계정에서의 CI/CD 구축[웨비나] 다중 AWS 계정에서의 CI/CD 구축
[웨비나] 다중 AWS 계정에서의 CI/CD 구축BESPIN GLOBAL
 
Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]Haggai Philip Zagury
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big PictureSriyank Siddhartha
 
Automatize seu processo de entrega de software com CI/CD na AWS
Automatize seu processo de entrega de software com CI/CD na AWSAutomatize seu processo de entrega de software com CI/CD na AWS
Automatize seu processo de entrega de software com CI/CD na AWSAmazon Web Services LATAM
 

Tendances (20)

[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트
[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트
[웨비나] Follow me! 클라우드 인프라 구축 기본편 - 강지나 테크 에반젤리스트
 
AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019
AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019
AWS를 위한 도커, 컨테이너 (이미지) 환경 보안 방안 - 양희선 부장, TrendMicro :: AWS Summit Seoul 2019
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
 
Running Microsoft SharePoint On AWS - Smartronix and AWS - Webinar
Running Microsoft SharePoint On AWS - Smartronix and AWS - WebinarRunning Microsoft SharePoint On AWS - Smartronix and AWS - Webinar
Running Microsoft SharePoint On AWS - Smartronix and AWS - Webinar
 
멀티·하이브리드 클라우드 구축 전략 - 네이버비즈니스플랫폼 박기은 CTO
멀티·하이브리드 클라우드 구축 전략 - 네이버비즈니스플랫폼 박기은 CTO멀티·하이브리드 클라우드 구축 전략 - 네이버비즈니스플랫폼 박기은 CTO
멀티·하이브리드 클라우드 구축 전략 - 네이버비즈니스플랫폼 박기은 CTO
 
Introduction of Open Source GIS
Introduction of Open Source GISIntroduction of Open Source GIS
Introduction of Open Source GIS
 
Location based services (LBS)
Location based services (LBS)Location based services (LBS)
Location based services (LBS)
 
컨테이너 기술 ( Container Technology ) 발표 자료 다운로드
컨테이너 기술 ( Container Technology ) 발표 자료 다운로드컨테이너 기술 ( Container Technology ) 발표 자료 다운로드
컨테이너 기술 ( Container Technology ) 발표 자료 다운로드
 
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
 
Gagan nav.
Gagan nav.Gagan nav.
Gagan nav.
 
Geofencing for mobile applications
Geofencing for mobile applicationsGeofencing for mobile applications
Geofencing for mobile applications
 
Remote Sensing
Remote SensingRemote Sensing
Remote Sensing
 
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Introduction to WebGIS- Esri norsk BK 2014
Introduction to WebGIS- Esri norsk BK 2014Introduction to WebGIS- Esri norsk BK 2014
Introduction to WebGIS- Esri norsk BK 2014
 
Micro services and Containers
Micro services and ContainersMicro services and Containers
Micro services and Containers
 
[웨비나] 다중 AWS 계정에서의 CI/CD 구축
[웨비나] 다중 AWS 계정에서의 CI/CD 구축[웨비나] 다중 AWS 계정에서의 CI/CD 구축
[웨비나] 다중 AWS 계정에서의 CI/CD 구축
 
Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]Modern Monitoring [ with Prometheus ]
Modern Monitoring [ with Prometheus ]
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
 
Automatize seu processo de entrega de software com CI/CD na AWS
Automatize seu processo de entrega de software com CI/CD na AWSAutomatize seu processo de entrega de software com CI/CD na AWS
Automatize seu processo de entrega de software com CI/CD na AWS
 

Similaire à Sensors on android

Sensors and location based services
Sensors and location based servicesSensors and location based services
Sensors and location based servicesChinmay V S
 
Sensor Observation Service Client for Android Mobile Phones
Sensor Observation Service Client for Android Mobile PhonesSensor Observation Service Client for Android Mobile Phones
Sensor Observation Service Client for Android Mobile PhonesCybera Inc.
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)Ahsanul Karim
 
Programming The Real World
Programming The Real WorldProgramming The Real World
Programming The Real Worldpauldeng
 
Developing Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for UltrabooksDeveloping Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for UltrabooksFelipe Pedroso
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Ahsanul Karim
 
Final presentation today
Final presentation todayFinal presentation today
Final presentation todaynusratlima
 
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...chaitanya ivvala
 
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai Itvedant
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Trends in mobile sensors: how smartphones keep changing our life
Trends in mobile sensors: how smartphones keep changing our lifeTrends in mobile sensors: how smartphones keep changing our life
Trends in mobile sensors: how smartphones keep changing our lifeSnapbackLabs
 

Similaire à Sensors on android (20)

Sensors and location based services
Sensors and location based servicesSensors and location based services
Sensors and location based services
 
Sensor Observation Service Client for Android Mobile Phones
Sensor Observation Service Client for Android Mobile PhonesSensor Observation Service Client for Android Mobile Phones
Sensor Observation Service Client for Android Mobile Phones
 
Android 1.8 sensor
Android 1.8 sensorAndroid 1.8 sensor
Android 1.8 sensor
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)
 
Semantics and Sensors
Semantics and SensorsSemantics and Sensors
Semantics and Sensors
 
Programming The Real World
Programming The Real WorldProgramming The Real World
Programming The Real World
 
Developing Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for UltrabooksDeveloping Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for Ultrabooks
 
Week12.pdf
Week12.pdfWeek12.pdf
Week12.pdf
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2
 
Final presentation today
Final presentation todayFinal presentation today
Final presentation today
 
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...
 
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Trends in mobile sensors: how smartphones keep changing our life
Trends in mobile sensors: how smartphones keep changing our lifeTrends in mobile sensors: how smartphones keep changing our life
Trends in mobile sensors: how smartphones keep changing our life
 
Soli sensor
Soli sensorSoli sensor
Soli sensor
 
Android the future
Android  the futureAndroid  the future
Android the future
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Android Sensor
Android SensorAndroid Sensor
Android Sensor
 
All about android
All about androidAll about android
All about android
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 

Dernier

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Dernier (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

Sensors on android

  • 2. cvs@droidcon$ who am i • Android >2yrs. Remember anyone? • - sensors development. 10million+ units sold. • Presently working @ PathPartnerTech.com 10:16 PM Sensors on Android 2
  • 3. Sensors on Android PART1 : 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 eventListener PART3 : 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
  • 4. “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. ORIENTATION 10:20 PM Sensors on Android 4
  • 5. “Famous” sensor apps 10:16 PM Sensors on Android 5
  • 6. 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 manager 10:16 PM Sensors on Android 6
  • 7. Sensors in Android applications (1/4) • Active input 10:16 PM Sensors on Android 7
  • 8. Sensors in Android applications (2/4) • Passive input 10:16 PM Sensors on Android 8
  • 9. Sensors in Android applications (3/4) • Active-passive 10:16 PM Sensors on Android 9
  • 10. Sensors in Android applications (4/4) • Auto-rotate 10:16 PM Sensors on Android 10
  • 11. Sensor Hardware Intro (1/4) • Accelerometer + ZERO drift - Relatively slower response 10:16 PM Sensors on Android 11
  • 12. Sensor Hardware Intro (2/4) • Gyroscope (MEMS) + Extremely quick response - Gradual drift with time 10:16 PM Sensors on Android 12
  • 13. Sensor Hardware Intro (3/4) • Compass (Magnetometer) + Obtain Yaw/Azimuth + Rotation with the device on a flat surface - Picks-up surrounding magnetic noise 10:16 PM Sensors on Android 13
  • 14. Sensor Hardware Intro (4/4) • Light & Proximity 10:16 PM Sensors on Android 14
  • 15. Android Sensors Frameworks Overview Android App • Use SensorManager & SensorEventListener C O Android Framework N D • SensorService & SensorManager T A R T Android sensor “HAL” O A L • Links the Kernel-Drivers to the framework Kernel Drivers • Device drivers to control and gather data from the actual hardware. 10:16 PM Sensors on Android 15
  • 16. Porting a sensor onto Android Q. 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 HAL 10:16 PM Sensors on Android 16
  • 17. 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_data 12:15 AM Sensors on Android 17
  • 18. Porting a sensor onto Android (kernel)  Workqueues 12:09 AM Sensors on Android 18
  • 19. Porting a sensor onto Android (kernel)  Early-Suspend hook  Input Events 12:13 AM Sensors on Android 19
  • 20. 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 constructor 12:30 AM Sensors on Android 20
  • 21. 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/OI8sg 12:30 AM Sensors on Android 21
  • 22. Using Sensors in your app SensorEvent http://goo.gl/hWOQu SensorManager http://goo.gl/1DRUv 12:30 AM Sensors on Android 22
  • 23. 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 Wakelocks 1:08 AM Sensors on Android 23
  • 24. App-dev Tips and tricks register sensorlistener acquire wakelock release wakelock unregister sensorlistener 1:04 AM Sensors on Android 24
  • 25. 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/ipbrL 12:57 AM Sensors on Android 25
  • 26. Thank You!! Questions? android-porting android-developers android-kernel android-platform CONTACT ME http://goo.gl/kKMOr 10:16 PM Sensors on Android 26