I have been doing a bit of searching and cannot seem to find something that will work well so I figured I would ask the larger audience here.
I some small non-ferrous metallic parts which have similar width, but have varying heights that I am trying to sort out by height. I also want to keep track of how many of these parts of each type I have go through in a batch.
The small parts will push the rod into its housing and based on how deep it pushes, it needs to measure the distance. The rod is spring loaded so it naturally wants to stay at 0, but as its depressed from the part, it can travel up to 25mm
Accuracy needs to be to at least 1mm (preferably to .5 mm) and the housing space is very limited (Like 1 inch square)
Due to the limited size, I dont think I can reasonably place a rotary encoder on there, and due to other metallic interference, a proximity sensor or other type wouldn't work either.
Are there any ways to measure the distance a rod travels in / out without a rotary encoder ?
I was also thinking LVDT. I wonder what the errors are in trying to DIY. I mean, it's a very simple concept so it should be easy enough to try.
OTOH, OP is only looking for about 2% precision so an encoder with a gear train or a string pot should be feasible.
OP: a string potentiometer might fit the bill.
[edit]
I've had this project on my back burner for a long time. There are low cost digital scales that can be read with an arduino. The digital calipers are even less expensive (about $10). This project is a good start to understand how to read them: Reading Grizzly iGaging DRO Scales with Arduino | Yuriy's Toys
If space is a problem you can take a look at these keyence lr-x laser sensors ( the head is super small ), the price is in the 'few hundred' dollars range.
P.S.
We also used keyence tof sensors LR-T ( that cost a little more ), but for our application ( with varying, dirty targets ) repeatability wasn't good ( measure varied too much )