Go Down

Topic: Measuring point to point distances with accelerometer (Read 14947 times) previous topic - next topic


Hi Everybody,
I'm happy to be the first one to write a topic on this forum session.
I'm mostly a beginner with Arduino.

I'm loosing my mind in finding a way to measure the distance between two point.+
I can can consider the A point as fixed and initial speed and position of B (moving) as 0.
I would like to have a precision of about + or - 10 cm for my project.

I'm using a Razor - 6DOF http://www.sparkfun.com/products/10010.
For the moment i'm considering just data coming from y axis moving on a flat surface and in a linear direction along the axe.
I'm not finding any method to read a real distance covered.
In fact I have nice result if i'm not accelerating to fast of too slow. Moreover if I shake the sensor I get kilometers without any reason.
Can you suggest me something? Should I abandon this way?

I found on the internet that some company is selling something similar to inertial navigation system and that something similar was used in the 60s for ballistic rockets so I'm not loosing fait in this project.

Please help me.
I already tried other technologies like the RSSI from Xbee radio to measure distances but without nice results even because I need to measure distances even when point B is moving behind walls.



I was proudly made in Italy like Arduino .


An accelerometer measures instantaneous acceleration. Since acceleration is change in velocity over time, you are getting delta V. You need to keep track of how delta V affects V, and V for any given time, to get distance.

Unfortunately, while you are busy doing that, you will be missing acceleration changes.

It seems to me that other mechanisms for tracking distance would be more appropriate. Which mechanisms depend on the type of object moving, the terrain being moved over, the type of wheels, the speeds involved, whether the object is indoors or outdoors, the total distance that needs to be measured, and the ability/inability/desire/lack thereof to place any kind of reference points in the area being traversed.

None of these details were provided.


Thanks a lot PaulS.
Unfortunately I don't have the possibility to use encoders or trackballs or something similar.
The most important part of my project is that the moving point B will be an Arduino in a box and will be handheld so i have not any idea to solve this problem.




The most important part of my project is that the moving point B will be an Arduino in a box and will be handheld

I would like to have a precision of about + or - 10 cm for my project.

This just does not seem likely to be achievable. Is it the location of the handheld device that you are trying to determine? Relative to what? For what purpose?

The more details you can provide, the more likely it is that someone will have a suggestion for you.


What you are talking about is double integration, which is just too inaccurate with a single accelerometer on this hardware. Even single integration will have a growing error per unit time simply because of the lack of accuracy in this setup.


Thanks to all.

In my mind I will have a fixed receiver that can be considered 0 point and a moving handheld that will start from point 0 and send by radio his movements to the fixed receiver.
I just need to know roughly the distance covered by the handheld in its movements, I don't need a real localization.
I also need to filter all the small movement and acceleration that a handheld device can have.   

jezuz what do you mean with
double integration

I already told you that I'm a beginner, sorry :(.



OK, i think i get the idea of what you are attempting and is in fact used in the real world for submarines, however they use a whole load of accelerometers, some serious computing power (and a whole bunch of other stuff, which i wont bore you with). What others have said is very true regarding the difficulty of achieving the desired results with just an accelerometer.

My suggestion would be to focus on other methods, there are a number of alternatives, you could pull apart an old mouse take one of the scroll wheels out and attach it to your arduino, work out some distance calculations and hey presto (you could use an optical mouse as well), or you could do something even simpler, measure the time taken for the vehicle to cover a number of distances get an average m/s then just run the motors for a given time for each distance (remember, there will be an error which will be compounded over time), or finally use a stepper motor and drive it via that.

And finaly good luck with the whole project and make sure you keep things updated on your progress.


The double integration means that you can only hope to achieve anything meaningful if

a) you are taking all the readings within a very short space of time, perhaps less than a second,
b) you are using large accelerations (near the upper limit for the sensor) so that you get reasonable number of significant bits in the A->D conversion.

Basically you can use an accelerometer like this to measure gestures, say, but for steady-state position all you'll get is accelerating drift - unless you can find an accelerometer with _very_ high specs, I don't think this is viable.  Differential GPS is the way to go I think.  Also even with a high-spec accelerometer you have the problem of earth's gravity swamping the wanted signal...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Getting position from acceleration is a double integration, so the error stackup is really evil. Getting good position data with a bolted down IMU (what you are trying to do) is a genuinely hard problem; the kind of accelerometers needed to do it are very expensive. IMUs capable of getting good performance over an hour or two without correction start at $10k and go *WAY* up from there.



what kind of distances are you considering? Are you taking the hand-held device for a hike or is it just moving around in a room. For larger outdoor distances, GPS is probably the best solution. If you move around inside a room however, it won't give you a good enough resolution, you might be better of installing a few beacons and triangulate the position. Also, as mentioned above, if your receiver is crawling along the floor, you can use things like the detectors from a mouse or add some wheel-encoders to the chassis. That however won't help you if the device is carried around by an operator in his hand.



Jan 29, 2011, 01:00 pm Last Edit: Jan 29, 2011, 01:06 pm by afclewis Reason: 1
I think i may have misunderstood your post slightly, i didn't appreciate that the device would be carried (ie. no wheels etc), in this case, may i suggest the possibility of using say 3 laser range finders, you should be able to hack them to get a serial signal to feed into your arduino, then simply measure the distances and time between measurements and you should be able to get a direction of travel and speed. The more range finders the better, the more readings per second the better. You could alternatively have a sweeping rangefinder (like a radar) and obtain not just movement, but the shape of the area around the device (like a radar), but the time gap between your distance readings may be too grate to get accurate readings.

Taken from wikipedia

The precision of the instrument is determined by the rise or fall time of the laser pulse and the speed of the receiver. One that uses very sharp laser pulses and has a very fast detector can range an object to within a few millimeters."

Link http://en.wikipedia.org/wiki/Laser_rangefinder

If the device is to be used outside over large distances i agree with Korman , but you are never going to get the 100mm accuracy you require with a single gps.

Hows the project going?

Oh yeah, almost forgot, the rangefinders will need to be on a panning and tilting head to keep them level and pointing in the same direction. Then it should just be a maths exercise. (you'll need a compass and gyro)


Hello there, did you find any way out to find the distance between the two points and move at a given X Y position ??
Thanks. :)

Go Up