Arduino uno boat lift control

I just want the encoder to shut motor off when it reaches a set point if it drifts past a little bit that will be ok. The pipe only turns a few rpm.