https://github.com/michaeltroger/simple-stair-detection
Simple stair (and movement) detection for Android
https://github.com/michaeltroger/simple-stair-detection
activity-detection activity-recognition android-application
Last synced: 10 months ago
JSON representation
Simple stair (and movement) detection for Android
- Host: GitHub
- URL: https://github.com/michaeltroger/simple-stair-detection
- Owner: michaeltroger
- License: gpl-3.0
- Archived: true
- Created: 2017-09-19T22:53:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-16T20:10:03.000Z (over 8 years ago)
- Last Synced: 2025-04-04T15:50:55.914Z (about 1 year ago)
- Topics: activity-detection, activity-recognition, android-application
- Language: Java
- Homepage:
- Size: 635 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple stair (and movement) detection for Android

This app demonstrates a simple approach for activity recognition without any Machine learning involved. The app requires an accelerometer sensor as well as an barometer sensor in order to function!
It is able to detect _movement_ (like walking) as well as stair climbing.
For movement detection the following algorithm is used:
1. Get linear acceleration vector
2. Calculate the length of the acceleration vector: vectorLength = √(accX² + accY² + accZ²)
3. Calculate the EWMA of this length: ewma(i) = 𝛼 * vectorLength + (1 - 𝛼) * ewma(i-1)
4. Check the EWMA for a certain threshold
For stairs detection the following algorithm is used:
1. Get pressure data
- Remember the initial pressure (only on 1st call)
2. Calculate the EWMA of this data
3. Check whether the device is moving (movement detection algorithm from before)
- Subtract the EWMA from the remembered pressure data
- Take its absolute value and check it for a certain threshold
- Save the EWMA for the next threshold comparison