I need to know how I can attach a rotary encoder to something string/wire that I can pull and it retracts automatically

My idea was to take apart a retractable dog lead leash and affix it to it somehow, but I'm not seeing how I could make that work.

I've included a picture of the dog leash(right) and the rotary endoer(left).

The only goal here is to measure distance/velocity of a retractable string/wire. I'm not tied down to using a dog leash or rotary encoder, open to any suggestions.

Is there any other solutions that are not very expensive?

enter image description here

  • $\begingroup$ tried superglue? $\endgroup$
    – PlasmaHH
    Feb 25, 2016 at 14:48
  • $\begingroup$ Seems more like a mechanical engineering problem :p You could try some 2 part epoxy, build up a little base... Maybe $\endgroup$
    – Tyler
    Feb 25, 2016 at 14:52
  • 1
    $\begingroup$ @JamesWierzba Nope, but I think it might be easier to turn new parts out of aluminum (give it a shaft and maybe use a flex shaft coupler which is tolerant of the inevitable misalignment) than to reliably join things to molded plastic. Google images 'string pot' or 'string encoder' for ideas. $\endgroup$ Feb 25, 2016 at 15:09
  • 1
    $\begingroup$ Use a BLDC motor and three phase rectifier, and maybe you can get that dog to recharge your phone. $\endgroup$ Feb 25, 2016 at 15:38
  • 2
    $\begingroup$ Instead of a mechanical encoder that connects with a shaft, have you considered building an optical encoder $\endgroup$
    – Johnny
    Feb 25, 2016 at 17:02

4 Answers 4


Instead of a shaft driven rotary encoder, you might be able to build an optical encoder that uses optical sensors to read a pattern printed on a disk.

A simple encoder uses white/black alternating sectors so it can only tell you the speed of the disk, not the direction or position:

enter image description here

Image credit: heliosoph - Make your own rotary encoder

More complex sensors can use multiple optical sensors and use encoding stripes on the disk so it can determine position and direction. There are multiple ways to do the encoding.

Here's simple binary encoding:

Binary encoded disk

Image credit: Cburnett - Image:Encoder Disc (3-Bit).svg, CC BY-SA 3.0

But this has the drawback that if the disk stops between sectors, the bit pattern is ambiguous.

By using Gray Encoding, any two adjacent codes differ by only one bit position, which eliminates that ambiguity:

Gray Encoded disk

Image credit: jjbeard - Replacement for Image:Encoder-disc.png, Public Domain

  • $\begingroup$ Do optical encoders come prebuilt from any suppliers or would I have to make one myself? $\endgroup$ Feb 26, 2016 at 1:11


Figure 1. This illustration clearly demonstrates the problem of making mechanical sketches with a schematic editor.

  • Mount the dog-lead on a base board with a sturdy capstan and connect the encoder to the capstan with a flexible link.
  • Wrap the dog-lead one or more turns around the capstan to give a good grip.
  • Make a stop so that the rewinding stops before the wire end runs off the capstan.

Depending on the degree of accuracy you want it may be acceptable to pinch the cord between two rubber wheels and fix the encoder to one of the axles. A bit like the wire feed on a MIG welder.


If you're wanting to attach a retractable string to a knob, then go kick that old broken lawnmower/generator/weedeater/whatever in your garage one last time (just for the gratification of it).

Now take out a screwdriver/saw and cut off the pull-start mechanism.

Inside, you have a spool of string, a retracting spring (which you DO NOT want to have "pop out," as it takes many minutes & a few nicks/cuts to rewind & re-seat), and 1-2 "little levers" mounted so they "stick out" into the center when the string is pulled, latching onto ths shaft of the (now removed) motor that the pull-starter used to start.

Now just make sure to put a cap on your rotary encoder that the "little levers" can engage, then slap her together & start tugging ;)

(P.S. This question actually would be a bit more on-topic on http://engineering.stackexchange.com )


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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