I would like to develop a small-distance measuring device that will be primarily used in indoor scenarios to measure a distance with cm accuracy (mm if possible). The device would be in a small form factor and would calculate the distance it has moved in reference to the starting position. However, upon doing more research I have found that this is a bit harder than I thought it would be. My initial idea was to utilize an accelerometer and take the double integral to determine displacement, however, I learned that this is primarily impossible with consumer grade accelerometers.
My current idea for implementation would utilize a small stationary external device that sends signals constantly back and forth measuring the difference in time it takes the wave of information to be received. I have looked online to find similar projects to this, but could not find any. Perhaps I haven't looked hard enough, but does anyone know if projects like this exist (preferably Arduino based)? If not then, would a simple consumer-based IR sensor work for this situation? Maybe I'm overthinking it and there's an even easier solution for measuring small distances with an external device. I could use some guidance on this. Thank you.