I am raising an object/platform up and down using a DC motor connected to a threaded rod. I wish to know exactly when the top of the object reaches a certain threshold point during its movement, sort of like a limit/end-stop. See drawing below.
What would be the best way to do this such that my microcontroller can be notified with low latency (< 50 ms) and good positional accuracy (< 1 mm)? Would mounting a simple reflective optical sensor at my desired height do the job?
Note: I understand a stepper motor + driver would have been an acceptable solution but I'm going with a DC motor for lower cost, and because I only need to "know" one position along the movement.