This is the spring part of a kind of sensor that is not so easy to find on the net, i just wanted to read my muscle status by their toughness variation, the possible applications are many. Keep in mind that this sensor (HS1) could work as could not, I haven't tried it because although its concept is more advanced then the HS2 one, it is more expensive, and i need lots of these things. Use HS1 if you need accuracy. Please do not order it in any metal, sandstone or glass material.
Works with any IR transmitter and IR receiver photodiode that you manage to push in it, you could try BP 104 FAS on the cylinder and SFH 421 as emitter on the piston
Remember that the system works by measuring the distance between the top of the cylinder and the top of the piston by the radiant flux seen by the photodiode, and not by the time passed between emission and reading.
One more thing.. to use this sensor you have to keep it on your skin, so before you order it you should make sure that it has the right junction.