I would like to automate a door lock. For reasons I won't get into, I'm not allowed to modify the lock itself, I can only attach things to the "safe side" of the door. On this safe side, instead of a keyhole, there's a knob. I've already attached a continuous servo to this knob (the lock needs multiple turns between its locked and unlocked position). The problem now is that when opening the door manually with a key from the other side instead of via the servo, the microcontroller loses track of what position the servo is in.

I would like to solve this with limit switches in the locked and unlocked position: that way, the microcontroller can instruct the servo to keep turning until the limit switch is depressed. If the lock needed less than a single turn between locking and unlocking, this would be easy to do, but because it need multiple turns, I can't really think of a way to do this.

I am looking for a way that allows two limit switches. I considered using a multiturn potentiometer, but decided against it because I would like to limit additional torque.

An ideal solution would be low-torque, cheap and ideally 3D-printable.

  • 1
    $\begingroup$ Use a multi-turn potentiometer as a cheap absolute encoder? $\endgroup$ Commented Jan 24, 2021 at 14:14
  • $\begingroup$ Use a screw thread to covert the rotation to linear movement, and use a linear encoder? $\endgroup$ Commented Jan 24, 2021 at 14:15

2 Answers 2


There are many options:

  • a gearbox
  • multiturn potensionmeters
  • convert rotational to linear motion through a screw
  • digital encoders (absolute or incremental)

If you need less that 5 or 6 turns you can use a gear box with a single turn stop. The gear box will reduce 5 turns to 1.

Regarding the use of multiturn potensiometer, IMHO is a viable option. The added torque is not significant and the cost is quite low. The only problem, is that they are quite flimsy - I've used one and after a test it actually broke off.

enter image description here

Another solution is using a screw which translates a solid block which activates the switches.

enter image description here

Finally, since you are already using microcontrollers, you could use software switches. You can either use:

  • absolute rotational encoders (these are expensive), or
  • incremental encoders with z index channel: which are much more cost effective.

enter image description here


You could try this mechanism (please pardon the mspaint drawing):

Notice how the inner shaft has to rotate more than 360 degrees to hit both limit switches. You can use multiple stages to get more rotations.

mechanism drawing

  • $\begingroup$ Neat! Does this mechanism have a name? Also, won't the outer part depress the switch for a while until the inner part hits the other side of the inner side of the outer part? $\endgroup$
    – redfast00
    Commented Jan 24, 2021 at 12:13
  • $\begingroup$ That's a bit like two stages of a multi-stage rotary dial combination lock although I think they are usually arranged axially rather than radially. The long on-time of the switch during reversal won't matter as it is only limiting travel in the "wrong" direction - unless you were to start to unlock and then relock in which case it wouldn't lock fully. $\endgroup$
    – Transistor
    Commented Jan 24, 2021 at 14:11

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.