I have a DC motor which rotates between position A and position B. These positions define the complete range over which the motor will rotate over. In general, these positions are more than one full revolution apart.

Similar to a power window (but for rotary motion i.e. not linear), I need a way of rotating and stopping the motor when it reaches either position A or position B. I also need to know at which position the motor is in i.e. whether it is at A or B.

One idea I had was that given I know position A and position B initially, I can use an multi-turn incremental shaft encoder, using either position as an index/origin and measure the number of turns/distance between the two. Then, I simply need to rotate the motor between these two positions.

From research, I've found that a limit switch/snap action switch may also be able to do the job. I haven't been able to find much info on these.

Are limit switches suitable for this and/or is the encoder route less well/better suited to meet the requirements?

  • \$\begingroup\$ The motor drives some mechanism, no? Maybe it would make more sense to attach limit switches to the mechanism instead of trying to attach them to the motor shaft. If there is no "mechanism," then what is the significance of positions A and B? (E.G., my garage door opener has a motor that turns more than a hundred revolutions between the "open" and "closed" positions. It is stopped by limit switches that are attached to the track in which the door's wheels run.) \$\endgroup\$ Commented Oct 30, 2023 at 13:41
  • \$\begingroup\$ Yes, my use case is similar to a garage door. I've just realised actually that for my use case, I don't have access to the mechanism- the motor shaft is coupled to different mechanisms, where each mechanism generally has to travel a different distance between position A and B. Maybe I need some sort of shaft encoder then? \$\endgroup\$
    – testing09
    Commented Oct 30, 2023 at 14:08
  • \$\begingroup\$ Roughly how many revolutions apart are A and B? What sort of resolution is required? \$\endgroup\$
    – jonathanjo
    Commented Oct 30, 2023 at 14:18
  • \$\begingroup\$ Max will be around 3 revolutions- if I need an encoder, I'll mount it to the output shaft (low speed, high torque). Resolution can be course i.e. few degrees. \$\endgroup\$
    – testing09
    Commented Oct 30, 2023 at 14:30

1 Answer 1


You have the choice between an absolute position measurement or a relative one. Servos often use a potentiometer to read the absolute position directly after power on, no reference movement to a limit switch is required. There are very precise multi turn potentiometers, which you can connect to the shaft.

If you connect an incremental rotary encoder, optical or based on interpolated hall signals, you need an initial move to a limit switch from where you can count the pulses. Absolute rotary encoders don't help you in a multi turn context.

Some applications allow it to just measure the motor current and stop if a limit is reached.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.