Track 3D Position with an Accelerometer
To get a position from pure accelerometer data, you need to integrate it twice over time. First integral gives you velocity, second gives you position.

The problem you run into is called integration error. This error gets larger and larger over time. And it gets much worse when you're integrating twice.

And what's more, for integration, you need input conditions, that is - you need to know position and velocity of the object at the moment you start the measurement.

So in the end, you may be able to track the direction of movement, you could measure the position during the first second of time or so. But it will be far from accurate, and you will need to assume you're starting from a stand still.



I suggest looking at positional measurement, rather than acceleration. Such as optical, magnetic, sound, etc.