# Accelerometer integration

#1

Hey,
Despite this thread, I want to use accelerometers for a bit of navigation this year.

In the attached excel spreadsheet, you can see that using the angles 0degrees 45degrees and 90degrees, I have found that the relation between the real acceleration and the output value is non linear and appears to be something like:
y=(a^3)/12+500
where a is the real acceleration and y is the sensor value.

My questions:
1)How can I convert this to a more linear connection? (do i need to?)
2)How do I integrate the values over time to get speed and more importantly distance?

Thanks!
-Leav

acceleration.xls (17 KB)

acceleration.xls (17 KB)

#2

Integrating the acceleration is pretty straightforward; dimensional analysis tells you that all you need to do is multiply your acceleration by your time element (if you’re in user_routines, that would be 0.0262 seconds) to get velocity, and multiply your velocity by your time element to get your distance.

I would be careful with that, though, I’ve been having quite a time trying to get the acceleration to integrate accurately.

#3

to get the real equation you have to remember that acceleration is a vector - it has magnitude and direction

when the bot is not moving the magnitude is 1g, and its pointing straight down

when the bot is accelerating forward at 1g on a level surface, the magnitude the sensor will read is (1^2 + 1^2)^ 0.5 = SQRT(2) and the direction will be 45° forward from -Z.

so the forward magnitude of the robots total acceleration vector should always be = SQRT(sensor^2 - 1^2) [units = g’s]. You must keep track of the direction through the SQ and SQRT calculations.

note that 1^2 assumes the sensor reading has been scaled so that 9.8M/S^ = 1g. also, if the robot is not on a level surface you must know the angle that it is tilting to separate out gravity and motor acceleration.

#4

I may have gotten things all wrong but I was under the impression that the accelerometer tells you the magnitude of acceleration on a given axis.

so if you know how you mounted the accelerometer you would know the acceleration direction relative to the robot (though you would miss any part of the acceleartion perpendicular to the axis that the accelerometer was measuring unless you had two gyros or a dual-axis accelerometer)

-Leav

#5

Leav,

you are correct - if the accelerometer is positioned with its axis horizontal, then gravity will not affect the reading, unless the robot tilts (climbs a ramp).

For some reason I had tilt-sensing on my mind and got the two applications mixed together.

I dont understand your original equation at all: a^3 ?! Which accelerometer are you using, I will look up the data sheet and see if I can make sense of this.