Distance sensor advice

I have a project I want to build but need some advice regarding sensors. I build model submarines and I want to very accurately sense the distance of a piston as it travels down a tube for buoyancy purposes. I have considered using stepper motors and measuring the number of turns, but I am not sure I can get one powerful enough, and a simpler answer would be to use a sensor. What I want is to read the distance (accurate to 1mm) from a sensor that is facing a panel of plastic (the back end of the piston, approx 90 ml in diameter) in a stable dark environment. I also want it to be pretty cheap. It needs to be able to measure accurately from 10 ml to about 60ml. Is this possible? Any suggestions?

The idea is that this will give the arduino information about the position of the piston so I can easily repeat the position of the piston to achieve neutral buoyancy. Also to put electronic 'stops' for piston travel.


Perhaps this might work: Adafruit VL6180X Time of Flight Distance Ranging Sensor (VL6180) [STEMMA QT] : ID 3316 : $13.95 : Adafruit Industries, Unique & fun DIY electronics and kits


It looks like a great option. I bought an adafruit one and a chinese clone. We will see.