Relative position using Accelerometer

Hi All,

I have a simple scenario please:

Two Arduino Nano 33 IoT devices started moving randomly from the same exact origin(Point = [X0, Y0, Z0]);

Can I use the coordinates queried from each device Accelerometer to get the Euclidean Distance between them?

In other words, Is the relative coordinate/position retrieved from the Accelerometer reliable?

Because I read that getting the relative position every time requires double integrations which leads to big accumulated error over time. Though I might be totally wrong.

Your help is very appreciated.

mike05sy:
Can I use the coordinates queried from each device Accelerometer to get the Euclidean Distance between them?

Of course, you can. But, in science education you learn that no result calculated is valid without an error calculation associated with that. That is why you sometimes hear the value is X +- 10%. The question is, can you figure out the error for your use case and is it small enough?

mike05sy:
Because I read that getting the relative position every time requires double integrations which leads to big accumulated error over time.

Let us look at a practical example. Humans have been measuring speed accurate for a long time. We know where our cars, planes and ships start the journey from, but we installed multiple satellite systems that cost ~ US$/EUR 5 billion each (GPS, GLONASS, Galileo, Beidou) to measure the location during travel.
Therefore, I think it is likely you will not be able to do any better if your use case is similar (e.g. small acceleration differences, long time movements).

I have a nano 33 iot and have reviewed its accelerometer a bit. I think you will find that what you want to do is going to be a bit challenging. What the accelerometer outputs is -- acceleration -- (duh), and it is output in terms of the earth's gravitational force (9.8 meters per second squared). If you put your nano 33 iot on a flat table that is level, you will see that the Z-component of the accelerometer is 1.0 g's. So that is the same as saying that the table is applying an acceleration of 1 earth g (9.8 m/s^2) on the nano to stop it from being in free fall. It should show X and Y values that are very small. You can tilt the nano and that "G-force" will shift into different directions.

So your challenge is to first of all remove that gravitational acceleration numerically, and that requires you to know the tilt of the nano and do some math. Then you have a sensor now that will ignore the gravity affect and only measure movement that YOU are providing (i.e. you push the nano in a certain direction).

Even with this, you only know the acceleration at each instant in time. So that is where the double integration comes in: one can integrate acceleration to get velocity (think of pressing on the car's acceleration pedal and going from 0 to 60 mph is 10 seconds or so). Then you have to integrate the velocity at each instant to get the change in position.

Note that for each one of these small steps you take (maybe every few milliseconds?), you have to get the nano's tilt, remove the gravity component, then do the double integration.

It's not trivial. Perhaps someone has written a library file to help you do all of that? I have worked at NASA for 30+ years doing orbital mechanics and so this is cool stuff, but not exactly easy to do for most people. I would be interested to know if anyone has written a library program that does this and keeps the accuracy in check for timescales on the order of minutes.

PS - The nano accelerometer and its attitude sensor both have biases in them that are temperature dependent and device dependent (mounting errors on the nano), so you will have to take those into account too. One Nano 33 iot I have has a 5 degree/second attitude bias in 2 of the 3 XYZ directions so I have had to account for that.

Dear Sirs,

You need to read books about inertial navigation in order to put something together that integrates acceleration to velocity and position. When that is done, one also need to keep track of the attitude of the device, which simplified is done by integrating the rotational speeds of the device. The navigation filter has to be initialized so it knows where the gravity vector points.

Because inertial navigation will result in drift of position (increased position error over time), one usually combine inertial navigation with position measures from for example GPS. That will be a navigation filter with inertial sensor input as well as GPS position.

The drift will increase quicker the worse the specifications of the inertial sensors are. With inertial sensors I mean accelerometers and gyros (rotation sensors). Good inertial sensors means that one needs GPS signals less often.

Commonly one uses Kalman filters for navigation purposes. Quaternions for keeping track of attitude (angular position).