# Building a controllable “knob”

I am trying to build a semi-analog timer. Something like those old egg timers that you rotate the face of. I want a knob that I can turn that can be read by a microcontroller, and I also want the microcontroller to be able to position the knob. I'd like to implement "stops" by letting the microcontroller push the knob towards certain positions. As it runs down, the knob should turn. This is my first project of this kind; I've built small robots in the past, but it's been many years.

I've considered hacking a servo motor to read its position, but the small hobby servos I've tried are too hard to turn, very noisy, and pick up too much momentum when turned. They don't act like a good knob.

I'm now considering a rotary encoder connected to a motor, but after hunting at several sites (SparkFun, ServoCity, DigiKey, Trossen, and some others), I haven't been able to find anything that seemed appropriate. I'm not certain how to find a motor that's going to have the right kind of low torque.

This seems like it shouldn't be a really uncommon problem. Is there a fairly normal approach to creating a knob that can be adjusted both by the user and a microcontroller?

• I found exactly what you're describing in the volume control of an old CD player. When you turned the knob, it would turn the potentiometer directly. When you pushed a button on the remote, a motor attached thru a clutch would turn the knob and the potentiometer. The clutch would prevent the motor from turning and making noise when the knob was turned manually. Perhaps you can salvage this kind of mechanism from a CD player or similar device? – Chris Feb 13 '13 at 1:26

I have a couple of options for you.

## Option 1, build your own servomechanism

As you only need a very low torque to move a knob, a very small motor should do the job nicely. You will probably need to add some friction so that it it doesn't move too easily, or use a small stepper motor with a decent detent torque and a little gearing.

A very cheap way of getting your position feedback is to find an old opto-mechanical mouse.

Opto-mechanical mouse

Connect up the shaft to your motor/knob shaft and then either roll your own quadrature encoder (taking the A/B phase inputs directly into your microcontroller) or reuse the entire circuit board and hook up the 'mouse' to a serial port and read back the X or Y mouse position through software.

The article Recycle PS/2 Mice into Rotary Pulse Generators is a nice example of someone doing this.

## Option 2, persevere with the RC servo

The reason why your RC servo's are hard to turn is that they have a high ratio gear train to give them the torque they need, and this makes them difficult to backdrive. Take a look at this exploded diagram from the wikipedia Servomechanism page:

Small R/C servo mechanism

1. electric motor

2. position feedback potentiometer

3. reduction gear

4. actuator arm

A small turn of the actuator shaft of this RC servo would result in a large (many turn) movement of the motor, if you could get it to move without stripping the gears.

Again, since in your application you only need enough torque to turn the knob, you may be able to get rid of that gearing and use the motor position directly. By removing or reducing the gearing, you should find the motor moves very freely indeed. In fact, you may need to add some friction (or leave some gearing in place) in order to prevent the motor being very jittery.

• Thanks for all this, it's really helped. My son and I took apart one of our servos yesterday and learned a lot playing with it. I think I may have some old PS/2 mice laying around to experiment with as well. – Rob Napier Jan 13 '13 at 21:50
• @RobNapier - I'm glad that I could help. As a kid I loved taking things to pieces, I even (mostly) managed to put them back together and learned lots in the process. So many things these days are no user servicable parts inside that I wonder what techie oriented kids do these days. – Mark Booth Jan 13 '13 at 22:59
• BTW, I've continued work on this with a servo. The secret I believe is to add a belt to allow slippage between the motor and the pot. – Rob Napier Jan 31 '13 at 16:30
• @RobNapier - Thanks for the update, feel free to answer your own question with what you tried and what you eventually found worked, you'll get at least a up vote from me. *8') – Mark Booth Jan 31 '13 at 19:44

I don't know if there is a normal approach to this, but you should definitely check out a video I found years ago and still blows my mind: The Secret Knock Detecting Lock. Basically the guy built an Arduino-based device you can hook up to your door and setup a secret knock that will trigger it to open... Awesome!

I'm sure just the video would be pretty good for inspiration (it's the first thing that came to my mind as I read the title of your question), but after a quick Google search I also found the instructable page that explains it all.

This is a part of the instructable page where he says the motor he uses and gives out some recommendations:

1 5v Gear reduction motor. The higher torque the better. Here's a good one. (14-16mm diameter is ideal because it fits inside of 1/2" PVC pipe.) I recommend one with at least 15oz/in (11 N-cm) of torque at 5v to turn a basic lock.

How about using a stepper motor, you will be able to control the position exactly.

• Welcome to R.SE - perhaps you could expand your answer, to give supporting reasons? – Andrew Jan 13 '13 at 7:24
• Currently this answer only addresses half of the question. If the knob is turned by hand, are there any tricks you can use to read back the new position from the motor without also having an encoder? Can you, for instance, use some sort of sensing on the motor coil wires to detect that the stepper motor has been turned by hand? – Mark Booth Jan 18 '13 at 14:16

Use a rotatory potentiometer. Interface it to an ADC pin of your micro-controller, and depending on the resolution, you can get anywhere between 256 to 65536 values, which you can then use to set "stops".

• Currently this answer only answers half of the question. This would allow you to sense the current position of the knob, but not move the knob from the controller. – Mark Booth Jan 18 '13 at 14:18

The industry standard for solving this problem is with moving faders.

They are readily available inexpensive components that do exactly what you ask for, except the being round part.