Stepper auto run width calibration


I want to create a follow focus system for dslr cam. Obviously, there are different lenses involved, which have different turn angle limits.

The use case is basically a stepper motor with attached gear, and on the lense a gear ring which will be turned by the stepper. But lenses use different max turn angles, so I want to tackle this problem.

When using a lense, I want basically the stepper motor to turn to "home" position 0 by turning the potentiometer to 0, turn the lense gear to start point, connect the gearings, then:

a.) Best case: Turn a potentiometer as far as the stepper stalls at the lenses end stop, detects the position, then press a button which saves the stepper end position and "recalibrate" the potentiometer to full scale.

b.) Standard case: Turn potentiometer to 0, the lense gear to start point, connect gears, then manually turn the lense to end stop, record the stepper position (like a closed loop configuration), press a button and "save" the end position and "recalibrate" the potentiometer to full scale.

I read a lot of google stuff, but got no clue except hardware switch end point detection, but this is not applicable here.

Thanks for any input,


I imagine your lenses are expensive and they may be damaged if you run the motor so far that it stalls.

There is no easy way to tell if a stepper motor has stalled so the Arduino would lose track of the position - it would keep issuing step instructions not knowing the motor was not moving.

There is no way to record the position of a regular stepper motor - it has no feedback system so turning it manually would not be useful.

What may be useful is a stepper motor with a rotary shaft encoder either integral to it or as an add-on. The encoder can send pulses to the Arduino to record the position when the motor is turned manually. You can also get simple DC motors with encoders which might do the job just as well, or better. (The link is just a typical example).