How about a simple rotary encoder, Saw this Arduino example this should be a simple add.

In my case only using the Min End stops and Of course Z-Max for filament run out sensor, so would choose to...