SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

smoke detector
smoke detectorsmoke detector
smoke detector
shashankbahale
 
PATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROID
PATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROIDPATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROID
PATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROID
Journal For Research
 
Radar communication
Radar communicationRadar communication
Radar communication
saravanan saminathan
 
Development of wearable object detection system &amp; blind stick for visuall...
Development of wearable object detection system &amp; blind stick for visuall...Development of wearable object detection system &amp; blind stick for visuall...
Development of wearable object detection system &amp; blind stick for visuall...
Arkadev Kundu
 
Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
creatjet3d labs
 
automatic number plate recognition
automatic number plate recognitionautomatic number plate recognition
automatic number plate recognition
Sairam Taduvai
 
Ultrasonic radar
Ultrasonic radarUltrasonic radar
Ultrasonic radar
FarhanMamun
 
Internet of Things(IoT) & Applications
Internet of Things(IoT) & ApplicationsInternet of Things(IoT) & Applications
Internet of Things(IoT) & Applications
Gunjan Panara
 
Fire Alarm System Project
Fire Alarm System ProjectFire Alarm System Project
Fire Alarm System Project
RinkuNahar
 
Coal Mine Safety Monitoring and Alerting System
Coal Mine Safety Monitoring and Alerting SystemCoal Mine Safety Monitoring and Alerting System
Coal Mine Safety Monitoring and Alerting System
IRJET Journal
 
Sensors in smartphones ( MEMS technology)
Sensors in smartphones ( MEMS technology) Sensors in smartphones ( MEMS technology)
Sensors in smartphones ( MEMS technology)
Kamal Bhagat
 
IRJET- Child Safety Wearable Device using Wireless Technology
IRJET- Child Safety Wearable Device using Wireless TechnologyIRJET- Child Safety Wearable Device using Wireless Technology
IRJET- Child Safety Wearable Device using Wireless Technology
IRJET Journal
 
Health monitoring system
Health monitoring systemHealth monitoring system
Health monitoring system
luvMahajan3
 
IRJET - Women’s Safety System using IoT
IRJET -  	  Women’s Safety System using IoTIRJET -  	  Women’s Safety System using IoT
IRJET - Women’s Safety System using IoT
IRJET Journal
 
Motion sensors powerpoint
Motion sensors powerpointMotion sensors powerpoint
Motion sensors powerpoint
Casey Corbin
 
The basics of antenna arrays
The basics of antenna arraysThe basics of antenna arrays
The basics of antenna arrays
janicetiong
 
Report of PILL CAMERA
Report of PILL CAMERAReport of PILL CAMERA
Report of PILL CAMERA
razaemohammed
 
Smart IoT Device for Vehicle Theft
Smart IoT Device for Vehicle TheftSmart IoT Device for Vehicle Theft
Smart IoT Device for Vehicle Theft
Mithileysh Sathiyanarayanan
 
ppt on accident detection system based on Iot
ppt on accident detection system based on Iotppt on accident detection system based on Iot
ppt on accident detection system based on Iot
rahul ranjan
 
NIGHT VISION TECHNOLOGY SEMINAR SLIDE
NIGHT VISION TECHNOLOGY SEMINAR SLIDENIGHT VISION TECHNOLOGY SEMINAR SLIDE
NIGHT VISION TECHNOLOGY SEMINAR SLIDE
SARJU bhatnagar
 
PATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROID
PATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROIDPATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROID
PATIENT HEALTH MONITORING SYSTEM USING IOT AND ANDROID
Journal For Research
 
Development of wearable object detection system &amp; blind stick for visuall...
Development of wearable object detection system &amp; blind stick for visuall...Development of wearable object detection system &amp; blind stick for visuall...
Development of wearable object detection system &amp; blind stick for visuall...
Arkadev Kundu
 
automatic number plate recognition
automatic number plate recognitionautomatic number plate recognition
automatic number plate recognition
Sairam Taduvai
 
Ultrasonic radar
Ultrasonic radarUltrasonic radar
Ultrasonic radar
FarhanMamun
 
Internet of Things(IoT) & Applications
Internet of Things(IoT) & ApplicationsInternet of Things(IoT) & Applications
Internet of Things(IoT) & Applications
Gunjan Panara
 
Fire Alarm System Project
Fire Alarm System ProjectFire Alarm System Project
Fire Alarm System Project
RinkuNahar
 
Coal Mine Safety Monitoring and Alerting System
Coal Mine Safety Monitoring and Alerting SystemCoal Mine Safety Monitoring and Alerting System
Coal Mine Safety Monitoring and Alerting System
IRJET Journal
 
Sensors in smartphones ( MEMS technology)
Sensors in smartphones ( MEMS technology) Sensors in smartphones ( MEMS technology)
Sensors in smartphones ( MEMS technology)
Kamal Bhagat
 
IRJET- Child Safety Wearable Device using Wireless Technology
IRJET- Child Safety Wearable Device using Wireless TechnologyIRJET- Child Safety Wearable Device using Wireless Technology
IRJET- Child Safety Wearable Device using Wireless Technology
IRJET Journal
 
Health monitoring system
Health monitoring systemHealth monitoring system
Health monitoring system
luvMahajan3
 
IRJET - Women’s Safety System using IoT
IRJET -  	  Women’s Safety System using IoTIRJET -  	  Women’s Safety System using IoT
IRJET - Women’s Safety System using IoT
IRJET Journal
 
Motion sensors powerpoint
Motion sensors powerpointMotion sensors powerpoint
Motion sensors powerpoint
Casey Corbin
 
The basics of antenna arrays
The basics of antenna arraysThe basics of antenna arrays
The basics of antenna arrays
janicetiong
 
Report of PILL CAMERA
Report of PILL CAMERAReport of PILL CAMERA
Report of PILL CAMERA
razaemohammed
 
ppt on accident detection system based on Iot
ppt on accident detection system based on Iotppt on accident detection system based on Iot
ppt on accident detection system based on Iot
rahul ranjan
 
NIGHT VISION TECHNOLOGY SEMINAR SLIDE
NIGHT VISION TECHNOLOGY SEMINAR SLIDENIGHT VISION TECHNOLOGY SEMINAR SLIDE
NIGHT VISION TECHNOLOGY SEMINAR SLIDE
SARJU bhatnagar
 

Similar to Sensors on android (20)

Android sensors
Android sensorsAndroid sensors
Android sensors
datta_jini
 
Week12.pdf
Week12.pdfWeek12.pdf
Week12.pdf
MuhammadMehran36
 
Sensors and location based services
Sensors and location based servicesSensors and location based services
Sensors and location based services
Chinmay V S
 
Sensors 9
Sensors   9Sensors   9
Sensors 9
Michael Shrove
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)
Ahsanul Karim
 
Android 1.8 sensor
Android 1.8 sensorAndroid 1.8 sensor
Android 1.8 sensor
Ahsanul Karim
 
Android Training (Sensors)
Android Training (Sensors)Android Training (Sensors)
Android Training (Sensors)
Khaled Anaqwa
 
Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013
Adam Blum
 
Tk2323 lecture 10 sensor
Tk2323 lecture 10   sensorTk2323 lecture 10   sensor
Tk2323 lecture 10 sensor
MengChun Lam
 
iwatchjr | Mobile Handset Sensors Coordinate System
iwatchjr | Mobile Handset Sensors Coordinate Systemiwatchjr | Mobile Handset Sensors Coordinate System
iwatchjr | Mobile Handset Sensors Coordinate System
iwatchjr
 
Base sensor
Base sensorBase sensor
Base sensor
Grail Papat-iw
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODEL
ijasuc
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODEL
ijasuc
 
Android Sensor
Android SensorAndroid Sensor
Android Sensor
nationalmobileapps
 
Smartphone sensor and gesture
Smartphone sensor and gestureSmartphone sensor and gesture
Smartphone sensor and gesture
Bhavya5800
 
Motion recognition with Android devices
Motion recognition with Android devicesMotion recognition with Android devices
Motion recognition with Android devices
Gabor Paller
 
Sensors and Actuators by VIRTUAL BASICS MACHINE.pptx
Sensors and Actuators by VIRTUAL BASICS MACHINE.pptxSensors and Actuators by VIRTUAL BASICS MACHINE.pptx
Sensors and Actuators by VIRTUAL BASICS MACHINE.pptx
MahalakshmiS100
 
Android Sensor System
Android Sensor SystemAndroid Sensor System
Android Sensor System
Yi-Hsiang Huang
 
Avi Itzkovitch- Designing with sensors
Avi Itzkovitch- Designing with sensorsAvi Itzkovitch- Designing with sensors
Avi Itzkovitch- Designing with sensors
inUse
 
IoT Sensors & Integration with Physical World
IoT Sensors & Integration with Physical WorldIoT Sensors & Integration with Physical World
IoT Sensors & Integration with Physical World
Mathavan N
 
Android sensors
Android sensorsAndroid sensors
Android sensors
datta_jini
 
Sensors and location based services
Sensors and location based servicesSensors and location based services
Sensors and location based services
Chinmay V S
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)
Ahsanul Karim
 
Android Training (Sensors)
Android Training (Sensors)Android Training (Sensors)
Android Training (Sensors)
Khaled Anaqwa
 
Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013
Adam Blum
 
Tk2323 lecture 10 sensor
Tk2323 lecture 10   sensorTk2323 lecture 10   sensor
Tk2323 lecture 10 sensor
MengChun Lam
 
iwatchjr | Mobile Handset Sensors Coordinate System
iwatchjr | Mobile Handset Sensors Coordinate Systemiwatchjr | Mobile Handset Sensors Coordinate System
iwatchjr | Mobile Handset Sensors Coordinate System
iwatchjr
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODEL
ijasuc
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODEL
ijasuc
 
Smartphone sensor and gesture
Smartphone sensor and gestureSmartphone sensor and gesture
Smartphone sensor and gesture
Bhavya5800
 
Motion recognition with Android devices
Motion recognition with Android devicesMotion recognition with Android devices
Motion recognition with Android devices
Gabor Paller
 
Sensors and Actuators by VIRTUAL BASICS MACHINE.pptx
Sensors and Actuators by VIRTUAL BASICS MACHINE.pptxSensors and Actuators by VIRTUAL BASICS MACHINE.pptx
Sensors and Actuators by VIRTUAL BASICS MACHINE.pptx
MahalakshmiS100
 
Avi Itzkovitch- Designing with sensors
Avi Itzkovitch- Designing with sensorsAvi Itzkovitch- Designing with sensors
Avi Itzkovitch- Designing with sensors
inUse
 
IoT Sensors & Integration with Physical World
IoT Sensors & Integration with Physical WorldIoT Sensors & Integration with Physical World
IoT Sensors & Integration with Physical World
Mathavan N
 

Recently uploaded (20)

Evaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical ContentEvaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical Content
Paul Groth
 
Measuring Microsoft 365 Copilot and Gen AI Success
Measuring Microsoft 365 Copilot and Gen AI SuccessMeasuring Microsoft 365 Copilot and Gen AI Success
Measuring Microsoft 365 Copilot and Gen AI Success
Nikki Chapple
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure ModesCognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Dr. Tathagat Varma
 
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AISAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
Peter Spielvogel
 
Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...
pranavbodhak
 
Dev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API WorkflowsDev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API Workflows
UiPathCommunity
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptxECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
Jasper Oosterveld
 
Maxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing placeMaxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing place
usersalmanrazdelhi
 
Building Agents with LangGraph & Gemini
Building Agents with LangGraph &  GeminiBuilding Agents with LangGraph &  Gemini
Building Agents with LangGraph & Gemini
HusseinMalikMammadli
 
Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025
Splunk
 
A Comprehensive Guide on Integrating Monoova Payment Gateway
A Comprehensive Guide on Integrating Monoova Payment GatewayA Comprehensive Guide on Integrating Monoova Payment Gateway
A Comprehensive Guide on Integrating Monoova Payment Gateway
danielle hunter
 
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCPMCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
Sambhav Kothari
 
Supercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMsSupercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMs
Francesco Corti
 
The 2025 Digital Adoption Blueprint.pptx
The 2025 Digital Adoption Blueprint.pptxThe 2025 Digital Adoption Blueprint.pptx
The 2025 Digital Adoption Blueprint.pptx
aptyai
 
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Aaryan Kansari
 
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
James Anderson
 
STKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 versionSTKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 version
Dr. Jimmy Schwarzkopf
 
Contributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptxContributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptx
Patrick Lumumba
 
Evaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical ContentEvaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical Content
Paul Groth
 
Measuring Microsoft 365 Copilot and Gen AI Success
Measuring Microsoft 365 Copilot and Gen AI SuccessMeasuring Microsoft 365 Copilot and Gen AI Success
Measuring Microsoft 365 Copilot and Gen AI Success
Nikki Chapple
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure ModesCognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Dr. Tathagat Varma
 
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AISAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
Peter Spielvogel
 
Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...
pranavbodhak
 
Dev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API WorkflowsDev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API Workflows
UiPathCommunity
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptxECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
Jasper Oosterveld
 
Maxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing placeMaxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing place
usersalmanrazdelhi
 
Building Agents with LangGraph & Gemini
Building Agents with LangGraph &  GeminiBuilding Agents with LangGraph &  Gemini
Building Agents with LangGraph & Gemini
HusseinMalikMammadli
 
Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025
Splunk
 
A Comprehensive Guide on Integrating Monoova Payment Gateway
A Comprehensive Guide on Integrating Monoova Payment GatewayA Comprehensive Guide on Integrating Monoova Payment Gateway
A Comprehensive Guide on Integrating Monoova Payment Gateway
danielle hunter
 
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCPMCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
Sambhav Kothari
 
Supercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMsSupercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMs
Francesco Corti
 
The 2025 Digital Adoption Blueprint.pptx
The 2025 Digital Adoption Blueprint.pptxThe 2025 Digital Adoption Blueprint.pptx
The 2025 Digital Adoption Blueprint.pptx
aptyai
 
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Aaryan Kansari
 
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
James Anderson
 
STKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 versionSTKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 version
Dr. Jimmy Schwarzkopf
 
Contributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptxContributing to WordPress With & Without Code.pptx
Contributing to WordPress With & Without Code.pptx
Patrick Lumumba
 

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