SlideShare a Scribd company logo
1 of 35
Designing An Android
 Sensor Subsystem


 Pitfalls and Considerations

        Jen Costillo
     jen@rebelbot.com
Simple Choices
               User                          Battery
            experience                     performance




7/15/2012           Costillo- OSCON 2012                 2
Established
                  or Innovative Product?
            Established                       Innovation-Driven
            • Will I be making another        • Do I have new sensors
               new product in 6                  types?
               months?                        • Are features more
            • Is the reference design            important than release
               considered good enough            date?
               for the application?           • Are money and
                                                 resources no
                                                 problem?



7/15/2012                       Costillo- OSCON 2012                      3
Forsaking Reference Designs




7/15/2012            Costillo- OSCON 2012   4
Going On Your Own
      • If you make your own,                  • But…
            – You’re on your own                    – power ↓
            – Integration pains                     – Control code size
            – Test time ↑                           – Control mechanical
            – Gesture testing                         footprint
              becomes a challenge                   – In-house expertise
            – Calibration blues
            – Larger mechanical
              footprint



7/15/2012                    Costillo- OSCON 2012                          5
Android Universe
                   Android Application                        Application
                      SensorManager
                                                              Frameworks
                          Sensor JNI
             Sensor Service      Sensor Manager
                                                               Libraries
                          Sensor HAL

            Interface Kernel
                 Driver
                                  Sensor Driver               Linux Kernel

            Sensor Hub/
            Coprocessor          Sensors                       Hardware
7/15/2012                              Costillo- OSCON 2012                  6
Application

                                          Frameworks


                                           Libraries


                                          Linux Kernel
            HARDWARE
                                           Hardware

7/15/2012          Costillo- OSCON 2012                  7
Hardware Architecture




7/15/2012          Costillo- OSCON 2012   8
Sampling Rates:
                                The 3 Rates
            Under-sampling                                  Over-sampling
            • Inaccurate, sluggish                          • Accurate, smooth
              response                                        response
            • Slight power savings                          • Power-hungry




                                     Sampling
                                       Rate




7/15/2012                            Costillo- OSCON 2012                        9
Wake up events and power
                    considerations
            Application           Internal                External
            Processor only        Coprocessor             Processor


                     D                     C
            Reference supported   Reference supported     More processor selection
            Most power hungry     Most work done for      More outcome control
                                  you                     Most customized
                                                          Footprint impact




7/15/2012                          Costillo- OSCON 2012                              10
Hardware Summary

                 Power                Latency =
             Consumption            Max(sensorsn)
                                                       Sensor
             = Σ sensorsn +          + dedicated
                                                      Solution
             any dedicated           processing
               processor                time




            • Use tie-breaker criteria




7/15/2012                      Costillo- OSCON 2012              11
Application

                                            Frameworks


                                             Libraries


                                            Linux Kernel
            KERNEL
                                             Hardware

7/15/2012            Costillo- OSCON 2012                  12
Kernel Driver
                      Application Processor


                       Peripheral                       Shared
                        Interface                       Memory




            Microcontroller       Sensor             Coprocessor


7/15/2012                     Costillo- OSCON 2012                 13
Application

                                         Frameworks


                                          Libraries


                                         Linux Kernel
        LIBRARIES AND
        SERVICES                          Hardware

7/15/2012         Costillo- OSCON 2012                  14
Sensor HAL and Services
  • HAL
       device/<vendor>/<board name>/libsensors


  • Service
       frameworks/base/services/sensorservice


  • Manager
       frameworks/base/libs/gui

7/15/2012            Costillo- OSCON 2012
                                                 15
Sensor Fusion

                                                                      Libraries

                                                                     Linux Kernel

                                                                     Sensor Hub


                                                                       Sensors
      http://en.wikipedia.org/wiki/Sensor_fusion
      https://www.llnl.gov/news/newsreleases/2010/NR-10-01-06.html
7/15/2012                                 Costillo- OSCON 2012                      16
Gesture Detection Algorithm
            Application                          Android
            Processor                          SensorService



                                                       Co-
            Sensor Hub                              Processor



            Sensors       MPU with
                                                    Barometer   Proximity
                          Gyro/Accel



                          Compass


7/15/2012                    Costillo- OSCON 2012                           17
Gesture Detection Comparison

              Make                Buy
                                                                      Application
                                                                      • Powerful processor
                                  Minimal
            Off-load AppPro
                              Schedule Impact

               In-house       Already Tested
               expertise          &tuned

                                 Complete
            Compact code
                                  solution           Sensor hub
                                                     • Off-load to cheaper
                                                       power
                                                     • Wake up Event
                                                       Handling


7/15/2012                         Costillo- OSCON 2012                                  18
Calibration




                         Use of Calibration Gesture in the
                         Compass App By Catch.com
7/15/2012                                                    19
             Costillo- OSCON 2012
Application

                                       Frameworks


                                        Libraries


                                       Linux Kernel
        FRAMEWORKS
                                        Hardware

7/15/2012       Costillo- OSCON 2012                  20
Virtual Sensors
       • Leverages 1+ physical or other virtual
         sensors
       • Multiple Options
            – Google (version 3)
            – Reference Vendor
            – Sensor Vendors



7/15/2012                 Costillo- OSCON 2012   21
Android Virtual Sensors


                            Accel            Gravity




            Gravity         Linear            Accel
                            Accel


7/15/2012             Costillo- OSCON 2012             22
Android Virtual Sensors


            Gyro             Accel           Orientation




            Compass          Accel           Rotation



7/15/2012             Costillo- OSCON 2012                 23
Virtual Sensors Challenges
                                                        Sensor
                                                          1
        • Garbage In- Garbage Out
        • Latency                                       Sensor             Virtual
                                                          2                Output
        • Non-Synchronized
          samples                                       Sensor
                                                          1
        • Implementation                                         Virtual
          Dependencies                                              1

        • Multi-vendor problems,                        Sensor             Virtual
                                                          2                   2
          verify Vendor ID
       http://www.invensense.com/midc/presentations/James%20Lim.pdf
7/15/2012                        Costillo- OSCON 2012                          24
Application

                                        Frameworks


                                         Libraries


                                        Linux Kernel
        APPLICATIONS
                                         Hardware

7/15/2012        Costillo- OSCON 2012                  25
Using Sensors
        mSensorManager =
          getSystemService(Context.SENSOR_SERVICE);
        mSensorManager.registerListener(
          mSensorListener,
          mSensorManager.getDefaultSensor(
              Sensor.TYPE_ACCELEROMETER),
          SensorManager.SENSOR_DELAY_NORMAL);

        void onSensorChanged(SensorEvent event) {
            // get sensor data
            float x =
          event.values[SensorManager.DATA_X];
        }
7/15/2012               Costillo- OSCON 2012          26
Using Sensor (Continued)
       SensorManager.getRotationMatrix(
         m_rotationMatrix,
         null,
         m_Mag,
         m_Accels);
       SensorManager.getOrientation(
         m_rotationMatrix,
         m_orientation);

            float yaw_deg = m_orientation[0] * 57.2957795f;
            float pitch_deg = m_orientation[1] * 57.2957795f;
            float roll_deg = m_orientation[2] * 57.2957795f;



7/15/2012                    Costillo- OSCON 2012               27
Types of Sensor Problems
        •   Bias
        •   Drift
        •   Settling Time
        •   Jitter/Noise
        •   Environmental
            Interference



7/15/2012               Costillo- OSCON 2012   28
Bias
        • Problem: Data is off
          by a constant value.
        • Sources:
            – static calibration
              failure
        • Solutions:
            – Calculate linear
              offset at start of
              application
            – Recalibrate locally

7/15/2012                     Costillo- OSCON 2012   29
Drift
      • Problem: Shift of
        data without cause
      • Sources:
            – Magnetic
              interference
            – Poor HW calibration
      • Solutions:
            – Increase smoothing
              techniques


7/15/2012                     Costillo- OSCON 2012   30
Settling Time
            • Problem: Extended
              time before
              finalized steady
              data.
            • Sources:
               – Latency
               – Sensitivity
            • Solutions:
               – Limit additional
                 processing


7/15/2012                       Costillo- OSCON 2012   31
Noise
            • Problem: Data jumps
              around constantly
            • Sources:
               – Sensor
               – Calibration
               – Poor filtering
            • Solutions:
               – High pass filter
               – Linear averaging
               – FFT
7/15/2012                   Costillo- OSCON 2012   32
Environmental Interference
            • Problem: Inconsistent
              results
            • Sources:
               – Magnetometer
               – EMI
            • Solutions:
               – Reference Device
               – Calibration gesture




7/15/2012                       Costillo- OSCON 2012   33
Best Practices in
             Application Development
        • Select the right sensor for the job.
        • Use the Correct Data Rate.
            – UI or GAMING are the most common.
        • Use Sensor In Context
        • Customize for your hardware and system
          capabilities
        • Magnetometer-based sensors are the most
          touchy.
        • Keep the Gesture UI simple.
7/15/2012                  Costillo- OSCON 2012     34
QUESTIONS?
              JEN@REBELBOT.COM




    Additional resources
    http://processors.wiki.ti.com/index.php/Android_Sensor_PortingGuide
    http://www.kandroid.org/online-pdk/guide/sensors.html
    http://invensense.com/midc/
    http://developer.android.com/reference/android/hardware/SensorEvent.html

7/15/2012                      Costillo- OSCON 2012                      35

More Related Content

Similar to Designing An Android Sensor Subsystem and Solving Common Sensor Problems

Introduction to OSLC and Linked Data
Introduction to OSLC and Linked DataIntroduction to OSLC and Linked Data
Introduction to OSLC and Linked Dataopenservices
 
Software engineering principles in system software design
Software engineering principles in system software designSoftware engineering principles in system software design
Software engineering principles in system software designTech_MX
 
Micro Focus COBOL Product Strategy & Roadmap
Micro Focus COBOL Product Strategy & RoadmapMicro Focus COBOL Product Strategy & Roadmap
Micro Focus COBOL Product Strategy & RoadmapMicro Focus
 
4 metals workshop igor quintao
4   metals workshop igor quintao4   metals workshop igor quintao
4 metals workshop igor quintaoGE_Energy
 
Discover problems in your distributed system before it's too late
Discover problems in your distributed system before it's too lateDiscover problems in your distributed system before it's too late
Discover problems in your distributed system before it's too lateReal-Time Innovations (RTI)
 
Bringing RFID to Electronics with Monza X RFID Chips
Bringing RFID to Electronics with Monza X RFID ChipsBringing RFID to Electronics with Monza X RFID Chips
Bringing RFID to Electronics with Monza X RFID ChipsImpinj RFID
 
Embedded system
Embedded systemEmbedded system
Embedded systemzdyhit
 
Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)Egor Elizarov
 
FUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGN
FUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGNFUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGN
FUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGNPankaj Singh
 
S3 Group: Customized SoC Solutions
S3 Group: Customized SoC Solutions S3 Group: Customized SoC Solutions
S3 Group: Customized SoC Solutions S3 Group
 
Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...
Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...
Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...Nesma
 
Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...
Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...
Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...Christian Gügi
 
Rocketick accelerated verilog simulations
Rocketick  accelerated verilog simulationsRocketick  accelerated verilog simulations
Rocketick accelerated verilog simulationschiportal
 
Monitoring of Web Applications and GlassFish for Performance and Availability...
Monitoring of Web Applications and GlassFish for Performance and Availability...Monitoring of Web Applications and GlassFish for Performance and Availability...
Monitoring of Web Applications and GlassFish for Performance and Availability...SL Corporation
 
GeneXus en Mitsubishi Heavy Industries (MHI) – Japón
GeneXus en Mitsubishi Heavy Industries (MHI) – JapónGeneXus en Mitsubishi Heavy Industries (MHI) – Japón
GeneXus en Mitsubishi Heavy Industries (MHI) – JapónGeneXus
 
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)Egor Elizarov
 
regmap: The power of subsystems and abstractions
regmap: The power of subsystems and abstractionsregmap: The power of subsystems and abstractions
regmap: The power of subsystems and abstractionsMark Brown
 
Sunrise Presentation, Company Overview 2012
Sunrise Presentation, Company Overview 2012Sunrise Presentation, Company Overview 2012
Sunrise Presentation, Company Overview 2012jvangombos
 

Similar to Designing An Android Sensor Subsystem and Solving Common Sensor Problems (20)

Introduction to OSLC and Linked Data
Introduction to OSLC and Linked DataIntroduction to OSLC and Linked Data
Introduction to OSLC and Linked Data
 
Software engineering principles in system software design
Software engineering principles in system software designSoftware engineering principles in system software design
Software engineering principles in system software design
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Micro Focus COBOL Product Strategy & Roadmap
Micro Focus COBOL Product Strategy & RoadmapMicro Focus COBOL Product Strategy & Roadmap
Micro Focus COBOL Product Strategy & Roadmap
 
4 metals workshop igor quintao
4   metals workshop igor quintao4   metals workshop igor quintao
4 metals workshop igor quintao
 
Discover problems in your distributed system before it's too late
Discover problems in your distributed system before it's too lateDiscover problems in your distributed system before it's too late
Discover problems in your distributed system before it's too late
 
Bringing RFID to Electronics with Monza X RFID Chips
Bringing RFID to Electronics with Monza X RFID ChipsBringing RFID to Electronics with Monza X RFID Chips
Bringing RFID to Electronics with Monza X RFID Chips
 
Embedded system
Embedded systemEmbedded system
Embedded system
 
Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)
 
FUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGN
FUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGNFUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGN
FUSION APU & TRENDS/ CHALLENGES IN FUTURE SoC DESIGN
 
S3 Group: Customized SoC Solutions
S3 Group: Customized SoC Solutions S3 Group: Customized SoC Solutions
S3 Group: Customized SoC Solutions
 
Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...
Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...
Estimating packaged software - Eric van der Vliet - NESMA najaarsbijeenkomst ...
 
Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...
Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...
Using HBase Coprocessors to implement Prospective Search - Berlin Buzzwords -...
 
Rocketick accelerated verilog simulations
Rocketick  accelerated verilog simulationsRocketick  accelerated verilog simulations
Rocketick accelerated verilog simulations
 
Monitoring of Web Applications and GlassFish for Performance and Availability...
Monitoring of Web Applications and GlassFish for Performance and Availability...Monitoring of Web Applications and GlassFish for Performance and Availability...
Monitoring of Web Applications and GlassFish for Performance and Availability...
 
GeneXus en Mitsubishi Heavy Industries (MHI) – Japón
GeneXus en Mitsubishi Heavy Industries (MHI) – JapónGeneXus en Mitsubishi Heavy Industries (MHI) – Japón
GeneXus en Mitsubishi Heavy Industries (MHI) – Japón
 
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
 
regmap: The power of subsystems and abstractions
regmap: The power of subsystems and abstractionsregmap: The power of subsystems and abstractions
regmap: The power of subsystems and abstractions
 
Sunrise Presentation, Company Overview 2012
Sunrise Presentation, Company Overview 2012Sunrise Presentation, Company Overview 2012
Sunrise Presentation, Company Overview 2012
 
Sunrise presentation
Sunrise presentationSunrise presentation
Sunrise presentation
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
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
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
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
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Designing An Android Sensor Subsystem and Solving Common Sensor Problems

  • 1. Designing An Android Sensor Subsystem Pitfalls and Considerations Jen Costillo jen@rebelbot.com
  • 2. Simple Choices User Battery experience performance 7/15/2012 Costillo- OSCON 2012 2
  • 3. Established or Innovative Product? Established Innovation-Driven • Will I be making another • Do I have new sensors new product in 6 types? months? • Are features more • Is the reference design important than release considered good enough date? for the application? • Are money and resources no problem? 7/15/2012 Costillo- OSCON 2012 3
  • 4. Forsaking Reference Designs 7/15/2012 Costillo- OSCON 2012 4
  • 5. Going On Your Own • If you make your own, • But… – You’re on your own – power ↓ – Integration pains – Control code size – Test time ↑ – Control mechanical – Gesture testing footprint becomes a challenge – In-house expertise – Calibration blues – Larger mechanical footprint 7/15/2012 Costillo- OSCON 2012 5
  • 6. Android Universe Android Application Application SensorManager Frameworks Sensor JNI Sensor Service Sensor Manager Libraries Sensor HAL Interface Kernel Driver Sensor Driver Linux Kernel Sensor Hub/ Coprocessor Sensors Hardware 7/15/2012 Costillo- OSCON 2012 6
  • 7. Application Frameworks Libraries Linux Kernel HARDWARE Hardware 7/15/2012 Costillo- OSCON 2012 7
  • 8. Hardware Architecture 7/15/2012 Costillo- OSCON 2012 8
  • 9. Sampling Rates: The 3 Rates Under-sampling Over-sampling • Inaccurate, sluggish • Accurate, smooth response response • Slight power savings • Power-hungry Sampling Rate 7/15/2012 Costillo- OSCON 2012 9
  • 10. Wake up events and power considerations Application Internal External Processor only Coprocessor Processor D C Reference supported Reference supported More processor selection Most power hungry Most work done for More outcome control you Most customized Footprint impact 7/15/2012 Costillo- OSCON 2012 10
  • 11. Hardware Summary Power Latency = Consumption Max(sensorsn) Sensor = Σ sensorsn + + dedicated Solution any dedicated processing processor time • Use tie-breaker criteria 7/15/2012 Costillo- OSCON 2012 11
  • 12. Application Frameworks Libraries Linux Kernel KERNEL Hardware 7/15/2012 Costillo- OSCON 2012 12
  • 13. Kernel Driver Application Processor Peripheral Shared Interface Memory Microcontroller Sensor Coprocessor 7/15/2012 Costillo- OSCON 2012 13
  • 14. Application Frameworks Libraries Linux Kernel LIBRARIES AND SERVICES Hardware 7/15/2012 Costillo- OSCON 2012 14
  • 15. Sensor HAL and Services • HAL device/<vendor>/<board name>/libsensors • Service frameworks/base/services/sensorservice • Manager frameworks/base/libs/gui 7/15/2012 Costillo- OSCON 2012 15
  • 16. Sensor Fusion Libraries Linux Kernel Sensor Hub Sensors http://en.wikipedia.org/wiki/Sensor_fusion https://www.llnl.gov/news/newsreleases/2010/NR-10-01-06.html 7/15/2012 Costillo- OSCON 2012 16
  • 17. Gesture Detection Algorithm Application Android Processor SensorService Co- Sensor Hub Processor Sensors MPU with Barometer Proximity Gyro/Accel Compass 7/15/2012 Costillo- OSCON 2012 17
  • 18. Gesture Detection Comparison Make Buy Application • Powerful processor Minimal Off-load AppPro Schedule Impact In-house Already Tested expertise &tuned Complete Compact code solution Sensor hub • Off-load to cheaper power • Wake up Event Handling 7/15/2012 Costillo- OSCON 2012 18
  • 19. Calibration Use of Calibration Gesture in the Compass App By Catch.com 7/15/2012 19 Costillo- OSCON 2012
  • 20. Application Frameworks Libraries Linux Kernel FRAMEWORKS Hardware 7/15/2012 Costillo- OSCON 2012 20
  • 21. Virtual Sensors • Leverages 1+ physical or other virtual sensors • Multiple Options – Google (version 3) – Reference Vendor – Sensor Vendors 7/15/2012 Costillo- OSCON 2012 21
  • 22. Android Virtual Sensors Accel Gravity Gravity Linear Accel Accel 7/15/2012 Costillo- OSCON 2012 22
  • 23. Android Virtual Sensors Gyro Accel Orientation Compass Accel Rotation 7/15/2012 Costillo- OSCON 2012 23
  • 24. Virtual Sensors Challenges Sensor 1 • Garbage In- Garbage Out • Latency Sensor Virtual 2 Output • Non-Synchronized samples Sensor 1 • Implementation Virtual Dependencies 1 • Multi-vendor problems, Sensor Virtual 2 2 verify Vendor ID http://www.invensense.com/midc/presentations/James%20Lim.pdf 7/15/2012 Costillo- OSCON 2012 24
  • 25. Application Frameworks Libraries Linux Kernel APPLICATIONS Hardware 7/15/2012 Costillo- OSCON 2012 25
  • 26. Using Sensors mSensorManager = getSystemService(Context.SENSOR_SERVICE); mSensorManager.registerListener( mSensorListener, mSensorManager.getDefaultSensor( Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL); void onSensorChanged(SensorEvent event) { // get sensor data float x = event.values[SensorManager.DATA_X]; } 7/15/2012 Costillo- OSCON 2012 26
  • 27. Using Sensor (Continued) SensorManager.getRotationMatrix( m_rotationMatrix, null, m_Mag, m_Accels); SensorManager.getOrientation( m_rotationMatrix, m_orientation); float yaw_deg = m_orientation[0] * 57.2957795f; float pitch_deg = m_orientation[1] * 57.2957795f; float roll_deg = m_orientation[2] * 57.2957795f; 7/15/2012 Costillo- OSCON 2012 27
  • 28. Types of Sensor Problems • Bias • Drift • Settling Time • Jitter/Noise • Environmental Interference 7/15/2012 Costillo- OSCON 2012 28
  • 29. Bias • Problem: Data is off by a constant value. • Sources: – static calibration failure • Solutions: – Calculate linear offset at start of application – Recalibrate locally 7/15/2012 Costillo- OSCON 2012 29
  • 30. Drift • Problem: Shift of data without cause • Sources: – Magnetic interference – Poor HW calibration • Solutions: – Increase smoothing techniques 7/15/2012 Costillo- OSCON 2012 30
  • 31. Settling Time • Problem: Extended time before finalized steady data. • Sources: – Latency – Sensitivity • Solutions: – Limit additional processing 7/15/2012 Costillo- OSCON 2012 31
  • 32. Noise • Problem: Data jumps around constantly • Sources: – Sensor – Calibration – Poor filtering • Solutions: – High pass filter – Linear averaging – FFT 7/15/2012 Costillo- OSCON 2012 32
  • 33. Environmental Interference • Problem: Inconsistent results • Sources: – Magnetometer – EMI • Solutions: – Reference Device – Calibration gesture 7/15/2012 Costillo- OSCON 2012 33
  • 34. Best Practices in Application Development • Select the right sensor for the job. • Use the Correct Data Rate. – UI or GAMING are the most common. • Use Sensor In Context • Customize for your hardware and system capabilities • Magnetometer-based sensors are the most touchy. • Keep the Gesture UI simple. 7/15/2012 Costillo- OSCON 2012 34
  • 35. QUESTIONS? JEN@REBELBOT.COM Additional resources http://processors.wiki.ti.com/index.php/Android_Sensor_PortingGuide http://www.kandroid.org/online-pdk/guide/sensors.html http://invensense.com/midc/ http://developer.android.com/reference/android/hardware/SensorEvent.html 7/15/2012 Costillo- OSCON 2012 35