Code Monkey home page Code Monkey logo

android-accelerometer's Introduction

Android accelerometer

An example app that uses a digital filter to detect shaking the device

Usage

When you open the app, you'll see the live values from the device's embedded accelerometer. Below the digital display is an analog bar. When you gently shake the device from side to side (X-axis) the analog bar will fill, showing full when consistent shaking is detected. The bar will not show full when the device is merely tapped.

Notes

This project was started in early 2010, in response to a SO question regarding detecting shake via the embedded accelerometer. I found many of the answers unsatisfactory, as they were based on empirical timing, loops, and averaging. From my engineering background I thought this would be better solved as a signal processing problem. The basic idea was to use a bandpass filter to detect energies in the shake frequency ranges.

I searched online to refresh my mind on DSP principles. I found a really good source that covered it comprehensively. In particular, one chapter covered bandpass and notch filters, with the recurrence equations and parameter computations. To aid in the computations, I created a simple spreadsheet, which would help in adjusting the coefficients.

The sensor list is technically not part of the digital filter code. I found it useful for looking up the details of the available sensors, which vary by device type. On Motorola XT1080, the accelerometer is LIS3DH 3-axis Accelerometer.

Building and running

The source contains IntelliJ files to facilitate using that IDE. It should be good to go if you have IntelliJ and the Android SDK configured.

android-accelerometer's People

Contributors

fweiss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.