Based on non-contact magnetic sensor technology, the ams AS5510 absolute position sensor is suitable for linear applications with short strokes (0.5mm to 2mm).
To measure lateral motion, the sensor requires a simple 2-pole magnet, and the distance measured depends on the geometry of the magnet. The measurement accuracy of the absolute position is 10 bits = 1024 positions and is provided as a digital value on the serial interface (I²C).