1
\$\begingroup\$

I have a preamp kit, it comes with 2 SMD buttons for volume up/down but I'd like to replace them with a turnable knob. Both the buttons share the same input, just the output goes on different legs of the main chip.

The component I'm looking for would have to have at least 3 pins and produce a series of switching between a common pin and one of the other 2 pins depending on which direction I turn. Pretty sure they exist, what are they called?

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Do you mean rotary encoders? \$\endgroup\$ – PlasmaHH May 11 '18 at 21:57
  • 1
    \$\begingroup\$ A rotary encoder wouldn’t directly give you what you want, you’d need some extra logic for that \$\endgroup\$ – C_Elegans May 11 '18 at 22:06
  • 1
    \$\begingroup\$ buttons share the same input ... probably not .... they are most likely each connected between an IC pin and ground .... can you post a schematic? \$\endgroup\$ – jsotola May 11 '18 at 22:50
0
\$\begingroup\$

So what you want is a rotary encoder. They work similar to the way a desktop computer mouse works, except that unlike a mouse which is continually moved, they can work with purely mechanical internal switches (a mouse often uses optical encoder because of its more frequent movement.

Anyway, a rotary encoder works by having two internal contacts, which make and break in a very specific order, called Quadrature. Look at this graph of the way the contacts change state over time...

quadrature timing

If you study it carefully, you can see that it is possible to write code to identify the direction of movement, with each transition. A further advantage of this scheme is that even though you always want to apply an algorithm to debounce contacts, its not very critical with the quadrature scheme, because the worst that can happen is usually just random toggling of one count up or down (unlike a simple UP/DOWN button pair, where a poor contact could mean several skips to a higher or lower setting).

Hope this helps. If you have trouble writing or finding pre-written code for dealing with the rotary encoder output, I can add to this post.

Or, since you don't seem to have a microcontroller in your circuit yet, its possible to do this with ordinary logic ICs too. For example, if you take a 'D' type flip flop, and connect one of the encoder outputs to the 'D' input, and the other to the clock input (with pull up resistors as needed, of course) the flip flop output will always indicate whether you're turning CW or CCW. If you then add a little more logic to simply change state when ANY transition has occurred (like an exclusive or gate), then you'll have both direction, and up/down pulses, just as you did with the simple buttons.

\$\endgroup\$
3
  • \$\begingroup\$ So a circuit like tinyurl.com/y8qrpsd4 would do? \$\endgroup\$ – user81993 May 11 '18 at 23:40
  • \$\begingroup\$ Thats a very cool simulation page, though its hard to see what its doing since it doesn't define the phase relationships between the illustrated 200 hZ sources. The flip flop part, for sure, is true. The Q (or Q not) output would surely indicate the direction. As i suggested, an exclusive OR gate should offer the counts, and the flip flop should offer the direction. May I make a prediction though? In time, and with the availability of some very cheap microcontroller boards and chips around, soon you'll discover the amazing convenience of doing things like this in code. \$\endgroup\$ – Randy May 12 '18 at 0:42
  • \$\begingroup\$ As an addendum to my "prediction", many cheap MCU boards also offer I2C control, which might lead you to using audio taper potentiometer ICs such as the Dallas SD1881. Personally I have found that using microcontrollers to control your audio projects to be awesome! And changing code to upgrade your design is SO much easier than changing a circuit! :-) \$\endgroup\$ – Randy May 12 '18 at 0:46
1
\$\begingroup\$

The device that you are thinking of is called a rotary encoder. Any time you meet a knob can be turned continuously without end stops, it is probably a rotary encoder.

However, you cannot connect it directly to your volume buttons. Rotary encoders do not produce different pulses for each direction — instead, they have "quadrature" output which must be interpreted by digital logic to tell which direction it is moving. (That or they are absolute encoders, for determining absolute angle, but that is also not what you want and much more expensive.)

You can achieve your goal with a rotary encoder and a single, cheap, microcontroller chip programmed to generate pulses when the knob is turned, but you will need to learn how to program microcontrollers.

\$\endgroup\$

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.