If you want a microswitch to set the zero point, rather than spot a whoopsy, make sure you always use the same transition. They have huge hysteresis.

I prefer an opto slot. They usually move from high to low in a fairly straight line as the beam is interrupted. Reading it is slightly tricky because logic gates have big hysteresis, so, you add a comparator and get no hysteresis at all. Switches perfectly in either direction.

Any cable will do, if worried about interference, twist it :D