Although this is not suitable for StackOverflow because it is not a question, but a discussion, I will try to summarize my thoughts about it.
As already mentioned, the accelerometer is very inaccurate, and you need very good accuracy for this kind of task, especially if you are trying to measure such short distances. In addition, accelerometers differ from device to device, you will get different results for the same movements with another device. Plus a very big random error.
My guess is that you can get rid of a huge part of randomness / error by calibrating the device and doing a “motion measurement” a couple of times, for example, 10 times. After that, you will have enough data to get an average value that can come close to the real value.
Calibration is a key part here, you should think about a smart calibration method, for example, allowing the user to move the device at different distances at different speeds.
But all this is just a theory. I would really like to see your results, but I doubt that you will earn well enough, even using the best filters / algorithms, since there is too much noise.
source share