- #1
marcospassos
- 3
- 0
I'm a few days trying to get the direction of movement using an accelerometer. For my application I need to put an object on the table (z axis fixed) and detect the movements. I know perhaps the accelerometer is not the best sensor for this kind of application but is the sensor that is available on the devices that I need to use.
For example:
- I move it to the right, left, right and then left quickly.
- The expected information: right, left, right, left
The pattern for the movement start is simple: I get the signal and compute the difference between the current value and last value (ignoring small values) and if is negative, than it is moving to the left, if is positive it is moving to the right. So, I've created a stop condition. When I've obtained X numbers of zeros of the difference I understand it is stoped. This algorithm works great and is very accurate.
The big problem is when I'm movig to right and I quickly move to the left. The algorithm cannot detect the change because he is waiting the stop and it doesn't happens.
I've analyzed the data several times, but I can not find a pattern to the end of the movement in order to create an new algorithm.
Bellow are some graphics that I've generated using the data obtained from accelerometer.
http://img31.imageshack.us/img31/9544/graphsjk.jpg
The chart on the left side is a simple and slow movement from the right to the left. In the right side is the problematic situation where the movement is from the right to the left and to the right again.
I would be grateful if you could help me.
Thanks in advance,
Marcos
For example:
- I move it to the right, left, right and then left quickly.
- The expected information: right, left, right, left
The pattern for the movement start is simple: I get the signal and compute the difference between the current value and last value (ignoring small values) and if is negative, than it is moving to the left, if is positive it is moving to the right. So, I've created a stop condition. When I've obtained X numbers of zeros of the difference I understand it is stoped. This algorithm works great and is very accurate.
The big problem is when I'm movig to right and I quickly move to the left. The algorithm cannot detect the change because he is waiting the stop and it doesn't happens.
I've analyzed the data several times, but I can not find a pattern to the end of the movement in order to create an new algorithm.
Bellow are some graphics that I've generated using the data obtained from accelerometer.
http://img31.imageshack.us/img31/9544/graphsjk.jpg
The chart on the left side is a simple and slow movement from the right to the left. In the right side is the problematic situation where the movement is from the right to the left and to the right again.
I would be grateful if you could help me.
Thanks in advance,
Marcos
Last edited by a moderator: