SlideShare a Scribd company logo
1 of 14
ANDROID SENSOR SYSTEM
Outline
• Sensors in Android
• SW
• Android sensor framework and implementation

• HW
• 3-axis e-compass hardware introduction

2
Sensors in Android
• Example
• Hardware
• STMicro LSM303DLHC 3-axis e-compass module
• 3-axis G-sensor (m/s2) and 3-axis M-sensor (gauss)
• 3-axis e-compass
• Using G/M-sensor data to compute heading

• Software
• Android 4.0

3
Software Architecture
Java Program

Android Framework

Sensor Library

Linux Driver
4
Java App on Android
• Android support several sensor types and provide unified
interface to control them.
• In android 4.0, there are 13 data types.
• G-sensor, M-sensor, Gyro-sensor, Light sensor, …

• Android defines several rules for app programmer
• Data polling rate
• SENSOR_DELAY_FASTEST
• SENSOR_DELAY_GAME
• SENSOR_DELAY_UI
• SENSOR_DELAY_NORMAL
• 3-axis dimension
• etc.

( 0 ms)
( 20 ms)
( 60 ms)
( 200 ms)

5
Java Program
• Classes and interface of android sensor framework
• Sensor class
• Instance of a specific sensor
• Get sensor’s capabilities

• SensorEvent class
• Instance of sensor event
• Get raw data

• SensorManager class
• Instance of sensor service
• Register/unregister, access, acquire orientation, …

• SensorEventListener interface
• Monitor sensor value/accuracy changed event
6
Sensors in Android
Framework
• Sensors in android framework
• User registers/unregisters listener for accessing sensor service
• User proposes the need for data exporting
• which sensor and data rate

• User could only get
• Static
•

Features of sensors

• Dynamic
•
•

raw data
processed information by android (eg. orientation, …)

7
Sensor Library in Android
• Sensor library provides necessary callback functions for
android to control sensors.
• Sensor manager in android framework
• Manages sensor resource for java apps
• Passes control commands and dispatches data

• In sensor library, we could implement extra features in Linux
user-space.
• Eg 1. orientation fixing
• Eg 2. For cost-down, we may use cheap sensor module. However, we
could develop some algorithm to improve its performance.

8
Callback Functions in Sensor
Library
• Callback functions should be implemented
• Open data source
• Initial the sensor library

• Close data source

Enter/Exit Sensor Library

• Exit the sensor library

• Activate
• Start/Stop sensor

• Set delay

Sensor State Setting

• Set the time interval of sensing

• Poll
• Poll all the sensors to get data

• Wake
• Stop sensor polling compulsively

Run-time Data Retrieving

9
Sensor Data Packet
• sensors_event_t structure
•
•
•
•

sensor type
timestamp
reserved
union {

}

float data[16];
sensors_vec_t acceleration; /* (m/s^2) */
sensors_vec_t magnetic; /* micro-Tesla (uT) */
sensors_vec_t orientation; /* degrees */
sensors_vec_t gyro; /* rad/s */
float temperature; /* Celsius */
float distance; /* centimeters */
float light; /* lux */
float pressure; /* hPa */
float relative_humidity; /* percent */
sensors_vec_t : union of (x,y,z), (azimuth, roll, pitch)

10
LSM303DLHC 3-axis ECompass
• Control hardware module and get data with I2C bus.
• G-sensor
• Two interrupt line for special situation
• Output data rate
• Output data range

• M-sensor
• Output data rate
• Output data range
• Enable/disable temperature exporting

11
Heading Computation

Xb

Yb
Zb

G-sensor

M-sensor

12
3-axis E-Compass Calibration
3-axis e-compass may not get right azimuth data
◦ Misalignment
◦ Magnetometer
 Hard-iron distortion
 It is a constant additive value to the output of each of the
magnetometer axes.
 Soft-iron distortion
 Soft-iron distortion cannot be compensated with a simple constant;
instead, a more complicated procedure is required.

Calibration sequence is related to hardware
13
Calibration for LSM303DLHC
• Accelerometer
• All ST MEMS accelerometers are factory calibrated, allowing the
user to avoid any further calibration for most of the applications
now present in the market.
• Calibration Matrix :

cal data

raw data

14

More Related Content

What's hot

Android sensors
Android sensorsAndroid sensors
Android sensors
datta_jini
 

What's hot (10)

Android sensors
Android sensorsAndroid sensors
Android sensors
 
Smartphone sensor and gesture
Smartphone sensor and gestureSmartphone sensor and gesture
Smartphone sensor and gesture
 
Mebin progress
Mebin progressMebin progress
Mebin progress
 
Fire fighting robot using 8051 microcontroller
Fire fighting robot using 8051 microcontrollerFire fighting robot using 8051 microcontroller
Fire fighting robot using 8051 microcontroller
 
Motion sensing and detection
Motion sensing and detectionMotion sensing and detection
Motion sensing and detection
 
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
 
Syn ankit
Syn ankitSyn ankit
Syn ankit
 
Missile detection and automatic destroy system
Missile detection and automatic destroy system Missile detection and automatic destroy system
Missile detection and automatic destroy system
 
Plant Conditioner - Humidity, Light intensity,& Temperature measurement tools
Plant Conditioner - Humidity, Light intensity,& Temperature measurement toolsPlant Conditioner - Humidity, Light intensity,& Temperature measurement tools
Plant Conditioner - Humidity, Light intensity,& Temperature measurement tools
 
Phys204 class project_final_b_cooper
Phys204 class project_final_b_cooperPhys204 class project_final_b_cooper
Phys204 class project_final_b_cooper
 

Viewers also liked

Environmental Sensor Network Paper
Environmental Sensor Network PaperEnvironmental Sensor Network Paper
Environmental Sensor Network Paper
Zoey Y. Kang
 
Chapter 5 ms access-1
Chapter 5   ms access-1Chapter 5   ms access-1
Chapter 5 ms access-1
Pratik Gupta
 

Viewers also liked (20)

Android - Sensor Manager
Android - Sensor ManagerAndroid - Sensor Manager
Android - Sensor Manager
 
Environmental Sensor Network Paper
Environmental Sensor Network PaperEnvironmental Sensor Network Paper
Environmental Sensor Network Paper
 
Review Paper on Smart Sensor Network for Air Quality Monitoring
Review Paper on Smart Sensor Network for Air Quality MonitoringReview Paper on Smart Sensor Network for Air Quality Monitoring
Review Paper on Smart Sensor Network for Air Quality Monitoring
 
GPS
GPSGPS
GPS
 
湘南ミーティングChallenges for Real-time Activity Recognition報告
湘南ミーティングChallenges for Real-time Activity Recognition報告湘南ミーティングChallenges for Real-time Activity Recognition報告
湘南ミーティングChallenges for Real-time Activity Recognition報告
 
Sensors 9
Sensors   9Sensors   9
Sensors 9
 
Sensor Cloud Infrastructure - Small Survey Report
Sensor Cloud Infrastructure - Small Survey ReportSensor Cloud Infrastructure - Small Survey Report
Sensor Cloud Infrastructure - Small Survey Report
 
Kernel Recipes 2015 - The Dronecode Project – A step in open source drones
Kernel Recipes 2015 - The Dronecode Project – A step in open source dronesKernel Recipes 2015 - The Dronecode Project – A step in open source drones
Kernel Recipes 2015 - The Dronecode Project – A step in open source drones
 
Android training (android style)
Android training (android style)Android training (android style)
Android training (android style)
 
Android Training (Broadcast Receiver)
Android Training (Broadcast Receiver)Android Training (Broadcast Receiver)
Android Training (Broadcast Receiver)
 
Android Training (android fundamental)
Android Training (android fundamental)Android Training (android fundamental)
Android Training (android fundamental)
 
Android Training (Touch)
Android Training (Touch)Android Training (Touch)
Android Training (Touch)
 
Android Training (Services)
Android Training (Services)Android Training (Services)
Android Training (Services)
 
Android Training (ScrollView , Horizontal ScrollView WebView)
Android Training (ScrollView , Horizontal ScrollView  WebView)Android Training (ScrollView , Horizontal ScrollView  WebView)
Android Training (ScrollView , Horizontal ScrollView WebView)
 
Android Training (Notifications)
Android Training (Notifications)Android Training (Notifications)
Android Training (Notifications)
 
Spattern matching using biometric techniques
Spattern matching using biometric techniquesSpattern matching using biometric techniques
Spattern matching using biometric techniques
 
Chapter 5 ms access-1
Chapter 5   ms access-1Chapter 5   ms access-1
Chapter 5 ms access-1
 
Android internals 09 - Sensors, Power Management, Input subsystem, Data stora...
Android internals 09 - Sensors, Power Management, Input subsystem, Data stora...Android internals 09 - Sensors, Power Management, Input subsystem, Data stora...
Android internals 09 - Sensors, Power Management, Input subsystem, Data stora...
 
Seminar Report on RFID Based Trackin System
Seminar Report on RFID Based Trackin SystemSeminar Report on RFID Based Trackin System
Seminar Report on RFID Based Trackin System
 
Android HAL Introduction: libhardware and its legacy
Android HAL Introduction: libhardware and its legacyAndroid HAL Introduction: libhardware and its legacy
Android HAL Introduction: libhardware and its legacy
 

Similar to Android Sensor System

Class5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptxClass5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptx
HebaEng
 
An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...
An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...
An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...
Andreas Triantafyllidis
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
eleksdev
 

Similar to Android Sensor System (20)

Primary mirror edge sensor project for the Southern African Large Telescope
Primary mirror edge sensor project for the Southern African Large TelescopePrimary mirror edge sensor project for the Southern African Large Telescope
Primary mirror edge sensor project for the Southern African Large Telescope
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)
 
Week12.pdf
Week12.pdfWeek12.pdf
Week12.pdf
 
Hello I hope you are doing well Would you be able to combi.pdf
Hello I hope you are doing well Would you be able to combi.pdfHello I hope you are doing well Would you be able to combi.pdf
Hello I hope you are doing well Would you be able to combi.pdf
 
Open Source Smartphone Libraries for Computational Social Science
Open Source Smartphone Libraries for Computational Social Science Open Source Smartphone Libraries for Computational Social Science
Open Source Smartphone Libraries for Computational Social Science
 
Track 4 session 3 - st dev con 2016 - pedestrian dead reckoning
Track 4   session 3 - st dev con 2016 - pedestrian dead reckoningTrack 4   session 3 - st dev con 2016 - pedestrian dead reckoning
Track 4 session 3 - st dev con 2016 - pedestrian dead reckoning
 
Project_Objectives
Project_ObjectivesProject_Objectives
Project_Objectives
 
Phil Day [Configured Things] | Policy-Driven Real-Time Data Filtering from Io...
Phil Day [Configured Things] | Policy-Driven Real-Time Data Filtering from Io...Phil Day [Configured Things] | Policy-Driven Real-Time Data Filtering from Io...
Phil Day [Configured Things] | Policy-Driven Real-Time Data Filtering from Io...
 
Class5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptxClass5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptx
 
Virtual Twins: Modeling Trends and Challenges Ahead
Virtual Twins: Modeling Trends and Challenges AheadVirtual Twins: Modeling Trends and Challenges Ahead
Virtual Twins: Modeling Trends and Challenges Ahead
 
An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...
An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...
An Open And Reconfigurable Wireless Sensor Network For Pervasive Health Monit...
 
LWM2M Introduction - Edinburgh 2016 Workshop with ARM
LWM2M Introduction - Edinburgh 2016 Workshop with ARMLWM2M Introduction - Edinburgh 2016 Workshop with ARM
LWM2M Introduction - Edinburgh 2016 Workshop with ARM
 
The Design of Multi-Platforms Rail Intelligence Flatness Detection System
The Design of Multi-Platforms Rail Intelligence Flatness Detection SystemThe Design of Multi-Platforms Rail Intelligence Flatness Detection System
The Design of Multi-Platforms Rail Intelligence Flatness Detection System
 
MPU-6050_RF24L01
MPU-6050_RF24L01MPU-6050_RF24L01
MPU-6050_RF24L01
 
Portfolio
PortfolioPortfolio
Portfolio
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
 
Unit i
Unit iUnit i
Unit i
 
Native container monitoring
Native container monitoringNative container monitoring
Native container monitoring
 
Native Container Monitoring
Native Container MonitoringNative Container Monitoring
Native Container Monitoring
 
Education set for collecting and visualizing data using sensor system based o...
Education set for collecting and visualizing data using sensor system based o...Education set for collecting and visualizing data using sensor system based o...
Education set for collecting and visualizing data using sensor system based o...
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Android Sensor System

  • 2. Outline • Sensors in Android • SW • Android sensor framework and implementation • HW • 3-axis e-compass hardware introduction 2
  • 3. Sensors in Android • Example • Hardware • STMicro LSM303DLHC 3-axis e-compass module • 3-axis G-sensor (m/s2) and 3-axis M-sensor (gauss) • 3-axis e-compass • Using G/M-sensor data to compute heading • Software • Android 4.0 3
  • 4. Software Architecture Java Program Android Framework Sensor Library Linux Driver 4
  • 5. Java App on Android • Android support several sensor types and provide unified interface to control them. • In android 4.0, there are 13 data types. • G-sensor, M-sensor, Gyro-sensor, Light sensor, … • Android defines several rules for app programmer • Data polling rate • SENSOR_DELAY_FASTEST • SENSOR_DELAY_GAME • SENSOR_DELAY_UI • SENSOR_DELAY_NORMAL • 3-axis dimension • etc. ( 0 ms) ( 20 ms) ( 60 ms) ( 200 ms) 5
  • 6. Java Program • Classes and interface of android sensor framework • Sensor class • Instance of a specific sensor • Get sensor’s capabilities • SensorEvent class • Instance of sensor event • Get raw data • SensorManager class • Instance of sensor service • Register/unregister, access, acquire orientation, … • SensorEventListener interface • Monitor sensor value/accuracy changed event 6
  • 7. Sensors in Android Framework • Sensors in android framework • User registers/unregisters listener for accessing sensor service • User proposes the need for data exporting • which sensor and data rate • User could only get • Static • Features of sensors • Dynamic • • raw data processed information by android (eg. orientation, …) 7
  • 8. Sensor Library in Android • Sensor library provides necessary callback functions for android to control sensors. • Sensor manager in android framework • Manages sensor resource for java apps • Passes control commands and dispatches data • In sensor library, we could implement extra features in Linux user-space. • Eg 1. orientation fixing • Eg 2. For cost-down, we may use cheap sensor module. However, we could develop some algorithm to improve its performance. 8
  • 9. Callback Functions in Sensor Library • Callback functions should be implemented • Open data source • Initial the sensor library • Close data source Enter/Exit Sensor Library • Exit the sensor library • Activate • Start/Stop sensor • Set delay Sensor State Setting • Set the time interval of sensing • Poll • Poll all the sensors to get data • Wake • Stop sensor polling compulsively Run-time Data Retrieving 9
  • 10. Sensor Data Packet • sensors_event_t structure • • • • sensor type timestamp reserved union { } float data[16]; sensors_vec_t acceleration; /* (m/s^2) */ sensors_vec_t magnetic; /* micro-Tesla (uT) */ sensors_vec_t orientation; /* degrees */ sensors_vec_t gyro; /* rad/s */ float temperature; /* Celsius */ float distance; /* centimeters */ float light; /* lux */ float pressure; /* hPa */ float relative_humidity; /* percent */ sensors_vec_t : union of (x,y,z), (azimuth, roll, pitch) 10
  • 11. LSM303DLHC 3-axis ECompass • Control hardware module and get data with I2C bus. • G-sensor • Two interrupt line for special situation • Output data rate • Output data range • M-sensor • Output data rate • Output data range • Enable/disable temperature exporting 11
  • 13. 3-axis E-Compass Calibration 3-axis e-compass may not get right azimuth data ◦ Misalignment ◦ Magnetometer  Hard-iron distortion  It is a constant additive value to the output of each of the magnetometer axes.  Soft-iron distortion  Soft-iron distortion cannot be compensated with a simple constant; instead, a more complicated procedure is required. Calibration sequence is related to hardware 13
  • 14. Calibration for LSM303DLHC • Accelerometer • All ST MEMS accelerometers are factory calibrated, allowing the user to avoid any further calibration for most of the applications now present in the market. • Calibration Matrix : cal data raw data 14