Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a device which allows the user to set a certain variable value. So instead of turning something on or off, the user can set a value at some point on a continuum. For example, suppose I have a microcontroller that blinks an LED every x number of seconds. The user can select any value between 1 and 10 seconds, simply by turning a knob of some sort. The microcontroller would interpret the 'position' of the knob, and accordingly set a value for the delay.

So I looked around at electronics I own which posses a similar capability (things like radios, speakers, fans, etc.). I noticed that some of them use what I now know as a potentiometer. Sorry if this is really beginner level stuff. I know I can use the potentiometer to retrieve an analog value, and I can confirm that this satisfies my objective perfectly.

So what I want to know now is if there are other ways to achieve the same result, or are potentiometers the best and most economical way of doing this? My preference would be to have a knob like mechanism, or sliding mechanism.

share|improve this question
up vote 3 down vote accepted

You could use a potentiometer (pot) for this, but they are typically continuous in their output where it sounds like what you want is discrete values. To use a pot you would need to use it in a voltage divider and set bins (voltage ranges) for the various values you want to set to, and read in the output of the divider with an ADC. To set this you would adjust the pot until value of the output falls in to one of the bins. This person made a pretty neat feedback system for this idea. You can also buy pots with detents, detents are mechanically set positions through the turn.

Alternatively you can use a rotary encoder, they're those knobs that spin forever in either direction and "click" in to set positions along the way, also by use of a detent. There is a wide variation in encoders. I've recently used these ones. Basically you can continue turning these around and around and they send pulses to your microcontroller letting it know which way they are turning (this is a slide set explaining how they work). By counting these turns in the respective directions your microcontroller can set values. For instance turning right increments the value while left decrements. This is nice when you want to use one knob to set variable ranges, a solution you can drop in to most projects that need a knob.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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