Have integrated a 3 axis accelerometer on a microcontroller in order to calculate speed and distance. So far my experimental data is off by a factor of 3. Any ideas of some good algorithms to implement?
The intuitive wày is to integrate twice your some example code with the attached link. BUT, the twice integration have a high sensibility to noise and the drift will really high.
So you have to use IMU methods fusion of GPS, gyro and magnetométer to have more accurate method.
Hey, that is normal. You have to integrate acceleration data twice, so you also integrate the error. Freescale has published a very good paper on the subject.
I would use IIR filters designed using polynomial regression with an exponentially fading memory. That would give you smoothed acceleration data. A GW indicates, you would need to cascade one integrator to get vel and two integrators to get pos.
The intuitive wày is to integrate twice your some example code with the attached link. BUT, the twice integration have a high sensibility to noise and the drift will really high.
So you have to use IMU methods fusion of GPS, gyro and magnetométer to have more accurate method.
I used an Arduino and ADXL345 to approximate distance traveled by an elevator. As is mentioned above, you have to integrate twice, but there are tricks to smooth the data and ensure accurate results. I wrote an entire article on how I did it on my blog:
to get velocity and position (distance) from discrete data, one have to integrate the acceleration data twice. first integral gives us velocity, then position. but to have relatively good precision values of the parameters (vel, pos) sampling period (Ts) must be as possible as close to real value of the parameter. in Matlab we can use tic and toc to get it. in this case velocity and distance can be measured relatively real.