Finding movement direction from accelerometer data
Hey guys,
I've been ripping my hair out over this problem for quite a while now (I have a previous post about the subject, but I am now further down the line).
I have a accelerometer (the ADXL330 from the WiiMRemote) which measures acceleration in three axis.
I'm using the 8-bit values that I get from the aka.wiiremote object, which is scaled from 0-255.
When the accelerometer is not in movement - the value is (jittery) but fairly stable at around the mid-value 127
What I have found out (well, it's no major discorvery or anything) is that an increase in value is a movement to the right, and a decrease in value is a movement to the left (this is on the x plane of the accelerometer, but this can also be applied to the other planes to find the direction of movement on all planes).
If you've ever dealt with accelerometer data in Max (I'm sure you've come across the same as me) you know that it always has a jump in one direction and then dips in to the opposite direction on stopping the acceleration (increase-decrease or decrease-increase)
What I'm trying to do is have a stable recognition of this dip (I only want to measure the first part of the dip, because the contrary dip in the other direction is not useful in my case).
I have tried doing this with scaling the parameters from +1 to -1 and find it whenever the scale has a zero crossing to say stop recognising the next bit of the dip. But so far no good results, as the no movement (or mid-value is always a bit unstable), so I get all these random zero crossings when I do not want them when there is little movement.
I've attached a simple little patch just to illustrate the problem - it's not from the actual patch I'm building (that's embarrissingly messy at the moment!)
Anyone know of a solution???? :)