-deleted-
12 years, 7 months ago.

accelerometer interface

presently i am working on 3 axis accelerometer interfaced with nxp lpc 1768.I want to know acceleration and speed using this sensor by connecting it to foot.i was able to find the x,y,z co-ordinate values ,when there is a movement.please any one help me in finding acceleration and velocity,

1 Answer

12 years, 7 months ago.

Maybe first tell what you already tried yourself and with which code.

I also doubt you got the coordinates, you probably right now got the acceleration, since an accelerometer returns the acceleration. Integrate that once and you got the velocity, with an error that keeps increasing.

hey erik! i tried with MMA7660 accelerometer present in mbed application board.i tried that sample program given in cook book

  1. include "mbed.h"
  2. include "MMA7660.h"

MMA7660 MMA(p28, p27);

DigitalOut connectionLed(LED1); PwmOut Zaxis_p(LED2); PwmOut Zaxis_n(LED3);

int main() { if (MMA.testConnection()) connectionLed = 1;

while(1) { Zaxis_p = MMA.z(); Zaxis_n = -MMA.z(); }

}

are these acceleration values this program returning?

posted by -deleted- 24 Apr 2013

if i use lcd to display values. its giving values between 0 to 1.what are these values?

posted by -deleted- 24 Apr 2013

Yes they return the acceleration. See also the documentation of the library: http://mbed.org/users/Sissors/code/MMA7660/docs/a8e20db7901e//classMMA7660.html. It retuns the acceleration in g's. So that you see numbers between 0 and 1 is exactly what you expect. If you shake it you should be able to get it a bit higher, but not much since the MMA7660 has fairly limited range.

If you want to get velocity you need to integrate it, while taking into account gravity, and for position you have to integrate yet again. The result is that any error in the output will really quickly become huge. So you can only do that a short time before the data is useless.

For your specific use case I could imagine you detect when the foot is on the ground (maybe the tap-detection of the IC you use works for that), and at that point put everything on zero and measure the gravity. Then when the foot leaves the ground you can integrate until you measure it is on the ground again. But that is your job ;)

posted by Erik - 24 Apr 2013

Thanks a lot!

posted by -deleted- 24 Apr 2013