Shake! Icon

Shake!

Accelerometer Filtering Example

Shake! is a re-imagining of Apple's AccelerometerGraph demonstration App. Shake! is only available as source code only from GitHub, and is not on the iTunes store.

The program features per axis configuration that includes several different signal sources and filters that are not present in AccelerometerGraph, as well as an RMS based level detector.

Shake! is only available as source code from GitHub, and you can find out more about it on my blog.

The design goals I had for Shake! were:

  • Split the graph into 3 traces – one for each axis.
  • Each graph would display raw, filtered and RMS values of the data with color coded traces.
  • Be able to select input data from the actual accelerometer input as well as three other calculated data sources: sine wave, step and impulse functions.
  • Implement the same filters as Apple, but also implement additional filters of my own choosing.
  • Calculate the RMS values of the filtered data over a moving window of arbitrary length.
  • Detect when the RMS value has exceeded a threshold value for a contiguous number of samples.
  • Be able to easily configure each axis both independently or all at the same time.
  • Release the source code of the resultant program under a BSD-3 style license

The culmination of these goals can be seen in the complete list screens from Shake!:

Main Screen
Shake! Main Screen
Overall Setup
Shake! Overall Setup
Axis Setup
Shake! Axis Setup
Signal Selection
Shake! Signal Selection
Filter Selection
Shake! Filter Selection
RMS Level Detection
Shake! Level Detection
Credits
Shake! Credits

The operation of Shake! is very simple. You select the signal source, filter and RMS detection level for each axis, and then shake the iOS device in order to see results on the screen.

And when enter the setup for Shake! the first screen you are presented with is for the over-all configuration of each axis as well as the “All Axes” choice. By selecting a single axis, you will head down the path of configuring only that one axis. The “All Axis” choice is special in that any configuration choices made here will be copied to the other 3 axes – however you will need to confirm this action before the copying occurs.

Within the Signal Source setup, there are 4 choices that can be made:

  1. The actual data from the accelerometer for the axis
  2. A calculated Sine wave generator, for which you can set the amplitude and frequency (within limits)
  3. A calculated step generator, for which you can configure nothing!
  4. A calculated Impulse generator, again for which you can’t configure anything.

The Filter Seelction allows you to selec from one of seven different types of digital filters:

  1. Pass Through – actually a “non-filter”
  2. Apple’s 5 Hz Low Pass 1st order filter
  3. Apple’s 5 Hz High Pass 1st order filter
  4. Butterworth 5 Hz Low Pass 2nd order filter
  5. Butterworth 5 Hz High Pass 2nd order filter
  6. Butterworth 1 to 3 Hz Band Pass 2nd order filter
  7. Butterworth 2.5 to 5 Hz Band Pass 2nd order filter

The Level Detection calculates the RMS value of the filtered signal over a rolling sample window, and then indicate a trigger when that level has exceeded a threshold for a set number of samples. The setup for the Level Detection reflects these requirements and allows you to independently change all three variables.

Shake! on GitHub
Shake! on Joalah Designs Blog